Impossible to create SIFT detector and extractor
I'm trying to detect SIFT keypoints, using this code:
#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.
I'm using QtCreator and my .pro file contains:
LIBS += -lopencv_nonfree
CONFIG += link_pkgconfig
PKGCONFIG += opencv
so my makefile contains:
LIBS = $(SUBLIBS) -lopencv_nonfree [...] /usr/local/lib/libopencv_nonfree.so [...]
There is no error when loading the libraries.
I've installed opencv using those instructions.
I forgot to call cv::initModule_nonfree(); before doing anything else.