0% found this document useful (0 votes)
20 views

DIP Module 3

O LO 1. The document discusses concepts related to image enhancement in the frequency domain TU including Fourier series, transforms, convolution, sampling and the sampling theorem. .V W 2. Key concepts covered include using sines and cosines to represent periodic signals, W expressing functions as integrals involving sines and cosines, and representing sampled W functions and their Fourier transforms. 3. The sampling theorem states that a band-limited function can be recovered from samples if the sampling rate exceeds twice the highest frequency in the function.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

DIP Module 3

O LO 1. The document discusses concepts related to image enhancement in the frequency domain TU including Fourier series, transforms, convolution, sampling and the sampling theorem. .V W 2. Key concepts covered include using sines and cosines to represent periodic signals, W expressing functions as integrals involving sines and cosines, and representing sampled W functions and their Fourier transforms. 3. The sampling theorem states that a band-limited function can be recovered from samples if the sampling rate exceeds twice the highest frequency in the function.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

1 IMAHE ENHANCEMENT IN THE FREQUENCY DOMAIN Module 3

Module 3
IMAGE ENHANCEMENT IN THE FREQUENCY
DOMAIN
Prepared By,
Sandesha Karanth P.K & Raghavendra Katagall
Assistant Professors, Dept. Of CSE,
VCET, Puttur
[email protected], [email protected]

M
Fourier series - Any function that periodically repeats itself can be expressed as the sum of sines

CO
and/or cosines of different frequencies, each multiplied by a different coefficient
P.
O
Fourier transform - Even functions that are not periodic (but whose area under the curve is
LO

finite) can be expressed as the integral of sines and/or cosines multiplied by a weighting
TU

function.
.V
W

The frequency domain refers to the plane of the two dimensional discrete Fourier
W

transform of an image. The purpose of the Fourier transform is to represent a signal as a linear
W

combination of sinusoidal signals of various frequencies.

Figure 1 The function at the bottom is the sum of the four functions above it.

[email protected]| [email protected] | VCET, Puttur


2 IMAHE ENHANCEMENT IN THE FREQUENCY DOMAIN Module 3

Preliminary Concepts

Complex Number : C = R + jI ---- 3.1


where R and I are real numbers, and j is an imaginary number equal to the square of -1.

Conjugate of C: C = R − jI ---- 3.2


*

Polar Representation: C =| C | (cos  + j sin  ) ---- 3.3

Where | C |= R + I is the magnitude


2 2

 is the angle between vector and the real axis.


j
Euler’s formula: e = cos  + j sin  ----- 3.4

M
C = C e j

CO
---- 3.5
j
Ex : 1 + 3e ,  = 1.1radian P.
O
LO

Fourier Series
TU

A function f(t) of a continuous variable t that is periodic with period, T can be expressed
.V

as the sum of sines and co-sines multiplied by appropriate co-efficient.


W
W
W

----3.6

Where ----3.7

Impulses and Their Sifting Property

Impulse: is a distribution or a generalised function. Sifting: to separate

A unit impulse of a continuous variable t located at t=0, is defined as:

---- 3.8a

[email protected]| [email protected] | VCET, Puttur


3 IMAHE ENHANCEMENT IN THE FREQUENCY DOMAIN Module 3

And is constrained also to satisfy the identity

----3.8b

An impulse has the sifting property with respect to integration

----3.9

Where f(t) is continues at t=0, a condition typically satisfied in practice. A more general
statement of the sifting property involves an impulse located at an arbitrary point t0, denoted by
𝜕(𝑡 − 𝑡0). In this case sifting properties becomes

M

∫−∞ 𝒇(𝒕)𝝏(𝒕 − 𝒕𝟎)𝒅𝒕 = 𝒇(𝒕𝟎) ----3.10

CO
P.
Let x represent a discrete variable. The unit discrete impulse, 𝝏(x),
O
LO

𝝏(𝒙) = {𝟏 𝒊𝒇 (𝒙 = 𝟎), 𝟎 𝒊𝒇(𝒙 ≠ 𝟎)}-----3.11a


TU

The impulse train is defined as the sum of infinitely many periodic impulses ∆T unit apart:
.V
W

𝑠∆𝑇(𝑡) = ∑∞
𝑛=−∞ 𝜕(𝑡 − 𝑛∆𝑇)-----3.14
W
W

The Fourier Transform of Functions of One Continuous Variable

Fourier transform of a continuous function f(t) of a continuous variable, t, is denoted by:

----3.15
Fourier Transform may be written as,

-----3.16
Inverse Fourier transform can be written as,

[email protected]| [email protected] | VCET, Puttur


