[vtkusers] pythonic non max suppression returning junk

jmerkow jmerkow at gmail.com
Wed Feb 25 14:06:12 EST 2015


Hello,

I am trying out vtk's non-maximum suppression in python.  I am running into
issues.  I followed the vtk example [1], using python, however I get junk as
the output. And the result changes between trials as well...

Everything up to the NMS filter look fine, only this filter returns junk.
I am using vtk 6.1.0.

Here is my code:

from vtk import *
print vtkVersion().GetVTKVersion()

sinsrc = vtkImageSinusoidSource()
sinsrc.SetWholeExtent(0, 255, 0, 255, 0, 0)
sinsrc.Update()

caster = vtkImageCast()
caster.SetInputData(sinsrc.GetOutput())
caster.SetOutputScalarTypeToUnsignedChar()
caster.Update()

writer = vtkJPEGWriter()
writer.SetInputData(caster.GetOutput())
writer.SetFileName("source.jpg")
writer.Write()

gradmag = vtkImageGradientMagnitude()
gradmag.SetInputData(caster.GetOutput())
gradmag.Update()

grad = vtkImageGradient()
grad.SetInputData(caster2.GetOutput())
grad.Update()

nms = vtkImageNonMaximumSuppression()
nms.SetInputData(0,gradmag.GetOutput())
nms.SetInputData(1,grad.GetOutput())
nms.SetDimensionality(2)
nms.Update()

caster3 = vtkImageCast()
caster3.SetInputData(nms.GetOutput())
caster3.SetOutputScalarTypeToUnsignedChar()
caster3.Update()

writer2 = vtkJPEGWriter()
writer2.SetInputData(caster3.GetOutput())
writer2.SetFileName("nms.jpg")
writer2.Write()

Links to output images:
source: http://imgur.com/KqsweLC
nms: http://imgur.com/SuTf00Q

Am I missing something?

[1]
http://www.vtk.org/Wiki/VTK/Examples/Cxx/Images/ImageNonMaximumSuppression






--
View this message in context: http://vtk.1045678.n5.nabble.com/pythonic-non-max-suppression-returning-junk-tp5730532.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list