Student Name Id: Dereje Addise Gpcosc/0008/13

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 21

Student Name ID

Dereje Addise GPCoSc/0008/13


Image Enhancement in Frequency Domain Filtering

Background
Frequency domain refers to the plane of the two dimensional discrete Fourier transform of an
image.

Fourier series: Any function that periodically repeats itself can be expressed as the sum of
sines/cosines of different frequencies, each multiplied with a different coefficient.

Fourier Transform: Functions that are not periodic, whose area under the curve is finite, can be
expressed as the integral of sine’s and/cosines multiplied by a weighting function. It is like a
glass prism that separates light into various color components.

Proposed by: Jean Baptiste Joseph Fourier

The Fourier Transform and the Frequency Domain


The Fourier Transform is an important tool in Image Processing, and is directly related
to filter theory, since a filter, which is a convolution in the spatial domain, is a simple
multiplication in the frequency domain.

The one-dimensional Fourier transform and its inverse


 Fourier transform (continuous case)

where j=√-1
 Inverse Fourier transform:
The two-dimensional Fourier transform and its inverse
 Fourier transform (Continuous case)

 Inverse Fourier transform:

The one-dimensional Fourier transform and its inverse


 Fourier transform (Discrete case) DCT

 Inverse Fourier transform:

Note: F(u), which is the Fourier transform of f(x) contains discrete complex quantities
and it has the same number of components as f(x).
The Fourier Transform generates complex quantities. The magnitude or the spectrum of
the Fourier transform is given by:

 R(u) is the Real Part and


 I(u) is the Imaginary Part
The Phase Spectrum of the transform refers to the angles between the real and
imaginary components and it is denoted by:
The Power Spectrum/spectral density is defined as the square of the Fourier spectrum
and denoted by:

 The power spectrum can be used, for example to separate a portion of a specified
frequency (i.e. low frequency) power from the power spectrum and monitor the
effect.
 Typically used to define the cut off frequencies used in lowpass and highpass
filtering.
 We primarily use the Fourier Spectrum for image enhancement applications.

The two-dimensional Fourier transform and its inverse


 Fourier transform (Discrete case) DFT

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


 Inverse Fourier transform:

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


 u, v : the transform or frequency variables
 x, y : the spatial or image variables
The 2D Fourier Spectrum, Phase Spectrum and Power Spectrum can be respectively
denoted by:

2D Discrete Fourier Transform Examples


The Periodicity property: F(u,v) in 2D DFT has a period of N in horizontal and M in
vertical directions.
The Symmetry property: The magnitude of the transform is centered on the origin.

 The left side figure (a) shows M x N Fourier spectrum (shaded), showing four back-to-
back quarter periods contained in the spectrum data.
 Right side figure (b) Spectrum obtained by multiplying f(x, y) by (-1)x+y prior to
computing the Fourier transform. Only one period is shown shaded because this is data
that would be obtained by an implementation of the equation for F(u,v).
Consider the following 2 left images which are pure vertical cosine of 4 cycles and a pure
vertical cosine of 32 cycles.

Notice that the Fourier Spectrum for each


image at the right contains just a single
component, represented by 2 bright
spots symmetrically placed about the
center.

The dot at the center that represents the


(0,0) frequency term or average value of
the image. Images usually have a large
average value/DC component. Due to
low frequencies Fourier Spectrum images
usually have a bright blob of components
near the center.

The center value (at the origin) of the Frequency Spectrum corresponds to the ZERO
frequency component which also referred to as the DC component in an image: Substituting
0,0 to the origin, the Fourier transform function yields to the average/DC component value as
follows:
Filtering in the Frequency Domain
 Frequency Domain Filters are used for smoothing and sharpening of image by
removal of high or low frequency components.
 Sometimes it is possible of removal of very high and very low frequency.
 Frequency domain filters are different from spatial domain filters as it basically focuses
on the frequency of the images.

