Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Undefined reference to `cv::xfeatures2d::SURF::create(double, int, int, bool, bool)'

I try tro get SURF running with OpenCV 3.2 on a Windows 7 maschine but I get the error message:"undefined reference to `cv::xfeatures2d::SURF::create(double, int, int, bool, bool)" "

I've installed contrib modules and set:

  • OPENCV_ENABLED_NONFREE = true.
  • OPENCV_EXTRA_MODULES_PATH = E:/Tools/OpenCv/sources/opencv_contrib/modules
  • WITH_QT = true

My code is:


#include "mainwindow.h"
#include "ui_mainwindow.h"

#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/xfeatures2d/nonfree.hpp"

using namespace cv;

MainWindow::MainWindow(QWidget *parent) :
  QMainWindow(parent),
  ui(new Ui::MainWindow)
{
  ui->setupUi(this);

  // this works
  Mat img_object = imread( "E:/Test/ColorChecker.jpg", CV_LOAD_IMAGE_COLOR );
  namedWindow("My Image");
  imshow("My Image", img_object);
  int minHessian = 400;

  // this fails
   cv::xfeatures2d::SURF::create( minHessian );

  // as well as 
  Ptr<surf> detector = SURF::create(400, 4, 3, true, true);
...

I searched around for a solution f.e. http: // answers.opencv.org/question/133017/undefined-reference-to-cvxfeatures2dsurfcreatedouble-int-int-bool-bool but nothing worked to me.

Thanks for any help.