OpenCV is an interesting library aimed to computer vision.
But before playing with it, it's necessary to set up your IDE.
This IDE will be Visual Studio for this tutorial.
So let's get started.
Let's start by downloading the OpenCV library from the official GitHub.
For this tutorial we'll use the 4.5.3 version:
For the latest version, it should be there:
Take the following file for our tutorial:
Run it and extract all files within in a folder as for example:
We'll use the Visual Studio 2019 version for this tutorial.
So the compiler will be version vc15.
If you had Visual Studio 20217 then the compiler version would have been vc14.
Open your Visual Studio and create a C++ console project.
Once done, right click your project directly from Visual Studio then select Properties.
Add the following settings :
This latter file can be found there:
Then you have to specify where you can find the .DLL file, such as:
Note the "d" letter at the end of the file name.
This "d" means debug.
This is because we are going to program our software in the Debug mode.
For the Release one (not with the "d" letter), take the other file, such as:
If your program generated (.EXE) doesn't know where is this .DLL, then you'll have an error like this:
The code execution cannot proceed because opencv_world452.dll was not found. Reinstalling the program may fix this problem.
So in order to prevent this kind of error, we'll to set our Environment variables.
Create a new variable then specify the following path:
The both .DLLs can indeed be found there.
Don't forget now to add this variable to your PATH.
Then close your Visual Studio (if it is already opened) because the Environment variables aren't updated automatically in Visual Studio.
Open it again and you are now ready to code your first OpenCV program.
A bit annoying as always for setting up your Visual Studio.
But once done, you won't have to modify it in the future.
So great job.
Comments
Chris (not verified)
Sunday, January 8, 2023 - 6:20am
Permalink
vc14 is Visual Studio 2015
vc14 is Visual Studio 2015
vc15 is Visual Studio 2017
Mi-K
Thursday, January 19, 2023 - 2:54pm
Permalink
Thank you Chris, you are
Thank you Chris, you are right
We also add that vc16 is for VS2019.
Nevertheless, it's possible to use a version of Visual Studio with an older vc version.
Add new comment