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.- Download CMAKE, I am using this version in the example.
2. Install Visual studio 2017 Community, with C++ and C support, maybe also cross platform C++ and C. This is lots of space around 20 gigs per installation. Who knows what is inside. :)
Download Opencv from github
I have created opencv32 folder in c:/.
https://github.com/opencv/opencv_contrib/releases
To this folder i extract from following links the source code Opencv 3.2.0 and opencv_contrib-3.2.0
just unzip here.
Create here one blank folder opencv21build
https://github.com/opencv/opencv/releaseshttps://github.com/opencv/opencv_contrib/releases
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.
Build and Install opencv
Open from Visual studio 2017 generated opencv.sln file inside opencv32build.
Visual studio just ask you if you want to upgrade toolchain to Visual studio 2017. Cmake just generate 2015 but visual studio upgrade this anyway,
In solution menu you just see all you want to build like on picture.
You can see my release build 114 modules and 0 fails. It should works. And works.
Your installation isn under opencv32build/install
In solution menu you just see all you want to build like on picture.
- FIRST just select DEBUG, x64 version like on picture, click right mouse on Entire solution and hit BUILD solution like on picture.

- Second you need to switch from DEBUG to RELEASE and build the solution again. This build also cmake target install, (you can see this under install) where is your installation located.
You can see my release build 114 modules and 0 fails. It should works. And works.
Your installation isn under opencv32build/install
This is your own build of opencv with specification to HW and software for any new release of Visual Studio. This is 2017.
NOW use same setting like to install Visual studio project as usual. Headers and libs you have build.












