美文网首页
opencv linux安装与编译

opencv linux安装与编译

作者: RobertY | 来源:发表于2017-07-29 15:12 被阅读1101次

    搭建编译环境,并安装相关关联库

    [compiler] sudo apt-get install build-essential
    [required] sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
    [optional] sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
    

    下载opencv并且编译

    git clone https://github.com/opencv/opencv.git
    cd opencv
    mkdir release
    cd release
    cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
    sudo make
    sudo make install
    sudo /bin/bash -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf'  
    sudo ldconfig
    

    测试安装

    切换到samples目录下面,并编译samples程序

    cd ../samples/  
    sudo cmake .  
    sudo make -j $(nproc)
    

    然后切换到cpp目录下运行测试程序

    cd cpp/  
    ./cpp-example-facedetect XX (图片路径)
    

    显示图像,测试成功

    相关文章

      网友评论

          本文标题:opencv linux安装与编译

          本文链接:https://www.haomeiwen.com/subject/sscclxtx.html