1. 程式人生 > >ubuntu16.04安裝opencv3.1.0

ubuntu16.04安裝opencv3.1.0

1.安裝依賴
sudo apt-get install build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
可選的:
sudo apt-get install checkinstall yasm libtiff5-dev libjpeg-dev libjasper-dev libdc1394-22-dev libxine2-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev python-dev python-numpy libtbb-dev libqt4-dev libgtk2.0-dev libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev x264 v4l-utils libeigen3-dev

2.建立編譯的臨時目錄
cd ~/opencv-3.1.0
mkdir release
cd release
(這裡release和下面對應的,儘量不要改)

3.生成cmake編譯配置
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..
===========================================================================
– ICV: Downloading ippicv_linux_20151201.tgz…

這裡下載檔案可能會出錯,解決辦法就是去官網下載ippicv_linux_20151201.tgz,然後放到該路徑下
/home/computer/opencv-3.1.0/3rdparty/ippicv/downloads/linux-808b791a6eac9ed78d32a7666804320e/
===========================================================================
miniconda2下cmake配置:
conda install -c menpo opencv3=3.1.0

4.安裝
sudo make install

5.安裝python-opencv
sudo apt-get install python-opencv

6.測試
python
import cv2
這裡寫圖片描述**
檢視python下opencv版本:
cv2.version
或者檢視opencv版本
pkg-config –modversion opencv
這裡寫圖片描述