%DIP Class Demo
%Shreekanth Mandayam, Rowan University
%
%Low Pass Spatial Filtering

close all; clear
%nois1pep: peppers image with zero mean, gaussian noise: 10dB SNR
load nois1pep.mat;
hlp=ones(3)*1/9;

figure(1);imshow(nois1pep);truesize;
title('Gaussian Noise; SNR=10dB');

pause;

figure(2);imshow(filter2(hlp,nois1pep));truesize;
title('3 x 3 Averaging Mask');

pause;

%%%%%%%%%%%%%%%%%%%%%%%%%
%nois2pep: peppers with salt&pepper noise, 0.009 density
load nois2pep.mat;
figure(3);imshow(nois2pep);truesize;
title('Salt & Pepper, Density=0.009')

pause;

figure(4);imshow(filter2(hlp,nois2pep));truesize;
title('3 x 3 Averaging Mask');

pause;

figure(5);imshow(medfilt2(nois2pep));truesize;
title('3 x 3 Median Filtered')
