0% found this document useful (0 votes)
27 views81 pages

Chap4enhancementin Frequencydomain

we will be learning about Frequency domain. If you learning DIP(digital Image Processing) this presentation will help to excel in this topic
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views81 pages

Chap4enhancementin Frequencydomain

we will be learning about Frequency domain. If you learning DIP(digital Image Processing) this presentation will help to excel in this topic
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 81

Chapter 4:

Image Enhancement in
the Frequency Domain
Frequency Domain
What is the frequency domain &
where
does it fit into image processing?

Sample link:
https://homepages.inf.ed.ac.uk/rbf/HIPR
2/fourier.htm

2
How to Represent Signals?
 Option 1: Taylor series represents any function using
polynomials.

 Polynomials are not the best - unstable and not very


physically meaningful.

 Easier to talk about “signals” in terms of its


“frequencies”
(how fast/often signals change, etc).
Jean Baptiste Joseph Fourier (1768-1830)
 Had crazy idea
(1807):
 Any periodic
function can be rewritten
as a weighted sum of
Sines and Cosines of
different frequencies.
 Don’t believe it?
 Neither did Lagrange,
Laplace, Poisson and
other big wigs
 Not translated into
English until 1878!
 But it’s true!
 called Fourier Series
 Possibly the greatest
tool
A Sum of Sinusoids
 Our building block:

Asin(x   
 Add enough of them to
get any signal f(x) you
want!
Time and Frequency
 example : g(t) = sin(2pi f t) + (1/3)sin(2pi (3f)
t)
Time and Frequency
 example : g(t) = sin(2pi f t) + (1/3)sin(2pi (3f)
t)

= +
Frequency Spectra
 example : g(t) = sin(2pi f t) + (1/3)sin(2pi (3f)
t)

= +
Frequency Spectra
 Usually, frequency is more interesting than the
phase
Frequency Spectra

= +

=
Frequency Spectra

= +

=
Frequency Spectra

= +

=
Frequency Spectra

= +

=
Frequency Spectra

= +

=
Frequency Spectra


1
= A sin(2 kt )
k 1 k
Frequency Spectra
DFT Examples

09/11/24 17
DFT Examples

09/11/24 18
Background
• Fourier Series:
– Any periodic function can be expressed as a
sum of sines and/or cosines of different
frequencies and amplitudes
• Fourier Transform:
– Non-periodic functions can be expressed as
an integral of sines and/or cosines
multiplied by weighting factors

19
20
Background
• A function represented as a Fourier
series or transform can be recovered
completely via an inverse process, with
no loss of information
• Allows us to work in the Fourier
domain
and then return to the original domain
21
Fourier Transform &
Frequency
Domain
1D Fourier Transform
• 2D Fourier Transform
• Discrete Formulation
• Properties

22
1-Dimensional Fourier
Transform
• 1D Function f(x)

23
Discrete Fourier Transform
• Discrete function: f(x)
• x = 0, 1, 2, … M-1

24
Inverse Discrete Fourier
Transform

25
Discrete Fourier Transform
• F(u) & f(x) are known as a Fourier
Transform Pair
DFT and its inverse always exist
unlike continuous

26
Computing DFT
• Substitute u=0 & sum over all values of
x
• Repeat for M values of u
• Total of M2 summations &
multiplications
• F(u) has same number of components
as
f(x) & is a discrete quantity
27
Frequency Domain
• Euler’s Formula

• Substitute into equation 1

28
Frequency Domain
• Each term of Fourier Transform (i.e. value of
F(u) for each value of u) is composed of
sum of all values of f(x)
• Each value of f(x) is multiplied by sine &
cosine of various frequencies
• Domain (u) over which values of F(u) range

is appropriately called the frequency domain


• Each of the M terms is called the frequency
component

29
Frequency Domain
 Analogy: Prism
• Physical device that separates white light
into its constituent colours.
• Each colour depends on it wavelength or
frequency
• Fourier Transform is a ‘mathematical prism’
• Allows us to characterise a function by its
frequency content

30
1-Dimensional DFT
• Discrete function f(x)
• Total of M data points
• K = 8 points
• Amplitude, A = 1

31
1-Dimensional DFT
• Discrete function f(x)
• Total of M data points
• K = 16 points
• Amplitude, A = 1

32
1-Dimensional DFT
 • When dealing with images only interested in
 magnitude of signal infrequency domain
 • Magnitude of f(x) = lf(x)

33
Discrete Fourier Transform
• M discrete data
points sampled from
a continuous signal
• f(x) for x = 0, 1 …
M-1
• Samples not
necessarily taken at
integer values
34
Discrete Fourier Transform
• F(u) has similar
properties, but
sequence always starts
at true zero frequency
• u = 0, Δu, 2Δu … [M-1] Δu
• Δx and Δu are inversely
related

35
2-Dimensional Fourier
Transform
 • 2D Function f(x, y)

36
2D Discrete Fourier
Transform

37
38
Frequency Domain
• Values of F(u, v) contain all values of f(x,y)
modified by exponential
• Impossible to make direct associations
between
specific components of image and its FT
• General statement can be made
– Where u = v = zero:
• Average gray-level of image
– Frequency (rate of change):
• Patterns of intensity variations
39
Examples

40
Examples

41
DFT

 
1
F (u, v)  R 2 (u, v)  I 2 (u, v) 2 ( spectrum)
 I (u, v) 
1
 (u, v) tan   (phase angle)
 R(u, v) 
2
P(u,v)  F (u, v) R 2 (u, v)  I 2 (u, v) (power spectrum)

R(u,v): the real part of


F(u,v)
I(u,v): the imaginary part
42
Some properties of Fourier
transform:

 
 f ( x, y )( 1) x  y F (u 
M
2
N
, v  ) (shift)
2
M 1N1
1
F (0,0) 
MN
  f ( x, y )
x 0 y 0
(average)

F (u , v) F * ( u , v) (conujgate symmetric)
F (u , v)  F ( u , v) (symmetric)
Ist equation means that the origin of the fourier transform of
f(x,y)(-1) x+y i.e F(0,0) is located at u=M/2 and v=N/2 i.e centre
Of MxN of freq rectangle
spectrum of a fourier transform is symmetric as stated by last eqn

43
Importance of magnitude
and Phase
 Magnitude :
Stores frequency information
Phase stores textural inform.

44
Basic steps for filtering in the
frequency domain

45
Basics of filtering in the
frequency domain
1. multiply the input image by (-1)x+y to center the
transform to u = M/2 and v = N/2 (if M and N are
even numbers, then the shifted coordinates will
be integers)
2. computer F(u,v), the DFT of the image from (1)
3. multiply F(u,v) by a filter function H(u,v)
4. compute the inverse DFT of the result in (3)
5. obtain the real part of the result in (4)
6. multiply the result in (5) by (-1)x+y to cancel the
multiplication of the input image.

46
Notch filter
• this filter is to force the F(0,0)
which is the average value of
an image (dc component of
the spectrum)
• the output has prominent

edges
• in reality the average of the

displayed image can’t be zero


as it needs to have negative
gray levels. the output image
needs to scale the gray level 0 if (u, v) (M/2, N/2 )
H (u , v) 
1 otherwise 47
Low pass filter

high pass filter

48
Add the ½ of filter height to
F(0,0) of the high pass filter

49
Correspondence between Filtering in
the Spatial and Frequency Domain
 Convolution theorem:

The discrete convolution of two functions f(x,y) and h(x,y) of size M 
N is defined as
M 1 N1
1
f ( x, y )  h ( x, y ) 
MN
  f (m, n)h( x  m, y  n)
m 0 n 0
M 1 N1
1

MN
  h(m, n) f ( x  m, y  n)
m 0 n 0

The process of implementation:


1) Flipping one function about the origin;
2) Shifting that function with respect to the other by changing the values
of (x, y);
3) Computing a sum of products over all values of m and n, for each
displacement.

