pptx

advertisement
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?
Enhanced image
How can
we get the
enhanced
image from
the original
image?
How can we get this original image?
Image transformation
What is a transformation?
• im is the original image;
• IM is the transformed image;
• ๐‘ฅ, ๐‘ฆ (or ๐‘ข, ๐‘ฃ) represents the spatial coordinates of a pixel.
Goal of a transformation
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.
Image transformation
Point to point transformation
• Geometric transformation such as rotation, scaling...
Example of rotation:
Remark: a point to point transformation doesn't require extra
memory...
Local to point transformation
Note that local to point transformation is also called neighborhood
operators.
Examples of local to point transformation:
Global to point transformation
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.
∞
๐‘“ ๐‘ฅ = ๐‘Ž0 +
∞
๐‘Ž๐‘› cos(2๐œ‹๐‘“๐‘›๐‘ฅ) +
๐‘›=1
๐‘๐‘› sin(2๐œ‹๐‘“๐‘›๐‘ฅ)
๐‘›=1
๐‘Ž๐‘› and ๐‘๐‘› are used to weight the influence of each frequency
component.
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
especially for large images.
domain can be much faster –
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
Jean Baptiste Joseph Fourier
Fourier 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 published
One of the most important mathematical theories
in modern engineering
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
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
Mathematical
Background
Sine and Cosine Functions
• Periodic functions
• General form of sine and cosine functions:
๐‘ฆ ๐‘ก = ๐ด๐‘ ๐‘–๐‘›(๐›ผ๐‘ก + ๐‘)
๐‘ฆ ๐‘ก = ๐ด๐‘๐‘œ๐‘ (๐›ผ๐‘ก + ๐‘)
Sine and Cosine Functions (cont’d)
• Changing the period T=2π/|α|
e.g., y=cos(αt)
α =4
period 2π/4=π/2
shorter period
higher frequency
(i.e., oscillates faster)
Frequency is defined as f=1/T
Different notation: cos(αt)=cos(2πt/T)=cos(2πft)
Angular Frequency
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).
Different Notation of Sine and Cosine
Functions
• Changing the period T=2π/|α|
e.g., y=cos(αt)
α =4
period 2π/4=π/2
shorter period
higher frequency
(i.e., oscillates faster)
Frequency is defined as f=1/T
Different notation: cos(αt)=cos(2πt/T)=cos(2πft)=cos(๐‘ค0 ๐‘ก)
where ๐‘ค0 = 2๐œ‹๐‘“
Different Notation of Sine and Cosine
Functions (continue)
cos 2๐œ‹๐‘“๐‘›๐‘ฅ
sin 2๐œ‹๐‘“๐‘›๐‘ฅ
๐‘“ ๐‘ฅ = ๐‘Ž0 + ๐‘Ž1 cos 2๐œ‹๐‘“๐‘ฅ + ๐‘Ž2 cos(2๐œ‹๐‘“2๐‘ฅ)+๐‘Ž3 cos 2๐œ‹๐‘“3๐‘ฅ + โ‹ฏ
+๐‘1 sin 2๐œ‹๐‘“๐‘ฅ + ๐‘2 sin(2๐œ‹๐‘“2๐‘ฅ)+๐‘3 sin 2๐œ‹๐‘“3๐‘ฅ + โ‹ฏ
Fundamental Frequency?
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.
The time-domain and frequency-domain plots of a sine wave
3.22
The time domain and frequency domain of three sine waves
A composite periodic signal
Decomposition of a composite periodic signal in the time and
frequency domains
Spatial Frequency in image
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).
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.
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.
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).
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.
Here are images for different k values. Values of k represents the
level of frequency (from low to high) for k=0,….,20.
Similar to the 1D case, we can say that if the intensity values in an
image changes dramatically, that image has high frequency
components.
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
Fourier Series and it’s Derivation
According to Fourier, any periodic function defined in
can be expressed as
∞
๐‘“ ๐‘ฅ = ๐‘Ž0 +
∞
๐‘Ž๐‘› cos(๐‘›๐‘ฅ) +
๐‘›=1
Where
1
๐‘Ž0 =
2๐œ‹
1
๐‘Ž๐‘› =
๐œ‹
1
๐‘๐‘› =
๐œ‹
๐‘๐‘› sin(๐‘›๐‘ฅ)
๐‘›=1
๐œ‹
๐‘“ ๐‘ฅ ๐‘‘๐‘ฅ
−๐œ‹
๐œ‹
๐‘“ ๐‘ฅ cos(๐‘›๐‘ฅ)๐‘‘๐‘ฅ
−๐œ‹
๐œ‹
๐‘“ ๐‘ฅ ๐‘ ๐‘–๐‘›(๐‘›๐‘ฅ)๐‘‘๐‘ฅ
−๐œ‹
๐‘› = 1,2,3, … …
Mathematical Concepts
Basis, Coordinate
Definition A: A set ๐‘† = ๐‘ข1 , ๐‘ข2 , … … , ๐‘ข๐‘› 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 ๐‘† = ๐‘ข1 , ๐‘ข2 , … … , ๐‘ข๐‘› of vectors is a basis of V
if every ๐‘ฃ๐œ–๐‘‰ can be written uniquely as a linear combination of the
basis vectors.
Let ๐‘ฃ๐œ–๐‘‰
๐‘ฃ = ๐‘Ž1 ๐‘ข1 + ๐‘Ž2 ๐‘ข2 + โ‹ฏ + ๐‘Ž๐‘› ๐‘ข๐‘›
These n scalars ๐‘Ž1 , ๐‘Ž2 , … … , ๐‘Ž๐‘› are called the coordinates of v
relative to the basis S. Thus
๐‘ฃ ๐‘† = ๐‘Ž1 , ๐‘Ž2 , … … , ๐‘Ž๐‘›
Example
Consider real space ๐‘…3 . The following vectors form a basis S of ๐‘…3 :
The coordinates of v = (5 , 3 , 4) relative to the basis S is obtained as follows. Set
๐‘ฃ = ๐‘ฅ๐‘ข1 + ๐‘ฆ๐‘ข2 + ๐‘ง๐‘ข3 , 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
Inner product
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)
40
Inner product Space, Norm. Metric, Projection
Inner Product
Ine
Space
N
Norm
Metric
Orthogonal Projection
ORTHOGONAL SETS AND BASES
Consider a set ๐‘† = ๐‘ข1 , ๐‘ข2 , … … , ๐‘ข๐‘› 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:
Orthogonal Basis and Linear Combinations
Let S consist of the following three vectors in ๐‘…3 :
we can verify that the vectors are orthogonal; hence they are
linearly independent. Thus S is an orthogonal basis of ๐‘…3 .
Suppose we want to write v = (7 , 1 , 9) as a linear combination of
๐‘ข1 , ๐‘ข2 , ๐‘ข3 . First we set v as a linear combination of
๐‘ข1 , ๐‘ข2 , ๐‘ข3 using unknowns ๐‘ฅ1 , ๐‘ฅ2 , ๐‘ฅ3 as follows:
Method One
Expand (*) to obtain the system
Solve the system by Gaussian elimination to obtain ๐‘ฅ1 = 3, ๐‘ฅ2 =
− 1, ๐‘ฅ3 = 2.
Thus
Method Two
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 ๐‘ข1 , ๐‘ข2 , ๐‘ข3 are orthogonal.
Accordingly,
Orthogonal Basis and Linear Combinations (continue)
Theorem
Let ๐‘ข1 , ๐‘ข2 , … … , ๐‘ข๐‘› be an orthogonal basis of V. Then,
for any ๐‘ฃ ∈ ๐‘‰,
๐‘ฃ, ๐‘ข1
๐‘ฃ, ๐‘ข2
๐‘ฃ, ๐‘ข๐‘›
๐‘ฃ=
๐‘ข1 +
๐‘ข2 + โ‹ฏ +
๐‘ข๐‘›
๐‘ข1 , ๐‘ข1
๐‘ข2 , ๐‘ข2
๐‘ข๐‘› , ๐‘ข ๐‘›
Hilbert Space
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 ๐ฟ2 (๐‘Ž, ๐‘)
Definition of ๐ฟ2 (๐‘Ž, ๐‘) . The space ๐ฟ2 (๐‘Ž, ๐‘) is the collection of Borel
measurable real or complex valued square integrable functions f on
(a,b), i.e.,
๐‘
๐‘Ž
๐‘“(๐‘ก)
2
< ∞ , endowed with inner product ๐‘“, ๐‘” =
๐‘
๐‘“(๐‘ก)๐‘”
๐‘Ž
๐‘ก ๐‘‘๐‘ก ,and associated norm and metric
๐‘“ =
๐‘
๐‘Ž
๐‘“(๐‘ก)
2 ๐‘‘๐‘ก
, ๐‘‘ ๐‘“, ๐‘” = ๐‘“ − ๐‘” =
๐‘
๐‘Ž
๐‘“ ๐‘ก − ๐‘”(๐‘ก) 2 ๐‘‘๐‘ก
respectively, where the integrals involved are Lebesgue integrals.
Basis of a Hilbert space
๐‘…๐‘› 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 ๐‘ฅ = ∞
1 ๐‘ฅ๐‘– ๐‘’๐‘– for some vectors ๐‘’๐‘– , we
mean that
๐‘ฅ−
๐‘›
๐‘–=1 ๐‘ฅ๐‘– ๐‘’๐‘–
→ 0 as ๐‘› → ∞
Basis of a Hilbert space (con..)
Orthonormal System: Let V be an inner product space. A
collection of vectors
๐‘ฅ๐›ผ ๐›ผ∈๐ด ⊆ ๐‘‰ is said to be an
orthonormal system if ๐‘ฅ๐›ผ , ๐‘ฅ๐›ฝ = 0 for ๐›ผ ≠ ๐›ฝ and if
๐‘ฅ๐›ผ , ๐‘ฅ๐›ผ = 1 for all ๐›ผ ∈ ๐ด.
Complete orthonormal system
A collection of vectors ๐‘ฅ๐›ผ ๐›ผ∈๐ด in a Hilbert space H is complete if
๐‘ฆ, ๐‘ฅ๐›ผ = 0 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 u ∈ ๐ป
and ๐œ€ > 0, there exists ๐‘ฃ ∈ ๐‘ ๐‘๐‘Ž๐‘› ๐‘ฅ๐›ผ such that ๐‘ข − ๐‘ฃ < ๐œ€.
Basis of a Hilbert space (Continue)
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 ๐“—.
Theorem
Let ๐ธ be an orthonormal set in an Hilbert space ๐“—. Then ๐ธ is an
orthonormal basis if and only if ๐‘ฌ⊥ = {๐ŸŽ}.
Theorem
Every Hilbert spaces has an orthonormal basis.
Separable Hilbert spaces
Definition.
A Hilbert space with a countable dense subset is
separable. That is, a separable Hilbert space H has subset ๐ท =
๐‘‘1 , ๐‘‘2 , … such that for any ๐‘ฆ ∈ ๐ป and for all ๐œ€ > 0, there exist
๐‘‘๐‘˜ ∈ ๐ท with ๐‘ฆ − ๐‘‘๐‘˜ < ๐œ€. Therefore the closure of D is H.
Theorem
A Hilbert space ๐“— is separable if and only if it has a
countable orthonormal basis.
Basis of a Separable Hilbert space
A set ๐‘’๐‘– |๐‘– ∈ โ„• is a basis for a Hilbert space H if every x can be expressed uniquely
in the form
๐‘ฅ=
∞
๐‘–=1 ๐‘ฅ๐‘– ๐‘’๐‘–
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:
According to Fourier, any function defined in
can be expressed as
∞
๐‘“ ๐‘ฅ = ๐‘Ž0 +
∞
๐‘Ž๐‘› cos(๐‘›๐‘ฅ) +
๐‘›=1
Where
1
๐‘Ž0 =
2๐œ‹
1
๐‘Ž๐‘› =
๐œ‹
1
๐‘๐‘› =
๐œ‹
๐‘๐‘› sin(๐‘›๐‘ฅ)
๐‘›=1
๐œ‹
๐‘“ ๐‘ฅ ๐‘‘๐‘ฅ
−๐œ‹
๐œ‹
๐‘“ ๐‘ฅ cos(๐‘›๐‘ฅ)๐‘‘๐‘ฅ
−๐œ‹
๐œ‹
๐‘“ ๐‘ฅ ๐‘ ๐‘–๐‘›(๐‘›๐‘ฅ)๐‘‘๐‘ฅ
−๐œ‹
๐‘› = 1,2,3, … …
(Con..)
∞
๐‘“ ๐‘ฅ = ๐‘Ž0 +
∞
๐‘Ž๐‘› cos(๐‘›๐‘ฅ) +
๐‘›=1
๐‘๐‘› sin(๐‘›๐‘ฅ)
๐‘›=1
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?
(Con..)
(Con..)
So the functions 1, cos x, sin x, cos 2x, sin 2x, . . .
are orthogonal with respect to the ๐ฟ2 inner
product!
(Con..)
They are not, however, orthonormal, since:
(Con..)
Normalizing them appropriately, we get the orthonormal sequence
of functions:
1
1
1
1
1
,
๐‘๐‘œ๐‘ ๐‘ฅ,
๐‘ ๐‘–๐‘›๐‘ฅ,
๐‘๐‘œ๐‘ 2๐‘ฅ,
๐‘ ๐‘–๐‘›2๐‘ฅ, … .
๐œ‹
๐œ‹
๐œ‹
2๐œ‹ ๐œ‹
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.
(Con..)
Theorem. The sequence
1
1
1
1
1
,
๐‘๐‘œ๐‘ ๐‘ฅ,
๐‘ ๐‘–๐‘›๐‘ฅ,
๐‘๐‘œ๐‘ 2๐‘ฅ,
๐‘ ๐‘–๐‘›2๐‘ฅ, … .
๐œ‹
๐œ‹
๐œ‹
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
1
1
1
1
,
๐‘๐‘œ๐‘ ๐‘ฅ,
๐‘ ๐‘–๐‘›๐‘ฅ,
๐‘๐‘œ๐‘ 2๐‘ฅ,
๐‘ ๐‘–๐‘›2๐‘ฅ, … .
๐œ‹
๐œ‹
๐œ‹
2๐œ‹ ๐œ‹
then f(x) = 0 almost everywhere in [−π, π].
So we can write any function defined in
AS
∞
๐‘“ ๐‘ฅ = ๐‘Ž0 +
∞
๐‘Ž๐‘› cos(๐‘›๐‘ฅ) +
๐‘›=1
๐‘๐‘› sin(๐‘›๐‘ฅ)
๐‘›=1
Inner Product of
๐œ‹
๐‘“, ๐‘” =
๐‘“(๐‘ฅ)๐‘” ๐‘ฅ ๐‘‘๐‘ฅ
−๐œ‹
So we can write any function defined in
AS
๐‘“ ๐‘ฅ
๐‘“(๐‘ฅ), 1
=
1
1,1
∞
+
๐‘›=1
So
∞
๐‘“(๐‘ฅ), cos(๐‘›๐‘ฅ)
๐‘“(๐‘ฅ), sin(๐‘›๐‘ฅ)
cos(๐‘›๐‘ฅ) +
sin(๐‘›๐‘ฅ)
sin(๐‘›๐‘ฅ),
sin(๐‘›๐‘ฅ)
cos(๐‘›๐‘ฅ), cos(๐‘›๐‘ฅ)
๐‘›=1
1
๐‘Ž0 =
2๐œ‹
1
๐‘Ž๐‘› =
๐œ‹
1
๐‘๐‘› =
๐œ‹
๐œ‹
๐‘“ ๐‘ฅ ๐‘‘๐‘ฅ
−๐œ‹
๐œ‹
๐‘“ ๐‘ฅ cos(๐‘›๐‘ฅ)๐‘‘๐‘ฅ
−๐œ‹
๐œ‹
๐‘“ ๐‘ฅ ๐‘ ๐‘–๐‘›(๐‘›๐‘ฅ)๐‘‘๐‘ฅ
−๐œ‹
๐‘› = 1,2,3, … …
Functions of arbitrary periodicity
Functions with a periodicity of 2๐ฟ (i.e: ๐‘“ ๐‘ฅ + 2๐ฟ๐‘› = ๐‘“(๐‘ฅ) for all n)
๐œ‹๐‘ฅ
can be decomposed into contributions from sin(๐‘› ) and
๐œ‹๐‘ฅ
cos(๐‘› )
๐ฟ
๐ฟ
which are periodic on the period 2๐ฟ.
∞
๐‘“ ๐‘ฅ = ๐‘Ž0 +
∞
๐‘Ž๐‘› cos(๐‘›๐œ‹๐‘ฅ/๐ฟ) +
๐‘›=1
Where
1
๐‘Ž0 =
2๐ฟ
1
๐‘Ž๐‘› =
๐ฟ
1
๐‘๐‘› =
๐ฟ
๐‘๐‘› sin(๐‘›๐œ‹๐‘ฅ/๐ฟ)
๐‘›=1
๐ฟ
๐‘“ ๐‘ฅ ๐‘‘๐‘ฅ
−๐ฟ
๐ฟ
๐‘“ ๐‘ฅ cos(๐‘›๐œ‹๐‘ฅ/๐ฟ)๐‘‘๐‘ฅ
−๐ฟ
๐ฟ
๐‘“ ๐‘ฅ ๐‘ ๐‘–๐‘›(๐‘›๐œ‹๐‘ฅ/๐ฟ)๐‘‘๐‘ฅ
−๐ฟ
An equation with many faces
∞
∞
๐‘“ ๐‘ฅ = ๐‘Ž0 +
๐‘Ž๐‘› cos(๐‘›๐‘ฅ) +
๐‘›=1
∞
๐‘“ ๐‘ฅ = ๐‘Ž0 +
๐‘๐‘› sin(๐‘›๐‘ฅ)
๐‘›=1
∞
๐‘Ž๐‘› cos(2๐œ‹๐‘“๐‘›๐‘ฅ) +
๐‘›=1
∞
๐‘๐‘› sin(2๐œ‹๐‘“๐‘›๐‘ฅ)
๐‘›=1
∞
๐‘“ ๐‘ฅ = ๐‘Ž0 +
๐‘Ž๐‘› cos(๐‘›๐‘ค๐‘ฅ) +
๐‘›=1
∞
๐‘“ ๐‘ฅ = ๐‘Ž0 +
๐‘๐‘› sin(๐‘›๐‘ค๐‘ฅ)
๐‘›=1
∞
๐‘Ž๐‘› cos(2๐œ‹๐‘›๐‘ฅ/๐‘‡) +
๐‘›=1
๐‘›=1
∞
๐‘“ ๐‘ฅ = ๐‘Ž0 +
๐‘๐‘› sin(2๐œ‹๐‘›๐‘ฅ/๐‘‡)
∞
๐‘Ž๐‘› cos(๐œ‹๐‘›๐‘ฅ/๐ฟ) +
๐‘›=1
๐‘๐‘› sin(๐œ‹๐‘›๐‘ฅ/๐ฟ)
๐‘›=1
The Complex Fourier Series
You are reminded of the following identities:
Let ๐‘Ž๐‘› and ๐‘๐‘› be the Fourier coefficients of the function f(x)
defined on [-L, L]. We introduce a new set of coefficients, viz. ๐‘๐‘› ,
where ๐‘› = −∞, … , −๐‘, −๐‘ + 1, 0, 1, ๐‘ − 1, ๐‘›, … ∞ .
These are given by
๐‘0 = ๐‘Ž0
๐‘Ž0 = ๐‘0
1
๐‘Ž๐‘› = (๐‘๐‘› + ๐‘−๐‘› )
๐‘๐‘› = (๐‘Ž๐‘› − ๐‘–๐‘๐‘› )
2
1
๐‘๐‘› = (๐‘๐‘› − ๐‘–๐‘−๐‘› )
๐‘−๐‘› = (๐‘Ž๐‘› + ๐‘–๐‘๐‘› )
2
The Fourier series may then be expressed as
๐‘“ ๐‘ฅ = ๐‘Ž0 +
∞
๐‘›=1 ๐‘Ž๐‘› cos(๐‘›๐œ‹๐‘ฅ/๐ฟ)
+
∞
๐‘›=1 ๐‘๐‘› sin(๐‘›๐œ‹๐‘ฅ/๐ฟ)
=๐‘0 +
∞
๐‘›=1[(๐‘๐‘› +๐‘−๐‘› )cos(๐‘›๐œ‹๐‘ฅ/๐ฟ) + ๐‘–(๐‘๐‘› +๐‘−๐‘› )sin(๐‘›๐œ‹๐‘ฅ/๐ฟ)]
=๐‘0 +
∞
๐‘›=1[๐‘๐‘› (cos
๐‘›๐œ‹๐‘ฅ/๐ฟ + ๐‘–sin(๐‘›๐œ‹๐‘ฅ/๐ฟ))] + ๐‘−๐‘› ((cos(๐‘›๐œ‹๐‘ฅ/
A new formula for the Fourier coefficients can be obtained as follows:
1 1 ๐ฟ
[ −๐ฟ ๐‘“
2 ๐ฟ
1
=
2๐ฟ
๐‘ฅ
๐ฟ
1
๐‘±๐‘› = (๐‘Ž๐‘› ± ๐‘–๐‘๐‘› )
2
๐‘›๐œ‹๐‘ฅ
๐‘– ๐ฟ
cos
๐‘‘๐‘ฅ ± −๐ฟ ๐‘“
๐ฟ
๐ฟ
๐‘“ ๐‘ฅ
−๐ฟ
1
=
2๐ฟ
=
๐‘ฅ sin
๐‘›๐œ‹๐‘ฅ
๐‘›๐œ‹๐‘ฅ
cos
± ๐‘–๐‘ ๐‘–๐‘›
๐ฟ
๐ฟ
๐‘›๐œ‹๐‘ฅ
๐ฟ
๐‘‘๐‘ฅ
๐ฟ
๐‘“(๐‘ฅ)๐‘’ ±๐‘–๐‘›๐œ‹๐‘ฅ/๐ฟ ๐‘‘๐‘ฅ
−๐ฟ
and
1
๐‘0 = ๐‘Ž0 =
2๐ฟ
๐ฟ
๐‘“(๐‘ฅ)๐‘’ 0 ๐‘‘๐‘ฅ
−๐ฟ
The formula for the complex Fourier coefficients is therefore
๐‘๐‘› =
1 ๐ฟ
−๐‘–๐‘›๐œ‹๐‘ฅ/๐ฟ ๐‘‘๐‘ฅ
๐‘“(๐‘ฅ)๐‘’
2๐ฟ −๐ฟ
๐‘‘๐‘ฅ]
for ๐‘› = −∞, … … … , ∞
Meaning of Coefficients
๐‘“ ๐‘ฅ = ๐‘Ž0 + ๐‘Ž1 cos ๐‘ฅ + ๐‘Ž2 cos(2๐‘ฅ)+๐‘Ž3 cos 3๐‘ฅ + โ‹ฏ
+๐‘1 sin ๐‘ฅ + ๐‘2 sin(2๐‘ฅ)+๐‘3 sin 3๐‘ฅ + โ‹ฏ
๐‘“ ๐‘ฅ = ๐‘Ž0 + ๐‘Ž1 cos 2๐œ‹๐‘“๐‘ฅ + ๐‘Ž2 cos(2๐œ‹๐‘“2๐‘ฅ)+๐‘Ž3 cos 2๐œ‹๐‘“3๐‘ฅ + โ‹ฏ
+๐‘1 sin 2๐œ‹๐‘“๐‘ฅ + ๐‘2 sin(2๐œ‹๐‘“2๐‘ฅ)+๐‘3 sin 2๐œ‹๐‘“3๐‘ฅ + โ‹ฏ
Examples of Signals and the Fourier Series Representation
Sawtooth Signal
๐’‡ ๐’™ =
3.69
๐Ÿ๐‘จ
๐Ÿ๐‘จ
๐Ÿ๐‘จ
๐Ÿ๐‘จ
๐ฌ๐ข๐ง ๐Ÿ๐…๐’‡๐’™ −
๐’”๐’Š๐’ ๐Ÿ๐…๐’‡๐Ÿ๐’™ +
๐’”๐’Š๐’ ๐Ÿ๐…๐’‡๐Ÿ‘๐’™ −
๐’”๐’Š๐’ ๐Ÿ๐…๐’‡๐Ÿ“๐’™ + โ‹ฏ
๐…
๐Ÿ๐…
๐Ÿ‘๐…
๐Ÿ’๐…
Application
Fourier Series to Fourier Transform
If ๐‘“(๐‘ฅ) has period 2๐ฟ, its (complex) Fourier series expansion is
๐‘›=∞
f x =
๐‘–๐‘›๐œ‹๐‘ฅ
๐‘๐‘› ๐‘’ ๐ฟ
๐‘›=−∞
๐‘๐‘› =
1 ๐ฟ
−๐‘–๐‘›๐œ‹๐‘ฅ/๐ฟ ๐‘‘๐‘ฅ
๐‘“(๐‘ฅ)๐‘’
2๐ฟ −๐ฟ
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 2๐ฟ, for some fixed ๐ฟ. So, from now on,
do not assume that ๐‘“(๐‘ฅ) is periodic.
Fourier Series to Fourier Transform
1
f x =
2๐œ‹
∞
๐‘“ ๐‘ค ๐‘’ ๐‘–๐‘ค๐‘ฅ ๐‘‘๐‘ค
−∞
Where
∞
๐‘“ ๐‘ค =
๐‘“(๐‘ฅ)๐‘’ −๐‘–๐‘ค๐‘ฅ ๐‘‘๐‘ฅ
−∞
Parseval's Theorem: Energy Relations in Time
and Frequency
Now We have
Finished
Mathematical
Discussion
Start DFT and it’s
application in Image
Processing
Discrete Fourier Transform
1-D case
Discrete Fourier transform (1-D)
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:
M ๏€ญ1 N ๏€ญ1
F (u, v) ๏€ฝ ๏ƒฅ๏ƒฅ f ( x, y)e
๏€ญ j 2๏ฐ ( ux / M ๏€ซvy / N )
x ๏€ฝ0 y ๏€ฝ0
for u = 0, 1, 2…M-1 and v = 0, 1, 2…N-1.
The Inverse DFT
It is really important to note that the Fourier transform
is completely reversible.
The inverse DFT is given by:
1
f ( x, y ) ๏€ฝ
MN
M ๏€ญ1 N ๏€ญ1
๏ƒฅ๏ƒฅ F (u, v)e
u ๏€ฝ0 v ๏€ฝ0
for x = 0, 1, 2…M-1 and y = 0, 1, 2…N-1
j 2๏ฐ ( ux / M ๏€ซvy / N )
Discrete Fourier transform (2-D)
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 compression
More efficient for certain image operations
Spatial Domain
Frequency Domain
For each location in the image, what
is the value of the light intensity at
that location?
For each frequency component in the
image, what is power or its
amplitude?
Image and it’s DFT
Image Representation using basis
A frequential decomposition in terms of exponential basis images ...
f ๐‘ฅ, ๐‘ฆ = ๐น 0,0 × exp ๐‘—2๐œ‹ 0 × ๐‘ฅ + 0 × ๐‘ฆ +
๐น 0,1 × exp ๐‘—2๐œ‹ 0 × ๐‘ฅ + 1 × ๐‘ฆ +
๐น 1,0 × exp ๐‘—2๐œ‹ 1 × ๐‘ฅ + 0 × ๐‘ฆ + โ‹ฏ
f ๐‘ฅ, ๐‘ฆ = ๐น 0,0 +
๐น 0,1 (cos 2๐œ‹๐‘ฆ + ๐‘— sin 2๐œ‹๐‘ฆ ) +
๐น 1,0 (cos 2๐œ‹๐‘ฅ + ๐‘— sin 2๐œ‹๐‘ฅ ) + โ‹ฏ
๐น[๐‘ข, ๐‘ฃ] 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!!!!
Image Representation using basis
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
The DFT and Image Processing
DFT & Images
DFT
Scanning electron microscope
image of an integrated circuit
magnified ~2500 times
Fourier spectrum of the image
Filter
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Some Basic Frequency Domain Filters
Low Pass Filter
High Pass Filter
Smoothing Frequency Domain Filters
Smoothing is achieved in the frequency domain
by dropping out the high frequency components
The 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 function
Low pass filters – only pass the low frequencies,
drop the high ones
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Ideal Low Pass Filter
Simply 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
Ideal Low Pass Filter (cont…)
The transfer function for the ideal low pass filter
can be given as:
๏ƒฌ1 if D(u, v) ๏‚ฃ D0
H (u, v) ๏€ฝ ๏ƒญ
๏ƒฎ0 if D(u, v) ๏€พ D0
where D(u,v) is given as:
D(u, v) ๏€ฝ [(u ๏€ญ M / 2) 2 ๏€ซ (v ๏€ญ N / 2) 2 ]1/ 2
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
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
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Ideal Low Pass Filter (cont…)
Original
image
Result of filtering
with ideal low pass
filter of radius 5
Result of filtering
with ideal low pass
filter of radius 15
Result of filtering
with ideal low pass
filter of radius 30
Result of filtering
with ideal low pass
filter of radius 80
Result of filtering
with ideal low pass
filter of radius 230
Illustration
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
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:
1
H (u , v) ๏€ฝ
1 ๏€ซ [ D(u , v) / D0 ]2 n
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Butterworth Lowpass Filter (cont…)
Original
image
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 15
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 80
Result of filtering
with Butterworth
filter of order 2 and
cutoff radius 230
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Gaussian Lowpass Filters
The transfer function of a Gaussian lowpass
filter is defined as:
H (u, v) ๏€ฝ e
๏€ญ D 2 ( u ,v ) / 2 D0 2
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Gaussian Lowpass Filters (cont…)
Original
image
Result of filtering
with Gaussian filter
with cutoff radius
5
Result of filtering
with Gaussian
filter with cutoff
radius 15
Result of filtering
with Gaussian filter
with cutoff radius 30
Result of filtering
with Gaussian
filter with cutoff
radius 85
Result of filtering
with Gaussian filter
with cutoff radius
230
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Lowpass Filters Compared
Result of filtering
with ideal low pass
filter of radius 15
Result of filtering
with Gaussian
filter with cutoff
radius 15
Result of filtering
with Butterworth
filter of order 2
and cutoff radius
15
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Lowpass Filtering Examples
A low pass Gaussian filter is used to connect
broken text
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Lowpass Filtering Examples (cont…)
Different lowpass Gaussian filters used to
remove blemishes in a photograph
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)
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Ideal High Pass Filters
The ideal high pass filter is given as:
๏ƒฌ0 if D(u, v) ๏‚ฃ D0
H (u, v) ๏€ฝ ๏ƒญ
๏ƒฎ1 if D(u, v) ๏€พ D0
where D0 is the cut off distance as before
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
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
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Butterworth High Pass Filters
The Butterworth high pass filter is given as:
1
H (u , v) ๏€ฝ
2n
1 ๏€ซ [ D0 / D(u , v)]
where n is the order and D0 is the cut off
distance as before
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
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
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Gaussian High Pass Filters
The Gaussian high pass filter is given as:
H (u, v) ๏€ฝ 1 ๏€ญ e
๏€ญ D 2 ( u ,v ) / 2 D0 2
where D0 is the cut off distance as before
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Gaussian High Pass Filters (cont…)
Results of
Gaussian
high pass
filtering with
D0 = 80
Results of
Gaussian
high pass
filtering with
D0 = 15
Results of Gaussian high pass
filtering with D0 = 30
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Highpass Filter Comparison
Results of ideal high
pass filtering with
D0 = 15
Results of Butterworth
high pass filtering of
order 2 with D0 = 15
Results of Gaussian high
pass filtering with D0 =
15
Original image
Highpass filtering result
After histogram
equalisation
High frequency
emphasis result
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Highpass Filtering Example
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Band Reject Filters
The ideal band reject filter is shown below,
along with Butterworth and Gaussian versions of
the filter
Ideal Band
Reject Filter
Butterworth
Band Reject
Filter
Gaussian
Band Reject
Filter
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Band Reject Filter Example
Image corrupted by
sinusoidal noise
Fourier spectrum of
corrupted image
Butterworth band
reject filter
Filtered image
Magnitude and Phase of DFT
• What is more important?
magnitude
phase
• Hint: use inverse DFT to reconstruct the image
using magnitude or phase only information
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!)
Another example: amplitude vs. phase
Thank You
Download