6)添加以下文件夹到“Include Directories”中
D:\OpenCV\opencv\build\include
D:\OpenCV\opencv\build\include\opencv
D:\OpenCV\opencv\build\include\opencv2
7)添加以下文件到“Library Directories”中
D:\OpenCV\opencv\build\x64\vc15\lib
8)添加以下语句到Linker->Input->Additional Dependencies
若上面选择Release,则添加"opencv_world320.lib"(注:320根据版本号修改)
若上面选择Debug,则添加“opencv_world320.lib”
9)添加程序代码运行
1 #include<opencv2/core/core.hpp>
2 #include<opencv2/highgui/highgui.hpp>
4 using namespace cv;
5 int main(int arg, char *argv[]) { //图片路径不要出现中文
6 Mat img = imread(argv[1], CV_LOAD_IMAGE_ANYCOLOR);
7 if (!img.data) {
8 return -1;
10 imshow("原图", img);
11 waitKey(0);
12 return 1;
2、若出现如下截屏的问题
3、解决方案
将目录D:\OpenCV\opencv\build\x64\vc15\bin下的三个以dll结尾的文件复制到C:\Windows\System32,注意:64位系统用户需要注意,32位的DLL文件放在“C:\Windows\SysWOW64”,64位的DLL文件放在“C:\Windows\System32”,方便起见可同时复制到那两个文件夹中。
一个OpenCV可能有VC14和VC15,最终根据VS版本来选择。