Download as pdf or txt
Download as pdf or txt
You are on page 1of 51

Digital Image Processing

Filtering in the Frequency Domain

Thanh-Hai Tran

Telecommunications Engineering Faculty


School of Electronics and Electrical Engineering
Hanoi University of Science and Technology
1 Dai Co Viet - Hanoi - Vietnam
Outline
n Background
n Basics of filtering in frequency domain
n Image Smoothing in frequency domain
n Image Sharpening in frequency domain
n References

2020 2
Outline
n Background
u Fourier transform
u Convolution

u Discret Fourier Transform

n Basics of filtering in frequency domain


n Image Smoothing in frequency domain
n Image Sharpening in frequency domain
n References

2020 3
Fourier Transform

n Fourier transform: a
continuous signal can be
represented as a
(countable) weighted
sum of sinusoids.

2020 4
Fourier Transform

n Fourier transform: a
continuous signal can be real(g(wx)) image(g(wx))
represented as a
(countable) weighted w =0
sum of sinusoids.
n 1-D continuous FT

w =7

2020 5
Convolution

n 2 continous functions f(t) and h(t)


n The convolution of these functions is defined as:
u Minus sign: flipping
u t: displacement needed to slide one function past the other

n Fourier transform

2020 6
Discret Fourier Transform

2020 7
Fourier transform of a sampled function

2020
Extracting one period of the transform

2020
DFT from Continous transform of a
sampled function
n Fourier transform of a sampled, band-limited function
from (-∞, ∞) is a continous, periodic function that
extend from (-∞, ∞)

n In pratice, we work with a finit number of samples M


taken over the period from 𝝁 = 𝟎 to 𝝁 = 𝟏/∆T

2020 10
Discrete convolution

n For x = 0, 1, 2, … M-1

n Extention to 2D signal

2020 11
Properties of 2D DFT

n Relationship between Spatial and Frequency Intervals


u ∆T and ∆Z separation between samples in spatial domain
u Then the separation between samples in frequency domain

n Translation and Rotation


u Translation

u Rotation

Rotating f(x,y) by an angle 𝜃! rotates F(u, v) by the same


angle
2020 12
Properties of 2D DFT

n Periodicity: k1 and k2 are integers

2020 13
Periodicity

2020
Fourier spectrum and Phase angle

n Fourier transform

n Fourier spectrum

n Phase angle

n Zero-frequency term:

2020 15
2D DFT of image

2020
Fourier spectrum

n F(0,0) is the largest component of the spectrum


n As frequency components u and v are 0 at origin,
F(0,0) is called the dc-component of the transform

2020 17
Phase angle

2020 18
Fourier spectrum and phase angle

n The component of spectrum determine the amplitudes


of the sinusoids that combine to form the resulting
image
n The phase is a measure of displacement of the
various sinusoids with respect to their origin
n

2020 19
Fourier spectrum and phase angle

2020
Convolution

n Convolution in spatial domain is product in frequency


domain

n Convolution in the frequency domain is analogous to


multiplication in spatial domain

2020 21
2D Fourier Transform

2020 22
From 1D to 2D

1D 2D

2020 23
Convolution of two discrete functions

2020
Example

25
2020
Example

2020
Outline
n Background
n Basics of filtering in frequency domain
u Characteristics
of frequency domain
u Frequency domain filtering fundamentals

u Summary step for filtering

u Correspondance between filtering in spatial and


frequency domains
n Image Smoothing in frequency domain
n Image Sharpening in frequency domain
n Reference
2020 27
2020
Filtering in the frequency domain

n Filtering

2020
Steps for filtering in frequency domain

2020
Zero padded filter and response

2020
Corresponding between Spatial and
Frequency filters

2020
observation 1: compacting energy

2020
observation 2: amplitude vs. phase

n Amplitude: relative prominence of sinusoids


2020 n Phase: relative displacement of sinusoids 34
another example: amplitude vs. phase

A = “Aron” P = “Phyllis”
FA = fft2(A) FP = fft2(P)

log(abs(FA)) log(abs(FP))

angle(FA) angle(FP)

ifft2(abs(FA), angle(FP)) ifft2(abs(FP), angle(FA))

Adpated from http://robotics.eecs.berkeley.edu/~sastry/ee20/vision2/vision2.html


2020 35
Filtering in the frequency domain

2020
Spatial filtering vs. Frequency fintering

2020
Outline
n Background
n Basics of filtering in frequency domain
n Image Smoothing in frequency domain
u IdealLowpass Filters
u Butterworth Lowpass Filters

u Gaussian Lowpass Filters

n Image Sharpening in frequency domain


n Reference

2020 38
Smoothing filters: Ideal low-pass

2020 39
Butterworth filters

2020
Gaussian filters

41
2020
Low-pass filter examples

2020
smoothing filter application 1

text enhancement

2020 43
smoothing filter application 2

beautify a photo

2020
DFT application #1: fast Convolution

? ?
O(N2)

Spatial filtering
f(x.y)*h(x.y)

2020 45
DFT application #1: fast convolution

O(N2¢log2N) O(N2) O(N2¢log2N)

Spatial filtering
f(x.y)*h(x.y)

O(N4)

2020 46
Outline
n Background
n Basics of filtering in frequency domain
n Image Smoothing in frequency domain
n Image Sharpening in frequency domain
u IdealHighpass Filters
u Butterworth Highpass Filters

u Gaussian Highpass Filters

n Reference

2020 47
High-pass filters

2020
Sobel operator in frequency domain

Question:
Sobel vs. other high-
pass filters?
Spatial vs frequency
domain
2020 49
High-pass filter examples

50
2020
References

n Chapter 4 – Digital Image Processing


n Slide - Lexing Xie –
http://www.ee.columbia.edu/~xlx/ee4830

2020 51

You might also like