资源简介
暗通道去雾代码及改进代码,拥有对色彩方面的改进
代码片段和文件信息
clear all;close all;clc;
I = double(imread(‘4.png‘))/255;
[hwc] = size(I);
%patch size = 15*15 so win_size = 7
win_size = 7;
omg = 0.8;
t0 = 0.1;
img_size = w*h;
dehaze = zeros(hwc);
dark_channel = zeros(hw);
J = zeros(hw3);
%求暗通道
r=I(::1);g=I(::2);b=I(::3);
r=reshape(r1img_size);g=reshape(g1img_size);b=reshape(b1img_size);
rgb = [r;g;b];
Ic_min = reshape(min(rgb)hw);
for m = 1:w
for n = 1:h
dark_channel(nm) = min(min(Ic_min(max(1n-win_size):min(hn+win_size)max(1m-win_size):min(wm+win_size))));
end
end
%大气光A
% dark_col = reshape(dark_channelimg_size1);
% I_col = reshape(Iimg_size3);
% [dark_sortIndex]=sort(dark_col‘descend‘);
% num_A = floor(img_size/1000);
% Index_A = Index(1:num_A);
% A = max(max(I_col(Index_A:)));
A = 220/255;
% 不使用soft matting求透射率
t=1-omg*(dark_channel/A);
T = uint8(t*255);
t = max(tt0);
figure;
set(gcf‘outerposition‘get(0‘screensize‘));
subplot(121);
imshow(dark_channel);title(‘Dark Channel‘‘Fontsize‘16);
subplot(122);
imshow(t);title(‘透射率‘‘Fontsize‘16);
for mm = 1:3
for nn = 1:h
for kk = 1:w
J(nnkkmm) = (I(nnkkmm)-A)/t(nnkk)+A;
end
end
end
figure;
set(gcf‘outerposition‘get(0‘screensize‘));
subplot(121);
imshow(I);title(‘去雾前‘‘Fontsize‘16);
subplot(122);
imshow(J);title(‘去雾后‘‘Fontsize‘16);
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 925449 2010-03-05 15:56 DeHaze\1.png
文件 375334 2013-05-30 13:36 DeHaze\1_1.png
文件 178022 2010-03-05 16:01 DeHaze\2.png
文件 127726 2013-05-30 13:38 DeHaze\2_1.png
文件 462146 2010-03-05 16:11 DeHaze\3.png
文件 282775 2013-05-30 14:14 DeHaze\3_1.png
文件 282735 2010-03-05 16:12 DeHaze\4.png
文件 328183 2013-05-30 14:14 DeHaze\4_1.png
文件 626225 2010-03-05 16:16 DeHaze\5.png
文件 244629 2013-05-30 14:15 DeHaze\5_1.png
文件 941540 2010-03-06 09:33 DeHaze\6.png
文件 631888 2013-05-30 13:43 DeHaze\6_1.png
文件 339534 2010-03-06 09:37 DeHaze\7.png
文件 307900 2013-05-30 13:43 DeHaze\7_1.png
文件 357457 2010-03-06 09:37 DeHaze\8.png
文件 247586 2013-05-30 13:43 DeHaze\8_1.png
文件 665832 2010-03-06 09:38 DeHaze\9.png
文件 501505 2013-05-30 13:43 DeHaze\9_1.png
文件 1423 2013-06-01 21:59 DeHaze\Dehaze_1.m
文件 3389 2013-06-02 11:35 DeHaze\Dehaze_2.m
文件 1618 2013-06-01 21:47 DeHaze\Dehaze_advanced1.m
文件 1518 2013-06-02 11:26 DeHaze\Dehaze_advanced2.m
文件 406 2013-06-02 13:49 DeHaze\Read Me.txt
文件 2999894 2012-05-07 14:32 DeHaze\Single Image Haze Removal Using Dark Channel Prior .pdf
目录 0 2014-06-27 09:27 DeHaze
----------- --------- ---------- ----- ----
10834714 25
评论
共有 条评论