• opencv 编译


    0. 准备

    安装cuda,cudnn;

    修改github clone代理

    zjr@zjr:~/disk/prjs/data/src/mdw/middleware_hal_camera/3rd/x86/opencv/build$ cat ~/.gitconfig 
    [url "https://ghproxy.com/https://github.com"]
        insteadOf = https://github.com

    1. 下载

    git clone https://ghproxy.com/https://github.com/opencv/opencv.git
    cd opencv && git checkout 4.5.5 -b b_4.5.5

    2. IPPICV ade github下载失败的问题,可添加github代理

    diff --git a/3rdparty/ippicv/ippicv.cmake b/3rdparty/ippicv/ippicv.cmake
    index 257af6fcc6..aeb2db6dae 100644
    --- a/3rdparty/ippicv/ippicv.cmake
    +++ b/3rdparty/ippicv/ippicv.cmake
    @@ -39,7 +39,7 @@ function(download_ippicv root_var)
                    URL
                      "${OPENCV_IPPICV_URL}"
                      "$ENV{OPENCV_IPPICV_URL}"
    -                 "https://raw.githubusercontent.com/opencv/opencv_3rdparty/${IPPICV_COMMIT}/ippicv/"
    +                 "https://ghproxy.com/https://raw.githubusercontent.com/opencv/opencv_3rdparty/${IPPICV_COMMIT}/ippicv/"
                    DESTINATION_DIR "${THE_ROOT}"
                    ID IPPICV
                    STATUS res
    diff --git a/modules/gapi/cmake/DownloadADE.cmake b/modules/gapi/cmake/DownloadADE.cmake
    index aa24e949ea..56aabfd119 100644
    --- a/modules/gapi/cmake/DownloadADE.cmake
    +++ b/modules/gapi/cmake/DownloadADE.cmake
    @@ -7,7 +7,7 @@ ocv_download(FILENAME ${ade_filename}
                  URL
                    "${OPENCV_ADE_URL}"
                    "$ENV{OPENCV_ADE_URL}"
    -               "https://github.com/opencv/ade/archive/"
    +               "https://ghproxy.com/https://github.com/opencv/ade/archive/"
                  DESTINATION_DIR ${ade_src_dir}
                  ID ADE
                  STATUS res

    3. opencv_cudev报错

    CMake Error at modules/core/CMakeLists.txt:55 (message):
      CUDA: OpenCV requires enabled 'cudev' module from 'opencv_contrib'
      repository: https://github.com/opencv/opencv_contrib

    手动clone,参考opencv_contrib的README,添加cmake flag: -DOPENCV_EXTRA_MODULES_PATH

    cmake -DWITH_CUDA=1 -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules ..

     4. 编译

    mkdir build && cd build && cmake -DWITH_CUDA=1 -DWITH_CUDNN=1 -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules ..
  • 相关阅读:
    SpringCloud简介及使用
    容器云技术选择之kubernetes和swarm对比
    LXC简单介绍与使用
    go recover让崩溃的程序继续执行
    dbeaver可视化工具-连接clickhouse
    JavaScript异步与Promise基本用法(resolve与reject)
    通过mysql操作clickhouse
    clickhouse客户端使用
    clickhouse安装数据导入及查询测试
    spring boot druid数据源
  • 原文地址:https://www.cnblogs.com/zengjianrong/p/16338474.html
Copyright © 2020-2023  润新知