%%program for ideal low pass filtering
clc
close all;
clear all;
f=imread('sunset.jpg');
figure(1)
imshow(f);
title('original image')
x=rgb2gray(f);
figure(2)
imshow(x);
title('grayscale image')
[m,n]=size(x);
V=max(max(x));
x0=V/4;
for i=1:m
for j=1:n
if(x(i,j)<=x0)
g(i,j)=1;
else
g(i,j)=0;
end
end
end
figure(3)
imshow(g)
title('modified image')