效果
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();
}
}