OpenCV+Visual Studio 2022 C++ learning route
1. VS configuration
1. OpenCV download
- GitHUb download: https://github.com/opencv/opencv/releases
It is recommended to download 4.1.2, which is currently more commonly used. The direct download address is attached ( https://github.com/opencv/opencv/releases/tag/4.5.5 )
! ! ! I’ve written this far, why haven’t I downloaded it yet, ah ah ah,
so I uploaded it to Alibaba Cloud Disk, there is no speed limit, it’s great ( https://www.aliyundrive.com/s/WWtsUR2TQgX )
2. Installation
- I unzipped it to the D drive, you can do whatever you
want - Add environment variables:
2. Create a project
-
Create a new c++ console project
-
Create project
-
Configure project package directory
-
In the same way, configure the library directory yourself
-
Configure the linker and enter it directly ( opencv_world412d.lib )
run
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc.hpp>
#include <iostream>
using namespace cv;
using namespace std;
int main()
{
Mat image = Mat::zeros(300,300, CV_8UC3);
circle(image, Point(150, 150), 100, Scalar(0, 255, 0), -100);
circle(image, Point(150, 150), 50, Scalar(0, 0, 255), -100);
imshow("circle", image);
waitKey(0);
return 0;
}
running result