网站首页Python相关

Centos7安装opencv3

发布时间:2017-02-23编辑:fc不将就阅读(1726

    安装依赖:

    cmake>=3
    $cd /var/local
    $wget http://www.cmake.org/files/v3.1/cmake-3.1.3.tar.gz
    $tar -zxvf cmake-3.1.3.tar.gz
    $cd cmake-3.1.3/
    $ ./configure 
    $make && make install
    $cmake --version
    cmake version 3.1.3
    gcc>=4.5    
    $yum install Git gtk2-devel pkgconfig numpy python python-pip python-devel gstreamer-plugins-base-devel libv4l ffmpeg-devel
    $yum install -y gcc gcc-c++ gtk+-devel libjpeg-devel libtiff-devel jasper-devel libpng-devel zlib-devel
    $yum install mplayer mencoder flvtool2 gtk* libgphoto2-devel

     安装opencv3:

    $git clone  https://github.com/opencv/opencv.git
    $cd opencv
    $git checkout -b 3.2.0 myopencv
    $mkdir build
    $cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=./build  -D  WITH_IPP=OFF .
    $make
    $make install

    然后把cv2.so软连接到python的包目录下

    $ln -s lib/cv2.so /usr/lib64/python2.7/cv2.so

    验证

    $python
    >>> import cv2
    >>> cv2.__version__
    '3.2.0-dev'