Opencv3安装所需要的库

Opencv3环境配置

一、安装依赖库

1、移除本地的通过apt-get安装的opencv:

sudo apt-get autoremove libopencv-dev python-opencv

2、安装编译工具:

sudo apt-get install cmake build-essential

3、安装gtk:

 sudo apt-get install libgtk2.0-dev libgtkglext1-dev

4、gui:

 sudo apt-get install libqt4-dev libpangox-1.0-dev libxmu-dev libxmu-headers

5、安装视频相关media I/O:

  安装是有的库可能是比较老的,请按住系统报的错误,更改为最新的。

 sudo apt-get install zlib1g-dev libjpeg-dev libpng12-dev libtiff4-dev libjasper-dev libgphoto2-2-dev
sudo apt-get install libdc1394-22 libdc1394-22-dev libavcodec-dev libavformat-dev libavresample-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-good1.0-dev libswscale-dev libtheora-dev libvorbis-dev libxvidcore-dev libx264-dev libopencore-amrnb-dev libopencore-amrwb-dev libv4l-dev v4l-utils libxine2-dev libmp3lame-dev libfaac-dev yasm

6、linear algebra

 sudo apt-get install libeigen3-dev

7、parallel computation

sudo apt-get install libtbb-dev ocl-icd-opencl-dev opencl-headers

8、python相关

sudo apt-get install python-dev python-numpy python3-dev python3-numpy

配置

  在编译的时候,关于cmake的配置,可以参考下面的的代码,并根据自己的需要增减模块:

cd /opt/
sudo mkdir opencv
cd /opencv/extracted/path
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/opt/opencv/ \
    -DBUILD_DOCS=ON -DBUILD_EXAMPLES=ON -DWITH_QT=ON -DWITH_OPENGL=ON -DWITH_TBB=ON -DWITH_XINE=ON \
    -DPYTHON2_INCLUDE_DIR=$(python -c "from distutils.sysconfig import get_python_inc; \
                print(get_python_inc())") \
    -DPYTHON2_INCLUDE_DIRS=$(python -c "from distutils.sysconfig import get_python_inc; \
                print(get_python_inc())") \
    -DPYTHON2_EXECUTABLE=$(which python) \
    -DPYTHON2_PACKAGES_PATH=$(python -c "from distutils.sysconfig import get_python_lib; \
                print(get_python_lib())") \
    -DPYTHON3_INCLUDE_DIR=$(python3 -c "from distutils.sysconfig import get_python_inc; \
                print(get_python_inc())") \
    -DPYTHON3_INCLUDE_DIRS=$(python3 -c "from distutils.sysconfig import get_python_inc; \
                print(get_python_inc())") \
    -DPYTHON3_EXECUTABLE=$(which python3) \
    -DPYTHON3_PACKAGES_PATH=$(python3 -c "from distutils.sysconfig import get_python_lib; \
                print(get_python_lib())") \
    -DPYTHON3_NUMPY_INCLUDE_DIRS=/usr/lib/python3/dist-packages/numpy/core/include/ ..
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值