笔者使用了vcpkg安装openCV3
打开git-cmd.exe然后输入
vcpkg install opencv3:x64-windows
等待30分钟左右终于安全完成。
然后,在VS2017中新建空项目,source内添加main.cpp文件
下一步,在项目中集成openCV,使用vcpkg的integrate方法
进入到vcpkg-master所在的目录,输入.\vcpkg integrate install,之后会提示成功集成到项目内,真是方便
项目的properties里面配置VC++ directories
main.cpp内键入如下代码
#include "../Common/common.h"
int main(int argc, char** argv)
{
IplImage* img = cvLoadImage(argv[1]);
cvNamedWindow("Example1", CV_WINDOW_AUTOSIZE);
cvShowImage("Example1", img);
cvWaitKey(0);
cvReleaseImage(&img);
cvDestroyWindow("Example1");
}
右键build
打开cmd,进入到HelloOpenCV.exe所在的目录
运行程序就会看到自己想看到的图像