How to detect small circle using Hough Circle Transform?

I want to detect small circle like the shape of golf ball which is about 150 cm from the camera. What parameter in hough circle transform should I change?

edit retag close merge delete

Sort by ยป oldest newest most voted

void cv::HoughCircles(

• InputArray image, //8-bit, single-channel, grayscale input image.
• OutputArray circles, // Output vector of found circles. Each vector is encoded as a 3-element floating-point vector (x,y,radius)
• int method, //Detection method, see cv::HoughModes. Currently, the only implemented method is HOUGH_GRADIENT
• double dp, //Inverse ratio of the accumulator resolution to the image resolution. For example, if dp=1 , the accumulator has the same resolution as the input image. If dp=2 , the accumulator has half as big width and height.
• double minDist, //Minimum distance between the centers of the detected circles. If the parameter is too small, multiple neighbor circles may be falsely detected in addition to a true one. If it is too large, some circles may be missed.
• double param1 = 100, // First method-specific parameter. In case of CV_HOUGH_GRADIENT , it is the higher threshold of the two passed to the Canny edge detector (the lower one is twice smaller).
• double param2 = 100, //Second method-specific parameter. In case of CV_HOUGH_GRADIENT , it is the accumulator threshold for the circle centers at the detection stage. The smaller it is, the more false circles may be detected. Circles, corresponding to the larger accumulator values, will be returned first.

)

Note: Usually the function detects the centers of circles well. However, it may fail to find correct radii. You can assist to the function by specifying the radius range ( minRadius and maxRadius ) if you know it. Or, you may ignore the returned radius, use only the center, and find the correct radius using an additional procedure.

Also, here is a tutorial with a sample code and explination

more

You might also want to take a look at this stackoverflow solution

( 2018-02-20 00:41:29 -0500 )edit

I missed one information in my question which I am using webcam to detect the circle. If I used image that have circle shape, it can detect but if I used webcam (Logitech Pro C920M) cannot detect. I don't know what is the problem

( 2018-02-20 00:44:56 -0500 )edit