openCV中 libopencv-nonfree-dev的安装: undefined reference to `cv::initModule_nonfree()'

今天照着 一起做RGB-D SLAM (3)    ,
程序会出现下面的错误:
cv::initModule_nonfree();

/home/yhzhao/slam/src/detectFeatures.cpp:32: undefined reference to `cv::initModule_nonfree()'

很奇怪,我在自己的libs文件夹里能够找到 libopencv_nonfree.so.2.4.9 .
但是在自己的cmake中

cmake 中 message("OpenCV_LIBS = ${OpenCV_LIBS}")
  OpenCV_LIBS = opencv_videostab;opencv_video;opencv_ts;opencv_superres;opencv_stitching;opencv_photo;opencv_ocl;opencv_objdetect;opencv_ml;opencv_legacy;opencv_imgproc;opencv_highgui;opencv_gpu;opencv_flann;opencv_features2d;opencv_core;opencv_contrib;opencv_calib3d

里面没有opencv_nonfree,多谢根哥提醒,再以下面方法安装了个库.给后来相同情况者提个醒.

sudo add-apt-repository --yes ppa:xqms/opencv-nonfree
sudo apt-get update
sudo apt-get install libopencv-nonfree-dev

安装后
cmake 中 message("OpenCV_LIBS = ${OpenCV_LIBS}")

OpenCV_LIBS = opencv_videostab;opencv_video;opencv_ts;opencv_superres;opencv_stitching;opencv_photo;opencv_ocl;opencv_objdetect; opencv_nonfree;opencv_ml;opencv_legacy;opencv_imgproc;opencv_highgui;opencv_gpu;opencv_flann;opencv_features2d;opencv_core;opencv_contrib;opencv_calib3d  

你可能感兴趣的:(openCV中 libopencv-nonfree-dev的安装: undefined reference to `cv::initModule_nonfree()')