环境:VS2010+opencv2.4.13
注意:把要显示的图片放到VS图片根目录即可。
#include<iostream>
#include <opencv2/core/core.hpp>#include <opencv2/highgui/highgui.hpp>
using namespace cv;
int main()
{
//1、读入一张图片,返回一个矩阵对象
Mat img = imread("pic.jpg");
//2、定义一个窗口盛放该图片
namedWindow("原图");
//3、显示该图片
imshow("游戏原图",img);
//4、等待6000ms后窗口退出
waitKey(6000);
return 0;
}