%Code to introduce the concepts of
%filters 

clear
clc

% read the color image
Id = imread('trevi.jpg');
% convert to grayscale

I3 = rgb2gray(Id);

% Introduce noise

J = imnoise(I3,'salt & pepper',0.02);
%h=ones(5,5)/5;
h = fspecial('average', 10);
K = imfilter(J,h);
K1 = medfilt2(J);
%imshow(K)
figure
imshowpair(I3,K,'montage')
figure
imshow(K)
figure
imshowpair(J,K1,'montage')
figure
