MATLAB Program to Implement LPF

clc;
a=imread('m.jpg');
f=rgb2gray(a);
s=size(f);
o=f;
fori=2:s(1)-1
for j=2:s(2)-1
        o(i,j)= (f(i-1,j-1)+f(i-1,j)+f(i-1,j+1)+f(i,j-1)+f(i,j)+f(i,j+1)+f(i+1,j-1)+f(i+1,j)+f(i+1,j+1))/9;
end;
end;
subplot(1,2,1);
imshow(f);
subplot(1,2,2);
imshow(o);

Output

Output

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.