Search code examples
opencvhough-transform

Opencv - cvHoughLines2


I am reading Learning openCV and I came across description of cvHoughLines2 in this book. But I can't understand one thing.

I read about Hough transform and I think I understand it, so the parameters rho and theta are bit puzzling to me. When we have equation rho=xcos(theta)+ycos(theta) when we decide on some set of discrete values of theta, values of rho should be automatically known.

In this book it is said that opencv creates rhoxtheta accumlator array.

Does opencv just discretize angle as multiplies of 360/theta? But how does the rho parameter fits? How are the values of rho discretized?


Solution

  • Your question isn't clear, it seems you are confused. Have a look at this page. Given a set of points (the x's and y's) belonging to a line you can describe the same line by just two parameters r and theta. These are two independent parameters we want to find that best describe the line that we have the points on.