%Lowpass Filters 
%Ideal 
HLPF_ideal=fftshift(lpfilter('ideal', 500, 500, 50)); 
mesh(HLPF_ideal(1:10:500,1:10:500));
title('Ideal Lowpass Filter');
colormap([0 0 0]) 
axis off 
grid off 
axis([0 50 0 50 0 1]) 
figure, imshow(HLPF_ideal)
title('Ideal Lowpass Filter');

%Butterworth 
HLPF_btw=fftshift(lpfilter('btw', 500, 500, 50)); 
figure, mesh(HLPF_btw(1:10:500,1:10:500))
title('Butterworth Lowpass Filter');
colormap([0 0 0]) 
axis off 
grid off 
axis([0 50 0 50 0 1]) 
figure, imshow(HLPF_btw)
title('Butterworth Lowpass Filter');


%Gaussian 
HLPF_gauss=fftshift(lpfilter('gaussian', 500, 500, 50)); 
figure, mesh(HLPF_gauss(1:10:500,1:10:500))
title('Gaussian Lowpass Filter');
colormap([0 0 0]) 
axis off 
grid off 
axis([0 50 0 50 0 1]) 
figure, imshow(HLPF_gauss) 
title('Gaussian Lowpass Filter');

%Highpass Filters
%Ideal 
HHPF_ideal=fftshift(hpfilter('ideal', 500, 500, 50)); 
mesh(HHPF_ideal(1:10:500,1:10:500)) 
title('Ideal Highpass Filter');
colormap([0 0 0]) 
axis off 
grid off 
axis([0 50 0 50 0 1]) 
figure, imshow(HHPF_ideal)
title('Ideal Highpass Filter');

%Butterworth 
HHPF_btw=fftshift(hpfilter('btw', 500, 500, 50)); 
figure, mesh(HHPF_btw(1:10:500,1:10:500))
title('Butterworth Highpass Filter');
colormap([0 0 0]) 
axis off 
grid off 
axis([0 50 0 50 0 1]) 
figure, imshow(HHPF_btw)
title('Butterworth Highpass Filter');

%Gaussian 
HHPF_gauss=fftshift(hpfilter('gaussian', 500, 500, 50)); 
figure, mesh(HHPF_gauss(1:10:500,1:10:500)) 
title('Gaussian Highpass Filter');
colormap([0 0 0]) 
axis off 
grid off 
axis([0 50 0 50 0 1]) 
figure, imshow(HHPF_gauss)
title('Gaussian Highpass Filter');

