How To Create A Setup File In Visual Studio 2019
OpenCV is the Real-Time Computer Vision library which provides various real-time computer vision, video capturing, image processing, and machine learning functionalities. Using OpenCV with Visual Studio you can build robust applications for object detection, image transformation, video capturing, and analysis with fast C++ computations. Follow the given steps and instructions for your OpenCV C++ Windows Setup:
OpenCV Download and Installation:
Follow the below steps to download and install OpenCV on your local machine:
Want to learn from the best curated videos and practice problems, check out the C++ Foundation Course for Basic to Advanced C++ and C++ STL Course for foundation plus STL. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course .
Step 1: Go to https://opencv.org/releases/ and under the latest version (4.5.0) select the windows button. You will be directed to another link and the setup file will be downloaded.
Step 2: Open the downloaded file. A self-extracting zip will open. Before proceeding with installation go and create a folder named OpenCV inside your C:\ drive. Run the installer and extract the zip file to the created folder C:\opencv
Step 3: Now that you have successfully installed OpenCV. The next step is to add binaries to the system path. Open a command prompt with admin privileges and write the command:setx -m OPENCV_DIR C:\opencv\build\x64\vc15 This will add OPENCV_dir as a system variable.
Step 4: Open Environment Variables Settings. Go to Path and add %OPENCV_DIR%\bin
OpenCV Setup is done here. The next step is to go ahead with the Visual Studio Project Configurations.
Visual Studio Project Configuration:
Step 1: Start a new Visual Studio project, and choose the C++ Console App template.
Step 2: After the Project has been created change the Debug to x64 platforms since we are using the x64 version at C:\opencv\build\x64\vc15
Step 3: Inside the Project, tab Open the Properties.
Step 4: Inside Configuration properties select VC++ Directories. The next step is to edit the included directories and library directories to add the OpenCV include directories and library directories. First Select Include Directories then Click on edit. A new window Pops up. Click on Add a new line which is a yellow colored button and enter the path for OpenCV include directoriesC:\opencv\build\include
Similarly for Library Directories Select Library directories and repeat the above steps. The only change will be the Library Directories path for OpenCV directories i.e. C:\opencv\build\x64\vc15\lib
After this is done go to Linker/Input inside the Project Properties and edit the Additional Dependencies to include the OpenCV DLL opencv_world450d.lib inside our linker.
Apply all the changes made and close the properties. Your OpenCV setup is done. Now you are ready to build amazing apps using OpenCV in C++. You have to repeat all these property changes every time you start a new OpenCV project with Visual Studio 2019.
Try this demo code to check your installation works properly.
C++
#include <opencv2/opencv.hpp>
#include <iostream>
using
namespace
cv;
using
namespace
std;
int
main(
int
argc,
char
** argv)
{
Mat image = imread(
"Image Address Here "
);
if
(image.empty())
{
cout <<
"Image Not Found!!!"
<< endl;
cin.get();
return
-1;
}
imshow(
"Image Window Name here"
, image);
waitKey(0);
return
0;
}
How To Create A Setup File In Visual Studio 2019
Source: https://www.geeksforgeeks.org/opencv-c-windows-setup-using-visual-studio-2019/
Posted by: mclaughlinfragend.blogspot.com
0 Response to "How To Create A Setup File In Visual Studio 2019"
Post a Comment