4
我需要查找和匹配立體圖像中的特徵點。因此我想比較OpenCV 2.4.5中支持的不同特徵檢測算法。通過將「SURF」,「SIFT」等傳遞給函數。在OpenCV中使用FeatureDetector會導致訪問衝突
的代碼片段:
#include "opencv2/opencv.hpp"
#include <opencv/highgui.h>
#include <opencv2/nonfree/features2d.hpp>
using namespace cv;
using namespace std;
...
void DisparityAnalysis::detectKeyPoints(Mat1b leftImageGrey, Mat1b rightImageGrey, string algorithmName)
{
Ptr<FeatureDetector> detector = FeatureDetector::create(algorithmName);
detector->detect(leftImageGrey, keypoints_1);
detector->detect(rightImageGrey, keypoints_2);
}
錯誤:
Unhandled exception at 0x770b15de in DisparityAnalysis.exe: 0xC0000005: Access violation reading location 0x00000000.
我已經搜索解決方案,發現這一個:Access violation reading in FeatureDetector OpenCV 2.4.5我已經認識不同的是,他們使用的簡歷:: initModule_nonfree()開頭。但是,當將其複製到我的代碼中時,它不會被編譯,因爲找不到標識符。 有什麼建議嗎?
感謝@berak,因爲... e「opencv2/nonfree/nonfree.hpp」缺失,cv :: initModule_nonfree()給出錯誤 – filla2003