The people who have studied the image processing know that Hough transform is used to detect the line, its principle is very simple, is to map the discrete points to the parameter space, in the parameter space accumulate the most points is the initial space decision line parameters. Detect Straight line
Hough Transform detection line is the most basic application, its essence is known a lot of points (x0,y0), (x1,y1) ... (x0,y0),(x1,y1)...... (X_0,Y_0), (x_1,y_1) ... Y=kx+b y = k x + b y=kx+b in the slope k K K and offset b b
Anyone who has studied mathematics knows that two points determines a straight line, as long as you know that two groups (X,y) (x, y) (x,y) can get a unique K K and b b, so you can get a number of groups (K,B) (k, B) (k,b) by any two points, and select the most frequently occurring group (k, b) (k, B) (K,B) is the required parameter.
Of course, it is not this method that is adopted in OpenCV, but the method of mapping from rectangular coordinate system to polar coordinate system. But the essence is the same, and in polar coordinates the solution is (ρ,θ) (ρ,θ) (\rho,\theta), but in the final analysis, the line is determined by two parameters. The polar coordinates mapping method is for the point in the rectangular coordinate system, each at a certain angle, such as π/10π/\PI/10 drew the line of the point, corresponding (ρ,θ) (ρ,θ) (\rho,\theta) map to polar coordinates, so that each point in polar coordinates can be mapped to a cycle of 2π2 Π2\pi a curve similar to a positive cosine curve, by mapping all the points in this way, in polar coordinates, most of the curves will be handed to a point, and the point is obtained by voting, then the corresponding (ρ,θ) (ρ,θ) (\rho,\theta) is the result of the request. Detection Circle
The formula for the circle is (x−x0