VS2019+Opencv4.0+Win10配置 VS2019+Opencv4.0+Win10配置详解
kiripeng 人气:0一.下载OpenCV4.0的安装文件:
然后安装到你想要的地方
二.添加到Path里面:
并且把文件opencv_world400.dll和opencv_world400d.dll文件复制到
C:\Windows\SysWOW64这个文件夹;
三.配置Vs2019环境(OpenCV4.0只能用x64配置)
1.在把opencv的include添加到Include Directories和vc15\lib添加到Library Directories
2.在把opencv_world400d.lib添加到Additional Dependencies
运行代码
#include <iostream> #include <opencv2/highgui.hpp> #include <opencv2/core.hpp> #include <opencv2/imgcodecs.hpp> using namespace cv; using namespace std; int main() { Mat image; image = imread("C:/Users/Kiripeng/Desktop/out-2950.jpg"); //记得改成自己的路径 if (image.empty()) { cout << "Could not open or find the image" << std::endl; return -1; } namedWindow("Display window", WINDOW_AUTOSIZE); imshow("Display window", image); waitKey(0); std::cout << "Hello World!\n"; }
加载全部内容