Ask Your Question
0

OpenCv SimpleBlobDetector does not find all blobs. C++ , VS2015

asked 2018-03-28 13:57:21 -0600

DmitryPonv gravatar image

updated 2018-03-28 14:32:29 -0600

I have a simple task for OpenCV SimpleBlobDetector

cv::SimpleBlobDetector::Params params;
cv::Ptr<cv::SimpleBlobDetector> detector = cv::SimpleBlobDetector::create(params);
std::vector<cv::KeyPoint> keypoints;
detector->detect(crop, keypoints);
drawKeypoints(crop, keypoints, crop, cv::Scalar(0, 0, 255), cv::DrawMatchesFlags::DRAW_RICH_KEYPOINTS);
cv::imshow("crop", crop);
cv::waitKey(0);

It is not detecting half of the blobs in my image. Please see picture below,

I tried adding parameters and varying them, at no point has it ever detected every single blob. Blob detection is a simple and straightforward algorithm that should be completely refined in every image processing API. Is this not the case with OpenCV?

All of these parameters were commented out when the image was taken, only the code above was executed

//params.minThreshold = 0;
//params.maxThreshold = 255;
//params.filterByArea = true;
//params.minArea = 1000;
//params.maxArea = 5000;
//params.filterByCircularity = true;
//params.minCircularity = 0.4;
//params.filterByConvexity = true;
//params.minConvexity = 0.87;
//params.filterByInertia = true;
//params.minInertiaRatio = 0.71;

https://i.stack.imgur.com/qnzMG.jpg

I'm using either OpenCV 3.3 or 3.2, I can't seem to find the version number in the sources

edit retag flag offensive close merge delete

Comments

params.filterByCircularity = true; yea, if i were a machine, i'd filter those out, too.

berak gravatar imageberak ( 2018-03-28 14:06:22 -0600 )edit

If its not clear by the question, All of the parameters are commented out as shown above when this image was taken.

DmitryPonv gravatar imageDmitryPonv ( 2018-03-28 14:30:44 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2018-03-28 23:23:56 -0600

LBerger gravatar image

updated 2018-03-28 23:24:44 -0600

May be surface is less than 25 or convexity<0.95...

Default parameters are :

SimpleBlobDetector::Params::Params()
{
    thresholdStep = 10;
    minThreshold = 50;
    maxThreshold = 220;
    minRepeatability = 2;
    minDistBetweenBlobs = 10;

    filterByColor = true;
    blobColor = 0;

    filterByArea = true;
    minArea = 25;
    maxArea = 5000;

    filterByCircularity = false;
    minCircularity = 0.8f;
    maxCircularity = std::numeric_limits<float>::max();

    filterByInertia = true;
    //minInertiaRatio = 0.6;
    minInertiaRatio = 0.1f;
    maxInertiaRatio = std::numeric_limits<float>::max();

    filterByConvexity = true;
    //minConvexity = 0.8;
    minConvexity = 0.95f;
    maxConvexity = std::numeric_limits<float>::max();
}
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2018-03-28 13:57:21 -0600

Seen: 4,990 times

Last updated: Mar 28 '18