我正在使用SimpleBlobDetector来检测摄像机捕获的图像中的圆形,并对其进行OpenCV颜色和形态过滤。我收到
.exe中的0x000 ...(opencv_imgproc249.dll)引发异常:访问冲突读取位置0x000 ...
我在包含d.detect(canny, keypoints);
的行上收到此错误
这是我的代码示例:
std::vector<KeyPoint> keypoints;
SimpleBlobDetector d(params);
d.detect(canny, keypoints);
drawKeypoints(im, keypoints, im_with_keypoints, Scalar(0, 255, 0), DrawMatchesFlags::DRAW_RICH_KEYPOINTS);
canny
来自Canny(input, canny, 10, 30);
有人可以解释为什么我会收到此错误吗?
编辑:
我意识到我正在对OpenCV版本<3使用关键点检测方法。此后我将其更改为:
Ptr<SimpleBlobDetector> d = SimpleBlobDetector::create(params);
std::vector<KeyPoint> keypoints;
d->detect(thresh, keypoints);
drawKeypoints(im, keypoints, im_with_keypoints, Scalar(0, 255, 0), DrawMatchesFlags::DRAW_RICH_KEYPOINTS);
但是,现在我遇到一个与params
相关的错误。读取以下错误:
E0312-从“ cv :: SimpleBlobDetector :: Params”到“ const std :: string”的用户定义的转换不存在
我完全从SimpleBlobDetector Tutorial复制了此文件,奇怪的是出现了这个问题。