1

I want to understand the Hough Transformation for school. I know that we can not represent vertical lines which are parallel to the Y-axis (with the y = m*x+b). But we can do this with the polar coordinates r and theta with (y= - cos(theta)/sin(theta) * x + r/sin(theta)).

But lets say I have a line which goes trough this two points. P1(0,0) and P2(0, 100). So this is a line which is exactly like the Y-Axis. How can this be represented by the polar coordinates r and theta? since r is 0 so theta is also 0. I don't understand how this line can be represented in the hough space... :/

Can someone explain this to me?

geoorge
  • 11
  • 1
  • Why can’t theta be 90 degrees is r is 0? – Cris Luengo Jun 12 '19 at 02:23
  • @CrisLuengo If my line goes through the points P1(0,0) and P2(0,100) then my r is 0. When I don't have an r, I also don't have theta or am I wrong? – geoorge Jun 12 '19 at 02:32
  • You still have a theta. These are two independent variables. – Cris Luengo Jun 12 '19 at 02:34
  • Please note that the question and answer in the duplicate is labelled with MATLAB, but the fundamental thing you're after is to understand how the Hough Transform is calculated which that answer covers. – rayryeng Jun 12 '19 at 05:03

1 Answers1

1

Your equation for the Hough transform can also be written as (is more commonly written as):

r = x*cos(theta) + y*sin(theta)

This can still be solved if you set r=0. In fact, this represents all the lines that go through the pixel at (0,0).

For the case of the vertical line through (0,0), we have r=0 and theta=pi/2. This leads to:

0 = x*1 + y*0

This is satisfied for x=0 and any y. So all pixels (0,y) form this line.

Cris Luengo
  • 55,762
  • 10
  • 62
  • 120