Comparison between Spatial Domain and the Frequency Domain


 Spatial domain is based on direct manipulation of pixels of an image. It is the technique
for changing the representation of an image and used in many field such as sharpening
and smoothing, whereas Frequency domain is based on modifying the Fourier
transform of an image to enhance an image and perform purely with convolution theorem
and it is used in changing the position of an image.
 Spatial domain is used to alter the gray level value of individual pixels and hence the
overall contrast of the entire image. It is not possible to selectively enhance edges or
other required information effectively. Whereas Frequency domain technique used to
easily enhance edges and other subtle information because they are high frequency
content and frequency domain operates on frequency content of an image. In this
technique, some parts of an image are enhanced in uniform manner.
 The advantage of spatial domain technique is that it is simple to understand and the
complexity of these techniques is very low which helps in real time implementation.
Whereas Frequency domain technique having advantages which include low
computation complexity, easy to view, manipulation of image’s frequency composition
and the special transformed domain property is easily applicable.
 The disadvantages of spatial domain technique is that it does not provides adequate
robustness and perceivably. Whereas the disadvantage of Frequency Domain is that it
cannot enhance properly every part of an image simultaneously and the automation of
image enhancement is also very difficult.
 Their steps
Spatial Domain: Input Image Processing Output
Frequency Domain: Frequency + Distribution Image Processing
Inverse Transformation Output
Some Basic Properties of the Frequency Domain Filtering:
 Frequency is directly related to the rate of change. Therefore, slowest varying component
(u=v=0) corresponds to the average intensity level of the image. Corresponds to the
origin of the Fourier Spectrum.
 Higher frequencies correspond to the faster varying intensity level changes in the
image. The edges of objects or the other components characterized by the abrupt changes
in the intensity level correspond to higher frequencies.
 Reflection of edge orientation in the spatial domain to an orthogonal orientation in the
frequency domain (e.g., the ±45° edges and the horizontal but slightly slanting oxide
protrusion)
 When an image is rotated by θ, so is the spectrum

(a) SEM image of a damaged integrated circuit (b) Fourier Spectrum of (a)

Basic Steps for Filtering in the Frequency Domain:

The figure shows a frequency Domain Filtering Operations


Given f(x,y) of size M x N:

1. Pad with P = 2M, Q = 2N (with zeros)

2. Multiply padded image by (-1)x+y to center the transform.

3. Compute F(u,v), the DFT of the image from

4. Generate a real, symmetric filter of size P x Q centered at P/2, Q/2.

5. Apply the filter: G = HF

6. Apply IDFT:

7. Extract M x N region from top, left quadrant

Given the filter H(u,v) (filter transfer function) in the frequency domain, the Fourier
transform of the output image (filtered image) is given by:
G(u,v)= H(u,v)F(u,v)  (step 5)
The filtered image g(x,y) is simply the inverse Fourier transform of G(u,v).

 (Step 6)

The following figure shows all above listed basic steps


Types of Frequency Domain Filters
1. Low pass filter

2. High pass filter

3. Laplacian filter

1. Low-Pass Filtering (Blurring) Image Enhancement


Low pass filter removes the high frequency components that mean it keeps low frequency
components.
It is used to smoothing the image by attenuates high frequencies and retains low
frequencies unchanged.
The basic “model” for filtering in frequency domain is given by:

There are several standard forms of low pass filters (LPF).


I. Ideal low pass filter (very sharp filtering)=> ILPF
II. Butterworth low pass filter (tune using the filter order)=>BLPF
III. Gaussian low pass filter (very smooth filtering)=>GLPF
Ideal Low pass Filters (ILPFs)
 The name ideal filter indicates that all frequencies inside a circle of radius D0 are passed
with no attenuation, whereas all frequencies outside the circle are completely attenuated.
 The simplest low pass filter is a filter that “cuts off” all highfrequency components of
the Fourier transform that are at a distance greater than a specified distance D 0 from the
origin of the transform.
 For an ideal low pass filter cross section, the point of transition between H(u,v)=1 and
