opencv3.0.0 ubuntu16.04

lihuifei 2020-01-28

1.搭建编译环境

sudo apt-get install build-essential
2.安装依赖库
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
3.下载opencv3.0
mkdir ~/opencv #创建opencv文件夹,用于存放opencv文件
cd ~/opencv
wget https://github.com/Itseez/opencv/archive/3.0.0-alpha.zip -O opencv-3.0.0-alpha.zip
unzip opencv-3.0.0-alpha.zip
4.安装opencv
cd ~/opencv/opencv-3.0.0-alpha
cmake .
sudo make #编译比较慢
sudo make install
sudo /bin/bash -c ‘echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf‘ #给opencv添加动态链接库目录
sudo ldconfig
5.编译samples例程

cd samples
sudo cmake .
sudo make -j $(nproc)
6.测试
cd cpp/
./cpp-example-facedetect lena.jpg

===================================

cmake出现ippicv下载失败或者hash不匹配,加上选项-D WITH_IPP=OFF

相关推荐