Skip to content

glingi/OpenCV_build_with_CUDA_on_Win10_VS2017

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 

Repository files navigation

OpenCV_build_with_CUDA_on_Ubuntu_18.04

$ sudo apt-get install -y \
ffmpeg \
libgtk2.0-dev libgtk-3-dev \
libavcodec-dev libavformat-dev libavutil-dev libavdevice-dev libavresample-dev libswscale-dev \
gfortran libblas-dev liblapack-dev \
python3-dev python3-numpy python3-py python3-pytest \
qt5-default \
zlib1g-dev \
libgl1 \
libglvnd-dev \
pkg-config
  • Set CMake options
WITH_CUDA : ON
WITH_TBB : ON
WITH_FFMPEG : ON
WITE_EIGEN : ON

OPENCV_EXTRA_MODULES_PATH : <your_opencv_contrib_path>/modules
OPENCV_ENABLE_NONFREE : ON
OPENCV_GENERATE_PKGCONFIG : ON

EIGEN_INCLUDE_PATH : <your_eigen_path>

ENABLE_FAST_MATH : ON

BUILD_opencv_world : ON
BUILD_TEST : OFF
BUILD_PERF_TEST : OFF
BUILD_PACKAGE : OFF
BUILD_opencv_cudacodec : ON (NVIDIA VIDEO CODEC SDK is requried)

WITH_1394 : OFF

CUDA_ARCH_BIN : 6.1 (for GTX 1050 laptop / GTX 1080 Ti / MX150)
  • TBB options
TBB_DIR : <your_tbb_folder>/tbb/cmake
TBB_ENV_INCLUDE : <your_tbb_folder>/tbb/include/tbb
TBB_ENV_LIB : <your_tbb_folder>/tbb/lib/intel64/vc14/tbb.lib
TBB_ENV_LIB_DEBUG : <your_tbb_folder>/tbb/lib/intel64/vc14/tbb_debug.lib
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\include\cuda_runtime.h
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\include\cuda_runtime_api.h
c:\program files\nvidia gpu computing toolkit\cuda\v10.2\include\sm_20_intrinsics.h
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\include\cuda.h

Using CUDACODEC VIDEOREADER

OpenCV 4.x version basically does not support udacodec::VideoReader function. Additional steps are required to use cudacodec [1].

  1. Download NVIDIA VIDEO CODEC SDK : https://developer.nvidia.com/nvidia-video-codec-sdk

  2. After extracing zip file, copy all header files in <video_codec_sdk>/interface into both 1) /usr/local/cuda/include and 2) /usr/local/cuda-10.0/include

  3. Check the system architecture

$ uname -a
Linux username 5.3.0-62-generic #56~18.04.1-Ubuntu SMP Wed Jun 24 16:17:03 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
  1. Copy all library files in <video_codec_sdk>/Lib/linux/stubs/(architecture) into both 1) /usr/local/cuda/lib64 and 2) /usr/local/cuda-10.0/lib64

  2. In CMake, set WITH_NVCUVID = ON

  3. Build OpenCV

  4. Run source code : https://github.com/opencv/opencv/blob/master/samples/gpu/video_reader.cpp

Results:
CPU : Avg : 2.76995 ms FPS : 361.017 Frames 987
GPU : Avg : 0.312265 ms FPS : 3202.41 Frames 995

Refereces [1] https://jamesbowley.co.uk/accelerate-opencv-4-2-0-build-with-cuda-and-python-bindings/

stitching_detailed.cpp with CUDA

https://answers.opencv.org/question/95148/cudalegacy-not-compile-nppigraphcut-missing/

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published