Visual Studio configures OpenCV C++ version

OpenCV+Visual Studio 2022 C++ learning route

1. VS configuration

1. OpenCV download

2. Installation

Insert image description here

  1. I unzipped it to the D drive, you can do whatever you want
  2. Add environment variables:Insert image description here

2. Create a project

  1. Create a new c++ console projectInsert image description here

  2. Create projectInsert image description here

  3. Configure project package directoryInsert image description here
    Insert image description here
    Insert image description here
    Insert image description here

  4. In the same way, configure the library directory yourselfInsert image description here

  5. Configure the linker and enter it directly ( opencv_world412d.lib )Insert image description here

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
Insert image description here

Guess you like

Origin blog.csdn.net/qq_55542491/article/details/124261113