编译caffe遇到的问题(四)linux 安装 opencv2.4

1、下载opencv2.4

官网 https://opencv.org/releases/,

github下载opencv2.4.13.6,https://github.com/opencv/opencv/tree/2.4.13.6

2、安装opencv所需要的依赖库

$ apt-get install build-essential
$ apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
$ apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev

3、编译opencv

$ cd opencv/
$ mkdir build
$ cd build/
$ cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local -D OPENCV_EXTRA_MODULES_PATH= ..

或者

cmake -D WITH_CUDA=OFF -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_TIFF=ON ..

或者

cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local -D OPENCV_EXTRA_MODULES_PATH= /home/usename/opencv_contrib/modules/
$ make && make install

 

编译过程可能遇到的问题

Configuring incomplete, errors occurred!

1、缺少各种库

apt-get install ......

2、IPPICV: Download: ippicv_2019_lnx_intel64_general_20180723.tgz下载失败

(1)手动下载(根据opencv/3rdparty/ippicv/CMakeLists.txt文件第47行可以推测出地址)https://raw.githubusercontent.com/opencv/opencv_3rdparty/a62e20676a60ee0ad6581e217fe7e4bada3b95db/ippicv/

(2)mkdir opencv/3rdparty/ippicv/downloads

(3)将下载的ippicv_2019_lnx_intel64_general_20180723.tgz放在opencv/3rdparty/ippicv/downloads下

(4)将opencv/3rdparty/ippicv/ippicv.cmake文件47行改为

"file:///home/username/opencv/3rdparty/ippicv/downloads/"

之后再cmake会自动从本地加载

你可能感兴趣的:(编译caffe遇到的问题)