[Insight-developers] Confused about this code fragment in itk::HoughTransform2DLinesImageFilter
Karthik Krishnan
karthik.krishnan at kitware.com
Tue Jan 19 08:45:47 EST 2010
I'm trying to generalize the hough transform line detector to 3D and
make it multithreaded..
I'm looking at some code in the existing 2D filter. Specifically :
Line 78 of itkHoughTransform2DLinesImageFilter.txx reads :
size[0]= (long unsigned
int)(vcl_sqrt(m_AngleResolution*m_AngleResolution+input->GetLargestPossibleRegion().GetSize()[0]*input->GetLargestPossibleRegion().GetSize()[0]));
The size of the "R" parametrization in hough space should simply be
the length of the diagonal (or twice the diagonal in implementations
where theta runs from 0 to pi instead of -pi to pi, as you have).
Shouldn't it read :
size[0]= (long unsigned
int)(vcl_sqrt(input->GetLargestPossibleRegion().GetSize()[1]*input->GetLargestPossibleRegion().GetSize()[1]+input->GetLargestPossibleRegion().GetSize()[0]*input->GetLargestPossibleRegion().GetSize()[0]));
Wouldn't the current code give incorrect results for images where
m_AngleResolution < inputSize[1] and where the lines lie on the upper
or lower band of the image ?
The check below would end up discarding these lines right ?
Line 134:
if ( (index[0] > 0) &&
(index[0] <= (long)outputImage->GetBufferedRegion().GetSize()[0]))
One should IMHO never need to check if (index[0] <=
(long)outputImage->GetBufferedRegion().GetSize()[0]). That should be
guaranteed by the size of the accumulator image if it was properly
declared, right ?
Obviously, I must be misunderstanding something.. Please clarify.
Thanks
--
karthik
More information about the Insight-developers
mailing list