1.首先在解压完的目录下新建build文件夹
2.安装依赖库
sudo apt-get install build-essential libgtk2.0-dev libvtk5-dev libjpeg-dev libjasper-dev libopenexr-dev libtbb-dev
3.然后进入到build文件夹右键打开终端
cmake -D CMAKE_BUILD_TYPE=bulid -D CMAKE_INSTALL_PREFIX=/usr/local -D CUDA_GENERATION=Kepler ..
4.如果遇到CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
CUDA_nppi_LIBRARY (ADVANCED)
linked by target "opencv_cudev" in directory D:/Cproject/opencv/opencv/sources/modules/cudev
可以参考这篇神作:https://blog.csdn.net/u014613745/article/details/78310916
5.如果有遇到-- ICV: Downloading ippicv_linux_20151201.tgz... CMake Error at 3rdparty/ippicv/downloader.cmake:73 (file): file DOWNLOAD HASH mismatch
或者
在此过程中会出现下载 ippicv_linux_20151201.tgz 或者 protobuf-cpp-3.1.0.tar.gz 包失败的情况,若 下载失败 或者 file DOWNLOAD HASH mismatch
如果下载不了,可以从本链接下载
链接: https://pan.baidu.com/s/1MPtmxGfjzBz5ZtE_Uim4CA 提取码: rpkr
可以去https://github.com/opencv/opencv_3rdparty/tree/ippicv/master_20151201/ippicv下载相应的包然后
参考这篇文章的做法:https://blog.csdn.net/youngpan1101/article/details/58027049
6.如果出现 A duplicate ELSE command was found inside an IF block错误,则需要把cmake/OpenCVCompilerOptions.cmake第21行的else()删掉。
7.在完成第4步后
make -j4
8. sudo make install
搞定!