版权声明:——转载请留言询问—— https://blog.csdn.net/weixin_44344462/article/details/88721267
效果
Show me the code
#include <iostream>
#include <string>
#include <opencv2/highgui.hpp>
using namespace std;
int main() {
// 文件路径
const string filePath = "xxx.jpg";
// 读取图像存入origin
cv::Mat origin = cv::imread(filePath);
// 创建一个窗口
cv::namedWindow("Origin Image");
// 在名为“Origin Image”的窗口显示图像
cv::imshow("Origin Image", origin);
// 用c接收键盘按键的映射
int c = cv::waitKey(0);
// 如果按下Esc则销毁所有窗口
if (c == 27) {
cv::destroyAllWindows();
}
}