diff options
Diffstat (limited to 'DCP/dcp.cpp')
-rw-r--r-- | DCP/dcp.cpp | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/DCP/dcp.cpp b/DCP/dcp.cpp index 4e100c6..716759c 100644 --- a/DCP/dcp.cpp +++ b/DCP/dcp.cpp | |||
@@ -1,7 +1,4 @@ | |||
1 | #include "dcp.h" | 1 | #include "dcp_core.h" |
2 | |||
3 | #include <iostream> | ||
4 | using namespace std; | ||
5 | 2 | ||
6 | void dehaze(IplImage *recover, IplImage *input) | 3 | void dehaze(IplImage *recover, IplImage *input) |
7 | { | 4 | { |
@@ -12,18 +9,36 @@ void dehaze(IplImage *recover, IplImage *input) | |||
12 | IplImage *transmission = cvCreateImage(cvSize(width, height), IPL_DEPTH_8U, 1); | 9 | IplImage *transmission = cvCreateImage(cvSize(width, height), IPL_DEPTH_8U, 1); |
13 | IplImage *refine_transmission = cvCreateImage(cvSize(width, height), IPL_DEPTH_8U, 1); | 10 | IplImage *refine_transmission = cvCreateImage(cvSize(width, height), IPL_DEPTH_8U, 1); |
14 | 11 | ||
15 | int darkchannelradius = MIN(width, height) * 0.02; | 12 | int darkchannelradius = cvRound(MIN(width, height) * 0.02); |
16 | |||
17 | |||
18 | |||
19 | double Airlight[3] = { 0.0, 0.0, 0.0 }; | 13 | double Airlight[3] = { 0.0, 0.0, 0.0 }; |
14 | |||
15 | TicToc t; | ||
16 | t.tic(); | ||
17 | printf("CalcDarkChannel..."); | ||
20 | CalcDarkChannel(darkchannel, input, darkchannelradius); | 18 | CalcDarkChannel(darkchannel, input, darkchannelradius); |
21 | 19 | t.toc(); | |
20 | |||
21 | t.tic(); | ||
22 | printf("CalcAirlight..."); | ||
22 | CalcAirlight(darkchannel, input, Airlight); | 23 | CalcAirlight(darkchannel, input, Airlight); |
23 | 24 | t.toc(); | |
25 | |||
26 | t.tic(); | ||
27 | printf("CalcTransmission..."); | ||
24 | CalcTransmission(transmission, input, Airlight, darkchannelradius); | 28 | CalcTransmission(transmission, input, Airlight, darkchannelradius); |
29 | t.toc(); | ||
30 | |||
31 | t.tic(); | ||
32 | printf("GuidedFilterColor..."); | ||
25 | GuidedFilterColor(refine_transmission, input, transmission, 1e-6, 60); | 33 | GuidedFilterColor(refine_transmission, input, transmission, 1e-6, 60); |
26 | CalcRecover(recover, input, refine_transmission, Airlight); | 34 | t.toc(); |
27 | 35 | ||
28 | 36 | t.tic(); | |
37 | printf("CalcRecover..."); | ||
38 | CalcRecover(recover, input, refine_transmission, Airlight); | ||
39 | t.toc(); | ||
40 | |||
41 | cvReleaseImage(&refine_transmission); | ||
42 | cvReleaseImage(&transmission); | ||
43 | cvReleaseImage(&darkchannel); | ||
29 | } | 44 | } |