Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How do the rho and theta values work in HoughLines?

I have found some source code that finds lines in an image like I want and it uses the following HoughLines:

HoughLines( edges, lines, 1, CV_PI/180, 50, 0, 0 );

What I want to do is add the top, left, right, and bottom borders into the lines vector after Houghlines. From what I read in the documentation:

lines – The output vector of lines. Each line is represented by a two-element vector (rho, theta) . rho is the distance from the coordinate origin (0,0) (top-left corner of the image) and theta is the line rotation angle in radians

lines uses the rho and theta values to represent lines. And that the 1, and CV_PI/180 arguments are called rho and theta. So I did some research on this algorithm and found this diagram: image description

This looks like a good explanation of what im trying to understand but I still cant wrap my head around how to add the borders using the appropriate rho and theta values. Can somone explain this a little more so that I can possibly understand it? I would really appreciate it! Thanks.