You are on page 1of 11

Fourier Transform: a review

CoE4TN3
• Basic ideas:
Image Processing ¾ A periodic function can be
represented by the sum of
Image Enhancement in sines/cosines functions of
different frequencies,
Freq enc Domain
Frequency multiplied by a different
coefficient.
¾ Non-periodic functions can
also be represented as the
integral of sines/cosines
multiplied by weighing
function.

Image Enhancement Joseph Fourier


(1768-1830)

Fourier was obsessed


with the physics of
Original image Enhanced image heat and developed
the Fourier transform
Enhancement: to process an image for more theory to model heat-
suitable output for a specific application. flow problems.

2 5

Image Enhancement
Fourier transform
basis functions
• Image enhancement techniques:
¾ Spatial domain methods
¾ Frequency domain methods

• S
Spatial
i l (time)
( i ) domain
d i techniques
h i are techniques
h i that
h
operate directly on pixels.
Approximating a
• Frequency domain techniques are based on modifying
square wave as the
the Fourier transform of an image.
sum of sine waves.

3 6

1
Any function can be written as the Fourier Series
sum of an even and an odd function
So if f(t) is a general function, neither even nor
E ( x) ≡ [ f ( x ) + f ( − x)] / 2 odd, it can be written:
∞ ∞
1 1
E(-x) = E(x)
f (t ) =
π
∑ m =0
Fm cos(mt ) +
π
∑ m =0
Fm′ sin(mt )
O ( x) ≡ [ f ( x ) − f ( − x)] / 2
Even component Odd component
O(-x) = -O(x)
⇓ where the Fourier series is

f ( x) = E ( x) + O( x)
Fm =
∫ f (t) cos(mt) dt Fm′ =
∫ f (t) sin(mt) dt

7 10

Fourier Cosine Series The Fourier Transform


Because cos(mt) is an even function, we can write an Let F(m) incorporates both cosine and sine series coefficients,
even function, f(t), as: with the sine series distinguished by making it the imaginary
component:

∑F
1
f(t) = cos(mt) F (m) = Fm − jFm' = ∫ f (t ) cos(mt )dt − j ⋅ ∫ f (t ) sin( mt )dt
π m
m =0
where series Fm is computed as Let’ss now allow f(t) range from –∞ to ∞, we rewrite:
Let

π
ℑ{ f (t )} = F (u ) = ∫ f (t ) exp(− j 2πut )dt
Fm =

−π
f (t ) cos(mt) dt −∞

F(u) is called the Fourier Transform of f(t). We say that f(t)


Here we suppose f(t) is over the interval (–π,π). lives in the “time domain,” and F(u) lives in the “frequency
domain.” u is called the frequency variable.
8 11

Fourier Sine Series The Inverse Fourier Transform

Because sin(mt) is an odd function, we can write any We go from f(t) to F(u) by
odd function, f(t), as: ∞
Fourier
ℑ{ f (t )} = F (u ) = ∫ f (t ) exp(− j 2πut )dt


1 Transform
f (t) = Fm′ sin(mt) −∞
π
m= 0

Given F(u), f(t) can be obtained by the inverse Fourier


where the series F’m is computed as transform
π
∞ Inverse
Fm′ =
∫ f (t ) sin(mt ) dt
−π
ℑ−1 {F (u )} = f (t ) = ∫ F (u ) exp( j 2πut )du
−∞
Fourier
Transform

9 12

2
2-D Fourier Transform Discrete Fourier Transform (DFT)
• The discrete Fourier transform pair that applies to
Fourier transform for f(x,y) with two variables sampled functions is given by:

∞ ∞
ℑ{ f ( x, y )} = F (u, v) = ∫ ∫ f ( x, y ) exp(− j 2π (ux + vy ))dxdy M −1
−∞ −∞
1
F (u ) =
M
∑ f ( x) exp(− j 2πux / M )
x =0
uu=0
0,1,2,…,M
1 2 M-1 1
and the inverse Fourier transform
and
∞ ∞
ℑ−1{F (u , v)} = f ( x, y ) = ∫ ∫ F (u , v) exp( j 2π (ux + vy ))dudv M −1
−∞ −∞ f ( x) = ∑ F (u ) exp( j 2πux / M ) x=0,1,2,…,M-1
u =0

13 16

Discrete Fourier Transform (DFT) 2-D Discrete Fourier Transform

