You are on page 1of 48

Image Enhancement in

Frequency Domain
ASHISH GHOSH

Spatial Vs Frequency Domain

Spatial Domain

Frequency Domain

Fourier Series
Any function that periodically
repeats itself can be expressed
as the sum of sines and/or
cosines of different frequencies,
each multiplied by a different
coefficients.
This sum is called a Fourier
series.

Fourier Series

g (t ) = a0 + [an cos nw0t + bn sin nw0t ]


n =1

1
a0 =
T0
2
an =
T0
2
bn =
T0

t 0 +T0

g (t )dt

t0

t 0 +T0

g (t ) cos nw t dt
0

t0

t 0 +T0

g (t ) sin nw t dt
0

t0

Where T0 is the period.

Fourier Transform
A function that is not periodic but the area under its
curve is finite can be expressed as the integral of
sines and/or cosines multiplied by a weighing
function. The formulation in this case is Fourier
transform.

Fourier Transform
Fourier transform
Functions which are not periodic (but whose area under the curve is
finite) can be expressed as the integral of sines and/or cosines
multiplied by a weighting function
Its utility is greater than the Fourier series in most practical problems
A function, expressed in either as a Fourier series or a Fourier transform,
can be reconstructed (recovered) completely via an inverse process, with
no loss of information

Continuous One-Dimensional Fourier


Transform and Its Inverse

F (u ) =

f ( x)e j 2ux dx

f ( x) =

Where

j = 1

j 2ux
F
(
u
)
e
du

u is the frequency variable.


F (u) is composed of an infinite sum of sine and cosine terms
Each value of u determines the frequency of its corresponding
sine-cosine pair.

Continuous One-Dimensional Fourier


Transform and Its Inverse
Example

Find the Fourier transform of a gate function (t) defined by

1
( x) =
0

1
x<
2
1
x>
2

u
F (u ) = sinc

2
Fourier Spectrum

x
- 0.5

0.5
where sin c( x) =

sin( x)
x

Continuous One-Dimensional Fourier


Transform and Its Inverse
f(x)

-k

-K

-K

f(x)

x
-2K

2K

Discrete One-Dimensional Fourier


Transform and Its Inverse
A continuous function f(x) is discretized into a
sequence:

{ f ( x0 ), f ( x0 + x), f ( x0 + 2x),..., f ( x0 + [ M 1]x)}


by taking M samples x units apart.

Discrete One-Dimensional Fourier


Transform and Its Inverse

Discrete One-Dimensional Fourier


Transform and Its Inverse
Where

x assumes
(0,1,2,3,,M-1) then

the

discrete

values

f ( x) = f ( x0 + xx)
The sequence {f(0),f(1),f(2),f(M-1)} denotes any
M uniformly spaced samples from a continuous
function.

Discrete One-Dimensional Fourier


Transform and Its Inverse

1
F (u ) =
M
1
F (u ) =
M

f ( x) =

M 1

f ( x )e

j 2u

x
M

;u =[0,1,2, , M-1]

x =0

M 1

x =0

x
x

f ( x) cos 2u
j sin 2u
M
M

M 1

u =0

u
j 2 x
F (u )e M

; x =[0,1,2, , M-1]

Discrete One-Dimensional Fourier


Transform and Its Inverse
The values u = 0, 1, 2, , M-1 correspond to
samples of the continuous transform at values 0, u,
2u, , (M-1)u.
i.e. F(u) represents F(uu), where:

1
u =
Mx
Each term of the FT (F(u) for every u) is composed of
the sum of all values of f(x)

Discrete One-Dimensional Fourier


Transform and Its Inverse
The Fourier transform of a real function is generally
complex and we use polar coordinates:

F (u ) = R(u ) + jI (u )
F (u ) = F (u ) e

j ( u )

F (u ) = [ R 2 (u ) + I 2 (u )]1/ 2
I (u )
(u ) = tan

R
(
u
)

Discrete One-Dimensional Fourier


Transform and Its Inverse
|F(u)| (magnitude function) is the Fourier
spectrum of f(x) and (u) its phase angle.
The square of the spectrum
P(u ) = F (u ) = R 2 (u ) + I 2 (u )
2

is referred to as the Power Spectrum of f(x)


(spectral density).

Discrete Two-Dimensional Fourier


Transform and Its Inverse

1
F (u , v) =
MN
f ( x, y ) =

M 1N 1

f ( x,

x
y
j 2 ( u + v )
M N
y )e

x =0 y =0

M 1N 1

F (u, v)e

j 2 (

u
v
x+ y )
M
N

u =0 v =0

F (u , v) = R (u , v) + I (u , v)
2

Fourier Spectrum

1/ 2

Discrete 2-Dimensional Fourier Transform

Fourier spectrum:

F (u , v) = R (u , v) + I (u , v)

Phase:

