undefined reference to `cv::xfeatures2d::SURF::create(double, int, int, bool, bool)' [closed]
Hi,
I have updated OpenCV c++ recently from 3.1 to 3.2 version and getting next error while compile:
undefined reference to `cv::xfeatures2d::SURF::create(double, int, int, bool, bool)'
My cmake file:
cmake_minimum_required(VERSION 3.6)
project(OpenCVProject)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "-O3")
find_package(OpenCV REQUIRED)
set(SOURCE_FILES main.cpp SurfDetector.cpp SurfDetector.h ContoursDetector.cpp ContoursDetector.h)
add_executable(OpenCVProject ${SOURCE_FILES})
target_link_libraries(OpenCVProject ${OpenCV_LIBS})
And my header file is:
#include <stdio.h>
#include <iostream>
#include <opencv2/imgproc.hpp>
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/xfeatures2d.hpp"
using namespace cv;
using namespace std;
using namespace cv::xfeatures2d;
Code snippet that cause the error:
Ptr<SURF> detector = SURF::create(400, 4, 3, true, true);
I compiled OpenCV from source, but previously I compiled opencv-contrib library following instruction in their readmy, exactly the way I did for version 3.1.
The question is there a bug or changes in 3.2 that I am not aware of?
Thanks in advance.
Have you check if in cmake OPENCV_ENABLE_NONFREE is checked ?
It was OFF. However, I set it to ON and still have the same issue. Here is how I handled it:
@LBerger , btw, OPENCV_ENABLE_NONFREE seems to be used only in bm3d_image_denoising ..
not with SIFT or SURF, as one might expect. weird, isn't it ?
Yes I am agree but in doc it is non free : an issue ? OPENCV_ENABLE_NONFREE what does it means?