Should I install OpenCV from source in Windows?

I have a windows 10 machine that has a NVIDIA GPU. I have installed the drivers and the cuda toolkit.

So far I have never used OpenCV on a windows environment.

I would like to use OpenCV with CUDA in this PC.
My question is do I have to build OpenCV from source with cmake with CUDA activated (as is usual in Ubuntu)? If yes, where I can find a tutorial on this ?

or is there any other way to prepare the environment for my machine?

Here you will find the latest stable documentation for installing opencv. There are several options to install it. Either by CMake or by sources, as you wish

EDIT : If you choose to build with CMake GUI, you have a checklist with the options you used in the command line on Linux.

there are official binary releases but they don’t contain CUDA. all the CUDA modules are in the contrib repository. the official binary releases don’t contain contrib.

that means you also want to clone the contrib repo, and you want to tell cmake about the OPENCV_EXTRA_MODULES_PATH. you see that in the tutorial linked in the previous post.

besides, CUDA is very particular about the version it’s built with, and the version that’s installed on the system, and the hardware that is supported by that version. even if you could find builds that someone made… best to build yourself. it’s doable.

you will have to build.

those aren’t alternatives, there’s no either/or. sources are the stuff you build from. cmake is the thing that creates a VS solution for the sources, given some configuration. without sources, there’s nothing to build. without cmake, you won’t have any build instructions (VS solution).

1 Like