Build install Opencv with Contrib, Visual studio 2017

Easy install and build of Opencv 3+ tested on 3.2 version with contributor library and additional features described step by step, picture by picture. After this tutorial you can modify setting of CMAKE project according to HW possibilities and available libraries to build your own Opencv library. Most of the time, Prebuild libs with already generated DLL, LIBS are used to start project and coding. In case, that new visual studio 2017 is available there is no prebuild libraries for VS141, Thich is from my point of view confusing naming of Libraries compatible with Visual Studio 2017.

Opencv VS 2017 install options

Alternatives to this tutorial. You can skip this.

There is possibility use some compatibility pack downloaded to VS140 and use same prebuild library as in case of Visual Studio 2015 this is described here

The second way is to try use some prebuild NUGET package. I am using nugets a lot. Simple installation under one line of code inside nuget packages console. here

Opencv Install and Build in Visual studio 2017 prerequisites

Do not afraid. There is lots of tricky parts for sure. You can miss some prerequisites for sure. You can fail many times. My last compilation has one error to link Python. I do not care. Library, I need are fine.

Configure CMAKE OPENCV project

Cmake configure project for Visual studio 2017 and checking what is available to be build with your own opencv libraries, ffmpeg, opencv, cuda and others.

Add path to opencv-3.2.0, where is the base opencv source code and to the empty folder created by you called build.

Now you need to specify path to Visual studio 2017 compiler for C and C++. Mine are on the picture.

You can several times hit configure. Until you have some list of possible settings like on image below. Use different settings and configuration options. Just pick up solution you want. FFMPEG, OPENCL support and generate OPENCV.SLN file inside yout opencv32 build folder.

Do not choose averythink but cmake check and configure also only what is possible..

Opencv Extra Modules contrib libraries

This is great source of modern algorithm to use. CNN, advanced tracking and detection like waldboost. Just in your cmake fill OPENCV_EXTRA_MODULES_PATH and put here path, where you extract zip from contributor git repository. HIT in cmake generate and yout Opencv.SLN file is upgraded.

getting errorCMake Deprecation Warning at CMakeLists.txt:81 (cmake_policy): The OLD behavior for policy CMP0020 will be removed from a future version of CMake.

The cmake-policies(7) manual explains that the OLD behaviors of all policies are deprecated and that a policy should be set to OLD only under specific short-term circumstances. Projects should be ported to the NEW behavior and not rely on setting a policy to OLD.

CMake Deprecation Warning at CMakeLists.txt:85 (cmake_policy): The OLD behavior for policy CMP0022 will be removed from a future version of CMake.

The cmake-policies(7) manual explains that the OLD behaviors of all policies are deprecated and that a policy should be set to OLD only under specific short-term circumstances. Projects should be ported to the NEW behavior and not rely on setting a policy to OLD.

CMake Deprecation Warning at CMakeLists.txt:94 (cmake_policy): The OLD behavior for policy CMP0026 will be removed from a future version of CMake.

The cmake-policies(7) manual explains that the OLD behaviors of all policies are deprecated and that a policy should be set to OLD only under specific short-term circumstances. Projects should be ported to the NEW behavior and not rely on setting a policy to OLD.

CMake Error at CMakeLists.txt:127 (project): Failed to run MSBuild command:

C:\Users\sam_o\Documents\opencv-3.3.0\build\CMakeFiles\3.9.4\VCTargetsPath.vcxproj(15,2): error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.

C:\Users\sam_o\Documents\opencv-3.3.0\build\CMakeFiles\3.9.4\VCTargetsPath.vcxproj(15,2): error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.