Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

CMake is not for compiling OpenCV, it's just a configuration utility. It generates the project files (SLN for Visual Studio or Makefile for make/gcc) according to your needs (you can select the modules you need), the installed libraries (e.g. video codecs) and the available hardware in your machine (e.g. CUDA support).

The compilation is handled by the Visual Studio compiler called cl.

Unfortunately I agree that external libraries in Visual Studio and compiling big projects is a real PITA.

Downloading the OpenCV library for windows from the site will give you a library that's ready to be employed. Just make sure that the include folders and the library (opencv_worldXXX.lib) are added to your Visual Studio project, and the OpenCV DLL file (opencv_worldXXX.dll) is accessible by the executable. This is valid for OpenCV library, no matter if you built it yourself or downloaded it.

Using the Python library (with pip install...) will get you a precompiled library too.

If you need to customize OpenCV, then you have to recompile it. Normally you won't get errors while compiling, so you don't need to debug. The errors might be caused by missing dependencies, so be sure that you follow every step of the tutorial.