From 66efed8b335610f9eae59fd3f52eccaffd7a6e0b Mon Sep 17 00:00:00 2001 From: JinweiClarkChao Date: Tue, 25 Aug 2015 16:03:05 +0800 Subject: fix --- DCP/dcp.cpp | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) (limited to 'DCP/dcp.cpp') 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 @@ -#include "dcp.h" - -#include -using namespace std; +#include "dcp_core.h" void dehaze(IplImage *recover, IplImage *input) { @@ -12,18 +9,36 @@ void dehaze(IplImage *recover, IplImage *input) IplImage *transmission = cvCreateImage(cvSize(width, height), IPL_DEPTH_8U, 1); IplImage *refine_transmission = cvCreateImage(cvSize(width, height), IPL_DEPTH_8U, 1); - int darkchannelradius = MIN(width, height) * 0.02; - - - + int darkchannelradius = cvRound(MIN(width, height) * 0.02); double Airlight[3] = { 0.0, 0.0, 0.0 }; + + TicToc t; + t.tic(); + printf("CalcDarkChannel..."); CalcDarkChannel(darkchannel, input, darkchannelradius); - + t.toc(); + + t.tic(); + printf("CalcAirlight..."); CalcAirlight(darkchannel, input, Airlight); - + t.toc(); + + t.tic(); + printf("CalcTransmission..."); CalcTransmission(transmission, input, Airlight, darkchannelradius); + t.toc(); + + t.tic(); + printf("GuidedFilterColor..."); GuidedFilterColor(refine_transmission, input, transmission, 1e-6, 60); - CalcRecover(recover, input, refine_transmission, Airlight); + t.toc(); - + t.tic(); + printf("CalcRecover..."); + CalcRecover(recover, input, refine_transmission, Airlight); + t.toc(); + + cvReleaseImage(&refine_transmission); + cvReleaseImage(&transmission); + cvReleaseImage(&darkchannel); } -- cgit v1.2.3