📄 smoothimage.m
字号:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% function smoothImage()
% z.li, 12-16-2003.
% smooth image with wavelet filters
% function dependency:
% - n/a
% input:
% img - facial images
% h - smoothing daubcheis filter
% output:
% face - facial area sub image
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [face]=smoothImage(img, h)
dbg = 'n';
if dbg == 'y'
h = daub(9);
truth = load('faGndTruth.dat');
[img]=showFeretFace(truth, 618);
w = 12; h = 16;
end
face = img;
[fh fw]=size(face);
npad = 7;
for y=1:fh % row filtering
row = double(face(y,:)); row = pad(row, npad);
frow = filter(h, [2], row);
face(y,:) = frow(npad+2:npad+2+fw-1);
end
for x=1:fw % col filtering
col = double(face(:,x))'; col = pad(col, npad);
fcol = filter(h, [2], col);
face(:,x) = fcol(npad+2:npad+2+fh-1);
end
if dbg == 'y'
figure;
err = double(face) - double(img);
subplot(2,2,1); imshow(img, 256);
subplot(2,2,2); imshow(face, 256);
subplot(2,2,3); imagesc(err);
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -