编译支持GPU的python3的OpenCV库

参考资料

https://www.pyimagesearch.com/2016/07/11/compiling-opencv-with-cuda-support/

 

关键步骤记录

1.ippicv_2019_lnx_intel64_general_20180723.tgz下载地址:

https://raw.githubusercontent.com/opencv/opencv_3rdparty/32e315a5b106a7b89dbed51c28f8120a48b368b4/ippicv/ippicv_2019_lnx_intel64_general_20180723.tgz

2.face_landmark_model.dat下载地址:

https://raw.githubusercontent.com/opencv/opencv_3rdparty/8afa57abc8229d611c4937165d20e2a2d9fc5a12/face_landmark_model.dat

3.ffmpeg配置命令:

./configure --disable-asm --disable-x86asm --enable-cuda --enable-cuvid --enable-nvenc --enable-nonfree --enable-shared --enable-pic --extra-cflags="-fPIC" --extra-cflags="-I/usr/local/cuda/include/" --extra-ldflags=-L/usr/local/cuda/lib64 --enable-libnpp --prefix=/usr/local/ffmpeg

4.OpenCV配置命令:

../../cmake-3.14.2-Linux-x86_64/bin/cmake -DPYTHON_DEFAULT_EXECUTABLE=$(which python3) -DPYTHON3_INCLUDE_DIR=$(python -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") -DPYTHON3_LIBRARY=$(python -c "import distutils.sysconfig as sysconfig; print(sysconfig.get_config_var('LIBDIR'))") -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_CUDA=ON -D ENABLE_FAST_MATH=1 -D CUDA_FAST_MATH=1 -D WITH_CUBLAS=1 -D INSTALL_PYTHON_EXAMPLES=ON -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-4.1.0/modules -D BUILD_EXAMPLES=ON -D CMAKE_SHARED_LINKER_FLAGS=-Wl,-Bsymbolic ..

你可能感兴趣的:(python)