美文网首页
Opencv3.2 ubuntu20.04安装过程

Opencv3.2 ubuntu20.04安装过程

作者: 可不期诺Cappuccino | 来源:发表于2021-09-27 16:08 被阅读0次

    1、更新源

    sudo add-apt-repository "deb http://security.ubuntu.com/ubuntu xenial-security main"
    sudo apt update
    

    2、安装依赖库

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

    3.FFMPEG 编译报错

    在 opencv-3.1.0/modules/videoio/src/cap_ffmpeg_impl.hpp 里最顶端添加:

    #define AV_CODEC_FLAG_GLOBAL_HEADER (1 << 22)
    #define CODEC_FLAG_GLOBAL_HEADER AV_CODEC_FLAG_GLOBAL_HEADER
    #define AVFMT_RAWPICTURE 0x0020
    

    4. const char* 转char*报错

    在 opencv-3.1.0/modules/python/src2/cv2.cpp 730行改为
    char* str = (char*)PyString_AsString(obj);

    mkdir build
    cd build
    cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..
    sudo make -j4
    sudo make install
    

    相关文章

      网友评论

          本文标题:Opencv3.2 ubuntu20.04安装过程

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