50
Correspondence between Filtering in
the Spatial and Frequency Domain
–Let F(u,v) and H(u,v) denote the Fourier
transforms of f(x,y) and h(x,y), then
f ( x, y )  h( x, y )  F (u , v) H (u , v) Eq1

f ( x, y )h( x, y )  F (u , v)  H (u , v) Eq2
• an impulse function of strength A, located
at coordinates (x0,y0): A ( x  x0 , y  y0 ) and
is defined by
AM( x1xN,y1 y )
where
 
0 0

s ( x, y ) A ( x  x0 , y  y0 )  As( x0 , y0 ) Eq3
 ( x, y ) : a x 0 y 0
unit M 1N1
The shifting property of
impulse  
x 0 y 0
s ( x , y ) ( x , y )  s ( 0, 0 ) Eq4 impulse function
located at 51
Correspondence between Filtering in
the Spatial and Frequency Domain
 The Fourier transform of
a unit impulse at the
origin
M 1N1
1 1
F (u , v) 
MN
   ( x, y )e
x 0 y 0
 j 2 ( ux / M vy / N )

MN

Eq5

52
Correspondence between Filtering in
the Spatial and Frequency Domain
 Let f ( x, y )  ( x, y ) , then the convolution
1 M 1N1
f ( x, y )  h ( x, y )   
MN m 0 n 0
 (m, n)h( x  m, y  n)

1
 h ( x, y ) Eq6
MN
Combining Eq 5, Eq 6 with Eq 1, we obtain

