Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.
6709 Discussions

Hough Transform: ippiHoughLine_Region_8u32f_C1R: Theta definition

RyanS
New Contributor I
388 Views

I am trying to detect near-vertical lines in an image using ippiHoughLine_Region_8u32f_C1R.

The documentation doesn't define theta, but it is apparently the angle of the normal to the line, relative to horizontal. So a vertical line in the image would be 0 radians, and as that line rotated counter-clockwise the angle increases.

The function is working for me for lines that are vertical or positive theta. But I can't get the correct angle for a line that is near-vertical but sloped the other way (slighly clockwise of 0), what would normally be negative theta. Regardless of the range parameters I specify (for some reason named dstRoi in the arguments), I cannot get the angle to be found correctly. The angle theta is always small and positive, as if it is reflected about the origin. I expect theta to either be a small negative number, or close to 2*PI.

This seems to be a bug in the function, or am I doing something wrong?

0 Kudos
3 Replies
Ying_H_Intel
Employee
388 Views
Hi

Yes, it should bethe angle of the normal to the line.

Some explanation in manual :
Hough Transform
The Hough transform is a general technique that allows to detect the flat curves in the binarised
images [Gon93]. The current version of Intel IPP implements the detecton of the straight lines
that are defined by the parametric equation
r = x*cos( ) + y*sin( ), where r and are the length and angle from the origin of a normal
to the line respectively.

and
this function performs detection of the straight line defined
by the equation given at the beginning of section Hough Transform. Only lines line with
the parameters satisfying the following conditions are detected:
dstRoi[0].rho line .rho dstRoi[1]. rho;
dstRoi[0]. theta line.theta dstRoi [1].theta;
where n = 0. pLineCount.

You problem looks familir. do you have code to show the problem as the discussion http://software.intel.com/en-us/forums/showthread.php?t=76157and http://software.intel.com/en-us/forums/showthread.php?t=80153?

Best Regards,
YingH.
0 Kudos
RyanS
New Contributor I
388 Views
This was due to my misunderstanding about the rho/theta representation. Since the "length from origin" implies a positive number, I assumed rho would always be positive, so I set the rho range to a positive range (0 to the width of the image). But for the lines in question, rho is returned as a negative number. I find that counter-intuitive, since there's no such thing as a negative distance. Anyway, now I can detect negative rho and flip rho/theta so that the lines in question are represented as positive rho and negative theta.

I would suggest updating the documentation tosay that rhocan be negative andthat it isnot the "length from origin".
0 Kudos
RyanS
New Contributor I
388 Views
Also, because of the fact that near-vertical lines are either near-0 or near-PI, I can't specify a useful theta range (0 to PI is not a useful constraint), so the Range version of this function is apparently not useful for near-vertical lines.
0 Kudos
Reply