function Noise_EdgeFilter (filename)
%write matlab function called "Noise_EdgeFilter" that accepts a string 
%(image file name) and displays images as shown in figure 1 
%(original image, image using Gaussian filter, Laplacian image and image 
%using Laplacian filter). 
%do the following steps with the input image:
%To reduce the noise use the low pass linear spatial filter "Gaussian"
%for edge detection use the high pass linear spatial filter "Laplacian"
%use fspecial matlab command to generate the filters mask

%Read and display the input image
f = imread(filename);
f = im2double(f);
subplot(2,2,1);
imshow(f,[]);
title('Input Image');

%Noise Reduction using Gaussian filter
h1 = fspecial('gaussian',[5 5],0.5); %create the Gaussian mask
g1 = imfilter(f,h1,'replicate');
subplot(2,2,2);
imshow(g1,[]);
title('image using Gaussian filter');

%Edge Detection using Laplacian filter
h2 =  fspecial('laplacian',0.5);
g2 = imfilter(g1,h2,'replicate');
subplot(2,2,3);
imshow(g2,[]);
title('Laplacian image');

g3 = g1 - g2;
subplot(2,2,4);
imshow(g3,[]);
title('image using Laplacian filter');





