Reputation: 11
I have line like in 2D defined by ax+by+c = 0 so (a,b,c). I need to compute a polar representation of this line like Hough approach with rho an theta.
How to do this?
Upvotes: 0
Views: 1215
Reputation: 701
A line in cartesian coordinates is not as easily represented in polar coordinates.
You can simply substitute x,y
with their respective polar equivalents, r*cos(theta), r*sin(theta)
, giving you
a*r*cos(theta) + b*r*sin(theta) + c = 0
This implicit equation is not as easy to figure out, however. But, if you first convert your implicit line equation to a parametric vector equation of the form (x,y) = R(t) = R0 + t*V
, where R0,V
are cartesian vectors which you can derive from a,b,c
, you can then write
(r*cos(theta), r*sin(theta)) = R0 + t*V
and solve this system of equations for r
and theta
in terms of t
.
However, polar coordinates are not the same as the Hough transform.
In the Hough system, the line is defined by the length rho
of a perpendicular line that crosses (0,0)
, which is theta = atan(b/a)
. Figuring out rho
seems more difficult at first, but this tutorial explains it.
Upvotes: 2