opencv非常庞大,有很多模块,但大部分情况我们可能只会用到三四个模块,此时如果还是直接cmake . & make,将会非常费时,尤其是部署时很麻烦。
所以需要去除掉一些不需要的模块,可参考如下编译脚本,build_opencv.sh :
#!/bin/sh cmake -D CMAKE_BUILD_TYPE=RELEASE -D BUILD_opencv_gpu=OFF -D BUILD_DOCS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_TESTS=OFF -D BUILD_WITH_DEBUG_INFO=OFF -D BUILD_opencv_apps=OFF -D BUILD_opencv_calib3d=OFF -D BUILD_opencv_contrib=OFF -D BUILD_opencv_features2d=OFF -D BUILD_opencv_flann=OFF -D BUILD_opencv_gpu=OFF -D BUILD_opencv_ml=OFF -D BUILD_opencv_nonfree=OFF -D BUILD_opencv_objdetect=OFF -D BUILD_opencv_photo=OFF -D BUILD_opencv_stitching=OFF -D BUILD_opencv_superres=OFF -D BUILD_opencv_ts=OFF -D BUILD_opencv_video=OFF -D BUILD_opencv_videostab=OFF . make sudo make install
原文:http://www.cnblogs.com/xylc/p/4201254.html