4 IMAHE ENHANCEMENT IN THE FREQUENCY DOMAIN Module 3

-----3.17
Using Eulers formula we can express eq 3.16 as

---- 3.18

The Fourier transform of the periodic impulse train s∆T(t), is


∞ 𝑛
𝑖 𝜕(𝜇 − )
𝑆(𝜇) = ∑ ∆𝑇
∆𝑇
𝑛=−∞

Convolution
The convolution of two functions, f(t) and h(t), of one continuous variable t is denoted by,

M
CO
P. ----3.20
Where minus sign accounts for flipping, t is the displacement and 𝜏 is a dummy variable that is
O
LO

integrated out.
TU

Sampling and the Fourier Transform of Sampled Functions


.V
W

Sampling
W

Continues function have to be converted into a sequence of discrete values before they can
W

be processed in a computer. This is accomplished by sampling and quantization. With reference


to below figure consider a continues function, f(t), that we wish to sample at uniform intervals
(∆T) of the independent variable t. We assume that the function extends from -∞ to ∞ with
respect to t.

…..3.21
Where 𝑓̃(t) denotes the sampled function. The value of each sample is given by strength of the
weighted impulse, obtained by integration.

[email protected]| [email protected] | VCET, Puttur


5 IMAHE ENHANCEMENT IN THE FREQUENCY DOMAIN Module 3

………3.22

M
CO
P.
O
LO
TU
.V
W
W
W

The Fourier transform, of the sampled function f(t) is:

…..3.23

The Sampling Theorem

A function f(t) whose Fourier transform is zero for values of frequencies outside a finite
interval(band)[-𝜇 𝑚𝑎𝑥, 𝜇 𝑚𝑎𝑥] about the origin is called a band-limited function.

[email protected]| [email protected] | VCET, Puttur


6 IMAHE ENHANCEMENT IN THE FREQUENCY DOMAIN Module 3

1
The equation > 2𝜇 max indicates that a continues, band limited function can be
∆𝑇

recovered completely from a set of its samples if the samples are acquired at a rate exceeding

M
CO
twice the highest frequency content of the function. This result is known as the sampling
theorem. No information is lost if a continues, band limited function is represented by samples
P.
O
acquired at a rate greater than twice the highest frequency content of the function. Conversely, it
LO

can state that the maximum frequency that can be ‘captured’ by sampling a signal at a rate 1/∆T
TU

is 𝜇 max = 1/2∆T.
.V
W

Aliasing
W
W

If a band limited function is sampled at a rate that is less than the twice its highest
frequency then it corresponds to the under-sampling. If a band limited function is sampled at a
rate that is equal to the twice its highest frequency then it results to the critical-sampling. If a
band limited function is sampled at a rate that is more than the twice its highest frequency then it
results to the over-sampling.

The effect that caused by under-sampling a function, is known as frequency aliasing or


simply as aliasing. In words, aliasing is a process in which high frequency components of a
continues function “masquerade” as lower frequencies in the sampled function. Suppose, we
want to limit the duration of a band-limited function f(t) to an interval, say [0, T]. We can do this
by multiplying f(t) by the function, as shown below.

[email protected]| [email protected] | VCET, Puttur


7 IMAHE ENHANCEMENT IN THE FREQUENCY DOMAIN Module 3

h(t) = {1 if 0≤ t ≤ T, 0 otherwise}

If the transform of f(t) is the band-limited, convolving it with H(𝜇), which involves
sliding one function across the other, will yield a result with frequency components extending to

M
CO
infinity. Therefore, no function of finite duration can be band-limited. Conversely, a function
that is band-limited must extend from -∞ to ∞.
P.
O
LO

In practice, the effects of aliasing can be reduced by smoothing the input function to
TU

attenuate its higher frequencies. This process is called anti-aliasing, has to be done before the
function its sampled because aliasing is a sampling issue that cannot be “undone after the fact”
.V
W

using computational technique. The below figure shows the classic example of aliasing. A pure
W

sign wave extending infinitely in both directions has a single frequency so, its band-limited and
W

having a frequency much lower than the frequency of the continuous signal. The period of the
sine wave is 2s, so the zero crossings of the horizontal axis occur every second. ∆T is the
separation between samples.

Function reconstruction from sampled data


The reconstruction of a function from a set of its samples reduces in practice to
interpolating between the samples. Convolution is the central in developing this concept. Using

[email protected]| [email protected] | VCET, Puttur


8 IMAHE ENHANCEMENT IN THE FREQUENCY DOMAIN Module 3

convolution theorem, in frequency domain we can obtain the equivalent result spatial domain.
So,

A spatial domain expression for f(t) is,

