当使用findcirclesgrid()查找带角度的非对称圆网格时,该函数不起作用

时间:2018-05-14 13:10:32

标签: opencv

分辨率为2592*1944,网格几乎填满图像,然后出现问题。当电路板与镜头平行时,我可以找到网格,就像那样 enter image description here

当电路板具有角度时,该功能不起作用: enter image description here

真诚地寻求帮助,谢谢。

这是我的代码。

SimpleBlobDetector::Params params;
params.maxArea = 30000;
params.minInertiaRatio = 0.05f;
Ptr<FeatureDetector> blobDetector = new SimpleBlobDetector(params);
bool found = findCirclesGrid(circleimg, Size(cbCols, cbRows), corners, CALIB_CB_ASYMMETRIC_GRID, blobDetector);

1 个答案:

答案 0 :(得分:0)

请将其作为自己的笔记写下来,并分享我的经验。

Mat circleimg = imread("circle.bmp");
SimpleBlobDetector::Params params;
params.maxArea = 30000;
params.minArea = 1000;
params.minThreshold = 10;
params.maxThreshold = 180;
params.thresholdStep = 5;
params.filterByCircularity = true;
params.minCircularity = 0.7;
params.filterByInertia = false;
params.filterByConvexity = false;
Ptr<FeatureDetector> blobDetector = new SimpleBlobDetector(params);

//this part can be used to test the if the blob detector work.
vector<KeyPoint> keypoints;
blobDetector->detect(circleimg, keypoints);
Mat circleimg_tmp = circleimg.clone();
for (size_t i = 0; i < keypoints.size(); i++)
{
    circle(circleimg_tmp, keypoints[i].pt, 25, Scalar(0, 0, 255), 3);
}
namedWindow("circleimg", cv::WINDOW_NORMAL);
imshow("circleimg", circleimg_tmp);
waitKey(0);

bool found = findCirclesGrid(circleimg, Size(cbCols, cbRows), corners, CALIB_CB_ASYMMETRIC_GRID | CALIB_CB_CLUSTERING, blobDetector);
drawChessboardCorners(circleimg, Size(cbCols, cbRows), corners, found);
imshow("circleimg", circleimg);

我发现一个问题,即使blobdetector找到了圆圈,当我没有使用聚类标志时,findcirclesgrid()函数也无法工作。