github 地址:

https://github.com/opencv/opencv

安装依赖

sudo apt-get install build-essential
sudo apt-get install cmake git libgtk2.-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff5-dev libdc1394--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

编译安装opencv

cd opencv

mkdir build

cd build

cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..

make

make install (需要管理员权限)

下面操作可选 ,以上只是安装好了,但是还没有配置环境

sudo /bin/bash -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf'

sudo ldconfig

编译的时候可以采用下面的命令

`pkg-config opencv --libs --cflags opencv`
原文路径: https://blog.csdn.net/jainszhang/article/details/79156737
05-27 19:44