CentOS OpenCV人脸识别环境搭建总结

1. 准备工作:
    yum update
    yum groupinstall "Development Tools"


2.安装OpenCV:
    yum install cmake python-devel numpy gcc gcc-c++ gtk2-devel libdc1394-devel libv4l-devel ffmpeg-devel gstreamer-plugins-base-devel libpng-devel libjpeg-turbo-devel jasper-devel openexr-devel libtiff-devel libwebp-devel opencv opencv-python opencv-devel    


3.查看gcc版本:
    g++ --version   ----> 如版本大等于4.8.2 可以跳过"步骤4",直接进行"步骤5"
    备注:如果不升级gcc,则无法安装dlib库


4.安装C++11(gcc4.8.2):
    4.1 执行如下命令:
        wget http://people.centos.org/tru/devtools-2/devtools-2.repo -O /etc/yum.repos.d/devtools-2.repo
        sudo yum install devtoolset-2-gcc devtoolset-2-binutils devtoolset-2-gcc-c++
        执行成功后,软件将会安装在/opt/rh下

    4.2 配置环境变量:
        vim /etc/profile
        export CC=/opt/rh/devtoolset-2/root/usr/bin/gcc  
        export CPP=/opt/rh/devtoolset-2/root/usr/bin/cpp
        export CXX=/opt/rh/devtoolset-2/root/usr/bin/c++
        执行成功后,再次查看gcc版本是否升级:g++ --version 

    4.3 将安装的目录软链接到local/bin
        ln -s /opt/rh/devtoolset-2/root/usr/bin/* /usr/local/bin/
        hash -r


5. 安装boost
    yum install boost boost-devel boost-doc 

    
6. 安装dlib
    pip install dlib


7. 验证dlib安装是否成功
    python>>import dlib
    如果有报错信息,尝试安装:yum install libXdmcp libXdmcp-devel


8. 安装face_recognition库
    pip install face_recognition
    

9. 安装OpenCV Python API库:cv2
    pip install opencv-python


备注:face-recognition要求dlib版本大于等于19.5

你可能感兴趣的:(环境搭建和工具使用,dlib,OpenCV,cv2)