0

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.

Mailerdaimon
  • 6,003
  • 3
  • 35
  • 46
arthur.sw
  • 11,052
  • 9
  • 47
  • 104

1 Answers1

0

I forgot to call cv::initModule_nonfree(); before doing anything else.

arthur.sw
  • 11,052
  • 9
  • 47
  • 104