ubuntu opencv3.2 安装(非CUDA版本)

1,下载好opencv 以及 opencv contrib 文件

sudo apt-get install build-essential
sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev # 处理图像所需的包
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev liblapacke-dev
sudo apt-get install libxvidcore-dev libx264-dev # 处理视频所需的包
sudo apt-get install libatlas-base-dev gfortran # 优化opencv功能
sudo apt-get install ffmpeg

安装命令:

cd opencv-3.2.0  
mkdir build  
cmake -D WITH_CUDA=OFF -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local OPENCV_EXTRA_MODULES_PATH=
/home/hanxuan/opencv-3.2.0/opencv3.2.0/opencv_contrib-3.2.0/modules/  ..
make -j4
make install

有两个文件无法直接下载,需要我们手动下载。
最后,输入:

pip3 install opencv-python

错误

如果出现编译问题“undefined reference to `cblas_sgemm(CBLAS_ORDER, CBLAS_TRANSPOSE, CBLAS_TRANSPOSE, int, int, int, float, float const, int, float const, int, float, float*, int)'”
可能需要重新编译BLAS,CBLAS,LPACK。(我的另外一篇文章)然后再重新安装:

sudo apt-get install libatlas-base-dev gfortran 

再编译就行。

你可能感兴趣的:(ubuntu opencv3.2 安装(非CUDA版本))