问题
I am using SimpleBlobDetector, of course to detect circles, in images grabbed from a camera and have undergone OpenCV color and morphological filters. I am receiving an
Exception thrown at 0x000... (opencv_imgproc249.dll) in .exe: Access violation reading location 0x000...
I am receiving this error on the line containing: d.detect(canny, keypoints);
Here is a sample of my code:
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
is from the utilization of Canny(input, canny, 10, 30);
Can anyone potentially explain why I might be receiving this error?
EDIT:
I realized I was using the method of keypoint detection for OpenCV version < 3. I have since changed it to:
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);
However, now I have an error related to params
. The following error reads:
E0312 - no suitable user defined conversion from "cv::SimpleBlobDetector::Params" to "const std::string" exists
I have copied this exactly from SimpleBlobDetector Tutorial and oddly have this issue.
来源:https://stackoverflow.com/questions/53202635/simpleblobdetector-detect-exception-thrown