clc;
n=3;sigma=1;theta=0;
[x]=imread('012.BMP');
filter1=d2gauss(n,sigma,theta);
y=imnoise(x,'gauss',0.01); f1=conv2(x,filter1,'same');
rf1=conv2(y,filter1,'same');
figure(1);
subplot(2,2,1);imagesc(x);title('原图');
subplot(2,2,2);imagesc(y);title('加噪图');
subplot(2,2,3);imagesc(f1);title('平滑图');
colormap(gray);