vendredi 31 janvier 2020

FindCirclesGrid c++11 does not work though detector finds all points

The Grid in the image is not found, though the simpleBlobDetector detects every blob.

I use the following code:

    vector<Point2f> pointBuf;
    Size gridSize(4, 11);

    cv::SimpleBlobDetector::Params params;
    params.maxArea = pixels / (gridSize.height * gridSize.width * 1.5);
    params.minArea = 70;
    params.minConvexity = 0.85;
    params.minThreshold = 80;
    params.maxThreshold = 230;
    params.thresholdStep = 20;
    params.minInertiaRatio = 0.05;

    auto detector = cv::SimpleBlobDetector::create(params);
    vector<KeyPoint> keypoints;
    detector->detect(image, keypoints);

    Mat debugImage = Mat::zeros(image.size(), CV_8U);
    for (auto keypoint : keypoints) {
        drawKeypoints(debugImage, keypoints, debugImage, 255);
    }
    imwrite("./debug/" + std::to_string(debugIndex) + "debugImage.png", image);
    imwrite("./debug/" + std::to_string(debugIndex) + "debugImage2.png", debugImage);

    findCirclesGrid(image, gridSize, pointBuf, cv::CALIB_CB_ASYMMETRIC_GRID, detector);

The code works for other images. So why is the code not working on this image?

Aucun commentaire:

Enregistrer un commentaire