除少像素连通区域Рse=strel('disk',1);Рregion1=imdilate(region1,se);%膨胀作用Рsubplot(2,2,1);imshow(x);title('原始图像');Рsubplot(2,2,2);imshow(y);title('进行中值滤波后灰度图像');Рsubplot(2,2,3):imshow(region);title('确定皮肤区域后图像');Рsubplot(2,2,4);imshow(region1);title('去除少像素连通区域后图像');Р6.Filename:Histogram matchingРs=imread('MoonPhobos.tiff');Р[m,n]=size(s);Рnum=m*n;Рr=zeros(1,256);Рe=zeros(1,256);Рd=zeros(size(s));Рfor i=1:mР for j=1:nР r(s(i,j)+1)=r(s(i,j)+1)+1; %原图像概率密度Р endРendРr=r./num;Рfor i=1:mР for j=1:iР e(i)=e(i)+r(j); %累积分布Р endРendРfor i=1:256Р e(i)=floor(e(i)*255+0.5); %映射关系РendРfor i=1:mР for j=1:nР d(i,j)=e(s(i,j)+1);Р endРendРs=uint8(s);Рd=uint8(d);Рsubplot(2,2,1);Рimshow(s);Рtitle('source');Рsubplot(2,2,2);Рimhist(s);Рtitle('histogram of source');Рsubplot(2,2,3);Рimshow(d);Рtitle('dest');Рsubplot(2,2,4);