H(u,v)=0 is called the cutoff frequency
 The complete filter transfer function can be visualized by rotating the cross section 360 0
about the origin.
 The low pass filter considered is radially symmetric about the origin, it means that a cross
section extending as a function of distance from the origin along a radial line is sufficient
to specify the filter as shown below figure (b)
 The transfer function of an ideal low pass filter is given where
as: D(u,v) : the distance from point
(u,v) to the center of their frequency
rectangle.

D0: positive constant (cutoff frequency)

M, N: Padded sizes
(a) (b) (c)
(a) Shows a 3-D perspective plot of an ideal low pass filter transfer function
(b) Filter displayed as an image => H(u,v)
(c) Filter radial cross section
This figure shows effect of different cutoff frequencies

(a) (b)
(a) An image of size 500 X 500 pixels and
(b) Fourier Spectrum of (a). The super imposed circles have radii values of 5,15,30,80
and 230, which enclose 92.0, 94.6, 98.0 and 99.5% of the image power respectively.
As cutoff frequency decreases

 Image become more blurred


 Noise become reduced
 Analogous to larger spatial filter size

Noticeable ringing artifacts that increase as


amount of high frequency components
removed are increased.

“Presence of Ringing effect” because

 ILPF function is rectangular


function
 The inverse Fourier transform of a
rectangular function is a sinc

(a) Original image


(b) –(f) results of ideal low pass filtering with cutoff frequencies set at radii
values of 5,15,30,80 and 230 as shown above first image (b). The power
removed by this filters was 8, 5.4, 3.6,2 and 0.5 % of the total respectively.

Butterworth Low pass Filters (BLPFs) with order n


 Unlike the ILPF, the BLPF transfer function does not have a sharp discontinuity that
establishes a clear cutoff between passed and filtered frequencies.
 For filters with smooth transfer functions, defining a cutoff frequency locus at a points
for which H(u,v) is down to a certain fraction of its maximum value is customary.

where D(u,v) : the distance from point


(u,v) to the center of their frequency
rectangle.

D0: positive constant (cutoff frequency)

M, N: Padded sizes
(a) (b) (c)
(a) Perspective plot of an ideal low pass filter transfer function
(b) Filter displayed as an image
(c) Filter radial cross sections of orders 1 through 4

Smooth transition in
blurring
No ringing visible

a,b n=2

D0=5, 15, 30, 80, and 230

(a) Original image


(b) –(f) results of filtering with BLPFs of order 2, with cutoff frequencies at radii
values of 5,15,30,80 and 230 as shown above first image (b) and Compare
with ILPFs (b)
Butterworth Low pass Filters (BLPFs) Spatial Representation
 Using different values of n:
 Note that ringing increases as a function of filter order increases.
 Usually use n = 2.

(a) (b) (c) (d)


(a) -(d) Spatial Representation of BLPFs of order 1,2,5, and 20 and corresponding
gray level profiles through the centers of the filters(all filters have a cutoff
frequency of 5).

Gaussian Low pass Filters (GLPFs)


 GLPFs of two dimensions is given by:

 The parameter σ measures the spread or dispersion of the Gaussian curve. Larger
the value of σ, larger the cutoff frequency and more severe the filtering.
but by letting sigma(σ)= D0;
where D(u,v) : the distance from point (u,v)
to the center of their frequency rectangle.

D0: positive constant (cutoff frequency)

M, N: Padded sizes
(a) Perspective plot of a GLPFs transfer function
(b) Filter displayed as an image
(c) Filter radial cross sections for various values of D0
 Result changing

 D0:Smooth transition in
blurring

 No ringing

 Gaussian in frequency
domain remains a Gaussian
a,b
in Spatial domain.

n=2

D0=5, 15, 30, 80, and 230

(a) Original image


(b) –(f) results of filtering with GLPFs with cutoff frequencies at radii values of
5,15,30,80 and 230 as shown above on BLPFs and Compare this with ILPFs
and BLPFs
2. High-Pass Filtering (Sharpening) Image Enhancement
High pass filter removes the low frequency components that mean it keeps high
frequency components.
It is used to sharpen the image by attenuating low frequency components and
preserving high frequency components.
It yields edge enhancement or edge detection in the spatial domain.
Edges contain mostly high frequencies while other areas of the image are rather constant
gray level (i.e. low frequencies) which is suppressed.
This method focuses on the finer details in the image and does the exact opposite of a
low-pass filter
A High-pass filter attenuates low frequencies and leaves the others unchanged.
High frequencies correspond to sharp intensity changes.
Mechanism of high pass filtering in frequency domain is given by:

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

 Hhp(u, v) is the Fourier Transform of high pass filtering


 Hlp(u, v) is the Fourier Transform of low pass filtering

There are several standard forms of High pass filters (HPF).


I. Ideal High pass filter (IHPF)
II. Butterworth High pass filter (BHPF)
III. Gaussian High pass filter (GHPF)
Generally, these types can be expressed as follows:

where D(u,v) : the distance from point (u,v) to


the center of their frequency rectangle.

D0: positive constant (cutoff frequency)

M, N: Padded sizes, n= order

Origin: (M/2,N/2)
(a) (b) (c)
From this figure, consider Top Row:
(a) Perspective plot of an ideal high pass filter transfer function
(b) Filter displayed as an image Middle row: BHPF
(c) Cross section of a typical IHPF
\ Bottom row: GHPF
High pass Filters Spatial Representations

(a) IHPF (b) BHPF (c) GHPF

Ideal High pass Filters


It is the opposite of ILPF in the sense that it sets to zero all frequencies inside a circle of
radius D0 while passing without attenuation, all frequencies outside the circle.
Problems with ringing are quite evident in figure (a) and (b)

Original Image

(a) (b) (c)


Butterworth High pass Filters
Boundaries are less distorted
Results are much smoother than those obtained with an ILPF.

(a) (b) (c)


Gaussian High pass Filters
It detects small high intensity transition as compared to BHPF moreover compared to
IHPF.
It is similar to lower order Butterworth filter.
Even the filtering of the smaller objects and thin bars is cleaner with Gaussian filter.
In GHPF the results obtained are smoother than the previous two filters.
3. Laplacian-Filtering in frequency Domain
It is used to improve the quality of an image
It is implemented using the filter
H(u,v)= -4π2(u2+v2)-------------------------eq1
With respect to center of the frequency rectangle it is represented as:
H(u,v)= -4π2[(u-M/2)2+(v-N/2)2]--------eq2
D(u,v)=√(u-M/2)2+(v-N/2)2
H(u,v)= -4π2D2(u,v)------------------------eq3
The laplacian for an image can be represented as:
▼2 f(x,y)=ʒ-1[H(u,v)F(u,v)]--------------eq4
where F(u,v) is Fourier Transform for f(x,y)
The enhancement in images can be written as
g(x,y)=f(x,y)+c▼2f(x,y)------------------eq5
where c=-1 and H(u,v)=-ve
In frequency domain this can be represented as
g(x,y)= ʒ-1[F(u,v)-H(u,v)F(u,v)]-------eq6

For the simplification


g(x,y)= ʒ-1[(1-H(u,v))F(u,v)]------------eq7
By substituting eq3 in eq7
g(x,y)= ʒ-1[((1+4π2D2(u,v))F(u,v)]
Here, g(x,y) is processed image
Laplacian-Filtering in frequency Domain Examples

Example 1

(a) 3D plot of laplacian in the frequency domain


(b) Image representation of (a)
(c) Laplacian in the spatial domain obtained from the IDFT of (b)
(d) Zoomed section of origin of (c)
(e) Gray-level profile through the center of(d)
(f) Laplacian mask

Laplacian: Example 2

You might also like