I want to use OpenCV in Visual Studio 2017 to do c++ program.
To do it, I followed Setting Up OpenCV in Visual Studio video. In that, he said vc14 should be set as environmental variables for VS2015. There is no vc16 for VS2017. So how do I do it for VS2017? And are there any other video instruction changes to be made if I am to use VS2017?
Since the Doc from official OpenCV tutorial is outdated, I will suggest:
get VS-2017 with full compiler like:
get the newest CMake (uninstall older versions)
get from github the sourceCode here and here and place those in C:/openCV folder, create a BUILD folder there too
open Cmake, select the opencv master folder... in the build write the build directory like:
6.1 now you should see cmake doing its job :)
once configuration is done set the opencv extra modules path and click configure again, and when is done click generate! :)
when generation is done click "open project", this will open a huge project in visual studio named "opencv", now you can close cmake, we dont need that anymore.
now, when the solution is ready, be sure you are in "debug" conf and do right click on "ALL_BUILD" and then "build" (that can take a while) once build succeed change to "release" config and do right click on "ALL_BUILD" and then "build" again.
now,be sure you are in "debug" conf and do right click on "INSTALL" and then "build" (that can take a while) once build succeed change to "release" config and do right click on "INSTALL" and then "build" again.
Additonal tip to the accepted answer - if you get an error like this:
Invalid escape sequence \ o
when you copy and paste the filesystem paths, make sure you use forward slash ( / ) instead of backward slash, so
C:\openCV\opencv_contrib-3.2.0\modules
Must be
C:/openCV/opencv_contrib-3.2.0/modules
Instead. Otherwise, you will get errors that escape sequence \o
does not exist.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With