One download vs2019
链接:Downloads - Visual Studio Subscriptions Portal
Download the community version, because it is free, everyone can use it casually
After the download is successful, install it directly.
After some environments are installed, there may be no Microsoft.Cpp.x64 file in the property manager
Download the Microsoft.Cpp.x64 file from the link below (link reprinted (227 messages) to solve the problem that there is no Microsoft.Cpp.x64 in the vs2019 property manager. user_vs2019 property manager has nothing in it_WangSaLe's blog-CSDN blog )
Link: https://pan.baidu.com/s/1C7yeKPpS-dMifS6UOP0HEg Extraction code: xjfj
After downloading, you will get a MSBuild folder, put this folder in the c drive user\AppData\Local\Microsoft\ path
Then reopen the vs2019 IDE and you will find the file Microsoft.Cpp.x64
Two download cmake
Link: Download | CMake
Three download opencv
Link: Releases - OpenCV
Four download opencv_contrib-5.5.5
Link: https://github.com/opencv/opencv_contrib
Five open cmake
Then configure the source code path and the compiled storage path
configure configuration
Select vs2019 and select x64
Click finish for the first compilation
After compiling, many errors will be displayed, don’t be afraid, configure as follows
Tick BUILD_opencv_world, tick OPENCV_ENABLE_NONFREE, then find OPENCV_EXTRA_MODULES_PATH, and set the modules folder in opencv_contrib -4.3.0 that was decompressed earlier , as shown in the figure below
Continue to click Configure until no red appears
Then click generate to generate the project
Six use VS2019 to open the compiled project
Go to the compilation directory to find the OpenCV.sin file and open it with vs2019
Select debug x64 and right-click opencv_world and click Properties
Open the opencv_world property page and configure as follows
Configured to No in Enable Incremental Links
Click OK, right-click INSTALL in CMake Targets and select Regenerate, and wait for the generated result. The release version needs to be generated once according to the above operations.
Seven configuration environment
Add the compiled path to the computer system environment variable
Eight create a project, test opencv
Right click in the property manager and select Microsoft.Cpp.x64.user
Select the include directory in the VC++ directory and select Edit
Open the containing directory and click Edit
Add compiled path
Select library directory
add library path
add dependencies
To enter dependencies according to your own opencv version
At this point, the system configuration is complete, and the next step is to do a test
#include <iostream>
#include <opencv2/opencv.hpp>
int main()
{ cv::Mat src = cv::imread("E:\\image1\\0.jpg");//image path cv::imshow("show", src); cv::waitKey (0); }
good luck ^_^