frequency domain filtering of digital images

120
Filtering in Frequency Domain Upendra Indian Institute of Information Technology, Allahabad Image and Video Processing February 26, 2017 Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video ProcessingFiltering in Frequency Domain February 26, 2017 1 / 120

Upload: upendra-pratap-singh

Post on 12-Apr-2017

72 views

Category:

Engineering


6 download

TRANSCRIPT

Page 1: Frequency Domain Filtering of Digital Images

Filtering in Frequency Domain

Upendra

Indian Institute of Information Technology, Allahabad

Image and Video Processing

February 26, 2017

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 1 / 120

Page 2: Frequency Domain Filtering of Digital Images

Background ITime Domain and Frequency Domain Analysis

Time Domain Analysis

1 Applications: predictions, fitting regression models etc[7].

2 Different types of equipments in each field

Frequency Domain Analysis

1 Motivation: conversion of complex differentials into polynomialequations

2 Inverse transform feasible (take care of rules though)

3 Different transforms like Fourier, Laplace, Z etc.

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 2 / 120

Page 3: Frequency Domain Filtering of Digital Images

Periodic Signals I

1 A signal f (t) that satisfies

f (t) = f (t + T ) ∀t ⊆ < (1)

2 In general,

f (t) = f (t ± T ) = f (t ± 2T ) = ... = f (t ± nT ) (2)

3 T fixed called period

4 Smallest value of T called Principal Period

5 Principal period Vs Period ?

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 3 / 120

Page 4: Frequency Domain Filtering of Digital Images

Background I

1 Proposed by French mathematician Jean Baptise Joseph Fourier [2]

2 Any periodic signal = sum of sines and/or cosines terms of differentfrequencies.

3 Each term multiplied by a coefficient

4 Coefficients value determines the term’s contribution [3].

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 4 / 120

Page 5: Frequency Domain Filtering of Digital Images

Dirichlet Conditions I

1 Named after Peter Gustav Lejeune Dirichlet [6].

2 Provides sufficient conditions for a real valued signal to be equal to itsfourier series sum

3 Conditions are

Signal must be absolutely integrable over a period

Finite number of extrema points in any given interval

Finite number of discontinuities in any given interval

4 Such a function is said to have a bounded variation over a period [6]

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 5 / 120

Page 6: Frequency Domain Filtering of Digital Images

Definition IFourier Series [2][3][5]

A signal f(t) of a continuous variable ’t’ that is periodic with period ’T’,can be expressed as

f (t) =∞∑

n=−∞cn e j

2πnT

t (3)

where

cn =

∫ T2

−T2

f (t) e−j2πnT

t for n = 0,±1,±2.... (4)

are the coefficients.

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 6 / 120

Page 7: Frequency Domain Filtering of Digital Images

Background ICharacteristics of Fourier Series Representation [2]

1 Holds good for all functions (complication immaterial)

2 The original function can be reconstructed completely; hence, alossless transformation[1][2]

3 Flexibility in terms of domain switch

4 Industries and Academic institutions alike

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 7 / 120

Page 8: Frequency Domain Filtering of Digital Images

Problem-01 IFind the Fourier Series Coefficients of the following signal:

Figure: Calculation of Fourier Series Coefficients for the above signal

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 8 / 120

Page 9: Frequency Domain Filtering of Digital Images

Problem-02 IFind the Fourier Series Coefficients of the following signal:

Figure: Calculation of Fourier Series Coefficients for the above signal

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 9 / 120

Page 10: Frequency Domain Filtering of Digital Images

Properties of Fourier Series [1][2][3] I

Assuming

x(t) ⇐⇒ {cn} ; y(t) ⇐⇒ {dn} (5)

Linearity

Ax(t) + By(t)⇐⇒ {Acn + Bdn} (6)

Multiplication

x(t)y(t)⇐⇒ {∞∑

k=−∞ckdn−k} (7)

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 10 / 120

Page 11: Frequency Domain Filtering of Digital Images

Properties of Fourier Series I

Time Shifting

x(t − t0)⇐⇒ {e−j2πnt0

T cn} (8)

Time Reversalx(−t)⇐⇒ {c−n} (9)

Conjugationx∗(t)⇐⇒ {c∗−n} (10)

Time Scaling property

x(at)⇐⇒∞∑

n=−∞cne

j2πn(at)T (11)

Time scaling, thus, changes the frequency components [3].

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 11 / 120

Page 12: Frequency Domain Filtering of Digital Images

Impulse functions and Time Shift Property IDefinition

δ(t) =

