opencv - How to find a line from polar coordinates (Hough Transform Confusion) -
i started cv course , going through old homeworks (the current ones aren't released). i've implemented hough lines function, loop through each point, if it's edge, loop through 0-180 (or -90 90) theta values, , calculate rho, , store in array.
when tried convert polar coordinates, can find x,y pair (using rho * sin(theta), , rho * cos(theta)), don't understand how convert line in cartesian space. have line need either 2 points or point , direction (assuming ray of course)
i understand point is.
i've done searching can't seem quite find answer, folks tend say, polar tells x, bam have line in cartesian, seem missing connection "bam" was.
what mean described here; explain hough transformation
also vector/line polar coordinates it's asked how draw line polar coords, response here's x , y. me never mentions rest of solution.
is line somehow related y = mx+b m theta , b rho?
if not how convert line in cartesian space.
edit: after reviewing sunreef's answer, , trying convert y on it's own side, discovered answer well: how convert coordinates image (x,y) hough transformation (rho, theta)?
it appears think i'm looking this
m = -cotθ
c = p*cosecθ
edit#2 found other examples on net. yes i'll need rho * sin(theta) , rho*cos(theta)
the other part messing me needed convert radians, once did that, started getting results.
you right can base point @ line as
(x0, y0) = (rho * cos(theta), rho * sin(theta))
and can find (unit) direction vector of line perpendicular normal:
(dx, dy) = ( -sin(theta), cos(theta))
Comments
Post a Comment