+ All Categories
Home > Technology > Implementation and comparison of Low pass filters in Frequency domain

Implementation and comparison of Low pass filters in Frequency domain

Date post: 10-Feb-2017
Category:
Upload: zara-tariq
View: 20 times
Download: 0 times
Share this document with a friend
49
IMPLEMENTATION AND COMPARISON OF LOW PASS FILTERS IN FREQUENCY DOMAIN PRESENTERS: ZARA TARIQ 1573119 SAPNA KUMARI 1573131
Transcript
Page 1: Implementation and comparison of Low pass filters in Frequency domain

IMPLEMENTATION AND COMPARISON OF LOW PASS FILTERS IN FREQUENCY DOMAIN

PRESENTERS:ZARA TARIQ 1573119SAPNA KUMARI 1573131

Page 2: Implementation and comparison of Low pass filters in Frequency domain

AGENDA Introduction Low Pass Filters Comparison Between Types of LPF Implementation of LPF Demonstration of Implementation in MATLAB

Page 3: Implementation and comparison of Low pass filters in Frequency domain

INTRODUCTION - FILTERS IN FREQENCY DOMAINImage filtering in frequency domain can be grouped in three, depending on the effects:

2. High pass filters (sharpening filters)3. Notch Filters (band-stop filters)

1. Low pass filters (smoothing filters)

Page 4: Implementation and comparison of Low pass filters in Frequency domain

LOW PASS FILTERS (LPF)Why Is It Used?: Creates a blurred (or smoothed) image Reduces the high frequencies and leave the low frequencies of the

Fourier transformation to relatively unchanged

How Does It Works? Low frequency components correspond to slow changes in images Used to remove high spatial frequency noise from a digital image The low-pass filters usually employ moving window operator which

affects one pixel of the image at a time, changing its value by some function of a local region (window) of pixels.

The operator moves over the image to affect all the pixels in the image.

Page 5: Implementation and comparison of Low pass filters in Frequency domain

COMPARISON BETWEEN TYPES OF LPFIdeal LPF: Cuts off all components that are greater than distance Do from center

Butterworth LPF: The transfer function of a Butterworth low pass filter of order n with cut-off

frequency at distance D0 from the origin No clear cut-off between passed & filtered frequencies

Gaussian LPF: Does not have sharp discontinuity Transfer function is smooth, like Butterworth filter

Page 6: Implementation and comparison of Low pass filters in Frequency domain

nDvuDvuH 2

