Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

try something like that:

    Mat image = imread("circles.bmp"); // or whatever image you have with circles
    Ptr<FeatureDetector> blobsDetector = SimpleBlobDetector::create();
    vector<KeyPoint> keypoints;
    GaussianBlur( image, image, cv::Size(9, 9), 3, 3 );

    // Change parameters
    SimpleBlobDetector::Params params;
    params.filterByCircularity = true;
    blobsDetector->detect(image, keypoints);

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

    imshow("result", drawImage);

    waitKey(0);
    return 0;

this should work without a problem.