Install visual studio2022 and configure opencv

Table of contents

1Download visual studio

1.1 Enter the website and click to download visual studio, select Community 2022

1.2 Open the installation package and enter the interface

1.3 Wait for the installation to complete 

2 download opencv

2.2 Customize the decompression path after the download is complete

3.3 win10 system configuration environment variables

3 configure visual studio

3.1 Open the software

3.2 Configuration

4 tests


1Download visual studio

Visual Studio: IDE and Code Editor for Software Developers and Teams (microsoft.com)

1.1 Enter the website and click to download visual studio, select Community 2022

Go to the page under automatic download

1.2 Open the installation package and enter the interface

Click continue and wait a while

 

 Enter the following interface, check (Desktop development using C++) and (Universal Windows platform development), these two are necessary, others can be added later, default C drive installation.

1.3 Wait for the installation to complete 

2 download opencv

Releases - OpenCV

2.1 Enter the website to select the version and system (I chose win10, opencv-4.5.5), and it will be downloaded automatically after selection. The speed is a bit slow, but you can go to CSDN to directly search for the opencv installation package resources organized by the big guys.

2.2 Customize the decompression path after the download is complete

3.3 win10 system configuration environment variables

 Click Start to enter the settings, click System and then click About to enter the following interface

Select Advanced System Settings, click Environment Variables

 Double-click Path to enter the following interface

 

 Click New to copy the bin file path in the opencv package

 

It is recommended to add the opencv\build\x64\vc14\bin path in the opencv package, and then click OK to complete

3 configure visual studio

3.1 Open the software

Click to create a new project, select [c++ console application], and click Next

 

 Customize the project name and storage location, and the creation is complete.

 

3.2 Configuration

Click the item at the top of the interface to enter the properties

 Find the VC++ directory, find the include directory, and click the down triangle button after the include directory to enter editing.

 

 First click on the new line to add the include file path

Then find the library directory of VC++, repeat the above adding process, add the path of the lib file, opencv\build\x64\vc15\lib

 Finally, find the input of the linker, click Additional Dependencies, add opencv_world455d.lib to it, and click OK

 

 

 Installing visual studio2022 and configuring opencv is complete. [It is recommended to restart visual studio2022 once]

4 tests

#include<opencv2/core/core.hpp>
#include<opencv2/highgui/highgui.hpp>
#include<opencv2/imgproc.hpp>
#include<iostream>
using namespace cv;
using namespace std;

int main() {
	Mat image = Mat::zeros(400, 800, CV_8UC3);
	circle(image, Point(500, 200), 100, Scalar(0, 255, 120), -100);
	circle(image, Point(400, 200), 100, Scalar(255, 255, 255), -100);
	imshow("show window", image);
	waitKey(0);
	return 0;
}

Guess you like

Origin blog.csdn.net/RZ_w99/article/details/129936828