OpenCV
4.4.0
Open Source Computer Vision
|
In this chapter,
A circle is represented mathematically as \((x-x_{center})^2 + (y - y_{center})^2 = r^2\) where \((x_{center},y_{center})\) is the center of the circle, and \(r\) is the radius of the circle. From equation, we can see we have 3 parameters, so we need a 3D accumulator for hough transform, which would be highly ineffective. So OpenCV uses more trickier method, Hough Gradient Method which uses the gradient information of edges.
The function we use here is cv.HoughCircles(). It has plenty of arguments which are well explained in the documentation. So we directly go to the code.
Result is shown below: