digital image processing in frequency domain

119
Digital Image Processing in Frequency Domain Md. Al Mehedi Hasan Assistant Professor Dept. of Computer Science & Engineering RUET, Rajshahi

Upload: tibor

Post on 21-Jan-2016

45 views

Category:

Documents


0 download

DESCRIPTION

Digital Image Processing in Frequency Domain. Md. Al Mehedi Hasan Assistant Professor Dept. of Computer Science & Engineering RUET, Rajshahi. How con we connect broken text ?. How can we remove blemishes in a photograph?. How can we get the enhanced image from the original image?. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Digital Image Processing in Frequency Domain

Digital Image Processing in Frequency Domain

Md. Al Mehedi HasanAssistant Professor

Dept. of Computer Science & EngineeringRUET, Rajshahi

Page 2: Digital Image Processing in Frequency Domain
Page 3: Digital Image Processing in Frequency Domain

How con we connect broken text ?

Page 4: Digital Image Processing in Frequency Domain

How can we remove blemishes in a photograph?

Page 5: Digital Image Processing in Frequency Domain

How can we get the enhanced

image from the original

image?En

hanc

ed im

age

Page 6: Digital Image Processing in Frequency Domain

How can we get this original image?

Page 7: Digital Image Processing in Frequency Domain

What is a transformation?

• im is the original image;• IM is the transformed image;• (or ) represents the spatial coordinates of a pixel.

The goal of a transformation is to get a new representation of the incoming picture. This new representation can be more convenient for a particular application or can ease the extraction of particular properties of the picture.

Goal of a transformation

Image transformation

Page 8: Digital Image Processing in Frequency Domain

Image transformation

Page 9: Digital Image Processing in Frequency Domain

• Geometric transformation such as rotation, scaling...Example of rotation:

Remark: a point to point transformation doesn't require extra memory...

Point to point transformation

Page 10: Digital Image Processing in Frequency Domain

Local to point transformation

Note that local to point transformation is also called neighborhood operators.

Examples of local to point transformation:

Page 11: Digital Image Processing in Frequency Domain

One of the most important transformation is the Fourier transform that gives a frequential representation of the signal.

Fourier series (development in real term):

Every periodic signal can be decomposed into a linear combination of sinusoidal and cosinusoidal component functions.

and are used to weight the influence of each frequency component.

𝑓 (𝑥 )=𝑎0+∑𝑛=1

𝑎𝑛cos (2𝜋 𝑓𝑛𝑥 )+∑𝑛=1

𝑏𝑛sin (2𝜋 𝑓𝑛𝑥 )

Global to point transformation

Page 12: Digital Image Processing in Frequency Domain

Why Frequency Domain?

Similar jobs can be done in the spatial and frequency domains.

Filtering in the spatial domain can be easier to understand.

Filtering in the frequency domain can be much faster – especially for large images.

Note that convolution in the time domain is equivalent to multiplication in the frequency domain (and vice versa)– When you are faced with a difficult convolution (or

multiplication), you can switch domains and do the complement operation

Page 13: Digital Image Processing in Frequency Domain

Jean Baptiste Joseph FourierFourier was born in Auxerre, France in 1768

– Most famous for his work “La Théorie Analitique de la Chaleur” published in 1822

– Translated into English in 1878: “The Analytic Theory of Heat”

Nobody paid much attention when the work was first publishedOne of the most important mathematical theories in modern engineering

Page 14: Digital Image Processing in Frequency Domain

The Big Idea

=

Any function that periodically repeats itself can be expressed as a sum of sines and cosines of different frequencies each multiplied by a different coefficient – a Fourier series

Imag

es ta

ken

from

Gon

zale

z &

Woo

ds, D

igita

l Im

age

Proc

essi

ng (2

002)

Page 15: Digital Image Processing in Frequency Domain

Mathematical Background

Page 16: Digital Image Processing in Frequency Domain

Sine and Cosine Functions

• Periodic functions• General form of sine and cosine functions:

𝑦 (𝑡 )=𝐴𝑠𝑖𝑛(𝛼𝑡+𝑏) 𝑦 (𝑡 )=𝐴𝑐𝑜𝑠 (𝛼𝑡+𝑏)

Page 17: Digital Image Processing in Frequency Domain

Sine and Cosine Functions (cont’d)

• Changing the period T=2π/|α| e.g., y=cos(αt)

period 2π/4=π/2

shorter period higher frequency(i.e., oscillates faster)

α =4

Frequency is defined as f=1/T

Different notation: cos(αt)=cos(2πt/T)=cos(2πft)

Page 18: Digital Image Processing in Frequency Domain

In physics, angular frequency ω is a scalar measure of rotation rate. Angular frequency is the magnitude of the vector quantity angular velocity. One revolution is equal to 2π radians, hence

Where

ω is the angular frequency or angular speed (measured in radians per second),T is the period (measured in seconds),f is the ordinary frequency (measured in hertz).

Angular Frequency

Page 19: Digital Image Processing in Frequency Domain

Different Notation of Sine and Cosine Functions

• Changing the period T=2π/|α| e.g., y=cos(αt)

period 2π/4=π/2

shorter period higher frequency(i.e., oscillates faster)

α =4

Frequency is defined as f=1/T

Different notation: cos(αt)=cos(2πt/T)=cos(2πft)=where

Page 20: Digital Image Processing in Frequency Domain

++

cos (2𝜋 𝑓𝑛𝑥 )s∈(2𝜋 𝑓𝑛𝑥 )

Different Notation of Sine and Cosine Functions (continue)

Fundamental Frequency?

Page 21: Digital Image Processing in Frequency Domain

Time Domain and Frequency Domain

Time Domain:

The time-domain plot shows changes in signal amplitude with respect to time. Phase and frequency are not explicitly measure on a time-domain plot.

Frequency Domain:

The time-domain plot shows changes in signal amplitude with respect to frequency.

Page 22: Digital Image Processing in Frequency Domain

3.22

The time-domain and frequency-domain plots of a sine wave

Page 23: Digital Image Processing in Frequency Domain

The time domain and frequency domain of three sine waves

Page 24: Digital Image Processing in Frequency Domain

A composite periodic signal

Page 25: Digital Image Processing in Frequency Domain

Decomposition of a composite periodic signal in the time and frequency domains

Page 26: Digital Image Processing in Frequency Domain

When we deal with a one dimensional signal (time series), it is quite easy to understand what the concept of frequency is. Frequency is the number of occurrences of a repeating event per unit time. For example, in the figure below, we have 3 cosine functions with increasing frequencies cos(t), cos(2t), and cos(3t).

Spatial Frequency in image

Page 27: Digital Image Processing in Frequency Domain
Page 28: Digital Image Processing in Frequency Domain

So, we know that a sequence of such numbers gives us the feeling that cos(t) is a low frequency signal. How we can create an image of these numbers? Let scale the numbers to the range 0 and 255:

Considering that values are intensity values, we can obtain the following image.

Page 29: Digital Image Processing in Frequency Domain

This is our first image with a low frequency component. We have a smooth transition from white to black and black to white. However, it is still difficult to say anything since we have not seen an image with high frequency. If we repeat all the steps for cos(3t) , we obtain the following image:

where we have sudden jumps to black. You can try the same experiment for different cosines. By looking at two examples, we can say that if there are sharp intensity changes in an image, those regions correspond to high frequency components. On the other hand, regions with smooth transitions correspond to low frequency components.

Page 30: Digital Image Processing in Frequency Domain

We now have an idea for one dimensional image. It is time to switch to two dimensional representation of a signal. Let us first define a kind of two dimensional signal: f(x, y)=cos(kx) cos(ky). For example, the signal for k=1, we have: f(x, y)=cos(x) cos(y).

Page 31: Digital Image Processing in Frequency Domain

Our corresponding two dimensional function will be f(x, y)=cos(x) cos(y). How we will obtain a two dimensional image from this function? This is the question! We are going to define a matrix and store the values of f(x,y) for different (x, y) pairs.

Basically, we divide the angle range 0-2∏ into M=512 and N=512 regions for x and y, respectively.

Page 32: Digital Image Processing in Frequency Domain

Here are images for different k values. Values of k represents the level of frequency (from low to high) for k=0,….,20.

Page 33: Digital Image Processing in Frequency Domain
Page 34: Digital Image Processing in Frequency Domain

Similar to the 1D case, we can say that if the intensity values in an image changes dramatically, that image has high frequency components.

Page 35: Digital Image Processing in Frequency Domain

Special Frequency In Images

Spatial frequency of an image refers to the rate at which the pixel intensities change

In picture on right: High frequences:

Near center Low frequences:

Corners

Page 36: Digital Image Processing in Frequency Domain

According to Fourier, any periodic function defined in

can be expressed as

𝑓 (𝑥 )=𝑎0+∑𝑛=1

𝑎𝑛cos (𝑛𝑥 )+∑𝑛=1

𝑏𝑛sin (𝑛𝑥)

Where𝑎0=

12𝜋 ∫

−𝜋

𝜋

𝑓 (𝑥 )𝑑𝑥

𝑎𝑛=1𝜋 ∫

−𝜋

𝜋

𝑓 (𝑥 )cos (𝑛𝑥 )𝑑𝑥

𝑏𝑛=1𝜋 ∫

−𝜋

𝜋

𝑓 (𝑥 )𝑠𝑖𝑛 (𝑛𝑥 )𝑑𝑥

𝑛=1,2,3 ,……

Fourier Series and it’s Derivation

Page 37: Digital Image Processing in Frequency Domain

Math

ematical C

on

cepts

Page 38: Digital Image Processing in Frequency Domain

Basis, CoordinateDefinition A: A set of vectors is a basis of V if it has the following two properties: ( 1 ) S is linearly independent. (2) S spans V.

Definition B: A set of vectors is a basis of V if every can be written uniquely as a linear combination of the basis vectors.

Let

These n scalars are called the coordinates of v relative to the basis S. Thus

Page 39: Digital Image Processing in Frequency Domain

Example

Consider real space . The following vectors form a basis S of :

The coordinates of v = (5 , 3 , 4) relative to the basis S is obtained as follows. Set , that is, set v as a linear combination of the basis vectors using unknown scalars x, y, z. This yields:

The equivalent system of linear equations is as follows:

The solution of the system is x = 3, y = 2, z = 4. Thus

Page 40: Digital Image Processing in Frequency Domain

40

Definition

An inner product on a real vector spaces V is a function that associates a number, denoted 〈 u, v 〉 , with each pair of vectors u and v of V. This function has to satisfy the following conditions for vectors u, v, and w, and scalar c.

1. 〈 u, v 〉 = 〈 v, u 〉 (symmetry axiom)

2. 〈 u + v, w 〉 = 〈 u, w 〉 + 〈 v, w 〉 (additive axiom)

3. 〈 cu, v 〉 = c 〈 u, v 〉 (homogeneity axiom)

4. 〈 u, u 〉 0, and 〈 u, u 〉 = 0 if and only if u = 0

(position definite axiom)

Inner product

Page 41: Digital Image Processing in Frequency Domain

IneInner Product

Space

NNorm

Metric

Inner product Space, Norm. Metric, Projection

Orthogonal Projection

Page 42: Digital Image Processing in Frequency Domain

ORTHOGONAL SETS AND BASES

Consider a set of nonzero vectors in an inner product space V. S is called orthogonal if each pair of vectors in S are orthogonal, and S is called orthonormal if S is orthogonal and each vector in S has unit length. That is:

Page 43: Digital Image Processing in Frequency Domain

Let S consist of the following three vectors in :

we can verify that the vectors are orthogonal; hence they are linearly independent. Thus S is an orthogonal basis of

Suppose we want to write v = (7 , 1 , 9) as a linear combination of . First we set v as a linear combination of using unknowns as follows:

Orthogonal Basis and Linear Combinations

Page 44: Digital Image Processing in Frequency Domain

Method One

Expand (*) to obtain the system

Solve the system by Gaussian elimination to obtain , , .

Thus

Page 45: Digital Image Processing in Frequency Domain

This method uses the fact that the basis vectors are orthogonal, and the arithmetic i s much simpler. If we take the inner product of each side of (*) with respect to we get

Here two terms drop out, since are orthogonal. Accordingly,

Method Two

Page 46: Digital Image Processing in Frequency Domain

Orthogonal Basis and Linear Combinations (continue)

Theorem

Let be an orthogonal basis of V. Then, for any

Page 47: Digital Image Processing in Frequency Domain

Definition . A Hilbert space H is a vector space endowed with an inner product and associated norm and metric, such that every Cauchy sequence in H has a limit in H.

An example of a Hilbert space is the space

Definition of . The space is the collection of Borel measurable real or complex valued square integrable functions f on (a,b), i.e.,, endowed with inner product ,and associated norm and metric

,

respectively, where the integrals involved are Lebesgue integrals.

Hilbert Space

Page 48: Digital Image Processing in Frequency Domain

and are examples of finite dimensional Hilbert spaces; that is, any basis will have a finite number of basis vectors (in fact, n of them); expressing a vector in and as a vector in terms of an orthonormal basis is easy.

In infinite-dimensional Hilbert spaces, however, such an expression must involve an infinite sum, and hence issues of convergence. To say that for some vectors , we mean that

as

Basis of a Hilbert space

Page 49: Digital Image Processing in Frequency Domain

Orthonormal System: Let V be an inner product space. A collection of vectors is said to be an orthonormal system if for and if for all .

A collection of vectors in a Hilbert space H is complete if for all implies that y = 0.

An equivalent definition of completeness is the following. is complete in H if span is dense in H , that is, given and , there exists such that .

Basis of a Hilbert space (con..)

Complete orthonormal system

Page 50: Digital Image Processing in Frequency Domain

Definition Let be an orthonormal set in an Hilbert space .Then is said to be an orthonormal basis of if it is a complete orthonormal set in .

TheoremLet be an orthonormal set in an Hilbert space . Then is an orthonormal basis if and only if .

TheoremEvery Hilbert spaces has an orthonormal basis.

Basis of a Hilbert space (Continue)

Page 51: Digital Image Processing in Frequency Domain

Separable Hilbert spaces

Theorem A Hilbert space is separable if and only if it has a countable orthonormal basis.

Definition. A Hilbert space with a countable dense subset is separable. That is, a separable Hilbert space H has subset such that for any and for all , there exist with . Therefore the closure of D is H.

Page 52: Digital Image Processing in Frequency Domain

A set is a basis for a Hilbert space H if every x can be expressed uniquely in the form

for some in the field of scalars. If in addition is an orthonormal set, then we refer to it as an orthonormal basis.

Proposition . Let be an orthonormal set in a Hilbert space H. Then the following are equivalent:

Basis of a Separable Hilbert space

Page 53: Digital Image Processing in Frequency Domain

According to Fourier, any function defined in

can be expressed as

𝑓 (𝑥 )=𝑎0+∑𝑛=1

𝑎𝑛cos (𝑛𝑥 )+∑𝑛=1

𝑏𝑛sin (𝑛𝑥)

Where𝑎0=

12𝜋 ∫

−𝜋

𝜋

𝑓 (𝑥 )𝑑𝑥

𝑎𝑛=1𝜋 ∫

−𝜋

𝜋

𝑓 (𝑥 )cos (𝑛𝑥 )𝑑𝑥

𝑏𝑛=1𝜋 ∫

−𝜋

𝜋

𝑓 (𝑥 )𝑠𝑖𝑛 (𝑛𝑥 )𝑑𝑥

𝑛=1,2,3 ,……

Page 54: Digital Image Processing in Frequency Domain

(Con..)

𝑓 (𝑥 )=𝑎0+∑𝑛=1

𝑎𝑛cos (𝑛𝑥 )+∑𝑛=1

𝑏𝑛sin (𝑛𝑥)

This is an infinite series of continuous functions, so each of the functions

1 ,𝑐𝑜𝑠𝑥 ,𝑠𝑖𝑛𝑥 ,𝑐𝑜𝑠2𝑥 ,𝑠𝑖𝑛2 𝑥 ,….belong to . What happens if we compute the inner product of these functions?

Page 55: Digital Image Processing in Frequency Domain

(Con..)

Page 56: Digital Image Processing in Frequency Domain

(Con..)

So the functions 1, cos x, sin x, cos 2x, sin 2x, . . . are orthogonal with respect to the inner product!

Page 57: Digital Image Processing in Frequency Domain

They are not, however, orthonormal, since:

(Con..)

Page 58: Digital Image Processing in Frequency Domain

(Con..)

Normalizing them appropriately, we get the orthonormal sequence of functions:

If this sequence were in fact an orthonormal basis, then we would be able to say that every function in has an expression in terms of that basis, i.e. a Fourier series, which converges to the function in question.

1

√2𝜋,

1

√𝜋𝑐𝑜𝑠𝑥 ,

1

√𝜋𝑠𝑖𝑛𝑥 ,

1

√𝜋𝑐𝑜𝑠2 𝑥 ,

1

√𝜋𝑠𝑖𝑛2 𝑥 ,….

Page 59: Digital Image Processing in Frequency Domain

(Con..)

Theorem. The sequence

1

√2𝜋,

1

√𝜋𝑐𝑜𝑠𝑥 ,

1

√𝜋𝑠𝑖𝑛𝑥 ,

1

√𝜋𝑐𝑜𝑠2 𝑥 ,

1

√𝜋𝑠𝑖𝑛2 𝑥 ,….

of functions in form an orthonormal basis of that space.

Lemma. If f is integrable on [−π, π], and f is orthogonal to each of the functions

1

√2𝜋,

1

√𝜋𝑐𝑜𝑠𝑥 ,

1

√𝜋𝑠𝑖𝑛𝑥 ,

1

√𝜋𝑐𝑜𝑠2 𝑥 ,

1

√𝜋𝑠𝑖𝑛2 𝑥 ,….

then f(x) = 0 almost everywhere in [−π, π].

Page 60: Digital Image Processing in Frequency Domain

So we can write any function defined in

AS

𝑓 (𝑥 )=𝑎0+∑𝑛=1

𝑎𝑛cos (𝑛𝑥 )+∑𝑛=1

𝑏𝑛sin (𝑛𝑥)

⟨ 𝑓 ,𝑔⟩=∫−𝜋

𝜋

𝑓 (𝑥 )𝑔 (𝑥 )𝑑𝑥

Inner Product of

Page 61: Digital Image Processing in Frequency Domain

𝑓 (𝑥 )= ⟨ 𝑓 (𝑥) ,1 ⟩⟨1,1 ⟩

1+∑𝑛=1

∞ ⟨ 𝑓 (𝑥) ,cos (𝑛𝑥) ⟩⟨cos (𝑛𝑥 ) ,cos (𝑛𝑥) ⟩

cos (𝑛𝑥)+∑𝑛=1

∞ ⟨ 𝑓 (𝑥) , sin (𝑛𝑥 )⟩⟨sin (𝑛𝑥 ), sin (𝑛𝑥 )⟩

sin (𝑛𝑥 )

So we can write any function defined in

AS

So𝑎0=

12𝜋 ∫

−𝜋

𝜋

𝑓 (𝑥 )𝑑𝑥

𝑎𝑛=1𝜋 ∫

−𝜋

𝜋

𝑓 (𝑥 )cos (𝑛𝑥 )𝑑𝑥

𝑏𝑛=1𝜋 ∫

−𝜋

𝜋

𝑓 (𝑥 )𝑠𝑖𝑛 (𝑛𝑥 )𝑑𝑥𝑛=1,2,3 ,……

Page 62: Digital Image Processing in Frequency Domain

Functions with a periodicity of (i.e: for all n) can be decomposed into contributions from and which are periodic on the period .

𝑓 (𝑥 )=𝑎0+∑𝑛=1

𝑎𝑛cos (𝑛𝜋 𝑥 /𝐿)+∑𝑛=1

𝑏𝑛sin (𝑛𝜋 𝑥 /𝐿)

Where

𝑎0=1

2𝐿∫−𝐿

𝐿

𝑓 (𝑥 )𝑑𝑥

𝑎𝑛=1𝐿 ∫

−𝐿

𝐿

𝑓 (𝑥 ) cos (𝑛𝜋 𝑥/𝐿)𝑑𝑥

𝑏𝑛=1𝐿∫

−𝐿

𝐿

𝑓 (𝑥 ) 𝑠𝑖𝑛 (𝑛𝜋 𝑥 /𝐿)𝑑𝑥

Functions of arbitrary periodicity

Page 63: Digital Image Processing in Frequency Domain

An equation with many faces

𝑓 (𝑥 )=𝑎0+∑𝑛=1

𝑎𝑛cos (𝑛𝑥 )+∑𝑛=1

𝑏𝑛sin (𝑛𝑥)

𝑓 (𝑥 )=𝑎0+∑𝑛=1

𝑎𝑛cos (2𝜋 𝑓𝑛𝑥 )+∑𝑛=1

𝑏𝑛sin (2𝜋 𝑓𝑛𝑥 )

𝑓 (𝑥 )=𝑎0+∑𝑛=1

𝑎𝑛cos (2𝜋𝑛𝑥 /𝑇 )+∑𝑛=1

𝑏𝑛sin (2𝜋𝑛𝑥 /𝑇 )

𝑓 (𝑥 )=𝑎0+∑𝑛=1

𝑎𝑛cos (𝑛𝑤𝑥 )+∑𝑛=1

𝑏𝑛sin (𝑛𝑤𝑥 )

𝑓 (𝑥 )=𝑎0+∑𝑛=1

𝑎𝑛cos (𝜋 𝑛𝑥 /𝐿)+∑𝑛=1

𝑏𝑛sin (𝜋 𝑛𝑥 /𝐿)

Page 64: Digital Image Processing in Frequency Domain

The Complex Fourier Series

𝑐0=𝑎0

𝑐𝑛=12(𝑎𝑛−𝑖𝑏𝑛)

𝑐−𝑛=12(𝑎𝑛+𝑖𝑏𝑛)

Let and be the Fourier coefficients of the function f(x) defined on [-L, L]. We introduce a new set of coefficients, viz. , where . These are given by

You are reminded of the following identities:

𝑎0=𝑐0

𝑎𝑛=(𝑐𝑛+𝑐−𝑛)𝑏𝑛=(𝑐𝑛− 𝑖𝑐−𝑛)

Page 65: Digital Image Processing in Frequency Domain

The Fourier series may then be expressed as

=

=

=

=

Page 66: Digital Image Processing in Frequency Domain

A new formula for the Fourier coefficients can be obtained as follows:

𝑐0=𝑎0=1

2𝐿∫−𝐿

𝐿

𝑓 (𝑥)𝑒0𝑑𝑥

and

The formula for the complex Fourier coefficients is therefore

for

Page 67: Digital Image Processing in Frequency Domain

++

Meaning of Coefficients

++

Page 68: Digital Image Processing in Frequency Domain

Examples of Signals and the Fourier Series Representation

Page 69: Digital Image Processing in Frequency Domain

3.69

Sawtooth Signal

𝒇 (𝒙 )=𝟐 𝑨𝝅

𝐬𝐢𝐧 (𝟐𝝅 𝒇𝒙 ) −𝟐 𝑨𝟐𝝅

𝒔𝒊𝒏 (𝟐𝝅 𝒇 𝟐 𝒙 )+𝟐𝑨𝟑𝝅

𝒔𝒊𝒏 (𝟐𝝅 𝒇 𝟑 𝒙 )−𝟐 𝑨𝟒𝝅

𝒔𝒊𝒏 (𝟐𝝅 𝒇 𝟓 𝒙 )+…

Page 70: Digital Image Processing in Frequency Domain

Application

Page 71: Digital Image Processing in Frequency Domain

If has period , its (complex) Fourier series expansion is

f ( x )= ∑𝑛=− ∞

𝑛=∞

𝑐𝑛𝑒𝑖𝑛 𝜋 𝑥𝐿

We now develop an expansion for non-periodic functions, by allowing complex exponentials (or equivalently sin’s and cos’s) of all possible periods, not just , for some fixed . So, from now on, do not assume that is periodic.

Fourier Series to Fourier Transform

Page 72: Digital Image Processing in Frequency Domain

�̂� (𝑤 )=∫−∞

𝑓 (𝑥)𝑒− 𝑖𝑤𝑥𝑑𝑥

Fourier Series to Fourier Transform

Where

Page 73: Digital Image Processing in Frequency Domain

Parseval's Theorem: Energy Relations in Time and Frequency

Page 74: Digital Image Processing in Frequency Domain

Now We have Finished

Mathematical Discussion

Start DFT and it’s application in Image

Processing

Page 75: Digital Image Processing in Frequency Domain

Discrete Fourier Transform1-D case

Page 76: Digital Image Processing in Frequency Domain

Discrete Fourier transform (1-D)

Page 77: Digital Image Processing in Frequency Domain

The Discrete Fourier Transform (DFT)2-D case

The Discrete Fourier Transform of f(x,y), for x = 0, 1, 2…M-1 and y = 0,1,2…N-1, denoted by F(u,v), is given by the equation:

for u = 0, 1, 2…M-1 and v = 0, 1, 2…N-1.

1

0

1

0

)//(2),(),(M

x

N

y

NvyMuxjeyxfvuF

Page 78: Digital Image Processing in Frequency Domain

The Inverse DFT

It is really important to note that the Fourier transform is completely reversible.

The inverse DFT is given by:

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

1

0

1

