我需要找到并匹配立体图像中的特征点 . 因此,我想比较OpenCV 2.4.5中支持的不同特征检测算法 . 通过将“SURF”,“SIFT”等传递给函数 .
代码段:
#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由于找不到标识符,我编译的区别是've recognized is, that they use cv::initModule_nonfree() at the beginning. But when copying it into my code it doesn' . 有什么建议?
1 回答
对于SIFT和SURF,您需要非自由模块,即:
包括“opencv2 / nonfree / nonfree.hpp”
在开头调用cv :: initModule_nonfree()
链接opencv_nonfree2.4.x.lib