opencv第一个例子:读入一张图片并显示

环境: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;
}

猜你喜欢

转载自blog.csdn.net/ziwuchen/article/details/78525872
今日推荐