% %高斯卷积,模板大小对卷积结果的影响
% %模板越大,图像越模糊。
f=rgb2gray(imread('lena.bmp'));
g1=fspecial('gaussian',[3 3],3);
g2=fspecial('gaussian',[5 5],3);
g3=fspecial('gaussian',[9 9],3);
image1=imfilter(f,g1,'replica');
image2=imfilter(f,g2,'replica');
image3=imfilter(f,g3,'replica');
subplot(1,4,1)
imshow(f)
subplot(1,4,2)
imshow(image1)
subplot(1,4,3)
imshow(image2)
subplot(1,4,4)
imshow(image3)
%高斯卷积,sigma对卷积结果的影响
%sigma大的图像越模糊。
f=rgb2gray(imread('lena.bmp'));
g1=fspecial('gaussian',[5 5],0.001);
g2=fspecial('gaussian',[5 5],1);
g3=fspecial('gaussian',[5 5],1000);
image1=imfilter(f,g1,'replica');
image2=imfilter(f,g2,'replica');
image3=imfilter(f,g3,'replica');
subplot(1,4,1)
imshow(f)
subplot(1,4,2)
imshow(image1)
subplot(1,4,3)
imshow(image2)
subplot(1,4,4)
imshow(image3)