1. 程式人生 > >ubuntu16.04 opencv環境搭建

ubuntu16.04 opencv環境搭建

1.下載opencv原始碼:

http://opencv.org/releases.html

2.解壓原始碼壓縮包:

unzip opencv-3.4.0.zip
or
tar xvf opencv-3.4.0.tar.gz

3.安裝相關依賴:

sudo apt-get install cmake  
sudo apt-get install build-essential libgtk2.0-dev libavcodec-dev libavformat-dev libjpeg.dev libtiff4.dev libswscale-dev libjasper-dev  

4.編譯opencv

$cd opencv-3.4.0
$mkdir build
$cd build
$cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..
$make
$sudo make install

5.連線庫

$sudo vim /etc/ld.so.conf.d/opencv.conf
新增
/usr/local/lib

$sudo ldconfig

6.例

cd opencv-3.4.0/samples/cpp/example_cmake
$cmake .
$make
$./opencv_example