0% found this document useful (0 votes)
6 views3 pages

High Pass and Low Pass Filter Effects

The document describes two assignments involving high pass and low pass filtering of an image. In the first assignment, an ideal and Gaussian high pass filter are applied to an image to demonstrate their effects. In the second assignment, a low pass filter is applied to an image to demonstrate ringing effects and how a Butterworth filter can avoid this.

Uploaded by

mohit kumar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views3 pages

High Pass and Low Pass Filter Effects

The document describes two assignments involving high pass and low pass filtering of an image. In the first assignment, an ideal and Gaussian high pass filter are applied to an image to demonstrate their effects. In the second assignment, a low pass filter is applied to an image to demonstrate ringing effects and how a Butterworth filter can avoid this.

Uploaded by

mohit kumar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Name: ANUJ SINGH

Roll No: BT17ECE016

ASSIGNMENT 6
Aim:
Program to demonstrate the effect of using Ideal high pass filter and Gaussian high pass filter.

code:
%BT17ECE016
%ANUJ SINGH
clc;
close all;
clear all;
an=double(imread('[Link]'));
F_u_v=fft2(an);
F_u_v=(fftshift(F_u_v));
subplot(3,3,1);imshow(uint8(an));
title('Image');
temp=log(abs(F_u_v));
subplot(3,3,2);
imshow(temp,[]);
title('Fourier domain image');
[M,N]=size(an);
u = 0:(M - 1);
v = 0:(N - 1);
idx = find(u > M/2);
u(idx) = u(idx) - M;
idy = find(v > N/2);
v(idy) = v(idy) - N;
[V, U] = meshgrid(v, u);
D = sqrt(U.^2 + V.^2);
D0=5;
H =ifftshift(double(D <=D0));
Hp=1-H;
g=real(ifft2(Hp.*F_u_v));
subplot(3,3,3);imshow(uint8(abs(g)));
title('Image after filtering');
subplot(3,3,4);imshow(Hp,[]);
title('Highpass filter with cutoff=5');
D0=10;
H= ifftshift(exp(-(D.^2)./(2*(D0^2))));
Hgh=1-H;
g=real(ifft2(Hgh.*F_u_v));
subplot(3,3,5);imshow(uint8(abs(g)));
title('Image after filtering');
subplot(3,3,6);imshow(Hgh,[]);
title('Gaussian Highpass filtered image');
OUTPUTS:

ASSIGNMENT 7
Aim:
Program to demonstrate the effect of ringing effect in an image by using a low pass filter also
how it can be avoided.

code:

%BT17ECE016
%ANUJ SINGH
clc
clear all
close all
an=imread('[Link]');
);
a=imresize(an,[256 256]);
af=fftshift(fft2(a));
subplot(331);
fftshow(af)
title('Image
'Image in frequency domain'
domain');
[x,y]=meshgrid(-128:127,
128:127,-128:127);
z=sqrt(x.^2+y.^2);
c=z<24;
af1=af.*c;
subplot(332)
fftshow(af1)
title('Low pass filter image');
afi=ifft2(af1);
subplot(333)
ifftshow(afi)
title('Filtered image');
lp=butterip(a,15,1);
aflp=af.*lp;
af=ifft2(aflp);
subplot(335)
ifftshow(af)
title('butterworth results');

OUTPUTS:

You might also like