OpenCV - undefined reference: SurfFeatureDetector and BruteForceMatcher

◇◆丶佛笑我妖孽 提交于 2019-11-30 06:26:34

If you're using opencv 2.4, SURF and SIFT interfaces are changed to nonfree folder. You can use it by including this line

#include <opencv2/nonfree/features2d.hpp>

then you can use SurfFeatureDetector as before.

For SURF, @Mingyi Wu have answered. For BruteForceMatcher, please

#include <opencv2/legacy/legacy.hpp>

if you're using opencv2.4 or trunk from svn, SURF and SIFT interfaces are changed. http://code.opencv.org/projects/opencv/wiki/ChangeLog

I really don't know what the problem is.

The problem is most likely incorrect link line. Unfortunately, you didn't say what your link line is, so no further help could be given. Reading this may be helpful.

I had a similar problem after installing ROS. The problem was that I was linking to the wrong libraries.

I fixed the link errors by adding the following line to my CMakeLists.txt: link_directories(/opt/ros/groovy/lib)

for ocv 2.4.9:#include <opencv2/nonfree/features2d.hpp> is the location of SURF. In project Settings select Configuration Properties, then Linker, then Input and then add opencv_nonfree249d.lib to Additional Dependencies. With those ones the following example from ocv documentation works fine :-) http://docs.opencv.org/doc/tutorials/features2d/feature_detection/feature_detection.html#feature-detection

I had this problem after upgrade OpenCV from 2.3.1 to 2.4.5, and I've solved this issue linking opencv_nonfree, and add the necessary headers for my project:

#include "opencv2/highgui/highgui.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/nonfree/features2d.hpp"
#include "opencv2/imgproc/imgproc.hpp"
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!