Ask Your Question

Revision history [back]

You can try to use SimpleBlobDetector which is tuned to detect circular blobs.

Here is complete code for detection:

Mat image = imread("image.jpg");
Ptr<FeatureDetector> blobsDetector = FeatureDetector::create("SimpleBlob");
vector<KeyPoint> keypoints;
blobsDetector->detect(image, keypoints);

visualization:

Mat drawImage = image.clone();
for (size_t i = 0; i < keypoints.size(); ++i)
    circle(drawImage, keypoints[i].pt, 4, Scalar(255, 0, 255), -1); 
imwrite("result.png", drawImage);

and achieved results: detected corners

Check out the description of the algorithm and its parameters in the official docs.