功能探測器在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