-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdehaze.cpp
executable file
·35 lines (30 loc) · 940 Bytes
/
dehaze.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
#include "dehaze.h"
int block_size = 5;
int morphology_transorm_kernel_size = 15;
bool save_buf = false;
bool save_bufwithmorph = false;
bool save_compare_img = false;
bool is_circle_wrong_point = true;
int main(int argc, char **argv)
{
int airlight;
Mat img, y_channel, y_channel_median, t_map, dst;
img = imread(argv[1]);
if (img.empty()){
printf("Can not load the picture.\n");
return -1;
}
namedWindow("Input");
imshow("Input", img);
y_channel = calcYchannel(img);
medianBlur(y_channel, y_channel_median, 5);
airlight = calcAirlight(img, block_size, is_circle_wrong_point, morphology_transorm_kernel_size, save_buf, save_bufwithmorph, save_compare_img);
t_map = calcTransmission(img, y_channel_median, airlight);
dst = dehazing(img, t_map, airlight);
namedWindow("Dehazing");
imshow("Dehazing", dst);
//imwrite("dehaze.bmp", dst);
waitKey(0);
destroyAllWindows();
return 0;
}