Compile OpenCV with Cuda is an easy task. All you need is the right HW from NVIDIA, drivers, and software. Additionally, the processed output video should be stream out from the OpenCV using the GStreamer. I am putting the GStreamer now as the standard option of my installation of OpenCV on the Windows machine. Let's go through step by step compilation of OpenCV from source, including Cuda, Gstreamer, and contribution modules. It is just a small increment to my previous tutorial that focuses just on the GStreamer setting in the Windows CMAKE project. This is a simplified version, verified on a different machine than the previous tutorials. You can found some details in this tutorial Install Opencv Gstreamer on windows step by step.
Software prerequisites
- Install cuda, This is my version of network installer cuda_11.0.2_win10_network
- Visual Studio 2019 community
- Cmake 3.17.4
- Opencv 4.4
- Opencv_contrib
Opencv Compilation in windows steps by step with GStreamer
Get and install GStreamer (optional step)
Opencv Cmake setting
- Set WITH_GSTREMER to yes
- Set WITH_FFMPEG to yes
- Set GStremer concrete lib location and header folder, The name of CMAKE Variables is equal to the concrete .lib file
- INCLUDE_DIR refers to a directory.
- HIT configure again
- Set WITH_CUDA to yes
- Optionally specify CUDA_TOOLKIT_ROOT_DIR (usually founded automatically)
- Specify opencv_cuda modules you want to build
- Hit configure
- Read the messages, if cmake is red and correct the settings. Not all your combination are posible for your HW and SW environment
Check OpenCV CMAKE configuration
HiT generate and open project in CMAKE and jump to Visual Studio
- Hit Generate in CMAKE
- Hit Open Project in CMAKE
Compile OpenCV, CUDA with GStreamer in Visual Studio
- Change setting of Visual Studio to Release, x64
- Right-click on Project ALL_BUILD -> hit build option
- This will take a lot of time since the CUDA is compiling
- IF you compile the project without errors (warnings are ok)
- Right-click on Project INSTALL -> hit build option
Comments
Post a Comment