资源简介

实现图像去雾处理,Matlab代码,可以直接运行的

资源截图

代码片段和文件信息

function retimg = bialteral2(img N sigma)
%% pre-computer domain filtering
sigma_d = sigma(1);
sigma_r = sigma(2);
[XY] = meshgrid(-N:N-N:N);%generate two matrix 
D = exp(-(X.^2+Y.^2)/(2*sigma_d^2));%domain weights with Euclidean distance
%% create waitbar
h = waitbar(0‘reflecting retinex algorithm……‘);
set(h‘Name‘‘Reflecting Retinex‘);
%% rang filtering in v layer
dim = size(img);%dim=[heightlength3]
B = zeros(dim);%create an image B with the same size and dimension with the zero value.
for i = 1:dim(1)
    for j = 1:dim(2)
            iMin = max(i-N1);
            iMax = min(i+Ndim(1));
            jMin = max(j-N1);
            jMax = min(j+Ndim(2));
            L = img(iMin:iMaxjMin:jMax);%extract the local region

            d = L-img(ij);%the dissimilarity between the surroud and center
            R = exp(-(d.^2)/(2*sigma_r^2));%range filter weights

            
            F = R.*D((iMin:iMax)-i+N+1(jMin:jMax)-j+N+1);%its row is from iMin-i+N+1 to iMax-i+N+1and so as line
            norm_F = sum(F(:));
            B(ij) = sum(sum(F.*L))/norm_F;

            retimg(ij) = B(ij);
    end
waitbar(i/dim(1));
end
close(h);%close the bar

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2013-03-30 19:54  code\
     文件        5575  2013-03-27 15:47  code\PhysicsSingleImageFogRemoval_Demo20101128_OK.asv
     文件        5616  2013-03-27 15:47  code\PhysicsSingleImageFogRemoval_Demo20101128_OK.m
     文件        5615  2013-03-27 15:47  code\PhysicsSingleImageFogRemoval_Demo20130105.asv
     文件        5629  2013-03-27 15:47  code\PhysicsSingleImageFogRemoval_Demo20130105.m
     文件        6006  2013-03-27 15:47  code\PhysicsSingleImageFogRemoval_Demo20130108.m
     文件        1212  2013-03-27 15:47  code\bialteral2.m
     文件         931  2013-03-27 15:47  code\boxfilter.m
     文件         384  2013-03-27 15:47  code\darkchannel.m
     目录           0  2013-03-30 19:54  code\dataset\
     文件      212068  2013-03-27 15:47  code\dataset\Canon (input).jpg
     文件      540054  2013-03-27 15:47  code\dataset\Cartoon.bmp
     文件      242185  2013-03-27 15:47  code\dataset\K080-000021.png
     文件      793283  2013-03-27 15:47  code\dataset\New York (input).jpg
     文件      200777  2013-03-27 15:47  code\dataset\New York (input)2.jpg
     文件      595854  2013-03-27 15:47  code\dataset\Red Bricks House.bmp
     文件     1023414  2013-03-27 15:47  code\dataset\Sky.bmp
     文件      112640  2013-03-27 15:47  code\dataset\Thumbs.db
     文件      121134  2013-03-27 15:47  code\dataset\TrafficFog.jpg
     文件       22826  2013-03-27 15:47  code\dataset\TrafficFog1.jpg
     文件       65412  2013-03-27 15:47  code\dataset\TrafficFog2.jpg
     文件       98400  2013-03-27 15:47  code\dataset\TrafficFog24.jpg
     文件      149528  2013-03-27 15:47  code\dataset\TrafficFog25.jpg
     文件       47810  2013-03-27 15:47  code\dataset\TrafficFog252.jpg
     文件       81736  2013-03-27 15:47  code\dataset\TrafficFog26.jpg
     文件      250683  2013-03-27 15:47  code\dataset\TrafficFog27.jpg
     文件      186495  2013-03-27 15:47  code\dataset\TrafficFog28.jpg
     文件       31963  2013-03-27 15:47  code\dataset\TrafficFog4.jpg
     文件        9374  2013-03-27 15:47  code\dataset\TrafficFog5.jpg
     文件      825710  2013-03-27 15:47  code\dataset\aerial-input.bmp
     文件      589878  2013-03-27 15:47  code\dataset\cones-input.bmp
............此处省略23个文件信息

评论

共有 条评论