作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
中的网格
未找到,尽管 simpleBlobDetector
检测每个 blob。
我使用以下代码,图像作为输入图像:
vector<Point2f> pointBuf;
Size gridSize(4, 11);
cv::SimpleBlobDetector::Params params;
params.maxArea = (image.rows * image.cols) / (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/" + "debugImage.png", image);
imwrite("./debug/" + "debugImage2.png", debugImage);
findCirclesGrid(image, gridSize, pointBuf, cv::CALIB_CB_ASYMMETRIC_GRID, detector);
最佳答案
您的代码没有问题并且工作正常。您分享的关于过滤器参数的图像的唯一问题params.maxArea
此限制不会让程序检测到您的网格。这是我尝试的代码和结果:
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/features2d.hpp>
#include <vector>
#include "opencv2/opencv.hpp"
using namespace cv;
using namespace std;
int main( int argc, char** argv )
{
Mat image = imread("/your/image/directory/blob.jpg");
vector<Point2f> pointBuf;
Size gridSize(4, 11);
cv::SimpleBlobDetector::Params params;
params.maxArea = 10000;
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);
}
findCirclesGrid(image, gridSize, pointBuf, cv::CALIB_CB_ASYMMETRIC_GRID, detector);
imshow("Result",debugImage);
imshow("Before",image);
waitKey(0);
return 0;
}
关于c++ - FindCirclesGrid c++11 不起作用,尽管检测器找到了所有点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60000857/
我在 Python 2.7 中使用 OpenCV 3 来校准不同的相机。我使用 findCirclesGrid() 函数,它成功地找到了 4 by 11 circle pattern在 1 兆像素的图
我正在使用 OpenCVSharp 运行一些校准测试,但我似乎无法让 FindCirclesGrid 工作,我在调用 FindCirclesGrid 时遇到了一个非常意外的 AccessViolati
我正在尝试使用圆网格执行相机校准。我一直没有成功,因为 findCirclesGrid 总是返回 false,即使文件只是一个圆网格也是如此。我把它归结为这个简单的程序: #include #inc
中的网格 未找到,尽管 simpleBlobDetector检测每个 blob。 我使用以下代码,图像作为输入图像: vector pointBuf; Size gridSize(4,
我是一名优秀的程序员,十分优秀!