1、 需要安装的库文件,执行以下命令:
sudo apt-get install ffmpeg libopencv-dev libdc1394-22 libdc1394-22-dev libjpeg-dev libpng12-dev libtiff5-dev libjasper-dev
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libxine2-dev libv4l-dev libtbb-dev qtbase5-dev libfaac-dev libmp3lame-dev
sudo apt-get install libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev x264 v4l-utils unzip libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
sudo apt-get install python-dev libv4l-dev
sudo apt install cmake
注:如果一次性安装有错误,可以一个一个进行安装,确定错误的地方进行解决。
2、下载OpenCV3.2.0的在安装包并进行解压,按以下步骤进行安装:
unzip opencv-3.2.0.zip -d ~/
cd ~/opencv-3.2.0
mkdir release
cd release
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
cmake -DWITH_LIBV4L=ON ..
sudo make
sudo make install
3、安装puthon-opencv
sudo apt-get install python-opencv
4、 anaconda 下安装opencv
conda install -c https://conda.binstar.org/menpo opencv3
注:如果需要打开视频文件,则需要将opencv3.2.0 /release/lib
下的cv2.so拷贝到anaconda2/lib/python2.7/site-packages.