Finds circles in a grayscale image using a Hough transform.
| Name | Type | Range | Description | |
|---|---|---|---|---|
![]() |
inImage | Image | UINT8, single-channel input image. | |
![]() |
inMethod | CvHoughMethod | Detection method to use. Currently, the only implemented method is CV_HOUGH_GRADIENT. | |
![]() |
inDp | Real | 0.0 - ![]() |
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. |
![]() |
inMinDist | Real | 0.0 - ![]() |
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. |
![]() |
inParam1 | Real | 0.0 - ![]() |
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. |
![]() |
inParam2 | Real | 0.0 - ![]() |
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. |
![]() |
inMinRadius | Integer | Minimum circle radius. When both minRadius and maxRadius equal zero, all radiuses will be accepted. | |
![]() |
inMaxRadius | Integer | Maximum circle radius. When both minRadius and maxRadius equal zero, all radiuses will be accepted. | |
![]() |
outCircles | Circle2DArray | Output array of detected circles. | |
The operation detects circular objects (in pixels) in the inImage using the Hough Transform approach. It is possible to set the range of circles' radiuses using inMinRadius and inMaxRadius parameters, or accept all radiuses by setting both these parameters to 0.
![]() |
![]() |
cvHoughCircles performed on the sample image with inMinRadius = 40, inMaxRadius = 50.
Note, that first step of algorithm is calculation of gradients on image. Therefore, the input image doesn't have to be binary image. This is other approach from the one in cvHoughLines function.
"Input image must be UINT8 sigle-channel in cvHoughCircles."
"Only supported method is HOUGH_GRADIENT in cvHoughCircles."
This article is valid for version 3.0.1012