资源简介
基于双边滤波+retinex理论的图像中增强,增强图像细节
代码片段和文件信息
function retimg = bialteral(img N sigma)
%% colorspace transformation
img = rgb2hsv(img);%convert rgb to hsv colorspace in order to process
%% 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‘illumination retinex algorithm……‘);
set(h‘Name‘‘Illumination 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:jMax3);%extract the local region
d = L-img(ij3);%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
for m = 1:iMax-iMin+1
for n = 1:jMax-jMin+1
if d(mn) < 0
F(mn) = 0;
end
end
end
norm_F = sum(F(:));
B(ij3) = sum(sum(F.*L))/norm_F;
retimg(ij1) = img(ij1);
retimg(ij2) = img(ij2);
retimg(ij3) = B(ij3);
end
waitbar(i/dim(1));
end
close(h);%close the bar
%% display colorspace transformation
img = hsv2rgb(img);
retimg = hsv2rgb(retimg);
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2010-07-15 10:06 hsv\
文件 1970126 2010-07-15 09:39 hsv\2005.bmp
文件 915894 2010-07-12 18:52 hsv\5.bmp
文件 1660 2010-07-15 10:27 hsv\bialteral.m
文件 1196 2010-07-15 10:28 hsv\bialteral2.m
文件 1962090 2010-07-15 10:19 hsv\boy.bmp
文件 1674 2010-07-15 10:13 hsv\demo.m
文件 1969902 2010-07-15 10:19 hsv\girl.bmp
文件 2963789 2013-03-20 18:45 PPT_Retinex by Two Bilateral Filters.pdf
文件 2516867 2013-03-20 18:21 Retinex by Two Bilateral Filters.pdf
文件 649988 2018-07-05 08:55 hsv\21.jpg
文件 609142 2018-07-05 08:56 hsv\22.jpg
文件 660655 2018-07-05 08:56 hsv\23.jpg
文件 619138 2018-07-05 08:56 hsv\24.jpg
文件 791326 2018-07-05 08:57 hsv\25.jpg
文件 477529 2014-08-19 10:03 hsv\DSC_0021.jpg
文件 458033 2014-08-19 10:03 hsv\DSC_0022.jpg
文件 621790 2014-08-19 10:03 hsv\DSC_0023.jpg
文件 508904 2014-08-19 10:03 hsv\DSC_0024.jpg
文件 641872 2014-08-19 10:03 hsv\DSC_0025.jpg
评论
共有 条评论