I am trying to use Hough Lines transform on some iage with itk on python (spyder).
I used the given example here: How to deal with HoughTransform2DLinesImageFilter GetLines() method in python - Beginner Questions - ITK
but I have the same problem. Here the code to make reading easier:
##Houghlines##
edges = sobslice #image itk.image(itk.F,2)
houghF = itk.HoughTransform2DLinesImageFilter[itk.F, itk.F].New()
houghF.SetInput(edges)
houghF.SetAngleResolution(100)
houghF.SetNumberOfLines(2)
houghF.Update()
DetectedLines=houghF.GetLines()
print(DetectedLines[0].GetPoints())
DetectedLines is a “Swig object of type std::vector” from which I can’t access data. At least, I know its size (with len() or .size()) but I can’t access value with GetPoint().
Any idea ?
Thanks !
Neither,it gives the same kind of output that .GetPoints(). I would expect an array with some coordinate, an angle and a distance as it is what the Hough transform should compute.
I read the page you linked with LineSpatialObject. The method “PrintSelf()” is not working (error), may be it coul be a way to retrieve the value ?
Thought I already tried this one but may be I only tried “print(DetectedLines)” and “print(DetectedLines[0].GetPoints)”.
It gives something at least, some info on the object (size) plus some on the region but I don’t know which region ! I have also info on “Family Bounding Boxes of Spatial Object”. I don’t see something which looks like a couple (distance, angle).Output_printDetectedLines.txt (3.8 KB)