功能探测器在Visual Studio 2010中的简单程序中使用失败。我使用的是opencv 2.4.2,并在2.4.1上进行了检查。唯一要做的就是创建一个特征检测器,并使用它来检测图像中的关键点。我在detect.cpp(即features2d \ detectors.cpp行:65)中得到未处理的异常崩溃,指向名为“detecImpl()”的函数。这个错误真的被卡住了,并且花了很多时间,所以任何帮助都非常感激。opencv功能探测器崩溃,未处理的异常错误
#include <iostream>
#include <opencv2/core/core.hpp>
#include "opencv2/highgui/highgui.hpp"
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/features2d/features2d.hpp>
using namespace std;
using namespace cv;
int main(int argc, char* argv[])
{
cv::Ptr<cv::FeatureDetector> featureDetector;
cv::Ptr<cv::DescriptorExtractor> descriptorExtractor;
featureDetector = cv::FeatureDetector::create("SURF");
descriptorExtractor = cv::DescriptorExtractor::create("SURF");
cv::Mat imageColor;
cv::Mat image = cv::imread("car1.jpg", 0);
cv::cvtColor(image, imageColor, CV_GRAY2BGR);
try{
imshow("Test Image",imageColor);
cv::waitKey(3000);
}
catch(cv::Exception exc)
{
cout << "CV error occured : " + exc.msg;
}
std::vector<cv::KeyPoint> currentKeypoints;
try{
featureDetector->detect(image,currentKeypoints); //This line generates the error but no exception is caught ....
}
catch(cv::Exception exc)
{
cout << "CV error occured : " + exc.msg;
return -1;
}
}
对于那些想知道的一个,初始化为:'CV :: initModule_nonfree()' – Eric 2014-09-05 19:34:00