MATLAB Answers

Understanding rho and theta in hough

86 views (last 30 days)
Jdeen
Jdeen on 7 May 2014
Edited: Jdeen on 7 May 2014
Hi!
I use
[H, theta, rho] = hough(image);
to calculate the hough transform of a 27x27 image. Theta ranges from -90 to 89 and rho from -37 to 37. I am trying to figure out how to interpret these values. I know that theta is the angle between the x-axis and the normal of corresponding line and rho the length of the normal. But:
  1. Where is the origin of the space?
  2. I assume the x-axis goes from left to right, and the y-axis from top to bottom?
  3. How would you roughly describe a line that goes through the points (-1,0) and (0,1)?
  4. In which unit is rho calculated?
I hope 3. will help me understand why -90 to 89 for theta is sufficient. Also, I am trying to figure out when two lines exactly are parallel.
So far for now :)

Answers (1)

Jdeen
Jdeen on 7 May 2014
Edited: Jdeen on 7 May 2014
I digged a bit deeper into the matter, and will give a first own answer. Of course people are welcome to give more elaborate answers, the best of which I will accept.
For questions (1), (2) and (4) refer to http://blogs.mathworks.com/steve/2006/10/19/hough-transform-coordinate-system/ Explicitly the answers are:
  1. Origin is the upper left corner of the image
  2. Correct
4. Should be the length of the projection in pixels.
Theta is the clockwise angle between the projection and the x-axis (the horizontal axis), which should jump from ~90° to ~-90° when passing the vertical axis. Rho is the length of the projection and is negative, if the projection is "at the left side" of the vertical axis. Therefore, a line passing through (-1,0) and (0,1) roughly has the values rho = -6 and theta = -55°.
I think theta values from -90° to 90° are sufficient, because we only deal with lines passing the first quadrant. An interesting question hence would be how to easily change the origin of the hough space to the center of the image for example.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!