0

)//(2),(1

),(M

u

N

v

NvyMuxjevuFMN

yxf

Page 79: Digital Image Processing in Frequency Domain

Discrete Fourier transform (2-D)

Page 80: Digital Image Processing in Frequency Domain

Spatial Domain and Frequency Domain of an Image

Image data can be represented in either the spatial domain or the frequency domain. The frequency domain contains the same information as the spatial domain but in a vastly different form.

Useful for data compressionMore efficient for certain image operations

Spatial Domain

For each location in the image, what is the value of the light intensity at that location?

Spatial Domain

For each location in the image, what is the value of the light intensity at that location?

Frequency Domain

For each frequency component in the image, what is power or its amplitude?

Frequency Domain

For each frequency component in the image, what is power or its amplitude?

Page 81: Digital Image Processing in Frequency Domain
Page 82: Digital Image Processing in Frequency Domain

Image and it’s DFT

Page 83: Digital Image Processing in Frequency Domain

A frequential decomposition in terms of exponential basis images ...

Image Representation using basis

f

f

are the weighting coefficients of the spatial frequencies present in the signal.

Note: A picture having a size of is a linear combination of exponential basis images!!!!

Page 84: Digital Image Processing in Frequency Domain

Image Representation using basis

Page 85: Digital Image Processing in Frequency Domain
Page 86: Digital Image Processing in Frequency Domain

The DFT and Image Processing

Imag

es ta

ken

from

Gon

zale

z &

Woo

ds, D

igita

l Im

age

Proc

essi

ng (2

002)

Page 87: Digital Image Processing in Frequency Domain

DFT & Images

DFT

Scanning electron microscope image of an integrated circuit

magnified ~2500 times

Fourier spectrum of the image

Page 88: Digital Image Processing in Frequency Domain

Filter

Page 89: Digital Image Processing in Frequency Domain

Some Basic Frequency Domain Filters

Imag

es ta

ken

from

Gon

zale

z &

Woo

ds, D

igita

l Im

age

Proc

essi

ng (2

002) Low Pass Filter

High Pass Filter

Page 90: Digital Image Processing in Frequency Domain

Smoothing Frequency Domain Filters

Smoothing is achieved in the frequency domain by dropping out the high frequency componentsThe basic model for filtering is:

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

where F(u,v) is the Fourier transform of the image being filtered and H(u,v) is the filter transform functionLow pass filters – only pass the low frequencies, drop the high ones

Page 91: Digital Image Processing in Frequency Domain

Ideal Low Pass FilterSimply cut off all high frequency components that are a specified distance D0 from the origin of the transform

changing the distance changes the behaviour of the filter

Imag

es ta

ken

from

Gon

zale

z &

Woo

ds, D

igita

l Im

age

Proc

essi

ng (2

002)

Page 92: Digital Image Processing in Frequency Domain

Ideal Low Pass Filter (cont…)

The transfer function for the ideal low pass filter can be given as:

where D(u,v) is given as:

0

0

),( if 0

),( if 1),(

DvuD

DvuDvuH

2/122 ])2/()2/[(),( NvMuvuD

Page 93: Digital Image Processing in Frequency Domain

Ideal Low Pass Filter (cont…)

Above we show an image, it’s Fourier spectrum and a series of ideal low pass filters of radius 5, 15, 30, 80 and 230 superimposed on top of it

Imag

es ta

ken

from

Gon

zale

z &

Woo

ds, D

igita

l Im

age

Proc

essi

ng (2

002)

Page 94: Digital Image Processing in Frequency Domain

Ideal Low Pass Filter (cont…)

Imag

es ta

ken

from

Gon

zale

z &

Woo

ds, D

igita

l Im

age

Proc

essi

ng (2

002)

Originalimage

Result of filtering with ideal low pass filter of radius 5

Result of filtering with ideal low pass filter of radius 30

Result of filtering with ideal low pass filter of radius 230

Result of filtering with ideal low pass

filter of radius 80

Result of filtering with ideal low pass

filter of radius 15

Page 95: Digital Image Processing in Frequency Domain
Page 96: Digital Image Processing in Frequency Domain
Page 97: Digital Image Processing in Frequency Domain

Illustration

Page 98: Digital Image Processing in Frequency Domain

Butterworth Lowpass Filters

The transfer function of a Butterworth lowpass filter of order n with cutoff frequency at distance D0 from the origin is defined as:

Imag

es ta

ken

from

Gon

zale

z &

Woo

ds, D

igita

l Im

age

Proc

essi

ng (2

002)

nDvuDvuH

20 ]/),([1

1),(

Page 99: Digital Image Processing in Frequency Domain

Butterworth Lowpass Filter (cont…)

Imag

es ta

ken

from

Gon

zale

z &

Woo

ds, D

igita

l Im

age

Proc

essi

ng (2

002)

Originalimage

Result of filtering with Butterworth filter of order 2 and cutoff radius 5

Result of filtering with Butterworth filter of order 2 and cutoff radius 30

Result of filtering with Butterworth filter of order 2 and cutoff radius 230

Result of filtering with Butterworth filter of

order 2 and cutoff radius 80

Result of filtering with Butterworth filter of

order 2 and cutoff radius 15

Page 100: Digital Image Processing in Frequency Domain

Gaussian Lowpass Filters

The transfer function of a Gaussian lowpass filter is defined as:

Imag

es ta

ken

from

Gon

zale

z &

Woo

ds, D

igita

l Im

age

Proc

essi

ng (2

002)

20

2 2/),(),( DvuDevuH

Page 101: Digital Image Processing in Frequency Domain

Gaussian Lowpass Filters (cont…)

Imag

es ta

ken

from

Gon

zale

z &

Woo

ds, D

igita

l Im

age

Proc

essi

ng (2

002)

Originalimage

Result of filtering with Gaussian filter with cutoff radius 5

Result of filtering with Gaussian filter with cutoff radius 30

Result of filtering with Gaussian filter with cutoff radius 230

Result of filtering with Gaussian

filter with cutoff radius 85

Result of filtering with Gaussian

filter with cutoff radius 15

Page 102: Digital Image Processing in Frequency Domain

Lowpass Filters Compared

Result of filtering with ideal low pass

filter of radius 15

Result of filtering with Butterworth filter of order 2 and cutoff radius 15

Result of filtering with Gaussian

filter with cutoff radius 15

Imag

es ta

ken

from

Gon

zale

z &

Woo

ds, D

igita

l Im

age

Proc

essi

ng (2

002)

Page 103: Digital Image Processing in Frequency Domain

Lowpass Filtering Examples

A low pass Gaussian filter is used to connect broken text

Imag

es ta

ken

from

Gon

zale

z &

Woo

ds, D

igita

l Im

age

Proc

essi

ng (2

002)

Page 104: Digital Image Processing in Frequency Domain

Lowpass Filtering Examples (cont…)

Different lowpass Gaussian filters used to remove blemishes in a photograph

Imag

es ta

ken

from

Gon

zale

z &

Woo

ds, D

igita

l Im

age

Proc

essi

ng (2

002)

Page 105: Digital Image Processing in Frequency Domain

Sharpening in the Frequency Domain

Edges and fine detail in images are associated with high frequency components.

High pass filters – only pass the high frequencies, drop the low ones

High pass frequencies are precisely the reverse of low pass filters, so:

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

Page 106: Digital Image Processing in Frequency Domain

Ideal High Pass Filters

The ideal high pass filter is given as:

where D0 is the cut off distance as before

0

0

),( if 1

),( if 0),(

DvuD

DvuDvuH

Imag

es ta

ken

from

Gon

zale

z &

Woo

ds, D

igita

l Im

age

Proc

essi

ng (2

002)

Page 107: Digital Image Processing in Frequency Domain

Ideal High Pass Filters (cont…)

Results of ideal high pass filtering with

D0 = 15

Results of ideal high pass filtering with

D0 = 30

Results of ideal high pass filtering with

D0 = 80

Imag

es ta

ken

from

Gon

zale

z &

Woo

ds, D

igita

l Im

age

Proc

essi

ng (2

002)

Page 108: Digital Image Processing in Frequency Domain

Butterworth High Pass Filters

The Butterworth high pass filter is given as:

where n is the order and D0 is the cut off distance as before

nvuDDvuH

20 )],(/[1

1),(

Imag

es ta

ken

from

Gon

zale

z &

Woo

ds, D

igita

l Im

age

Proc

essi

ng (2

002)

Page 109: Digital Image Processing in Frequency Domain

Butterworth High Pass Filters (cont…)

Results of Butterworth

high pass filtering of

order 2 with D0 = 15

Results of Butterworth high pass filtering of order 2 with D0 = 80

Results of Butterworth high pass filtering of order 2 with D0 = 30

Imag

es ta

ken

from

Gon

zale

z &

Woo

ds, D

igita

l Im

age

Proc

essi

ng (2

002)

Page 110: Digital Image Processing in Frequency Domain

Gaussian High Pass Filters

The Gaussian high pass filter is given as:

where D0 is the cut off distance as before

20

2 2/),(1),( DvuDevuH

Imag

es ta

ken

from

Gon

zale

z &

Woo

ds, D

igita

l Im

age

Proc

essi

ng (2

002)

Page 111: Digital Image Processing in Frequency Domain

Gaussian High Pass Filters (cont…)

Results of Gaussian high pass

filtering with D0 = 15

Results of Gaussian high pass filtering with D0 = 80

Results of Gaussian high pass filtering with D0 = 30

Imag

es ta

ken

from

Gon

zale

z &

Woo

ds, D

igita

l Im

age

Proc

essi

ng (2

002)

Page 112: Digital Image Processing in Frequency Domain

Highpass Filter Comparison

Results of ideal high pass filtering with

D0 = 15

Results of Gaussian high pass filtering with D0 =

15

Results of Butterworth high pass filtering of order

2 with D0 = 15

Imag

es ta

ken

from

Gon

zale

z &

Woo

ds, D

igita

l Im

age

Proc

essi

ng (2

002)

Page 113: Digital Image Processing in Frequency Domain

Highpass Filtering ExampleO

rigin

al im

age

Highpass filtering result

Hig

h fr

eque

ncy

emph

asis

resu

lt After histogram

equalisation

Imag

es ta

ken

from

Gon

zale

z &

Woo

ds, D

igita

l Im

age

Proc

essi

ng (2

002)

Page 114: Digital Image Processing in Frequency Domain

Band Reject Filters

The ideal band reject filter is shown below, along with Butterworth and Gaussian versions of the filter

Imag

es ta

ken

from

Gon

zale

z &

Woo

ds, D

igita

l Im

age

Proc

essi

ng (2

002)

Ideal BandReject Filter

ButterworthBand Reject

Filter

GaussianBand Reject

Filter

Page 115: Digital Image Processing in Frequency Domain

Band Reject Filter Example

Imag

es ta

ken

from

Gon

zale

z &

Woo

ds, D

igita

l Im

age

Proc

essi

ng (2

002) Image corrupted by

sinusoidal noiseFourier spectrum of

corrupted image

Butterworth band reject filter

Filtered image

Page 116: Digital Image Processing in Frequency Domain

Magnitude and Phase of DFT

• What is more important?

• Hint: use inverse DFT to reconstruct the image using magnitude or phase only information

magnitude phase

Page 117: Digital Image Processing in Frequency Domain

Magnitude and Phase of DFT (cont’d)

Reconstructed image using

magnitude only

(i.e., magnitude determines the

contribution of each component!)

Reconstructed image using

phase only

(i.e., phase determines

which components are present!)

Page 118: Digital Image Processing in Frequency Domain

Another example: amplitude vs. phase

Page 119: Digital Image Processing in Frequency Domain

Thank You