资源简介
【图像处理·实验三】matlab 去除人脸图像中的雀斑,人脸美白
代码片段和文件信息
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%彩色图双边滤波%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function g = bfilt_rgb(frab)
% f灰度图;r滤波半径;a全局方差;b局部方差
tic
[xy] = meshgrid(-r:r);
w1 = exp(-(x.^2+y.^2)/(2*a^2));
f = tofloat(f);%f = im2double(f);
fr = f(::1);
fg = f(::2);
fb = f(::3);
[mn] = size(fr);
fr_temp = padarray(fr[r r]‘symmetric‘);
fg_temp = padarray(fg[r r]‘symmetric‘);
fb_temp = padarray(fb[r r]‘symmetric‘);
[grgggb] = deal(zeros(size(fr)));
for i = r+1:m+r
for j = r+1:n+r
temp1 = fr_temp(i-r:i+rj-r:j+r);
temp2 = fg_temp(i-r:i+rj-r:j+r);
temp3 = fb_temp(i-r:i+rj-r:j+r);
dr = temp1 - fr_temp(ij);
dg = temp2 - fg_temp(ij);
db = temp3 - fb_temp(ij);
w2 = exp(-(dr.^2+dg.^2+db.^2)/(2*b^2));
w = w1.*w2;
gr(i-rj-r) = sum(sum(temp1.*w))/sum(w(:));
gg(i-rj-r) = sum(sum(temp2.*w))/sum(w(:));
gb(i-rj-r) = sum(sum(temp3.*w))/sum(w(:));
end
end
g = cat(3grgggb);
% g = revertclass(g);
toc
end
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1057 2018-12-22 22:31 Lab3\bfilt_rgb.m
文件 3857 2018-12-17 23:09 Lab3\bilateralFilter.m
文件 343 2018-12-22 23:50 Lab3\brightness.m
文件 1300 2018-12-22 23:50 Lab3\Demo1.m
文件 592 2018-12-23 00:17 Lab3\Demo2.m
文件 1886 2018-12-23 00:21 Lab3\Demo3.m
文件 358 2018-12-23 00:28 Lab3\Demo4.m
文件 616 2018-12-23 00:29 Lab3\Demo5.m
文件 577 2018-12-23 00:31 Lab3\Demo6.m
文件 2388 2018-12-18 19:01 Lab3\L0Smoothing.m
文件 1195 2018-12-23 00:31 Lab3\LeeAdditvieNoiseFilter.m
文件 2530 2018-12-21 23:02 Lab3\mywlsFilter.m
文件 415 2018-12-22 03:04 Lab3\RgbSkinReconize.m
文件 159 2018-12-22 23:48 Lab3\sharp.m
文件 526 2018-12-17 17:22 Lab3\tofloat.m
文件 2794 2018-12-18 19:01 Lab3\wlsFilter.m
目录 0 2018-12-23 00:32 Lab3
----------- --------- ---------- ----- ----
20593 17
评论
共有 条评论