我正在尝试使用以下代码检测SIFT关键点:
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/nonfree/nonfree.hpp"
#include "opencv2/nonfree/features2d.hpp"
[...]
Ptr<FeatureDetector> detector = FeatureDetector::create( "SIFT" );
vector<KeyPoint> keyPoints;
detector->detect( image, keyPoints );
The problem is that my detector pointer points to nowhere after that last line, and no error is shown in the console.
我正在使用QtCreator,我的.pro文件包含:
LIBS += -lopencv_nonfree
CONFIG += link_pkgconfig
PKGCONFIG += opencv
所以我的makefile包含:
LIBS = $(SUBLIBS) -lopencv_nonfree [...] /usr/local/lib/libopencv_nonfree.so [...]
加载库时没有错误。
我已经使用这些说明安装了opencv。
答案 0 :(得分:0)
在做其他任何事情之前我忘了给cv::initModule_nonfree();
打个电话。