f ( x, y )  h( x, y )  F (u , v) H (u , v)
 ( x, y )  h( x, y )   ( x, y )H (u, v)
1 1
h ( x, y ) H (u , v)
MN MN
h( x, y )  H (u , v) 53
The distinction and links
between spatial and frequency
filtering
 If the size of spatial and frequency filters is same, then
the computation burden in spatial domain is larger than
in frequency domain;
 However, whenever possible, it makes more sense to
filter in the spatial domain using small filter masks.
 Filtering in frequency is more intuitive. We can specify
filters in the frequency, take their inverse transform,
and the use the resulting filter in spatial domain as a
guide for constructing smaller spatial filter masks.
 Fourier transform and its inverse are linear process, so
the following discussion is limited to linear processes.

54
Correspondence between
filter in spatial and frequency
domains

55
Smoothing Frequency-Domain Filters
 The basic model for filtering in the frequency domain

G (u , v) H (u , v) F (u , v)
where F(u,v): the Fourier transform of the image to be
smoothed
H(u,v): a filter transfer function

 Smoothing is fundamentally a lowpass operation in the


frequency domain.
 There are several standard forms of lowpass filters (LPF).

Ideal lowpass filter

Butterworth lowpass filter

Gaussian lowpass filter

56
Ideal Lowpass Filters
(ILPFs)
 The simplest lowpass filter is a filter that “cuts off”
all high-frequency components of the Fourier
transform that are at a distance greater than a
specified distance D0 from the origin of the
transform.
 The transfer function of(uan
1 if D , v) ideal
D0 lowpass filter
H (u , v) 
0 if D(u , v)  D0

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


center of then frequency rectangle (M/2, N/2)
 
1
D(u , v)  (u  M / 2) 2  (v  N / 2) 2 2

57
Smoothing Frequency-
domain filters: Ideal Lowpass
filter

58
image power circles

59
Result of ILPF

60
Example

Notation: the radius of center


component and the number of
circles per unit distance from
the origin are inversely
proportional to the value of the
cutoff frequency.

61
Butterworth Lowpass Filter:
BLPF H (u, v) 1  D(u,1v) / D  2n
0

The BLPF may be viewed as a transition between ILPF AND GLPF, BLPF of
order 2 is a good compromise between effective lowpass filtering and
acceptable ringing characteristics.
62
Example

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

63
Spatial representation of
BLPFs

n=2 n=20
n=1 n=5

64
Gaussian Lowpass Filter:
GLPF
 D 2 ( u ,v ) / 2 D02
H (u , v) e

65
Example

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

66
Example

67
Example

68
Example

69
Sharpening Frequency
Domain Filter:
Ideal highpass filter

0 if D(u, v) D 0
H (u , v) 
1 if D(u, v)  D 0
Butterworth highpass filter
1
H (u , v) 
1  D 0 D(u , v)
2n

Gaussian highpass filter


 D 2 ( u ,v ) / 2 D02
H (u , v) 1  e

70
Spatial representation of Ideal,
Butterworth and Gaussian
highpass filters

71
Example: result of IHPF

72
Example: result of BHPF

73
Example: result of GHPF

74
75
76
77
78
Discrete cosine transform (DCT)

A discrete cosine transform (DCT) expresses a finite sequence of


data points in terms of a sum of cosine functions oscillating at different frequenc
-It is a widely used transformation technique in signal processing and
data compression.
The use of cosine rather than sine functions is critical for compression, since it tu
out that fewer cosine functions are needed to approximate a typical signal.
DCTs are equivalent to DFTs of roughly twice the length, operating on real data w
even symmetry
There are eight standard DCT variants, of which four are common.

or in simple words:
DCT stands for Discrete Cosine Transform. It is a type of fast computing Fourier
transform which maps real signals to corresponding values in frequency domain.
DCT just works on the real part of the complex signal because most of the
real-world signals are real signals with no complex components.
79
DCT Equation

80
phase values determine the shift in the sinusoid components of the image.
zero phase, all the sinusoids are centred at the same location and
get a symmetric image whose structure has no real correlation with
original image at all. Being centred at the same location means that
sinusoids are a maximum at that location, The phase-only reconstruction preser
ciple of phase congruency. At the location of edges and lines,
t of the sinusoid components have the same phase.
properly alone can be used to detect lines and edges,
out regard to magnitude. Changing the magnitude of the various component sin
nges the shape of the feature. When you do a phase-only
nstruction, you set all the magnitudes to one, which changes
shape of the features, but not their location. In many images the
frequency components have a magnitude higher than the high frequency compo
phase-only reconstruction does look like a high-pass filter.
hort, phase contains the information about the locations of features.
cannot add the phase-only and magnitude-only images to get the original.
can multiply them in the Fourier domain and transform back to get the original.
81

You might also like