I (u , v)
(u , v) = tan

R
(
u
,
v
)

Power spectrum:

1/ 2

P(u, v) = F (u, v) = R 2 (u , v) + I 2 (u , v)
2

Discrete Two-Dimensional Fourier


Transform and Its Inverse

1
F (u , v) =
MN
1
F (0,0) =
MN

M 1 N 1

f ( x, y)e

j 2 ( u

x
y
+v )
N
M

x =0 y =0

M 1N 1

f ( x, y )
x =0 y =0

F(0,0) is the average gray value of an image

Discrete Two-Dimensional Fourier


Transform and Its Inverse

Frequency Shifting Property of the Fourier


Transform

If f ( x) F (u ) then
f ( x )e

j 2u 0 x

f ( x, y ) e

F (u u0 )

j 2 ( u 0

x
y
+ v0 )
M
N

F (u u0 , v v0 )

Basic Filtering in the Frequency Domain

F f ( x, y )( 1)

1.
2.
3.
4.
5.
6.

x+ y

) = F (u M / 2, v N / 2)

Multiply the input image by (-1)x+y to center the transform


Compute F(u,v), the DFT of the image from (1)
Multiply F(u,v) by a filter function H(u,v)
Compute the inverse DFT of the result in (3)
Obtain the real part of the result in (4)
Multiply the result in (5) by (-1)x+y

FREQUENCY DOMAIN METHODS


DFT

H(u,v) is specified in
the frequency domain.
DFT

h(x,y) is specified in
the spatial domain.

Major Filter Categories


Typically, filters are classified by examining their
properties in the frequency domain:
(1) Low-pass
(2) High-pass

EXAMPLE

Original Signal
Low-Pass filtered output

High-Pass filtered output

Filtering out the DC Frequency Component

Filtering out the DC Frequency Component

Notch Filter

0
H (u , v) =
1

if u = M / 2, v = N / 2
otherwise

Low-pass and High-pass Filters


Low Pass Filter
attenuates high frequencies
while passing low
frequencies.

High Pass Filter


attenuates low frequencies
while passing high
frequencies.

Low-pass and High-pass Filters

Low-pass and High-pass Filters

Smoothing Frequency-Domain Filters

The basic model for filtering in the frequency domain

G (u , v) = H (u , v) F (u , v)
where F(u,v): the Fourier transform of the image to be
smoothed

H(u,v): a filter transfer function

Smoothing is fundamentally a lowpass operation in the frequency domain.

There are several standard forms of lowpass filters (LPF).


o Ideal lowpass filter
o Butterworth lowpass filter
o Gaussian lowpass filter

Smoothing Frequency Domain, Ideal Lowpass Filters

1
H (u , v) =
0

if D(u, v) D0
if D(u , v) > D0

D(u, v) = (u M / 2) + (v N / 2)
2

2 1/ 2

Smoothing Frequency Domain, Ideal Lowpass Filters

Total Power

M 1 N 1

f c = F (u , v)

u =0 v =0

The remained percentage


power after filtration

= 100 F (u, v) / f c
u v

Smoothing Frequency Domain, Ideal Lowpass Filters


fc =5
= 92%

fc =15
= 94.6%

fc =30
= 96.4%

fc =80
= 98%

fc =230
= 99.5%

Cause of Ringing

Smoothing Frequency Domain, Butterworth


Low-pass Filters

H (u , v) =

1 + [D(u , v) / D0 ]2 n

Smoothing Frequency Domain, Butterworth


Low-pass Filters
Butterworth Low-pass
Filter: n=2

Radii= 15

Radii= 80

Radii= 5

Radii= 30

Radii= 230

Smoothing Frequency Domain, Butterworth


Low-pass Filters

Smoothing Frequency Domain, Gaussian


Low-pass Filters

H (u , v) = e

D 2 ( u ,v ) / 2 D02

Smoothing Frequency Domain, Gaussian


Low-pass Filters
Gaussian Low-pass

Radii= 15

Radii= 80

Radii= 5

Radii= 30

Radii= 230

Smoothing Frequency Domain, Gaussian


Low-pass Filters

Smoothing Frequency Domain, Gaussian


Low-pass Filters

Smoothing Frequency Domain, Gaussian


Low-pass Filters

Sharpening Frequency Domain Filters

Hhp(u,v) = 1 - Hlp(u,v)

Sharpening Frequency Domain Filters

Sharpening Frequency Domain, Ideal Highpass Filters

0
H (u , v) =
1

if D(u , v) D0
if D (u , v) > D0

Sharpening Frequency Domain, Butterworth


High-pass Filters

H (u , v) =

1 + [D0 / D(u , v)]

2n

Sharpening Frequency Domain, Gaussian


High-pass Filters

H (u , v) = 1 e

D 2 ( u ,v ) / 2 D02

You might also like