DIP Module 3
DIP 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
Figure 1 The function at the bottom is the sum of the four functions above it.
Preliminary Concepts
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
----3.6
Where ----3.7
---- 3.8a
----3.8b
----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
The impulse train is defined as the sum of infinitely many periodic impulses ∆T unit apart:
.V
W
𝑠∆𝑇(𝑡) = ∑∞
𝑛=−∞ 𝜕(𝑡 − 𝑛∆𝑇)-----3.14
W
W
----3.15
Fourier Transform may be written as,
-----3.16
Inverse Fourier transform can be written as,
-----3.17
Using Eulers formula we can express eq 3.16 as
---- 3.18
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
W
Continues function have to be converted into a sequence of discrete values before they can
W
…..3.21
Where 𝑓̃(t) denotes the sampled function. The value of each sample is given by strength of the
weighted impulse, obtained by integration.
………3.22
M
CO
P.
O
LO
TU
.V
W
W
W
…..3.23
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.
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.
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.
convolution theorem, in frequency domain we can obtain the equivalent result spatial domain.
So,
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
Substituting this result for 𝜇 into eq.(4.4-2) and letting Fm denote the result yields
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
𝟏
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.
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
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
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
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).
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
Note: The separation between samples in the frequency domain are inversely proportional both
to the spacing between spatial samples and the number of samples.
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
Proof
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
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
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
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,
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.
H (u, v) = e − D
2
( u ,v ) / 2 𝜎2
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
M
CO
Figure : Butterworth high pass filter
H (u, v) = 1 − e− D ( u ,v ) / 2 D0 2
2
TU
Properties of DCT:
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.
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)
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