• A continuous function f(x) is discretized as: • In 2-D case, the DFT pair is:
{ f ( x0 ), f ( x0 + Δx), f ( x0 + 2Δx),..., f ( x0 + ( M − 1)Δx)}
M −1 N −1
1
F (u, v) =
MN
∑∑ f ( x, y) exp(− j 2π (ux / M + vy / N ))
x =0 y = 0

u=0,1,2,…,M-1
012 1 andd v=0,1,2,…,N-1
012 1
and:
M −1 N −1
f ( x, y ) = ∑∑ F (u , v) exp( j 2π (ux / M + vy / N ))
u =0 v =0

x=0,1,2,…,M-1 and y=0,1,2,…,N-1


14 17

Discrete Fourier Transform (DFT) Polar Coordinate Representation of FT

Let x denote the discrete values (x=0,1,2,…,M-1), • The Fourier transform of a real function is generally
i.e. complex and we use polar coordinates:

f ( x) = f ( x0 + xΔx) F (u , v) = R (u, v) + j ⋅ I (u, v)


then Polar coordinate

{ f ( x0 ), f ( x0 + Δx), f ( x0 + 2Δx),..., f ( x0 + ( M − 1)Δx)} F (u , v) = F (u , v) exp( jφ (u, v))


Magnitude: F (u , v) = [ R 2 (u, v) + I 2 (u , v)]1/ 2
⎡ I (u, v) ⎤
{ f (0), f (1), f (2),..., f ( M − 1)} Phase: φ (u, v) = tan −1 ⎢ ⎥
⎣ R(u, v) ⎦
15 18

3
Fourier Transform: shift Edge Effect on FT

• It is common to multiply input image by (-1)x+y prior to


computing the FT. This shift the center of the FT to (M/2,N/2). Periodic signal

ℑ{ f ( x, y )} = F (u, v)
ℑ{ f ( x, y )(−1) x + y } = F (u − M / 2, v − N / 2)

Shift

19 22

Symmetry of FT Edge Effect

• For real image f(x,y), FT is conjugate symmetric:

F (u , v) = F * (−u , −v)
• The magnitude of FT is symmetric:

F (u , v) = F (−u , −v)

20 23

Simple Cases Magnitude (how much) & Phase (where)

21 24

4
Image Frequency Domain
(log magnitude)
FT v Detail

u
IFT

General
appearance

25 28

IFT

5% 10 % 20 % 50 %

IFT

26 29

Frequency Domain Filtering


The central part of FT, i.e.
the low frequency
components are responsible
for the general gray-level
appearance of an image.

The high frequency


components of FT are
responsible for the detail
information of an image.

27 30

5
Frequency Domain Filtering Ideal low-pass filter (ILPF)

• Edges and sharp transitions (e.g., noise) in an


⎧1 D(u, v) ≤ D0
image contribute significantly to high-frequency H (u, v) = ⎨
content of FT. ⎩0 D(u, v) > D0
• Low frequency contents in the FT are responsible
D (u , v) = [(u − M / 2) 2 + (v − N / 2) 2 ]1/ 2
to the general appearance of the image over
smooth areas.
(M/2,N/2): center in frequency domain
• Blurring (smoothing) is achieved by attenuating
range of high frequency components of FT. D0 is called the cutoff frequency.

31 34

Convolution Theorem Shape of ILPF


Multiplication in
G(u,v)=F(u,v)●H(u,v) Frequency Domain

g(x,y)=h(x,y)*f(x,y) Convolution in
Time Domain
– f(x
f(x,y)
y) is the input image
– g(x,y) is the filtered
Frequency domain
– h(x,y): impulse response
• Filtering in Frequency Domain with H(u,v) is
equivalent to filtering in Spatial Domain with f(x,y). Spatial domain

32 35

Examples of Filters
FT

Frequency
domain
ringing
and
Ideal in frequency g
blurring
Gaussian lowpass filter Gaussian highpass filter domain means
non-ideal in
Spatial
domain spatial domain,
vice versa.

33 36

6
Butterworth Lowpass Filters (BLPF) Gaussian Lowpass Filters (GLPF)
• Smooth transfer function, 1
• Smooth transfer function,
no sharp discontinuity, H (u, v) = 2n smooth impulse −
D 2 ( u ,v )
⎡ D(u , v) ⎤
H (u, v) = e 2 D 0
2
no clear cutoff 1+ ⎢ ⎥ response, no ringing
frequency. ⎣ D0 ⎦

