//包含OpenCV的头文件
#include <opencv2/opencv.hpp>
#include <iostream>
using namespace  std;
//使用OpenCV的命名空间
using namespace cv;
int main()
{
	//读取一幅文件
	//imread支持BMP,DIB,JPEG,GPE,PNG,PBM,PGM,PPM,SR,RAS,TIFF这些格式
	cv::Mat img = imread("C:/Users/GuSheng/Desktop/标准测试图片/aerial.bmp",-1);
	//如果读取失败的话,直接返回
	if (img.empty())
	{
		return 0;
	}
	//创建一个窗口,来显示影像,WINDOW_AUTOSIZE 表示 窗口大小根据影像的大小进行自适应调整大小
	namedWindow("Example", WINDOW_AUTOSIZE);
	//显示一幅影像
	imshow("Example", img);
	//等候多少毫秒进行下条语句,如果为0或者负数的话,那么就一直进行等待,直到一个按键被按下
	waitKey(0);
	//销毁窗口
	destroyWindow("Example");
	return 0;
}

OpenCV 显示影像

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-10-11
  • 2021-09-25
  • 2022-12-23
  • 2021-06-24
  • 2021-11-02
  • 2021-04-21
猜你喜欢
  • 2021-09-07
  • 2021-10-11
  • 2022-12-23
  • 2022-12-23
  • 2021-05-23
  • 2021-08-03
  • 2022-12-23
相关资源
相似解决方案