问题描述
我需要在立体图像中查找和匹配特征点。因此,我想比较OpenCV 2.4.5中支持的不同的Feature Detection算法。通过向函数传递SURF,SIFT等。
代码片段:
#includeopencv2 / 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);
detect-> detect(leftImageGrey,keypoints_1);
detect-> detect(rightImageGrey,keypoints_2);
}
错误:
DisparisAnalysis.exe中0x770b15de处的未处理异常:0xC0000005:访问冲突读取位置0x00000000。
我已经搜索过解决方案,发现这个:我认识到的差别是,他们在开头使用cv :: initModule_nonfree()。但是,当它复制到我的代码,它不编译,因为未找到标识符。
对于SIFT和SURF,任何建议?
,你需要nonfree模块, p>
-
包含opencv2 / nonfree / nonfree.hpp
-
开始时调用cv :: initModule_nonfree()
-
链接到opencv_nonfree2.4.x.lib
I need to find and match feature points in stereo images. Therefore I want to compare the different Feature Detection algorithms that are supported in OpenCV 2.4.5. by passing "SURF", "SIFT", etc. to the function.
The code snippet:
#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);
}
The error:
Unhandled exception at 0x770b15de in DisparityAnalysis.exe: 0xC0000005: Access violation reading location 0x00000000.
I've already searched for solutions and found this one: Access violation reading in FeatureDetector OpenCV 2.4.5 The difference I've recognized is, that they use cv::initModule_nonfree() at the beginning. But when copying it into my code it doesn't compile because the identifier isn't found.Any suggestions?
for SIFT and SURF, you'll need the nonfree module, that is :
include "opencv2/nonfree/nonfree.hpp"
call cv::initModule_nonfree() at the beginning
link against opencv_nonfree2.4.x.lib
这篇关于在OpenCV中使用FeatureDetector会导致访问冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!