The Discrete Fourier Transform of One Variable

M
CO
Obtaining the DFT from the continuous transform of a sampled function, From the
definition of Fourier transform, we have,
P.
O
LO
TU

By substituting Eq., we obtain,


.V
W
W
W

Suppose that we want to obtain M equally spaced samples of ̃


𝐹(𝜇) Taken over the period

This is accomplished by taking the samples at the following frequencies.

Substituting this result for 𝜇 into eq.(4.4-2) and letting Fm denote the result yields

[email protected]| [email protected] | VCET, Puttur


9 IMAHE ENHANCEMENT IN THE FREQUENCY DOMAIN Module 3

The inverse Fourier transform is given by,

Eqns 4.4-4 and 4.4-5 become:

M
Relationship between the Sampling and frequency intervals

CO
If f(x) consists of M samples of a function f(t) taken ∆T units apart, the duration of the
P.
record comprising the set {f(x)}, x = 0,1,2,….,M-1, is
O
LO

T = M∆T ….
The corresponding spacing, ∆u, in the discrete frequency domain follows from eq.
TU

𝟏 𝟏
.V

∆𝒖 = =
𝒎∆𝑻 𝑻
W

The entire frequency range spanned by the M components of the DFT is


W

𝟏
W

Ω = 𝑴∆𝒖 =
∆𝑻
Extension to Functions of Two variables
2D impulse and its sifting properties:
The impulse, 𝜕(𝑡, 𝑧), of two continuous variables, t and z, is defined as

And

As in the 1-D case, the 2-D impulse exhibits the sifting property under integration.

[email protected]| [email protected] | VCET, Puttur


10 IMAHE ENHANCEMENT IN THE FREQUENCY DOMAIN Module 3

Or, more generally for an impulse located at coordinates (t0, z0)

As before, we see that the sifting property yields the value of the function f(t,z) at the location of
the impulse.
For discrete variables x and y, the 2-D discrete impulse is defined as

And its sifting properties is

M
CO
Where f(x,y) is a function of discrete variables x and y. For an impulse located at coordinates (x0,
P.
O
y0) the sifting property is
LO
TU

As before, the sifting property of a discrete impulse yields the value of the discrete function
.V
W

f(x,y) at location of the impulse.


W
W

Figure: Two dimensional unit discrete impulse.

The 2-D Continuous Fourier Transform Pair


Let f(t,z) be a continuous function of two continuous variables, t and z. The two-
dimensional, continuous Fourier transform pair is given by the expressions

[email protected]| [email protected] | VCET, Puttur


11 IMAHE ENHANCEMENT IN THE FREQUENCY DOMAIN Module 3

And

Where 𝜇 and v are the frequency variables. When referring to images, t and z are interpreted to
be continuous spatial variables. As in the 1-D case, the domain of the variables 𝜇 and v defines
the continuous frequency domain.

M
CO
P.
O
LO
TU
.V

Figure: a. 2-D function and b. Section of its spectrum


W
W

Two dimensional sampling and Two dimensional sampling theorem


W

In a manner similar to the 1-D case, sampling in two dimensions can be modeled using
the sampling function (2-D impulse train):

Where ∆T and ∆Z are the separations between samples along the t- and z- axis of the
continuous function f(t, z).

Figure : 2D impulse train

[email protected]| [email protected] | VCET, Puttur


12 IMAHE ENHANCEMENT IN THE FREQUENCY DOMAIN Module 3

Function f(t, z) is said to be band-limited if its Fourier transform is 0 outside a rectangle


established by the intervals [-µmax, µ max] and [-Vmax, Vmax]; that is,

The two-dimensional sampling theorem states that a continuous, band-limited function


f(t,z) can be recovered with no error from a set of its samples if the sampling intervals are
1
∆𝑇 <
2𝜇 𝑚𝑎𝑥
And
1
∆𝑍 <
2𝑣 𝑚𝑎𝑥
The 2-D Discrete Fourier Transform and its inverse

M
The 2-D discret Fourier transform(DFT):

CO
P.
O
LO

Where f(x,y) is a digital image of size M X N. and variable u and v in the ranges u = 0,1,2,….M-
TU

1 and v = 0,1,2,….N-1.
.V

Given the transform F(u,v), we can obtain f(x,y) by using the inverse discrete Fourier
W

transform (IDFT):
W
W

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

Properties of 2D Fourier Transform


Relationships between Spatial and Frequency Intervals
F(t, z) sampled from f(x, y) using the separation between separation between samples as ∆T and
∆Z. Then, the separations denote the corresponding discrete, frequency domain variables are
given by,

[email protected]| [email protected] | VCET, Puttur


