Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Here are the HoughCircles parameters and default arguments:

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.
  • int minRadius = 0, //Minimum circle radius.
  • int maxRadius = 0 //Maximum circle radius.

)

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