diff options
author | JinweiClarkChao <[email protected]> | 2015-08-25 16:48:29 +0800 |
---|---|---|
committer | JinweiClarkChao <[email protected]> | 2015-08-25 16:49:51 +0800 |
commit | c16ba61435b2dc94c9871cee77bd2291febbc7fe (patch) | |
tree | 6d0686a8c93288ce8767e9d0cc101f15b1feccb5 | |
parent | 66efed8b335610f9eae59fd3f52eccaffd7a6e0b (diff) | |
download | Dehaze-c16ba61435b2dc94c9871cee77bd2291febbc7fe.tar.gz |
add refs in README
-rw-r--r-- | DCP.sln | 6 | ||||
-rw-r--r-- | DCP/DCP.vcxproj | 69 | ||||
-rw-r--r-- | DCP/darkchannel.cpp | 12 | ||||
-rw-r--r-- | DCP/dcp.cpp | 13 | ||||
-rw-r--r-- | DCP/dcp.h | 1 | ||||
-rw-r--r-- | DCP/dcp_core.h | 2 | ||||
-rw-r--r-- | DCP/test.cpp | 2 | ||||
-rw-r--r-- | README.md | 11 |
8 files changed, 29 insertions, 87 deletions
@@ -8,19 +8,13 @@ EndProject | |||
8 | Global | 8 | Global |
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution | 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution |
10 | Debug|Win32 = Debug|Win32 | 10 | Debug|Win32 = Debug|Win32 |
11 | Debug|x64 = Debug|x64 | ||
12 | Release|Win32 = Release|Win32 | 11 | Release|Win32 = Release|Win32 |
13 | Release|x64 = Release|x64 | ||
14 | EndGlobalSection | 12 | EndGlobalSection |
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution | 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution |
16 | {1543533F-481B-40EC-BEFC-90E46456A5F8}.Debug|Win32.ActiveCfg = Debug|Win32 | 14 | {1543533F-481B-40EC-BEFC-90E46456A5F8}.Debug|Win32.ActiveCfg = Debug|Win32 |
17 | {1543533F-481B-40EC-BEFC-90E46456A5F8}.Debug|Win32.Build.0 = Debug|Win32 | 15 | {1543533F-481B-40EC-BEFC-90E46456A5F8}.Debug|Win32.Build.0 = Debug|Win32 |
18 | {1543533F-481B-40EC-BEFC-90E46456A5F8}.Debug|x64.ActiveCfg = Debug|x64 | ||
19 | {1543533F-481B-40EC-BEFC-90E46456A5F8}.Debug|x64.Build.0 = Debug|x64 | ||
20 | {1543533F-481B-40EC-BEFC-90E46456A5F8}.Release|Win32.ActiveCfg = Release|Win32 | 16 | {1543533F-481B-40EC-BEFC-90E46456A5F8}.Release|Win32.ActiveCfg = Release|Win32 |
21 | {1543533F-481B-40EC-BEFC-90E46456A5F8}.Release|Win32.Build.0 = Release|Win32 | 17 | {1543533F-481B-40EC-BEFC-90E46456A5F8}.Release|Win32.Build.0 = Release|Win32 |
22 | {1543533F-481B-40EC-BEFC-90E46456A5F8}.Release|x64.ActiveCfg = Release|x64 | ||
23 | {1543533F-481B-40EC-BEFC-90E46456A5F8}.Release|x64.Build.0 = Release|x64 | ||
24 | EndGlobalSection | 18 | EndGlobalSection |
25 | GlobalSection(SolutionProperties) = preSolution | 19 | GlobalSection(SolutionProperties) = preSolution |
26 | HideSolutionNode = FALSE | 20 | HideSolutionNode = FALSE |
diff --git a/DCP/DCP.vcxproj b/DCP/DCP.vcxproj index b2ef313..68eeb69 100644 --- a/DCP/DCP.vcxproj +++ b/DCP/DCP.vcxproj | |||
@@ -5,18 +5,10 @@ | |||
5 | <Configuration>Debug</Configuration> | 5 | <Configuration>Debug</Configuration> |
6 | <Platform>Win32</Platform> | 6 | <Platform>Win32</Platform> |
7 | </ProjectConfiguration> | 7 | </ProjectConfiguration> |
8 | <ProjectConfiguration Include="Debug|x64"> | ||
9 | <Configuration>Debug</Configuration> | ||
10 | <Platform>x64</Platform> | ||
11 | </ProjectConfiguration> | ||
12 | <ProjectConfiguration Include="Release|Win32"> | 8 | <ProjectConfiguration Include="Release|Win32"> |
13 | <Configuration>Release</Configuration> | 9 | <Configuration>Release</Configuration> |
14 | <Platform>Win32</Platform> | 10 | <Platform>Win32</Platform> |
15 | </ProjectConfiguration> | 11 | </ProjectConfiguration> |
16 | <ProjectConfiguration Include="Release|x64"> | ||
17 | <Configuration>Release</Configuration> | ||
18 | <Platform>x64</Platform> | ||
19 | </ProjectConfiguration> | ||
20 | </ItemGroup> | 12 | </ItemGroup> |
21 | <PropertyGroup Label="Globals"> | 13 | <PropertyGroup Label="Globals"> |
22 | <ProjectGuid>{1543533F-481B-40EC-BEFC-90E46456A5F8}</ProjectGuid> | 14 | <ProjectGuid>{1543533F-481B-40EC-BEFC-90E46456A5F8}</ProjectGuid> |
@@ -30,12 +22,6 @@ | |||
30 | <PlatformToolset>v120</PlatformToolset> | 22 | <PlatformToolset>v120</PlatformToolset> |
31 | <CharacterSet>Unicode</CharacterSet> | 23 | <CharacterSet>Unicode</CharacterSet> |
32 | </PropertyGroup> | 24 | </PropertyGroup> |
33 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> | ||
34 | <ConfigurationType>Application</ConfigurationType> | ||
35 | <UseDebugLibraries>true</UseDebugLibraries> | ||
36 | <PlatformToolset>v120</PlatformToolset> | ||
37 | <CharacterSet>Unicode</CharacterSet> | ||
38 | </PropertyGroup> | ||
39 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> | 25 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> |
40 | <ConfigurationType>Application</ConfigurationType> | 26 | <ConfigurationType>Application</ConfigurationType> |
41 | <UseDebugLibraries>false</UseDebugLibraries> | 27 | <UseDebugLibraries>false</UseDebugLibraries> |
@@ -43,31 +29,16 @@ | |||
43 | <WholeProgramOptimization>true</WholeProgramOptimization> | 29 | <WholeProgramOptimization>true</WholeProgramOptimization> |
44 | <CharacterSet>Unicode</CharacterSet> | 30 | <CharacterSet>Unicode</CharacterSet> |
45 | </PropertyGroup> | 31 | </PropertyGroup> |
46 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> | ||
47 | <ConfigurationType>Application</ConfigurationType> | ||
48 | <UseDebugLibraries>false</UseDebugLibraries> | ||
49 | <PlatformToolset>v120</PlatformToolset> | ||
50 | <WholeProgramOptimization>true</WholeProgramOptimization> | ||
51 | <CharacterSet>Unicode</CharacterSet> | ||
52 | </PropertyGroup> | ||
53 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | 32 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> |
54 | <ImportGroup Label="ExtensionSettings"> | 33 | <ImportGroup Label="ExtensionSettings"> |
55 | </ImportGroup> | 34 | </ImportGroup> |
56 | <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | 35 | <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
57 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | 36 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
58 | <Import Project="D:\3rdLibs\OpenCV3\OpenCV3GPU.props" /> | 37 | <Import Project="D:\3rdLibs\OpenCV3\OpenCV3Contrib.props" /> |
59 | </ImportGroup> | ||
60 | <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> | ||
61 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
62 | <Import Project="D:\3rdLibs\OpenCV3\OpenCV3GPU.props" /> | ||
63 | </ImportGroup> | 38 | </ImportGroup> |
64 | <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | 39 | <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
65 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | 40 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
66 | <Import Project="D:\3rdLibs\OpenCV3\OpenCV3GPU.props" /> | 41 | <Import Project="D:\3rdLibs\OpenCV3\OpenCV3Contrib.props" /> |
67 | </ImportGroup> | ||
68 | <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> | ||
69 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
70 | <Import Project="D:\3rdLibs\OpenCV3\OpenCV3GPU.props" /> | ||
71 | </ImportGroup> | 42 | </ImportGroup> |
72 | <PropertyGroup Label="UserMacros"> | 43 | <PropertyGroup Label="UserMacros"> |
73 | <NuGetPackageImportStamp>ed7df352</NuGetPackageImportStamp> | 44 | <NuGetPackageImportStamp>ed7df352</NuGetPackageImportStamp> |
@@ -75,15 +46,9 @@ | |||
75 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | 46 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
76 | <LinkIncremental>true</LinkIncremental> | 47 | <LinkIncremental>true</LinkIncremental> |
77 | </PropertyGroup> | 48 | </PropertyGroup> |
78 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||
79 | <LinkIncremental>true</LinkIncremental> | ||
80 | </PropertyGroup> | ||
81 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | 49 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
82 | <LinkIncremental>false</LinkIncremental> | 50 | <LinkIncremental>false</LinkIncremental> |
83 | </PropertyGroup> | 51 | </PropertyGroup> |
84 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||
85 | <LinkIncremental>false</LinkIncremental> | ||
86 | </PropertyGroup> | ||
87 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | 52 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
88 | <ClCompile> | 53 | <ClCompile> |
89 | <PrecompiledHeader> | 54 | <PrecompiledHeader> |
@@ -97,19 +62,6 @@ | |||
97 | <GenerateDebugInformation>true</GenerateDebugInformation> | 62 | <GenerateDebugInformation>true</GenerateDebugInformation> |
98 | </Link> | 63 | </Link> |
99 | </ItemDefinitionGroup> | 64 | </ItemDefinitionGroup> |
100 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||
101 | <ClCompile> | ||
102 | <PrecompiledHeader> | ||
103 | </PrecompiledHeader> | ||
104 | <WarningLevel>Level3</WarningLevel> | ||
105 | <Optimization>Disabled</Optimization> | ||
106 | <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
107 | </ClCompile> | ||
108 | <Link> | ||
109 | <SubSystem>Console</SubSystem> | ||
110 | <GenerateDebugInformation>true</GenerateDebugInformation> | ||
111 | </Link> | ||
112 | </ItemDefinitionGroup> | ||
113 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | 65 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
114 | <ClCompile> | 66 | <ClCompile> |
115 | <WarningLevel>Level3</WarningLevel> | 67 | <WarningLevel>Level3</WarningLevel> |
@@ -127,23 +79,6 @@ | |||
127 | <OptimizeReferences>true</OptimizeReferences> | 79 | <OptimizeReferences>true</OptimizeReferences> |
128 | </Link> | 80 | </Link> |
129 | </ItemDefinitionGroup> | 81 | </ItemDefinitionGroup> |
130 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||
131 | <ClCompile> | ||
132 | <WarningLevel>Level3</WarningLevel> | ||
133 | <PrecompiledHeader> | ||
134 | </PrecompiledHeader> | ||
135 | <Optimization>MaxSpeed</Optimization> | ||
136 | <FunctionLevelLinking>true</FunctionLevelLinking> | ||
137 | <IntrinsicFunctions>true</IntrinsicFunctions> | ||
138 | <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
139 | </ClCompile> | ||
140 | <Link> | ||
141 | <SubSystem>Console</SubSystem> | ||
142 | <GenerateDebugInformation>true</GenerateDebugInformation> | ||
143 | <EnableCOMDATFolding>true</EnableCOMDATFolding> | ||
144 | <OptimizeReferences>true</OptimizeReferences> | ||
145 | </Link> | ||
146 | </ItemDefinitionGroup> | ||
147 | <ItemGroup> | 82 | <ItemGroup> |
148 | <ClInclude Include="dcp.h" /> | 83 | <ClInclude Include="dcp.h" /> |
149 | <ClInclude Include="dcp_core.h" /> | 84 | <ClInclude Include="dcp_core.h" /> |
diff --git a/DCP/darkchannel.cpp b/DCP/darkchannel.cpp index ab5a365..64d9963 100644 --- a/DCP/darkchannel.cpp +++ b/DCP/darkchannel.cpp | |||
@@ -25,14 +25,10 @@ void CalcDarkChannel(IplImage *darkchannel, IplImage *input, int radius) | |||
25 | st_row = i - radius, ed_row = i + radius; | 25 | st_row = i - radius, ed_row = i + radius; |
26 | st_col = j - radius, ed_col = j + radius; | 26 | st_col = j - radius, ed_col = j + radius; |
27 | 27 | ||
28 | if (st_row < 0) | 28 | st_row = st_row < 0 ? 0 : st_row; |
29 | st_row = 0; | 29 | ed_row = ed_row >= height ? (height - 1) : ed_row; |
30 | if (ed_row >= height) | 30 | st_col = st_col < 0 ? 0 : st_col; |
31 | ed_row = height - 1; | 31 | ed_col = ed_col >= width ? (width - 1) : ed_col; |
32 | if (st_col < 0) | ||
33 | st_col = 0; | ||
34 | if (ed_col >= width) | ||
35 | ed_col = width - 1; | ||
36 | 32 | ||
37 | int cur = 0; | 33 | int cur = 0; |
38 | int min = 300; | 34 | int min = 300; |
diff --git a/DCP/dcp.cpp b/DCP/dcp.cpp index 716759c..97a597f 100644 --- a/DCP/dcp.cpp +++ b/DCP/dcp.cpp | |||
@@ -1,5 +1,7 @@ | |||
1 | #include "dcp_core.h" | 1 | #include "dcp_core.h" |
2 | 2 | ||
3 | using namespace cv::ximgproc; | ||
4 | |||
3 | void dehaze(IplImage *recover, IplImage *input) | 5 | void dehaze(IplImage *recover, IplImage *input) |
4 | { | 6 | { |
5 | int height = input->height; | 7 | int height = input->height; |
@@ -30,7 +32,18 @@ void dehaze(IplImage *recover, IplImage *input) | |||
30 | 32 | ||
31 | t.tic(); | 33 | t.tic(); |
32 | printf("GuidedFilterColor..."); | 34 | printf("GuidedFilterColor..."); |
35 | // GuidedFilterColor() is my own implementation of guided filter | ||
36 | // guidedFilter() is the implementation included in OpenCV 3.0 | ||
37 | // The result is almost the same, however my implementation is much more slower | ||
38 | // because I haven't spend much time optimizing the code efficiency. | ||
39 | |||
40 | // See http://research.microsoft.com/en-us/um/people/kahe/eccv10/ for more details | ||
41 | // ref: | ||
42 | // He, Kaiming, Jian Sun, and Xiaoou Tang. "Guided image filtering." | ||
43 | // Pattern Analysis and Machine Intelligence, IEEE Transactions on 35.6 (2013): 1397-1409. | ||
44 | |||
33 | GuidedFilterColor(refine_transmission, input, transmission, 1e-6, 60); | 45 | GuidedFilterColor(refine_transmission, input, transmission, 1e-6, 60); |
46 | // guidedFilter(cv::cvarrToMat(input), cv::cvarrToMat(transmission), cv::cvarrToMat(refine_transmission), 60, 1e-6); | ||
34 | t.toc(); | 47 | t.toc(); |
35 | 48 | ||
36 | t.tic(); | 49 | t.tic(); |
@@ -2,7 +2,6 @@ | |||
2 | #define DCP_H | 2 | #define DCP_H |
3 | 3 | ||
4 | #include "dcp_core.h" | 4 | #include "dcp_core.h" |
5 | |||
6 | void dehaze(IplImage *recover, IplImage *input); | 5 | void dehaze(IplImage *recover, IplImage *input); |
7 | 6 | ||
8 | #endif \ No newline at end of file | 7 | #endif \ No newline at end of file |
diff --git a/DCP/dcp_core.h b/DCP/dcp_core.h index 658e461..98db7a4 100644 --- a/DCP/dcp_core.h +++ b/DCP/dcp_core.h | |||
@@ -3,6 +3,8 @@ | |||
3 | 3 | ||
4 | #include <opencv\cv.h> | 4 | #include <opencv\cv.h> |
5 | #include <opencv\highgui.h> | 5 | #include <opencv\highgui.h> |
6 | #include <opencv2\opencv.hpp> | ||
7 | #include <opencv2\ximgproc.hpp> | ||
6 | 8 | ||
7 | #include <iostream> | 9 | #include <iostream> |
8 | 10 | ||
diff --git a/DCP/test.cpp b/DCP/test.cpp index 2af8719..7587c35 100644 --- a/DCP/test.cpp +++ b/DCP/test.cpp | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | int main() | 3 | int main() |
4 | { | 4 | { |
5 | IplImage *input = cvLoadImage("house-input.bmp"); | 5 | IplImage *input = cvLoadImage("input.png"); |
6 | IplImage *result = cvCreateImage(cvGetSize(input), IPL_DEPTH_8U, 3); | 6 | IplImage *result = cvCreateImage(cvGetSize(input), IPL_DEPTH_8U, 3); |
7 | dehaze(result, input); | 7 | dehaze(result, input); |
8 | 8 | ||
@@ -1,6 +1,9 @@ | |||
1 | Implementation of Dark Channel Prior | 1 | ## Single Image Haze Removal Using Dark Channel Prior |
2 | 2 | ||
3 | This repo is still under development. | 3 | Implementation of Single Image Haze Removal Using Dark Channel Prior. |
4 | 4 | ||
5 | He K, Sun J, Tang X. Single image haze removal using dark channel prior[J]. Pattern Analysis and | 5 | Dependence: OpenCV 3.0 |
6 | Machine Intelligence, IEEE Transactions on, 2011, 33(12): 2341-2353. | 6 | |
7 | ### Ref | ||
8 | + He K, Sun J, Tang X. Single image haze removal using dark channel prior[J]. Pattern Analysis and Machine Intelligence, IEEE Transactions on, 2011, 33(12): 2341-2353. | ||
9 | + He, Kaiming, Jian Sun, and Xiaoou Tang. "Guided image filtering." Pattern Analysis and Machine Intelligence, IEEE Transactions on 35.6 (2013): 1397-1409. \ No newline at end of file | ||