clear all;

%I = imread('../../Images/Matt.jpg');
I = imread('peppers.png');
I = rgb2gray(I);
%I = imread('../../Images/stepFunction.png');

% Add noise
gn = imnoise(I, 'gaussian'); % add noise
%gn = I; % or not

% Create box filter
box = ones(5,5) / 25;

% Create Gaussian filter
gauss = fspecial('gaussian', [5, 5], 1);

% smooth the image
boxSmooth = imfilter(gn,box, 'replicate');
gaussSmooth = imfilter(gn,gauss, 'replicate');
medSmooth = medfilt2(gn,[5 5]);

imtool(I); 
imtool(boxSmooth); 
imtool(gaussSmooth); 
imtool(medSmooth); 

if (0)
imwrite(g, 'gray_peppers.png');
imwrite(gn, 'gray_peppers_gauss.png');
imwrite(I2, 'gray_peppers_gauss_box.png');
imwrite(I3, 'gray_peppers_gauss_gauss.png');
end
