今天照着一起做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}")
程序会出现以下的错误:
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