编译opencv cuda环境时的cmake指令及依赖数据下载vgg、ippicv、wechat_qrcode等

nvidia-docker下安装编译opencv cuda,python调用

根据这个方式走 https://blog.csdn.net/qq_44523137/article/details/124098406

cmake时 遇到缺少什么包,就安装什么包。-D后面如果有空格报错没有CMakexxxlist.txt可以把-D后面的空格去掉,cmake后面得有两个点…

-DCUDA_nppi_LIBRARY=stdc++

如果遇到CUDA_nppi_LIBRARY(AVERAGE)报错,按照这个方法
https://blog.csdn.net/dawn_chen121/article/details/82828629

https://blog.csdn.net/u014613745/article/details/78310916
然后重新编译就好

对于编译中下载依赖数据失败的问题,可以在这里找到,解压放在opencv目录下的.cache文件夹中。
链接: https://pan.baidu.com/s/1XnxUNJPk2T0dtHl1ZItGtg?pwd=1rr6 提取码: 1rr6

注意修改opencv安装路径、gcc路径、opencv_contrib路径、python路径、pythonxx.m路径、numpy路径、cuda路径、cudnn路径、cudnn版本、显卡算力。

-DCMAKE_INSTALL_PREFIX=/usr/local/opencv \
-DCMAKE_C_COMPILER=/usr/local/bin/gcc \
-DCUDA_ARCH_BIN=6.1  \
-DOPENCV_EXTRA_MODULES_PATH=/home/software/opencv4.5/opencv_contrib-4.5.5/modules \
-DPYTHON3_EXECUTABLE=/home/opt/out/bin/python3.6 \
-DPYTHON3_INCLUDE_DIR=/home/opt/out/include/python3.6m \
-DPYTHON3_NUMPY_INCLUDE_DIRS=/home/opt/out/lib/python3.6/site-packages/numpy/core/include  \
-DPYTHON3_PACKAGES_PATH=/home/opt/out/lib/python3.6/site-packages \
-DPYTHON_DEFAULT_EXECUTABLE=/home/opt/out/bin/python3.6 \
-DCUDNN_INCLUDE_DIR=/usr/local/cuda/include \
-DCUDA_CUDA_LIBRARY=/usr/local/cuda/lib64/stubs/libcuda.so \
-DOPENCV_PYTHON3_INSTALL_PATH=/home/opt/out/lib/python3.6/site-packages \
-DCUDNN_VERSION='7.6.3' 

cmake

cmake .. -DCMAKE_BUILD_TYPE=RELEASE \
-DCMAKE_INSTALL_PREFIX=/usr/local/opencv \
-DCMAKE_C_COMPILER=/usr/local/bin/gcc \
-DINSTALL_PYTHON_EXAMPLES=ON \
-DINSTALL_C_EXAMPLES=ON \
-DOPENCV_ENABLE_NONFREE=ON \
-DBUILD_opencv_python3=ON \
-DWITH_CUDA=ON \
-DWITH_CUDNN=ON \
-DWITH_TBB=ON \
-DOPENCV_DNN_CUDA=OFF \
-DENABLE_FAST_MATH=1 \
-DCUDA_FAST_MATH=1 \
-DCUDA_ARCH_BIN=6.1 \
-DWITH_CUBLAS=1 \
-DOPENCV_GENERATE_PKGCONFIG=ON \
-DOPENCV_EXTRA_MODULES_PATH=/home/software/opencv4.5/opencv_contrib-4.5.5/modules \
-DPYTHON3_EXECUTABLE=/home/opt/out/bin/python3.6 \
-DPYTHON3_INCLUDE_DIR=/home/opt/out/include/python3.6m \
-DPYTHON3_NUMPY_INCLUDE_DIRS=/home/opt/out/lib/python3.6/site-packages/numpy/core/include  \
-DPYTHON3_PACKAGES_PATH=/home/opt/out/lib/python3.6/site-packages \
-DPYTHON_DEFAULT_EXECUTABLE=/home/opt/out/bin/python3.6 \
-DCUDNN_INCLUDE_DIR=/usr/local/cuda/include \
-DCUDA_CUDA_LIBRARY=/usr/local/cuda/lib64/stubs/libcuda.so \
-DOPENCV_PYTHON3_INSTALL_PATH=/home/opt/out/lib/python3.6/site-packages \
-DWITH_WEBP=OFF \
-DWITH_OPENCL=OFF \
-DETHASHLCL=OFF \
-DENABLE_CXX11=ON \
-DBUILD_EXAMPLES=OFF \
-DOPENCV_ENABLE_NONFREE=ON \
-DWITH_OPENGL=ON \
-DWITH_GSTREAMER=ON \
-DWITH_V4L=ON \
-DWITH_QT=OFF \
-DBUILD_opencv_python3=ON \
-DBUILD_opencv_python2=OFF \
-DHAVE_opencv_python3=ON \
-DCUDNN_VERSION='7.6.3' \
-DBUILD_PERF_TESTS=OFF  \
-DBUILD_TESTS=OFF \
-DCUDA_nppi_LIBRARY=stdc++

你可能感兴趣的:(Linux,图像处理)