clear;
[fname,pname]=uigetfile({'*.jpg';'*.bmp';'*.tif';'*.gif'},'Please choose a color picture...');% 返回打开的图片名与图片路径名
[u,v]=size(fname);
y=fname(v);% 图片格式代表值
switch y
case 0
errordlg('You Should Load Image File First...','Warning...');
case{'g';'G';'p';'P';'f';'F'} % 图片格式若是JPG/jpg、BMP/bmp、TIF/tif或者GIF/gif,才打开
I=cat(2,pname,fname);
Ori_Face=imread(I);
subplot(2,3,1),imshow(Ori_Face);
otherwise
errordlg('You Should Load Image File First...','Warning...');
end
p=rgb_RGB(Ori_Face); %肤色分割
subplot(2,3,2);imshow(p); % 显示皮肤灰度图像
low_pass=1/9*ones(3);
image_low=filter2(low_pass,p);% 低通滤波去噪声
subplot(2,3,3);imshow(image_low);