{1, if t = 0,

0, if t 6= 0.(12)

Subjected to, ∫ ∞−∞

δ(t)dt = 1 (13)

Physical Interpretation A spike of infinite amplitude and zero duration,having a unit area [2].

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 12 / 120

Page 13: Frequency Domain Filtering of Digital Images

Impulse functions and Time Shift Property IIDefinition

Figure: Plot of an Impulse Function

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 13 / 120

Page 14: Frequency Domain Filtering of Digital Images

Time Shift Property-Continuous Domain I

1 The impulse function has got a time shift property (wrt integration)given by [2][4], ∫ ∞

−∞f (t)δ(t) = f (0) (14)

provided that the function remain continuous at t = 0

2 In general, this notion could be generalized to,∫ ∞−∞

f (t)δ(t − t0) = f (t0) (15)

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 14 / 120

Page 15: Frequency Domain Filtering of Digital Images

Time Shift Property-Discrete Domain I

The unit discrete impulse function, serves the same purpose as itscontinuous counterpart [2]. Mathematically,

δ(x) =

{1, if x = 0,

0, if x 6= 0.(16)

As such, the time shift properties become,

x=∞∑x=−∞

f (x)δ(x) = f (0) (17)

x=∞∑x=−∞

f (x)δ(x − x0) = f (x0) (18)

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 15 / 120

Page 16: Frequency Domain Filtering of Digital Images

Need for Fourier Transform[8][9] I

Figure: Different Types of Fourier Transforms. Source: Digital Image ProcessingProcessing(3rd Edition) by Gonzalez, R.C. and Woods, R.E, PHI

1 Inverse transform is loss-less2 Widespread use since the advent of digital computers and Fast

Fourier Transform

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 16 / 120

Page 17: Frequency Domain Filtering of Digital Images

Fourier Transform[8][9][10] IDefinition

The Fourier Transform of a continuous function f(t) of a continuousvariable t denoted by

F{f (t)} =

∫ ∞−∞

f (t) e−j2πµtdt (19)

where µ is also a continuous variableThus,

F{f (t)} = F (µ) (20)

F (µ) =

∫ ∞−∞

f (t) e−j2πµtdt (21)

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 17 / 120

Page 18: Frequency Domain Filtering of Digital Images

Fourier Transform IDefinition

Using Euler’s Formula,

F (µ) =

∫ ∞−∞

f (t)[cos(2πµt)− jsin(2πµt)]dt (22)

Inverse Fourier Transform

f (t) =

∫ ∞−∞

F (µ)e j2πµtdµ (23)

Together, F (µ) and f (t) are known as Fourier Transform pairs

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 18 / 120

Page 19: Frequency Domain Filtering of Digital Images

Fourier Transform I

Note: The Fourier Transform is an expansion of f(t) multiplied bysinusoidal terms whose frequencies are determined by µ.

Question

Why is the domain of Fourier Transform ’frequency’?

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 19 / 120

Page 20: Frequency Domain Filtering of Digital Images

Fourier Spectrum INeed and Definition

Fourier transform contains complex terms. So, we usually deal withmagnitude part

Mathematically, the Fourier Spectrum or the Frequency Spectrum is givenby,

|F (µ)| = |∫ ∞−∞

f (t)[cos(2πµt)− jsin(2πµt)]dt | (24)

Question

What is the physical significance of frequency spectrum?

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 20 / 120

Page 21: Frequency Domain Filtering of Digital Images

Questions IFind out the Fourier Transform of the following signals

f (t) = e−a|t| (25)

f (t) = δ(t − t0) (26)

Figure: A simple signal in time domain

Also plot the obtained Fourier Transform

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 21 / 120

Page 22: Frequency Domain Filtering of Digital Images

Convolution IDefinition

1 Flip, multiply and then add.

2 Denoted by a ? operator.

3 Mathematically, the convolution of two functions f (t) and h(t) of onecontinuous variable ’t’ is given by

f (t) ? h(t) =

∫ ∞−∞

f (τ)h(t − τ) dτ (27)

4 Flip by - sign

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 22 / 120

Page 23: Frequency Domain Filtering of Digital Images

Convolution IFourier Transform of Convolution operation[2]

F{f (t) ? h(t)} =

∫ ∞−∞

[ ∫ ∞−∞

f (τ)h(t − τ)dτ]e−2jπµt dt (28)

In other words,

F{f (t) ? h(t)} =

∫ ∞−∞

f (τ)[ ∫ ∞−∞

h(t − τ)e−2jπµt dt]

dτ (29)

=

∫ ∞−∞

f (τ)[H(µ)e−2πjµτ

]dτ (30)

= H(µ)

∫ ∞−∞

f (τ)e−j2πµτ dτ (31)

= H(µ)F (µ) (32)

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 23 / 120

Page 24: Frequency Domain Filtering of Digital Images

Convolution IConsequence-Convolution Theorem[2]

1 First half of convolution theorem

f (t) ? h(t)⇐⇒ F (µ)H(µ) (33)

2 Interchangeability of domains

spatial domain(t)⇐⇒ frequency domain(µ) (34)

3 Another half

f (t)h(t)⇐⇒ H(µ) ? F (µ) (35)

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 24 / 120

Page 25: Frequency Domain Filtering of Digital Images

Properties of Fourier Transform[10] I

Assuming that

f (t)⇐⇒ F (µ) (36)

We have the following properties for the Fourier Transform

Translation

f (t − t0)⇐⇒ e−jµt0F (µ) (37)

Modulation

e jµ0t f (t)⇐⇒ F (µ− µ0) (38)

Scaling

f (at)⇐⇒ 1

|a|F(µ

a

)(39)

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 25 / 120

Page 26: Frequency Domain Filtering of Digital Images

Properties of Fourier Transform I

DualityF (t)⇐⇒ 2πf (−µ) (40)

Multiplication

f1(t)f2(t)⇐⇒ 1

[F1(µ) ? F2(µ)] (41)

Differentiation in Time

df (t)

dt⇐⇒ jµ F (µ) (42)

Differentiation in Frequency

(−jt)nf (t)⇐⇒ dnF (µ)

dµ(43)

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 26 / 120

Page 27: Frequency Domain Filtering of Digital Images

Sampling and Fourier Transform of Sampled signals ISampling

Continuous signals into discrete signals

Sampled values then quantized

Mathematically,

f ˜(t) = f (t)s∆T (t) =∞∑

n=−∞f (t)δ(t − n∆T ) (44)

Each component of this summation is an impulse weighted by thevalue of f(t) at the location of the impulse

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 27 / 120

Page 28: Frequency Domain Filtering of Digital Images

Sampling and the Fourier Transform of Sampled signals ISampling

The value of each sample is given by the strength of the weigted impulse,which we obtain by integration.Mathematically,

fk =

∫ ∞−∞

f (t)δ(t − k∆T ) dt (45)

= f (k∆T) (46)

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 28 / 120

Page 29: Frequency Domain Filtering of Digital Images

Fourier Transform of Sampled Function I

The Fourier Transform F˜(µ) of the sampled function f ˜(t) is

F˜(µ) = F{f ˜(t)} (47)

= F{f (t)s∆T (t)} (48)

= F (µ) ? S(µ) (49)

where,

S(µ) =1

∆T

∞∑n=−∞

δ(µ− n

∆T

)(50)

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 29 / 120

Page 30: Frequency Domain Filtering of Digital Images

The Fourier Transform of Sampled Signal I

UsingF˜(µ) = F (µ) ? S(µ) (51)

we have

F˜(µ) =

∫ ∞−∞

F (τ)S(µ− τ) dτ (52)

=1

∆T

∫ ∞−∞

F (τ)∞∑

n=−∞δ(µ− τ − n

∆T

)dτ (53)

=1

∆T

∞∑n=−∞

F(µ− n

∆T

)(54)

Thus, Fourier Transform F˜(µ) of the sampled signal f ˜(t) is an infinite,periodic sequence of copies of F (µ), the transform of the original,continuous signal

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 30 / 120

Page 31: Frequency Domain Filtering of Digital Images

The Fourier Transform of the Sampled Signals I

From,

F˜(µ) =1

∆T

∞∑n=−∞

F(µ− n

∆T

)(55)

, we have

∆T as the sample duration

The separation between copies is determined by 1∆T

This separation can determine if F (µ) is preserved in the sum

Accordingly we have oversampling, critical sampling andunder-sampling

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 31 / 120

Page 32: Frequency Domain Filtering of Digital Images

The Fourier Transform of the Sampled Signal[2] ISampling under different conditions

Figure: Transforms of the corresponding sampled function under conditions ofover-sampling, critically-sampling and undersampling. Source: Digital ImageProcessing Processing(3rd Edition) by Gonzalez, R.C. and Woods, R.E, PHI

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 32 / 120

Page 33: Frequency Domain Filtering of Digital Images

Fourier Transform in two variables IDefinition

The Fourier transform equations can be easily extended to two variables as

F (u, v) =

∫ ∞−∞

∫ ∞−∞

f (x , y)e−j2π(ux+vy) dx dy (56)

Simlarly, the inverse transform is given by

f (x , y) =

∫ ∞−∞

∫ ∞−∞

F (u, v)e j2π(ux+vy) du dv (57)

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 33 / 120

Page 34: Frequency Domain Filtering of Digital Images

Discrete Fourier Transform [2] IDefinition

The Fourier Transform of a discrete function of one variable, f [x ],x=0,1,2...M − 1 is given by

F (u) =1

M

M−1∑x=0

f [x ]e−j2πux

M for u = 0, 1, 2, ...,M − 1 (58)

Simiarly, the inverse DFT is given by

f [x ] =M−1∑u=0

F (u)ej2πuxM for x = 0, 1, 2, ...,M − 1 (59)

The DFT remains a discrete quantity with same number of components assignal.

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 34 / 120

Page 35: Frequency Domain Filtering of Digital Images

Discrete Fourier Transform IKey points

1 DFT remains a discrete quantity with same number of components asthe signal

2 Same applies for IDFT as well

3 DFT and IDFT always exist (unlike the continuous case)

4 Each summation term called the component of DFT

5 In general, components are complex, Why?

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 35 / 120

Page 36: Frequency Domain Filtering of Digital Images

Discrete Fourier Transform IRepresentation of DFT in Euler form

Usin Euler’s formula, we express F (u) in polar coordinates,

F (u) = |F (u)| e−j φ(u) (60)

where

|F (u)| =[R2(u) + I 2(u)

] 12

(61)

is the magnitude spectrum of the Fourier transform and

φ(u) = tan−1[ I (u)

R(u)

](62)

is the phase angle or the phase spectrum.

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 36 / 120

Page 37: Frequency Domain Filtering of Digital Images

Discrete Fourier Transform IRepresentation of DFT in Euler form

Power SpectrumThis is yet another important parameter given by

P(u) = |F (u)|2 (63)

= R2(u) + I 2(u) (64)

Also referred to as spectral density

What is the physical significance of power spectrum?

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 37 / 120

Page 38: Frequency Domain Filtering of Digital Images

The Two-dimensional DFT and its Inverse IDefinition of Two-dimensional DFT

Since image is a 2-D signal, we now proceed to Discrete Fourier Transformin two dimensions.The Discrete Fourier transform of a function f (x , y) of size M x N isgiven by

F (u, v) =1

MN

M−1∑x=0

N−1∑y=0

f (x , y) e−j2π(uxM+ vy

N) (65)

for u=0,1,2...M-1 and v=0,1,2,..N-1.Reminder: x,y are spatial variables while u,v are frequency variables

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 38 / 120

Page 39: Frequency Domain Filtering of Digital Images

The Two-dimensional DFT and its Inverse IDefinition of Inverse DFT

As is the case of 1-D transform, the inverse DFT for two dimensions isgiven by

f (x , y) =M−1∑u=0

N−1∑v=0

F (u, v) e j2π(uxM+ vy

N) (66)

for x=0,1,2...M-1 and y=0,1,2,....N-1

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 39 / 120

Page 40: Frequency Domain Filtering of Digital Images

The Two-dimensional DFT and its Inverse IRepresentation of 2-D DFT in Euler form

Fourier Spectrum

|F (u, v)| =[R2(u, v) + I 2(u, v)

] 12

(67)

Phase Spectrum

φ(u, v) = tan−1[ I (u, v)

R(u, v)

](68)

Power SpectrumP(u, v) = |F (u, v)|2 (69)

= R2(u, v) + I 2(u, v) (70)

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 40 / 120

Page 41: Frequency Domain Filtering of Digital Images

Properties of Two-dimensional DFT I

Translation Property

f (x , y)ej2π

(u0xM

+v0yN

)↔ F (u − u0, v − v0) (71)

Similarly,

f (x − x0, y − y0)↔ F (u, v) e−j2π

(ux0M

+vy0N

)(72)

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 41 / 120

Page 42: Frequency Domain Filtering of Digital Images

Properties of Two-dimensional DFT I

Translation to the center of the frequency rectangle

f (x , y)(−1)x+y ↔ F (u − M

2, v − N

2) (73)

And,

f (x − M

2, y − N

2)↔ F (u, v)(−1)u+v (74)

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 42 / 120

Page 43: Frequency Domain Filtering of Digital Images

Properties of Two-dimensional DFT I

Convolution Property

f (x , y) ? h(x , y)↔ F (u, v)H(u, v) (75)

And,

f (x , y)h(x , y)↔ F (u, v) ? H(u, v) (76)

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 43 / 120

Page 44: Frequency Domain Filtering of Digital Images

Properties of Two-dimensional DFT I

Translation to the center of the frequency rectangle

f (x , y)(−1)x+y ↔ F (u − M

2, v − N

2) (77)

Input image function usually multiplied by (−1)x+y prior to FourierTransform[1]. Why?Origin of frequency rectangle shifts to the center of the frequencyrectangle.

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 44 / 120

Page 45: Frequency Domain Filtering of Digital Images

Properties of Two-dimensional DFT I

The value of the transform at (u,v)=(0,0) is given by

F (0, 0) =1

MN

M−1∑x=0

N−1∑y=0

f (x , y) (78)

which is the average value of f(x,y)(also called dc component of thespectrum).Corollary If the image is f(x,y), the value of Fourier Transform at theorigin is equal to the average gray level of the image.

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 45 / 120

Page 46: Frequency Domain Filtering of Digital Images

Aliasing[11][2] IDefinition

Occurs when high frequency components ”masquarade” as low frequencycomponents(called aliased freqencies)

1 A consequence of under-sampling

2 Corrupts the sampled image

3 Additional frequency components are introduced into the sampledimage

4 Moire’s pattern introduced in the images (spatially sampled signal)

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 46 / 120

Page 47: Frequency Domain Filtering of Digital Images

Aliasing IMoire’s Patterns

Figure: A sine waveform being sampled at frequency less than twice the maximumfrequency. Source:http: // users. wfu. edu/ matthews/ misc/ DigPhotog/ alias/

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 47 / 120

Page 48: Frequency Domain Filtering of Digital Images

Aliasing I

(a) Original Image (b) Resized Image (c) Moire’s pattern inimage due to aliasing

Figure: Moire’s pattern in images due to aliasing. Source:http: // users. wfu. edu/ matthews/ misc/ DigPhotog/ alias/

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 48 / 120

Page 49: Frequency Domain Filtering of Digital Images

Aliasing IMoire’s Patterns[2]

Figure: Some more examples of Moire’s pattern. Source: Digital ImageProcessing Processing(3rd Edition) by Gonzalez, R.C. and Woods, R.E, PHI

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 49 / 120

Page 50: Frequency Domain Filtering of Digital Images

Anti-Aliasing[11] I

1 Attenuate higher frequencies (relative to what?)

2 Needs to be done before sampling since it cannot be undone after thefact[1].Hence, effective software antialias filters do not exist.

3 Various strategies like notch filters, intentional blurring[6] in front ofCCD etc.

Question: Any alternative to Antialias filter?

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 50 / 120

Page 51: Frequency Domain Filtering of Digital Images

Basics of Filtering in the frequency domain IBasic Steps

Filtering takes place in the following steps [1]

1 Multiply the image function by (−1)x+y . Why?

2 Multiply F(u,v) of the image by filter transfer function H(u,v)

3 Compute the inverse DFT of the above product

4 Obtain the real part

5 Multiply the above result by (−1)x+y

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 51 / 120

Page 52: Frequency Domain Filtering of Digital Images

Basics of Filtering in the frequency domain IBasic Steps

Figure: Basic steps for filtering in the frequency domain. Source: Digital ImageProcessing Processing(3rd Edition) by Gonzalez, R.C. and Woods, R.E, PHI

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 52 / 120

Page 53: Frequency Domain Filtering of Digital Images

Image Smoothing using lowpass filter IKey points

Edges and noises(sharp transitions) in an image contributessignificantly to the high frequency content of its Fourier transform

Smoothing(blurring) achieved by high frequency attenuation

Types of low pass filters to be discussed1 Ideal Low pass filters2 ButterWorth filters3 Gaussian Filters

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 53 / 120

Page 54: Frequency Domain Filtering of Digital Images

Image Smoothing using lowpass filter IIdeal Lowpass Filter[2]

A 2-D lowpass filter that passes without attenuation all frequencies withina radius of D0 and at the same time cuts off all other frequenciescompletely. Mathematically, it is defined as

H(u, v) =

{1, if D(u, v) ≤ D0,

0, if D(u, v) > D0.(79)

Here, D(u, v) is the distance between a point (u,v) in the frequencydomain and the center of the frequency rectangle

D(u, v) =[(

u − P

2

)2+(

v − Q

2

)2] 12

(80)

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 54 / 120

Page 55: Frequency Domain Filtering of Digital Images

Image Smoothing using lowpass filter IIdeal Lowpass Filter

Figure: (a) Perspective plot of an ideal low pass filter (b) Filter displayed as animage (c) Filter radial cross section. Source: Digital Image ProcessingProcessing(3rd Edition) by Gonzalez, R.C. and Woods, R.E, PHI

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 55 / 120

Page 56: Frequency Domain Filtering of Digital Images

Image Smoothing using lowpass filter IIdeal Lowpass Filter

Key Point

1 ILPF is radially symmteric about the origin

2 The point of transition from H(u, v) = 1 to H(u, v) = 0 called cutofffrequency

3 Ideal behavior cannot be realized by electronics; mathematicallyfeasible

In order to establish a set of cutoff frequency loci, we compute circles thatenclose specified amounts of total image power PT .Mathematically

PT =P−1∑u=0

Q−1∑v=0

P(u, v) (81)

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 56 / 120

Page 57: Frequency Domain Filtering of Digital Images

Image Smoothing using lowpass filter IIdeal Lowpass Filter

Figure: (a) and (b) show a test pattern image and its spectrum. The circlessuperimposed on the spectrum hve radii of 10, 30, 60, 160 and 460 pixelsrespectively. These circles enclose α percent of image power, forα = 87.0, 93.1, 95.7, 97.8 and 99.2 respectively. The spectrum falls off rapidly,with 87 % of the total power being enclosed by a relatively small circle of radius10.

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 57 / 120

Page 58: Frequency Domain Filtering of Digital Images

Image Smoothing using lowpass filter IIdeal Lowpass Filter

Figure: (b)-(f) Results of filtering using ILPFs with cutoff frequencies set at radiivalues 10, 30, 60, 160 and 460. The power removed by these filters was 13, 6.9,4.3, 2.2 and 0.8 % of the total respectively. Source: Digital Image ProcessingProcessing(3rd Edition) by Gonzalez, R.C. and Woods, R.E, PHI

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 58 / 120

Page 59: Frequency Domain Filtering of Digital Images

Image Smoothing using lowpass filter IIdeal Lowpass Filter

Severe blurring in (b) means majority of the sharp detail informationin the picture is contained in the 13 percent power removed by thefilter.

With increasing radius, lesser power is removed; hence, less blurring

Ringing gets finer in texture as the amount of high frequencycomponent removed decreases.

Ringing, a characteristic of less popular ideal filters

Little edge information lost meant less blurring with increasing α

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 59 / 120

Page 60: Frequency Domain Filtering of Digital Images

Image Smoothing using lowpass filter IIdeal Lowpass Filter

Figure: (a)Representation in the spatial domain of an ILPF of radius 5 and size1000 x 1000. (b) Intensity profile of a horizontal line passing through the centerof the image. Source: Digital Image Processing Processing(3rd Edition) byGonzalez, R.C. and Woods, R.E, PHI

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 60 / 120

Page 61: Frequency Domain Filtering of Digital Images

Image Smoothing using lowpass filter IIdeal Lowpass Filter

Blurring and ringing properties can be explained though convolutiontheorem

Cross section of ILPF in spatial domain bound to appear as a sincfunction(why?)

Filtering in the spatial domain by convolving h(x,y) with the image

Each pixel as a discrete impulse with strength proportional to itsintensity

Convolving a sinc function with an impulse simply copies the sinc atthe location of the impulse

Center lobe of the sinc is the principal cause for blurring

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 61 / 120

Page 62: Frequency Domain Filtering of Digital Images

Image Smoothing using lowpass filter IIdeal Lowpass Filter

Colvolving a sinc function with every pixel in the image: a nice modelto guess the response of ILPF

Spread of sinc inversely proportional to radius of H(u,v); means forlarger D0, sinc approaches an impulse function

In the extreme case, when sinc becomes an impulse function, noblurring upon convolution

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 62 / 120

Page 63: Frequency Domain Filtering of Digital Images

Image Smoothing using lowpass filter IButterworth Lowpass Filter[2]

A butterworth low pass filter of order n and with cutoff frequency D0 fromthe origin is defined as

H(u, v) =1

1 +[D(u,v)D0

]2n (82)

Here, the terms D(u, v) and D0 have the usual meaning.

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 63 / 120

Page 64: Frequency Domain Filtering of Digital Images

Image Smoothing using lowpass filter IButterworth Lowpass Filter

Figure: (a) Perspective plot of a Butterworth lowpass filter transfer function. (b)Filter displayed as an image. (c) Filter radial cross sectionsof orders 1 through 4.Source: Digital Image Processing Processing(3rd Edition) by Gonzalez, R.C. andWoods, R.E, PHI

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 64 / 120

Page 65: Frequency Domain Filtering of Digital Images

Image Smoothing using lowpass filter IButterworth Lowpass Filter

Figure: (a) and (b) show a test pattern image and its spectrum. The circlessuperimposed on the spectrum hve radii of 10, 30, 60, 160 and 460 pixelsrespectively. These circles enclose α percent of image power, forα = 87.0, 93.1, 95.7, 97.8 and 99.2 respectively. The spectrum falls off rapidly,with 87 % of the total power being enclosed by a relatively small circle of radius10.

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 65 / 120

Page 66: Frequency Domain Filtering of Digital Images

Image Smoothing using lowpass filter IButterworth Lowpass Filter

Figure: Results of filtering using BLPFs of order (n)=2, with cutoff frequencies atthe radii shown above. Source: Digital Image Processing Processing(3rd Edition)by Gonzalez, R.C. and Woods, R.E, PHI

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 66 / 120

Page 67: Frequency Domain Filtering of Digital Images

Image Smoothing using lowpass filter IButterworth Lowpass Filter

Figure: Spatial representations of BLPFs of order 1,2,5 and 20, and thecorresponding intensity profiles through the center of the filters (the size in allcases in 1000 x 1000 and the cutoff frequency is 5). Ringing increases with filterorder

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 67 / 120

Page 68: Frequency Domain Filtering of Digital Images

Image Smoothing using lowpass filter IButterworth Lowpass Filter

Ringing imperceptible in lower orders, significant for higher orders.

For lower orders, the ringing remains less compared to ILPF

Ringing becomes prominent and comparable for orders above 20

Order 2 most popular since it strikes a balance between filtering andringing.

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 68 / 120

Page 69: Frequency Domain Filtering of Digital Images

Image Smoothing using lowpass filter IGaussian Lowpass Filters[1]

The Gaussian lowpass filter in two dimensions is given by

H(u, v) = e−D2(u,v)

2D20 (83)

Here, the terms D(u, v) and D0 have the usual meaning.When D(u, v) = D0, the GLPF is down to 0.607 of its maximum value.

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 69 / 120

Page 70: Frequency Domain Filtering of Digital Images

Image Smoothing using lowpass filter IGaussian Lowpass Filters[2]

Figure: (a) Perspective plot of a GLPF transfer function. (b) Filter displayed asan image. (c) Filter radial cross sections for various values of D0. Source: DigitalImage Processing Processing(3rd Edition) by Gonzalez, R.C. and Woods, R.E,PHI

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 70 / 120

Page 71: Frequency Domain Filtering of Digital Images

Image Smoothing using lowpass filter IGaussian Lowpass Filter

Figure: (a) and (b) show a test pattern image and its spectrum. The circlessuperimposed on the spectrum hve radii of 10, 30, 60, 160 and 460 pixelsrespectively. These circles enclose α percent of image power, forα = 87.0, 93.1, 95.7, 97.8 and 99.2 respectively. The spectrum falls off rapidly,with 87 % of the total power being enclosed by a relatively small circle of radius10.

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 71 / 120

Page 72: Frequency Domain Filtering of Digital Images

Image Smoothing using lowpass filter IGaussian Lowpass Filters

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 72 / 120

Page 73: Frequency Domain Filtering of Digital Images

Image Smoothing using lowpass filter IIGaussian Lowpass Filters

Figure: (a) Original Image. (b)-(f) Results of filtering using GLPFs with cutofffrequencies at the radii show above. Source: Digital Image ProcessingProcessing(3rd Edition) by Gonzalez, R.C. and Woods, R.E, PHI

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 73 / 120

Page 74: Frequency Domain Filtering of Digital Images

Image Smoothing using lowpass filter IGaussian Lowpass Filters

The inverse Fourier transform of GLPF is Gaussian[1]

A spatial Gaussian filter obtained by computing the IDFT of H(u,v)will have no ringing[1]

A smooth transition in blurring as a function of increasing cutofffrequency obtained

GLPF achieved slightly less smoothing than the BLPF of order 2 forsame cutoff frequency

Assures no ringing[2][3]; However, if a tight control of frequencytransition required, then a BLPF is preferred.

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 74 / 120

Page 75: Frequency Domain Filtering of Digital Images

Sharpening Frequency Domain Filters[2] IHighpass Filters

1 Edges and other abrupt changes associated with high frequencycomponents.

2 Sharpening means accentuating these high frequency features

3 Assumptions

Only zero phase shift filters

Filters are radially symmetric

All filter functions assumed to be of the size PxQ

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 75 / 120

Page 76: Frequency Domain Filtering of Digital Images

Sharpening Frequency Domain Filters IIdeal Highpass Filters

An ideal HPF is given by

Hhp(u, v) = 1− Hlp(u, v) (84)

Idea? Fairly IntuitiveWhen the low pass filter attenuates a particular frequency, highpass filtersimply allows it.

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 76 / 120

Page 77: Frequency Domain Filtering of Digital Images

Sharpening Frequency Domain Filters IIdeal highpass Filter

Figure: Perspective plot, image representation and cross section of a typical idealhighpass filter. Source: Digital Image Processing (3rd Edition) by Gonzalez, R.C.and Woods, R.R.,PHI

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 77 / 120

Page 78: Frequency Domain Filtering of Digital Images

Sharpening Frequency Domain Filters IIdeal Highpass Filters

A 2-D highpass filter (IHPF) is defined as

H(u, v) =

{0, if D(u, v) ≤ D0,

1, if D(u, v) > D0.(85)

where D0 is the cutoff distance measured from the origin of the frequencyrectangle.

Question: Why are ideal filters not physically realizable

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 78 / 120

Page 79: Frequency Domain Filtering of Digital Images

Sharpening Frequency Domain Filters ICharacteristics of Ideal Highpass Filters

Figure: Spatial representation of a typical ideal highpass filter an correspondinggray level profiles. Source: Digital Image Processing (3rd Edition) by Gonzalez,R.C. and Woods, R.R.,PHI

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 79 / 120

Page 80: Frequency Domain Filtering of Digital Images

Sharpening Frequency Domain Filters ICharacteristics of Ideal Highpass filters

1 Same ringing characteristics[12][13]

2 Smaller lines and objects appear almost solid white

3 With increasing D0, edges become much cleaner and less distortedand smaller objects get filtered properly.

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 80 / 120

Page 81: Frequency Domain Filtering of Digital Images

Sharpening Frequency Domain Filters ICharacteristics of Ideal Highpass Filters

Figure: Results of ideal highpass filtering the image with D0=15,30 and 80respectively. Ringing[12][2] quite evident in (a) and (b). Source: Digital ImageProcessing (3rd Edition) by Gonzalez, R.C. and Woods, R.R.,PHI

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 81 / 120

Page 82: Frequency Domain Filtering of Digital Images

Sharpening Frequency Domain Filters IButterworth Highpass Filters

The transfer function of the Butterworth highpass filter (BHPF) of order nand with cutoff frequency locus at a distance D0 from the origin is given by

H(u, v) =1

1 +[

D0D(u,v)

]2n (86)

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 82 / 120

Page 83: Frequency Domain Filtering of Digital Images

Sharpening Frequency Domain Filters ICharacteristics of Butterworth Highpass Filters

Figure: Perspective plot, image representation and cross section of a typicalButterworth highpass filter. Source: Digital Image Processing (3rd Edition) byGonzalez, R.C. and Woods, R.R.,PHI

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 83 / 120

Page 84: Frequency Domain Filtering of Digital Images

Sharpening Frequency Domain Filters ICharacteristics of Butterworth Highpass Filters

Figure: Spatial representation of a typical Butterworth highpass filter ancorresponding gray level profiles. Source: Digital Image Processing (3rd Edition)by Gonzalez, R.C. and Woods, R.R.,PHI

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 84 / 120

Page 85: Frequency Domain Filtering of Digital Images

Sharpening Frequency Domain Filters ICharacteristics of Butterworth Highpass Filters

1 Smoother than IHPFs

2 For smaller objects, performance of IHPF and low order BHPF isalmost same

3 Transition into higher cutoff frequencies is much smoother with theBHPF.

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 85 / 120

Page 86: Frequency Domain Filtering of Digital Images

Sharpening Frequency Domain Filters ICharacteristics of Butterworth Highpass Filters

Figure: Results of highpass filtering the image using a BHPF or order 2 withD0=15, 30 and 80 respectively. The results are much smoother than thoseobtained with an ILPF. Source: Digital Image Processing (3rd Edition) byGonzalez, R.C. and Woods, R.R.,PHI

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 86 / 120

Page 87: Frequency Domain Filtering of Digital Images

Sharpening Frequency Domain Filters IGaussian Highpass Filters

The transfer function of the Gaussian Highpass filter (GHPF) with cutofffrequency locus at a distance D0 from the origin is given by

H(u, v) = 1− e−D2(u,v)

2D20 (87)

Results are thus much smoother compared to Butterworth filter.

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 87 / 120

Page 88: Frequency Domain Filtering of Digital Images

Sharpening Frequency Domain Filters ICharacteristics of Gaussian Highpass Filters

Figure: Perspective plot, image representation and cross section of a typicalGaussian highpass filter. Source: Digital Image Processing (3rd Edition) byGonzalez, R.C. and Woods, R.R.,PHI

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 88 / 120

Page 89: Frequency Domain Filtering of Digital Images

Sharpening Frequency Domain Filters ICharacteristics of Gaussian Highpass Filters

Figure: Spatial representation of a typical Gaussian highpass filter ancorresponding gray level profiles. Source: Digital Image Processing (3rd Edition)by Gonzalez, R.C. and Woods, R.R.,PHI

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 89 / 120

Page 90: Frequency Domain Filtering of Digital Images

Sharpening Frequency Domain Filters ICharacteristics of Highpass Filters

Figure: Results of highpass filtering the image using a GHPF of order 2 withD0=15,30 and 80 respectively.Source: Digital Image Processing (3rd Edition) byGonzalez, R.C. and Woods, R.R.,PHI

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 90 / 120

Page 91: Frequency Domain Filtering of Digital Images

Unsharp Masking and Highboost Filtering in SpatialDomain IIntroduction[2]

1 For sharpening the images

2 Idea is to substract an unsharped version of the image from theoriginal image

3 Process called unsharp masking

4 In printing and publishing industry

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 91 / 120

Page 92: Frequency Domain Filtering of Digital Images

Unsharp masking and Highboost Filtering in SpatialDomain IBasic steps

The process of unsharp masking involves

Blur the image (using a lowpass filter). Denote it by f−(x , y)

Subtract the blurred image from the original (this difference called themask)

gmask(x , y) = f (x , y)− f (x , y) (88)

Add the weighted portion of mask to the original

g(x , y) = f (x , y) + k ∗ gmask(x , y) (89)

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 92 / 120

Page 93: Frequency Domain Filtering of Digital Images

Unsharp Masking and Highboost Filtering in SpatialDomain ISummary

From,

g(x , y) = f (x , y) + k ∗ gmask(x , y) (90)

The parameter k is used for generality.

1 When k = 1, we have unsharp masking

2 When k > 1 we have highboost filtering

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 93 / 120

Page 94: Frequency Domain Filtering of Digital Images

Unsharp Masking and HIghboost Filtering in SpatialDomain IIllustration

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 94 / 120

Page 95: Frequency Domain Filtering of Digital Images

Unsharp Masking and HIghboost Filtering in SpatialDomain IIIllustration

Figure: 1-D illustration of the mechanics of unsharp masking. (a) Original Signal.(b) Blurred signal with original shown dashed for reference. (c) Unsharp Mask.(d)Sharpened signal obtained by by adding (c) to (a). Source: Digital ImageProcessing Processing(3rd Edition) by Gonzalez, R.C. and Woods, R.E, PHI

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 95 / 120

Page 96: Frequency Domain Filtering of Digital Images

Unsharp Masking and Highboost Filtering in FrequencyDomain IIntroduction

From the discussion wrt to spatial domain, we have

gmask(x , y) = f (x , y)− fLP(x , y) (91)

where

fLP(x , y) = f −1[HLP(u, v)F (u, v)

](92)

Thus, the modified image could be written as

g(x , y) = f (x , y) + k ∗ gmask(x , y) (93)

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 96 / 120

Page 97: Frequency Domain Filtering of Digital Images

Unsharp Masking and Highboost Filtering in SpatialDomain IDerivation

Continuing from the above discussion, we have

g(x , y) = F−1[1 + k ∗ [1− HLP(u, v)]]F (u, v) (94)

Expressing the same results in terms of a highpass filter, we have

g(x , y) = F−1[1 + k ∗ HHP(u, v)]F (u, v) (95)

The term in the square brackets better known as high frequency emphasisfilter. The HPFs set the dc term to 0 but not in this case.

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 97 / 120

Page 98: Frequency Domain Filtering of Digital Images

Homomorphic Filtering[2] IIntroduction

1 Uses illumination-reflectance model to improve the appearance of theimage

2 Common procedures include simultaneous intensity rane compressionand contrast enhancement

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 98 / 120

Page 99: Frequency Domain Filtering of Digital Images

Homomorphic Filtering IBackground

From the illumination-reflectance model, an image f (x , y) can beexpressed as the product of illumination and reflectance terms.Mathematically,

f (x , y) = i(x , y)r(x , y) (96)

However, the same cannot be subsituted with the frequency counterparts.Why?Solution: Go for the log

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 99 / 120

Page 100: Frequency Domain Filtering of Digital Images

Homomorphic Filtering IBackground

We define,

z(x , y) = lnf (x , y) (97)

= lni(x , y) + lnr(x , y) (98)

Then,

F (z(x , y)) = F (lni(x , y)) + F (lnr(x , y)) (99)

Equivalently,

Z (u, v) = Fi (u, v) + Fr (u, v) (100)

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 100 / 120

Page 101: Frequency Domain Filtering of Digital Images

Homomorphic Filtering IFiltering

With the above transformation, we can filter Z (u, v) using a filter H(u, v)so that the output is

S(u, v) = H(u, v)Z (u, v) (101)

= H(u, v)Fi (u, v) + H(u, v)Fr (u, v) (102)

The filtered image in the spatial domain will then be

s(x , y) = F−1S(u, v) (103)

= F−1H(u, v)Fi (u, v) + F−1H(u, v)Fr (u, v) (104)

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 101 / 120

Page 102: Frequency Domain Filtering of Digital Images

Homomorphic Filtering IFiltering

By defining,i′(x , y) = F−1H(u, v)Fi (u, v) (105)

andr′(x , y) = F−1H(u, v)Fr (x , y) (106)

we haves(x , y) = i

′(x , y) + r

′(x , y) (107)

Also, by reversing the logarithm, the filtered image obtained could be

g(x , y) = es(x ,y) (108)

= e i′(x ,y)er

′(x ,y) (109)

i0(x , y)r0(x , y) (110)

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 102 / 120

Page 103: Frequency Domain Filtering of Digital Images

Homomorphic Filtering IFiltering

The basic steps of homomorphic filtering could be represented as

Figure: Summary of steps in homomorphic filtering. Source: Digital ImageProcessing Processing(3rd Edition) by Gonzalez, R.C. and Woods, R.E, PHI

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 103 / 120

Page 104: Frequency Domain Filtering of Digital Images

Homomorphic Filtering IFiltering

1 Applicable for homomorphic systems

2 The illumination and refectance components could be separated

3 The filter then operates on individual components

Note: Illumination components associated with slow spatial variationswhile reflectance components are usually associated with abrupt spatialvariations.

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 104 / 120

Page 105: Frequency Domain Filtering of Digital Images

Homomorphic Filtering IFiltering

The above constraints are taken care by homomorphic filters. In otherwords, a homomorphic filter controls the illumination and reflectancecomponents.The net result is simultaneous dynamic range compression and contrastenhancement

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 105 / 120

Page 106: Frequency Domain Filtering of Digital Images

Periodic Noise Reduction by Frequency Domain Filtering IIntroduction

1 Freuqency domain analysis suited to noise analysis

2 Periodic noise: Burst of noise in FT

3 Selective filters to isolate noise

4 Common filters used are bandreject, bandpass and notch filters

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 106 / 120

Page 107: Frequency Domain Filtering of Digital Images

Periodic Noise Reduction by Frequency Domain Filtering[2]IBandreject Filters

1 for noise removal when the location of noise components known

2 Example: an image corrupted by additive periodic noise that can beapproximated as two-dimensional sinusoids

3 Because FT of sine consists of two imaginary impulses mirrored aboutorigin. Imaginary, hence, complex conjugates to one another

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 107 / 120

Page 108: Frequency Domain Filtering of Digital Images

Periodic Noise Reduction by Frequency Domain Filtering IBandreject Filters

Figure: From left to right, perspective plots of ideal, Butterworth (of order 1),and Gaussian bandreject filters. Source: Digital Image Processing Processing(3rdEdition) by Gonzalez, R.C. and Woods, R.E, PHI

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 108 / 120

Page 109: Frequency Domain Filtering of Digital Images

Periodic Noise Reduction by Frequency Domain Filtering IBandreject Filters

Figure: (a) Image corrupted by the sinusoid noise. (b) Spectrum of (a). (c)Butterworth bandreject filter (white represents 1). (d) Results of filtering.(Original image courtsey of NASA)

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 109 / 120

Page 110: Frequency Domain Filtering of Digital Images

Periodic Noise Reduction by Frequency Domain Filtering IBandreject Filters

1 image corrupted by sinusoids

2 Noise components can be seen as symmetric dots in the FT (in thiscase, on a circle)

3 Butterworth bandreject filter of order 4

4 Radius appropriate to enclose completely the noise impluses

5 Small details and textures restored successfully

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 110 / 120

Page 111: Frequency Domain Filtering of Digital Images

Periodic Noise Reduction by Frequency Domain Filtering IBandpass Filters

1 Opposite to bandreject filter

HBP(u, v) = 1− HBR(u, v) (111)

2 Can sometimes remove too much image details.

3 Useful in isolating the effects on an image by frequency bands.

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 111 / 120

Page 112: Frequency Domain Filtering of Digital Images

Periodic Noise Reduction by Frequency Domain Filtering IBandpass Filters

Figure: Noise pattern of the image obtained by bandpass filtering. Source: DigitalImage Processing Processing(3rd Edition) by Gonzalez, R.C. and Woods, R.E,PHI

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 112 / 120

Page 113: Frequency Domain Filtering of Digital Images

Periodic Noise Reduction by Frequency Domain Filtering IBandpass Filters

1 Most image details lost

2 Noise patterns recovered accurately

3 Thus, bandpass filtering helps isolate the noise patterns.

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 113 / 120

Page 114: Frequency Domain Filtering of Digital Images

Periodic Noise Reduction by Frequency Domain Filtering INotch Filter

1 Rejects (or passes) frequencies in predefined neighbourhoods about acertain frequency

2 Notch filters appear in symmetric pairs about the origin

3 Usually, they are used to pass the frequencies in the notch area

4 Mathematically, notchpass and notchreject filters are related as

HNP(u, v) = 1− HNR(u, v) (112)

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 114 / 120

Page 115: Frequency Domain Filtering of Digital Images

Periodic Noise Reduction by Frequency Domain Filtering INotch filters

Figure: Perspective plots of (a) ideal, (b)Butterworth (order 2), (c) Gaussiannotch filters. Source: Digital Image Processing Processing(3rd Edition) byGonzalez, R.C. and Woods, R.E, PHI

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 115 / 120

Page 116: Frequency Domain Filtering of Digital Images

Inverse Filtering[2] IIntroduction

1 First step towards image restoration

2 We assume the degrading function to be H

3 Here, we an estimate of the transform simply by dividing thetransform of the degraded image G (u, v), by the degradation function

F̂ (u, v) =G (u, v)

H(u, v)(113)

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 116 / 120

Page 117: Frequency Domain Filtering of Digital Images

Inverse Filtering IIntroduction

The previous equation can also be written as

F̂ (u, v) = F (u, v) +N(u, v)

H(u, v)(114)

In the above equation, N(u, v) is unknown.Consequence: Even if we know the degraation function, we cannot recoverthe undegraded image.To add to this, if H(u, v) is small, then it cannot virtually dominate thevalue of F̂ (u, v)

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 117 / 120

Page 118: Frequency Domain Filtering of Digital Images

Inverse Filtering IIntroduction

Possible SolutionLimit the filter frequencies near the origin since H(0, 0) is highest near theorigin.

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 118 / 120

Page 119: Frequency Domain Filtering of Digital Images

References I

1 http://nptel.ac.in/courses/111103021/15

2 Digital Image Processing (3rd Edition) by Gonzalez, R.C. and Woods,R.R.,PHI

3 http://web.stanford.edu/class/ee104/lecture4.pdf

4 Digital Image Processing (3rd Edition) by Willian k. Pratt, JohnWiley and Sons

5 MIT OpenCourseWarehttp://math.mit.edu/~gs/cse/websections/cse41.pdf

6 https://en.wikipedia.org/wiki/Dirichlet_conditions

7 Web Tutorialshttps://6002x.mitx.mit.edu/

8 Stanford University Textweb.stanford.edu/class/ee102/lectures/fourtran

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 119 / 120

Page 120: Frequency Domain Filtering of Digital Images

References II

9 Nptel Tutorials(IIT Madras)http://nptel.ac.in/courses/IIT-MADRAS/Principles_Of_

Communication/pdf/Lecture05_FTProperties.pdf

10 Princeton University Courseware https://www.princeton.edu/

~cuff/ele201/kulkarni_text/frequency.pdf

11 Web Tutorialshttp://users.wfu.edu/matthews/misc/DigPhotog/alias/

12 Web Resources imaging.cs.msu.ru/en/research/ringing

13 M. Khambete and M. Joshi, ”Blur and Ringing Artifact Measurementin Image Compression using Wavelet Transform ”, World Academy ofScience, Engineering and Technology , 2007.

Upendra (Indian Institute of Information Technology, Allahabad[4ex] Image and Video Processing)Filtering in Frequency Domain February 26, 2017 120 / 120