-
Notifications
You must be signed in to change notification settings - Fork 0
/
ch1_meow.cpp
39 lines (30 loc) · 1.07 KB
/
ch1_meow.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <opencv2/opencv.hpp>
int main(int argc, char **argv)
{
cv::Mat image;
std::string win_name;
if (argc >= 2) //如果有輸入參數
{
std::cout << "Your command: " << argv[0] << "\n"; //印出執行檔名
std::cout << "Your environment variable is: " << argv[1] << "\n"; //印出環境變數
image = cv::imread(argv[1], cv::IMREAD_COLOR); //讀取圖片(路徑, 彩色)
win_name = "PoP_caTTo";
}
else //沒有輸入參數
{
std::cout << "what?? now Diavolo is here to suffer!\n"
<< "you should summon the PoP_caTTo to save Diavolo\n";
image = cv::imread("../pic/default.jpg", cv::IMREAD_GRAYSCALE); //讀取圖片(路徑, 灰階)
cv::blur(image, image, {15, 15}); //模糊化
win_name = "what?????";
}
if (image.empty()) //如果圖片是空值
{
std::cout << "Dude! I cannot find the file, the program dies!"
<< "\n";
exit(-1); // 跳出程式
}
cv::imshow(win_name, image);
cv::waitKey(0);
return 0;
}