1
2

37 40

Butterworth Lowpass Filters (BLPF) GLPF

Frequency
domain

n=11 n=22 n=55 n=20


20
Gaussian lowpass filter

Spatial
1 domain
H (u, v) = 2n
⎡ D(u , v) ⎤
1+ ⎢ ⎥
⎣ D0 ⎦
38 41

No serious
ringing No ringing
artifacts artifacts

39 42

7
Examples of Lowpass Filtering

43 46

Examples of Lowpass Filtering High-pass Filters

Low-pass filter H(u,v)

Original image and its FT Filtered image and its FT

44 47

Sharpening High-pass Filters Ideal High-pass Filtering


• Hhp(u,v)=1-Hlp(u,v) ringing artifacts
⎧1 D(u, v) > D0
• Ideal: H (u, v) = ⎨
⎩0 D(u, v) ≤ D0

1
• Butterworth: | H (u , v) |2 = 2n
⎡ D0 ⎤
1+ ⎢ ⎥
⎣ D (u , v ) ⎦
2
( u ,v ) / 2 D02
• Gaussian: H (u, v) = 1 − e − D

45 48

8
Butterworth High-pass Filtering Laplacian in Frequency Domain

∂ 2 f ( x , y ) ∂ 2 f ( x, y )
ℑ[ + ] = −(u 2 + v 2 ) F (u, v)
∂x 2 ∂y 2

H1 (u, v ) = −(u 2 + v 2 )
Frequency
Spatial domain
∂ f
2
∂ f domain
2
∇2 f = + Laplacian operator
∂x 2 ∂y 2

49 52

Gaussian High-pass Filtering

50 53

Gaussian High-pass Filtering Subtract Laplacian from the Original


Image to Enhance It

enhanced Original Laplacian


image image output

Spatial g ( x , y ) = f ( x , y ) − ∇ 2 f ( x, y )
domain
Gaussian filter H(u,v) Frequency
Original image G (u , v) = F (u , v) + (u 2 + v 2 ) F (u , v)
domain
new operator H 2 (u , v) = 1 + (u 2 + v 2 ) = 1 − H 1 (u , v)
Filtered image and its FT Laplacian

51 54

9
An image formation model
• We can view an image f(x,y) as a product of two
components:
f ∇2 f
f (x , y ) = i (x , y ) ⋅ r (x , y )
0 < i( x, y ) < ∞
0 < r(x, y) < 1

• i(x,y): illumination. It is determined by the


illumination source.
f − ∇2 f • r(x,y): reflectance (or transmissivity). It is
determined by the characteristics of imaged objects.

55 58

Unsharp Masking, High-boost Filtering Homomorphic Filtering

• Unsharp masking: fhp(x,y)=f(x,y)-flp(x,y)


• In some images, the quality of the image has reduced
• Hhp(u,v)=1-Hlp(u,v) because of non-uniform illumination.
• Homomorphic filtering can be used to perform
One more
illumination correction.
• Hi
High-boost
h b t filtering:
filt i parameter to
adjust the
fhb(x,y)=Af(x,y)-flp(x,y) enhancement f (x , y ) = i (x , y ) ⋅ r (x , y )

• fhb(x,y)=(A-1)f(x,y)+fhp(x,y) • The above equation cannot be used directly in order


to operate separately on the frequency components of
• Hhb(u,v)=(A-1)+Hhp(u,v) illumination and reflectance.

56 59

Homomorphic Filtering
ln : z(x, y) = ln f (x, y) = ln i(x, y) + ln r (x, y)
DFT : Z (u , v ) = F i (u , v ) + F r (u , v )
H(u,v) : S ( u , v ) = H ( u , v ) Z (u , v )
(DFT)-1 : s ( x, y ) = i ' ( x, y ) + r ' ( x, y )
exp : g ( x, y ) = e s ( x , y ) = i0 ( x, y ) r0 ( x, y )

57 60

10
Homomorphic Filtering Homomorphic Filtering: Example 2

• By separating the illumination and reflectance


components, homomorphic filter can then
operate on them separately.
• Illumination component of an image generally
has slow variations,
variations while the reflectance
component vary abruptly.
• By removing the low frequencies (highpass
filtering) the effects of illumination can be
removed . Original image Filtered image

61 64

Homomorphic Filtering

End of Lecture

62 65

Homomorphic Filtering: Example 1

63

11

You might also like