13 IMAHE ENHANCEMENT IN THE FREQUENCY DOMAIN Module 3

Note: The separation between samples in the frequency domain are inversely proportional both
to the spacing between spatial samples and the number of samples.

Translation and Rotation


Multiplying f(x,y) by the exponential shifts the original of DFT to (u0, v0).
Multiplying F(u,v) by the exponential shifts the original of (x,y) to (x0, y0).

Periodicity
The Fourier transform and inverse are infinitely periodic on the u and v directions. (k1

M
and k2 are integers).

CO
P.
O
LO
TU

To show the origin of F(u,v) at the center we shift the data by M/2 and N/2
.V
W
W

Symmetry
W

Any real or complex any complex function can be expressed as sum of odd and even part

This shows that even functions are symmetric and odd functions are anti-symmetric

The Fourier transform of a real function f(x,y) is conjugate symmetric

[email protected]| [email protected] | VCET, Puttur


14 IMAHE ENHANCEMENT IN THE FREQUENCY DOMAIN Module 3

The Fourier transform of a imaginary function f(x,y) is conjugate anti-symmetric

Proof

Frequency Domain Filtering

M
Filtering techniques in frequency domain are based on modifying the Fourier transform to

CO
achieve a specific objective and then computing the inverse DFT to get us back to the image
P.
domain. Steps involved in the process of filtering in the frequency domain are as follows.
O
LO

1. Compute the Fourier Transform of the image


2. Multiply the result by filter transfer function
TU

3. Take the inverse transform


.V
W
W
W

Summary of steps involved for filtering in the Frequency Domain


1. Given an input f(x,y) of size M X N, obtain the padding parameters P and Q. Typically,
we select P = 2M and Q= 2N.

[email protected]| [email protected] | VCET, Puttur


15 IMAHE ENHANCEMENT IN THE FREQUENCY DOMAIN Module 3

2. Form a padding image, fp (x, y), of size P X Q by appending the necessary number of
zeros to f(x, y).
3. Multiply fp (x, y) by (-1)x+y to center its transform
4. Compute the DFT, F(u, v), of the image from step 3.
5. Generate a real, symmetric filter function, H(u, v), of size P X Q with center at
coordinates (P/2, Q/2). From the product G(u, v) = H(u, v) F(u, V) using array
multiplication; that is, G(i, k) = H(i, k) F(i, k).
6. Obtain the processed image;

7. Obtain the final processed result, g(x, y), by extracting the M X N region from the top,
left quadrant of gp (x, y).

M
Smoothing Frequency Domain Filters
CO
P.
O
Smoothing is achieved in the frequency domain by dropping out the high frequency
LO

components. The basic model for filtering is:


TU

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

where F(u,v) is the Fourier transform of the image being filtered and H(u,v) is the filter transform
W

function.
W

Low pass filters – only pass the low frequencies, drop the high ones.
W

Ideal Low Pass Filter


Changing the distance changes the behaviour of the filter. 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 D0 is a positive constant and D(u,v) is the distance between a point (u, v) in the frequency
domain and the centre of the frequency rectangle; that is,

D(u, v) = [(u − M / 2) 2 + (v − N / 2) 2 ]1/ 2

Where, as before, P and Q are the padded sizes.

[email protected]| [email protected] | VCET, Puttur


16 IMAHE ENHANCEMENT IN THE FREQUENCY DOMAIN Module 3

The name ideal indicates that all frequencies on or inside a circle of radius D0 are passed
without attenuation, where as all frequencies outside the circle are completely attenuated. The
ideal lowpass filter is rapidly symmetric about the origin, which means that the filter is
completely defined by radial cross section by 3600 yields the filter in 2-D.

Figure : a. Perspective plot of an ideal lowpass-filter transfer function b. Filter defined as image c. Filter radial cross section

For an ILPF cross section, the point of transition between H(u,v) = 1 and H(u, v) = 0 is

M
called the cutoff frequency.

CO
Butterworth Lowpass Filters P.
The transfer function of a Butterworth low pass filter of order n with cut-off frequency at
O
distance D0 from the origin is defined as:
LO

1
TU

H (u , v) =
1 + [ D(u , v) / D0 ]2 n
.V
W
W
W

Figure : a. Perspective plot of an Butterworth lowpass-filter transfer function b. Filter defined as image c. Filter radial cross
sections of order 1 through 4.

Unlike the ILPF, the BLPF transfer function does not have sharp discontinuity that gives
a clear cutoff between passed and filtered frequencies.

Gaussian Lowpass Filters


Gaussian lowpass filters (GLPFs) of two dimensions is given by

H (u, v) = e − D
2
( u ,v ) / 2 𝜎2

[email protected]| [email protected] | VCET, Puttur


17 IMAHE ENHANCEMENT IN THE FREQUENCY DOMAIN Module 3

Where D(u,v) is the distance from the centre of the frequency rectangle. 𝜎 is a measure of
spread about the centre By letting 𝜎 = D0 , The transfer function of a Gaussian lowpass filter is
defined as:
H (u, v) = e − D ( u ,v ) / 2 D0 2
2

Figure : a. Perspective plot of an Gaussian lowpass-filter transfer function b. Filter defined as image c. Filter radial cross
sections for various values of D0

M
Sharpening in the Frequency Domain Filters using highpass filter

CO
Edges and fine detail in images are associated with high frequency components hence
P.
image sharpening can achieved in the frequency domain by highpass filtering, which attenuates
O
LO

the low frequency components without disturbing high frequency information in the Fourier
transform.
TU
.V

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

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

Hhp(u, v) = 1 – Hlp(u, v)
Ideal High Pass Filters
The ideal high pass filter is given by:
0 if D(u, v)  D0
H (u, v) = 
1 if D(u, v)  D0
Where D0 is the cut off frequency.

Figure : a. Perspective plot, image representation and cross section of a typical ideal highpass filter

[email protected]| [email protected] | VCET, Puttur


18 IMAHE ENHANCEMENT IN THE FREQUENCY DOMAIN Module 3

Butterworth High Pass Filters


The Butterworth high pass filter is given as:
1
H (u , v) =
1 + [ D0 / D(u , v)]2 n
n is the order and D0 is the cut off distance as before.

M
CO
Figure : Butterworth high pass filter

Gaussian High Pass Filters


P.
O
The Gaussian high pass filter is given as:
LO

H (u, v) = 1 − e− D ( u ,v ) / 2 D0 2
2
TU

Where D0 is the cut off distance as before.


.V
W
W
W

Figure : Gaussian Highpass Filters

The Discrete Cosine Transform


The N X N cosine transform matrix C={c(k,n)}, also called the discrete cosine
transform(DCT), is defined as

The one dimensional DCT of a sequence {u(n), 0 ≤ K ≤N-1} is defined as

[email protected]| [email protected] | VCET, Puttur


19 IMAHE ENHANCEMENT IN THE FREQUENCY DOMAIN Module 3

The inverse transformation is given by

Properties of DCT:

1. The cosine transform is real and orthogonal, i.e


C=C* C-1 = CT

M
2. The cosine transform is not the real part of the unitary DFT.

CO
3. The cosine transform is a fast transform. The cosine transform of a vector of N elements
P.
O
can be calculated in O(N log2 N).
LO

4. The basis vector of the sine transform is the eigenvectors of the symmetric tridiagonal
TU

toeplize matrix.
.V
W
W
W

5. The sine transform is close to the KL transform of first order stationary markov
sequences, when the correlation parameter 𝜌 lies in the interval (-0.5, 0.5). In general it
has very good to excellent energy compaction property for images.
6. The sine transform leads to a fast transform algorithm for mark 0v sequences, whose
boundary values are given. This makes it useful in many image processing problems.

Probable university exam questions

1. Explain the process of obtaining the Discrete Fourier transform from the continuous
transform of a sampled function. (Pg. No: 8)
2. Derive the relationship between the sampling and frequency intervals (Pg. No: 9)

[email protected]| [email protected] | VCET, Puttur


20 IMAHE ENHANCEMENT IN THE FREQUENCY DOMAIN Module 3

3. Explain the properties of the 2D Discrete Fourier transform (Pg. No: 12 & 13)
4. Explain the following with relevant equations

a. The 2D discrete Fourier transform and its inverse. (Pg. No: 12)
b. The 2D continuous Fourier transform pair (Pg. No: 10)

5. Explain Image smoothing and Image sharpening in frequency domain.(Pg.No: 15 & 16)
6. Explain the steps for filtering in frequency domain in detail. (Pg. No: 14)
7. Explain Discrete Cosine Transform. (Pg. No: 18 & 19)
8. Explain 1-D impulses and their sifting property. (Pg. No: 2 & 3)
9. Sampling and the Fourier Transform of Sampled Functions (Pg. No: 4, 5 & 6)
10. Explain aliasing (Pg. No: 6 & 7)

M
CO
11. Explain 2-D impulses and their sifting property. (Pg. No: 9 & 10)
12. Sharpening in the Frequency Domain Filters using highpass filter (Pg. No: 17 & 18)
P.
O
LO
TU
.V
W
W
W

[email protected]| [email protected] | VCET, Puttur

You might also like