0 ]/),([11),(

Ideal LPF

Butterworth LPF

Gaussian LPF

Page 7: Implementation and comparison of Low pass filters in Frequency domain

IMPLEMENTATION OF ALL TYPES OF LPF

EXAMPLE 1 - NOISY BIRD IMAGE

Page 8: Implementation and comparison of Low pass filters in Frequency domain

Original Image of noisy miner bathing image

Page 9: Implementation and comparison of Low pass filters in Frequency domain

Result of Ideal Low Pass Filter

Page 10: Implementation and comparison of Low pass filters in Frequency domain

Result of Butterworth Low Pass Filter

Page 11: Implementation and comparison of Low pass filters in Frequency domain

Result of Gaussian Low Pass Filter

Page 12: Implementation and comparison of Low pass filters in Frequency domain

Result of Butterworth Low Pass Filter Result of Gaussian Low Pass Filter

Original Image Result of Ideal Low Pass Filter

Fourier Spectrum of Bird Image

Page 13: Implementation and comparison of Low pass filters in Frequency domain

Result of Butterworth Low Pass Filter Result of Gaussian Low Pass Filter

Original Image Result of Ideal Low Pass Filter

Spectrum of Bird Image

Page 14: Implementation and comparison of Low pass filters in Frequency domain

IMPLEMENTATION OF ALL TYPES OF LPF

EXAMPLE 2 - SIBERIAN HUSKY FOX IMAGE

Page 15: Implementation and comparison of Low pass filters in Frequency domain

Original Image of Siberian Husky Fox image

Page 16: Implementation and comparison of Low pass filters in Frequency domain

Result of Ideal Low Pass Filter

Page 17: Implementation and comparison of Low pass filters in Frequency domain

Result of Butterworth Low Pass Filter

Page 18: Implementation and comparison of Low pass filters in Frequency domain

Result of Gaussian Low Pass Filter

Page 19: Implementation and comparison of Low pass filters in Frequency domain

Result of Butterworth Low Pass Filter Result of Gaussian Low Pass Filter

Original Image Result of Ideal Low Pass Filter

Fourier Spectrum of Siberian Husky Fox Image

Page 20: Implementation and comparison of Low pass filters in Frequency domain

Result of Butterworth Low Pass Filter Result of Gaussian Low Pass Filter

Original Image Result of Ideal Low Pass Filter

Spectrum of Siberian Husky Fox Image

Page 21: Implementation and comparison of Low pass filters in Frequency domain

IMPLEMENTATION OF ALL TYPES OF LPF

EXAMPLE 3 - ROSE FLOWER IMAGE

Page 22: Implementation and comparison of Low pass filters in Frequency domain

Original Image of Rose Flower image

Page 23: Implementation and comparison of Low pass filters in Frequency domain

Result of Ideal Low Pass Filter

Page 24: Implementation and comparison of Low pass filters in Frequency domain

Result of Butterworth Low Pass Filter

Page 25: Implementation and comparison of Low pass filters in Frequency domain

Result of Gaussian Low Pass Filter

Page 26: Implementation and comparison of Low pass filters in Frequency domain

Result of Butterworth Low Pass Filter Result of Gaussian Low Pass Filter

Original Image Result of Ideal Low Pass Filter

Fourier Spectrum of Rose Flower Image

Page 27: Implementation and comparison of Low pass filters in Frequency domain

Result of Butterworth Low Pass Filter Result of Gaussian Low Pass Filter

Original Image Result of Ideal Low Pass Filter

Spectrum of Rose Flower Image

Page 28: Implementation and comparison of Low pass filters in Frequency domain

IMPLEMENTATION OF ALL TYPES OF LPF

EXAMPLE 4 - CAT IMAGE

Page 29: Implementation and comparison of Low pass filters in Frequency domain

Original Image of Wild Cat image

Page 30: Implementation and comparison of Low pass filters in Frequency domain

Result of Ideal Low Pass Filter

Page 31: Implementation and comparison of Low pass filters in Frequency domain

Result of Butterworth Low Pass Filter

Page 32: Implementation and comparison of Low pass filters in Frequency domain

Result of Gaussian Low Pass Filter

Page 33: Implementation and comparison of Low pass filters in Frequency domain

Result of Butterworth Low Pass Filter Result of Gaussian Low Pass Filter

Original Image Result of Ideal Low Pass Filter

Fourier Spectrum of Wild Cat Image

Page 34: Implementation and comparison of Low pass filters in Frequency domain

Result of Butterworth Low Pass Filter Result of Gaussian Low Pass Filter

Original Image Result of Ideal Low Pass Filter

Spectrum of Wild Cat Image

Page 35: Implementation and comparison of Low pass filters in Frequency domain

IMPLEMENTATION OF ALL TYPES OF LPF

EXAMPLE 5 - MOVIE POSTER IMAGE

Page 36: Implementation and comparison of Low pass filters in Frequency domain

Original Image of Movie Poster image

Page 37: Implementation and comparison of Low pass filters in Frequency domain

Result of Ideal Low Pass Filter

Page 38: Implementation and comparison of Low pass filters in Frequency domain

Result of Butterworth Low Pass Filter

Page 39: Implementation and comparison of Low pass filters in Frequency domain

Result of Gaussian Low Pass Filter

Page 40: Implementation and comparison of Low pass filters in Frequency domain

Result of Butterworth Low Pass Filter Result of Gaussian Low Pass Filter

Original Image Result of Ideal Low Pass Filter

Fourier Spectrum of Movie Poster Image

Page 41: Implementation and comparison of Low pass filters in Frequency domain

Result of Butterworth Low Pass Filter Result of Gaussian Low Pass Filter

Original Image Result of Ideal Low Pass Filter

Spectrum of Movie Poster Image

Page 42: Implementation and comparison of Low pass filters in Frequency domain

DEMONSTRATION OF IMPLEMENTATION IN

MATLAB

Page 43: Implementation and comparison of Low pass filters in Frequency domain

APPENDIX – MATLAB CODELow Pass Filter Function

H = lpfilter(type, M, N, D0, n)

[U, V] = dftuv(M, N);

D = sqrt(U.^2 + V.^2);

switch type

case 'ideal'

H = double(D <=D0);

case 'btw'

if nargin == 4

n = 1;

end

H = 1./(1 + (D./D0).^(2*n));

case 'gaussian'

H = exp(-(D.^2)./(2*(D0^2)));

otherwise

error('Unknown filter type.')

end

Page 44: Implementation and comparison of Low pass filters in Frequency domain

APPENDIX – MATLAB CODEIdeal Low Pass Filter

fox=imread('fox.jpg');

fox=rgb2gray(fox);

imshow(fox)

PQ = paddedsize(size(fox));

D0 = 0.05*PQ(1);

H = lpfilter('ideal', PQ(1), PQ(2), D0);

F=fft2(double(fox),size(H,1),size(H,2));

LPFS_fox = H.*F;

LPF_fox=real(ifft2(LPFS_fox));

LPF_fox=LPF_fox(1:size(fox,1), 1:size(fox,2));

figure, imshow(LPF_fox, [])

Fc=fftshift(F);

Fcf=fftshift(LPFS_fox);

S1=log(1+abs(Fc));

S2=log(1+abs(Fcf));

figure, imshow(S1,[])

figure, imshow(S2,[])

Page 45: Implementation and comparison of Low pass filters in Frequency domain

APPENDIX – MATLAB CODEButterworth Low Pass Filter

fox=imread('fox.jpg');fox=rgb2gray(fox);imshow(fox)PQ = paddedsize(size(fox));

D0 = 0.05*PQ(1);H = lpfilter('btw', PQ(1), PQ(2), D0);

F=fft2(double(fox),size(H,1),size(H,2));

LPFS_fox = H.*F;

LPF_fox=real(ifft2(LPFS_fox));

LPF_fox=LPF_fox(1:size(fox,1), 1:size(fox,2));figure, imshow(LPF_fox, [])

Fc=fftshift(F);Fcf=fftshift(LPFS_fox);S1=log(1+abs(Fc));S2=log(1+abs(Fcf));figure, imshow(S1,[])figure, imshow(S2,[])

Page 46: Implementation and comparison of Low pass filters in Frequency domain

APPENDIX – MATLAB CODEGaussian Low Pass Filter

fox=imread('fox.jpg');fox=rgb2gray(fox);imshow(fox)PQ = paddedsize(size(fox));D0 = 0.05*PQ(1);H = lpfilter('gaussian', PQ(1), PQ(2), D0);F=fft2(double(fox),size(H,1),size(H,2));LPFS_fox = H.*F;LPF_fox=real(ifft2(LPFS_fox));LPF_fox=LPF_fox(1:size(fox,1), 1:size(fox,2));figure, imshow(LPF_fox, [])Fc=fftshift(F);Fcf=fftshift(LPFS_fox);S1=log(1+abs(Fc));S2=log(1+abs(Fcf));figure, imshow(S1,[])figure, imshow(S2,[])

Page 47: Implementation and comparison of Low pass filters in Frequency domain

APPENDIX – MATLAB CODEMeshgrid Frequency Matrices.

function [U, V] = dftuv(M, N)

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);

Page 48: Implementation and comparison of Low pass filters in Frequency domain

APPENDIX – MATLAB CODEPadding for Fourier Transform

function PQ = paddedsize(AB, CD, PARAM)

if nargin == 1

PQ = 2*AB;

elseif nargin == 2 & ~ischar(CD)

PQ = AB + CD - 1;

PQ = 2 * ceil(PQ / 2);

elseif nargin == 2

m = max(AB);

P = 2^nextpow2(2*m);

PQ = [P, P];

elseif nargin == 3

m = max([AB CD]);

P = 2^nextpow2(2*m);

PQ = [P, P];

else

error('Wrong number of inputs.')

end

Page 49: Implementation and comparison of Low pass filters in Frequency domain

THANK YOU!


Recommended