I was wondering why the Hough Transform uses rho=xcos(theta) + ysin(theta) for representation of a straight line (y=mx+b). I tried to work through this (and went to the wikipedia article about this), but can not find a way to derive one from the other.
Does anyone know how to derive one from the other?
Thank you in advance.
Derivation:
The equation
x/a + y/b = 1:From trigonometry, recall how a ray rotated by angle
twill project onto the x- and y- axes according to(angle=t, radius=1) -> (x=cos(t), y=sin(t))*Draw the tangent line at the labelled point. Trigonometry (or even geometry with similar triangles) tells us that the tangent line intersects at
x=1/cos(t),y=1/sin(t). Thus the line a distance 1 away will havea=1/cos(t)andb=1/sin(t), and thus described byx/(1/cos(t)) + y/(1/sin(t)) = 1…… which is just
cos(t) x + sin(t) y = rhowhererho=1You can see that
rhocorresponds to how far the line is from the origin (either by playing around with the equation, or by noting that multiplication here just scales all values by the same amount, effectively rescaling the grid).*see http://en.wikipedia.org/wiki/File:Unit_circle.svg for credit