KEMBAR78
Lec 6 Image Processing | PDF | Discrete Fourier Transform | Low Pass Filter
0% found this document useful (0 votes)
26 views79 pages

Lec 6 Image Processing

The document outlines the fundamentals of Digital Image Processing (DIP), focusing on image enhancement techniques in the frequency domain. It covers concepts such as the Fourier Transform, Discrete Fourier Transform (DFT), and various filtering methods including low-pass and high-pass filters. The agenda includes detailed discussions on smoothing and sharpening filters, emphasizing their applications in image enhancement.

Uploaded by

dracola909
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)
26 views79 pages

Lec 6 Image Processing

The document outlines the fundamentals of Digital Image Processing (DIP), focusing on image enhancement techniques in the frequency domain. It covers concepts such as the Fourier Transform, Discrete Fourier Transform (DFT), and various filtering methods including low-pass and high-pass filters. The agenda includes detailed discussions on smoothing and sharpening filters, emphasizing their applications in image enhancement.

Uploaded by

dracola909
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/ 79

Digital Image Processing

(CSC 352)
2024 – 2025
Lecture-6
Dr: Mary monir saied
Email: mmh04@fayoum.edu.eg
Digital Image Fundamentals
Image Enhancement IIII
(Frequency Domain)
Fundamental Steps of DIP

3
Agenda

1. Introduction
2.Frequency Domain and Fourier Transform
3.1D Discrete Fourier Transform
4.2D Discrete Fourier Transform
5.Filtering in the Frequency Domain
6.Smoothing Filters
7.Sharpening Filters

4
1. Introduction

Spatial domain

Image Enhancement

Frequency Domain

• Image has two domains: spatial domain and frequency domain.


• Transform: Convert the image from spatial to frequency domain. 5
• Inverse transform: convert image from frequency to spatial domain.
1. Introduction

6
1. Introduction
Idea of the enhancement in frequency domain…
• Convert image into frequency domain
• Apply filter in this domain
• Convert the result into spatial domain to get the filtered image

Why we need to enhance in frequency domain…?!


• Apply filters that can’t be applied in spatial domain
• Having more control on existing filters (e.g. blurring,
sharpening,…)
• Faster implementation for large-size filters
7
1. Introduction
Image is a Signal!!
 Show that any image is a 2D analog signal and it has
been sampled to get the digitized image (pixels)

8
1. Introduction

Types of transforms…
 Fourier
 Cosine
 Wavelet

9
Agenda

1. Introduction
2.Frequency Domain and Fourier Transform
3.1D Discrete Fourier Transform
4.2D Discrete Fourier Transform
5.Filtering in the Frequency Domain
6.Smoothing Filters
7.Sharpening Filters

10
2. Frequency Domain and Fourier Transform

Jean Baptiste Joseph Fourier

 Developed one of the


most important
mathematical theories
in modern engineering.

11
2. Frequency Domain and Fourier Transform

The Big Idea

=
Continuous function

Any function that periodically repeats itself can be


expressed as a sum of sines and cosines of different
12
frequencies each multiplied by a different coefficient –
a Fourier series
2. Frequency Domain and Fourier Transform

13
2. Frequency Domain and Fourier Transform
Continuous function

3 sin(x) A

+ 1 sin(3x) B A+B

+ 0.8 sin(5x) C
A+B+C

+ 0.4 sin(7x) D
A+B+C+D

14
2. Frequency Domain and Fourier Transform
 These components differ in 3 values:
Magnitude
Which component has large effect on the signal?! with small
magnitude or with large magnitude.

Frequency
Phase shift

15
2. Frequency Domain and Fourier Transform

• Show how we represent these components in


frequency domain (i.e. the chart between the
frequency in x-axes and the magnitude in y-axes)

Magnitude

16

Frequency
2. Frequency Domain and Fourier Transform

17
Agenda

1. Introduction
2.Frequency Domain and Fourier Transform
3.1D Discrete Fourier Transform
4.2D Discrete Fourier Transform
5.Filtering in the Frequency Domain
6.Smoothing Filters
7.Sharpening Filters

18
3. 1D Discrete Fourier Transform (DFT)

• Sampling idea…(take samples from the continuous


signal in order to discretize it)
• N samples  DFT  N Components

Fourier Tr.
spatial Frequency
Domain Domain
Signals Inv Fourier Tr. Signals

19
3. 1D Discrete Fourier Transform (DFT)
◦ I D Fourier transform (DFT)
N 1
1
F (u ) 
N
 f
x 0
( x )e  j 2 ux / N
for u  0,1, 2,..., N  1

◦ 1D Inverse Fourier Transform:


N 1
f (x )   f u  e 2 ux N
for x  0,1, 2,..., N  1
u 0

N
20
3. 1D Discrete Fourier Transform (DFT)
 The Euler’s formula:

 By substituting the Euler formula, we can write the DFT as:

21
3. 1D Discrete Fourier Transform (DFT)
◦ Thus, each frequency component has two parts, real and
imaginary.
N 1

 f x cos2 ux N
1
real (u ) 
N x 0

N 1

 f x sin 2 ux N
1
imaginary (u ) 
N x 0

22
3. 1D Discrete Fourier Transform (DFT)

 Properties:
a. Frequency: obtained from u.
b. Magnitude:

magnitude(u)  real (u)  imaginary (u)2 2

c. Phase shift:

imaginary (u )
phase (u )  tan 1

real (u ) 23
3. 1D Discrete Fourier Transform (DFT)
N 1

 f x 
1
d. DC component: F (0) 
N x 0
which represents the signal average. It’s the component with largest
magnitude.
e. Symmetric: Magnitudes of the FT components are symmetric on
N/2, while differ in phase shift… (i.e. there are only N/2 different
frequencies that represent the signal with N samples)

Magnitude

… …

24
Frequency
DC N/2 N–1

N/2 Frequencies
3. 1D Discrete Fourier Transform (DFT)

0 N-1

High frequency
High frequency area area
Low frequency
area
Low frequency area
25
Agenda

1. Introduction
2.Frequency Domain and Fourier Transform
3.1D Discrete Fourier Transform
4.2D Discrete Fourier Transform
5.Filtering in the Frequency Domain
6.Smoothing Filters
7.Sharpening Filters

26
4. 2D Discrete Fourier Transform (DFT)

-2D Discrete Fourier Transform (DFT)


•For an image of size M×N

- 2D Inverse Discrete Fourier Transform (IDFT)

27
4. 2D Discrete Fourier Transform (DFT)
•Magnitude (spectrum) of the FT

•Phase angle of the FT

28
4. 2D Discrete Fourier Transform (DFT)

•The DC component

29
4. 2D Discrete Fourier Transform (DFT)
1. W × H image  DFT  W × H components with
complex values
2. Magnitude of these components are diagonally symmetric

Low Low
Freq. Freq.

2D FT Magnitude
High
Freq.

Low Low
Freq. Freq.

Original Image Fourier transform Magnitudes


(Complex values) (Diagonally symmetric)
30
Real & Imaginary
4. 2D Discrete Fourier Transform (DFT)

31
4. 2D Discrete Fourier Transform (DFT)

What’s the meaning of low and high frequencies in


the image?!
• Frequency in the image means the rate of change in
colors
• Low frequencies represent regions with low color
changes  backgrounds
• High frequencies represent region with high color
changes  edges and noises

32
4. 2D Discrete Fourier Transform (DFT)
Which components have large magnitude and
which have small ones?!
• Since low frequencies represent backgrounds, they
have large magnitudes as backgrounds are the dominant
regions in the image.
• While high frequencies represent edges and noises, so,
they have small magnitudes as edges and noises are
NOT dominant regions in the image

33
4. 2D Discrete Fourier Transform (DFT)
Translation of Fourier Transform
• To facilitate the filtering process. we need to translate
the results of Fourier transform by (Half Width, Half
Height) to bring the low frequencies in the center of
buffer.

Fourier Transform Translated by Width / 2 Translated by Height / 2


Low Low High High
Low Low Freq. Freq. Freq. Freq.
Freq. Freq.
1 2 2 1 4 3
Translate Translate
High High Low
High Freq. Freq. Freq.
Freq.
Width / 2 Height / 2
3 4 4 3 2 1

Low Low
Low
Freq.
Low
Freq.
High
Freq.
High
Freq.
34
Freq. Freq.

Real & Imaginary


4. 2D Discrete Fourier Transform (DFT)

35
4. 2D Discrete Fourier Transform (DFT)

2D DFT

Original image

2D FFT Shift 36
Agenda

1. Introduction
2.Frequency Domain and Fourier Transform
3.1D Discrete Fourier Transform
4.2D Discrete Fourier Transform
5.Filtering in the Frequency Domain
6.Smoothing Filters
7.Sharpening Filters

37
5. Filtering in the Frequency Domain
Image Enhancement

Spatial domain

Low-pass filtering
Frequency Domain

High-pass filtering

38
5. Filtering in the Frequency Domain
 Correspondence Between Filtering in the Spatial
and Frequency Domains

The relationship is establish through the convolution theorem:

Convolution in spatial domain= Multiplication in frequency domain


Multiplication in spatial domain = Convolution in frequency domain

39
5. Filtering in the Frequency Domain

H(u,v)
F(u,v) g(x,y)

FFT shift
X 2D IFFT

2D FFT
FFT shift

f(x,y) G(u,v) 40
5. Filtering in the Frequency Domain
To filter an image in the frequency domain:

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


2. Multiply F(u,v) by a filter function H(u,v)
3. Compute the inverse DFT of the result

41
Agenda

1. Introduction
2.Frequency Domain and Fourier Transform
3.1D Discrete Fourier Transform
4.2D Discrete Fourier Transform
5.Filtering in the Frequency Domain
6.Smoothing Filters (Low-pass filtering)
7.Sharpening Filters (High-pass filtering)

42
6. Smoothing Filters
 Lowpass filter – remove high-frequency
information, or allow LOW- frequency
information to PASS through

 Useful for removing noise in images

 There are three types of lowpass filters:


1. Ideal Lowpass Filters (ILPF)
2. Butterworth Lowpass Filters (BLPF)
3. Gaussian Lowpass Filters (GLPF) 43
6.1 Ideal Lowpass Filter (ILPF)
 A 2-D lowpass filter that passes without attenuation
all frequencies within a circle of radius from the
origin, and “cuts off” all frequencies outside this
circle is called an ideal lowpass filter (ILPF); it is
specified by the transfer function:
1 if D(u, v)  D0
H (u, v)  
0 if D(u, v)  D0

where 𝐷0 is a positive constant,


44
6.1 Ideal Lowpass Filter (ILPF)

1 if D(u, v)  D0
H (u, v)  
0 if D(u, v)  D0
where 𝐷0 is a positive constant,

D(u,v) is the distance between a point (u,v) to the origin


(center) of the frequency rectangle. It is denoted as

D(u, v)  [(u  M / 2) 2  (v  N / 2) 2 ]1/ 2


45
6.1 Ideal Lowpass Filter (ILPF)

cutoff
frequency

47
6.1 Ideal Lowpass Filter (ILPF)

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 48
6.1 Ideal Lowpass Filter (ILPF)

Result of filtering
Original with ideal low pass
image filter of radius 5

Result of filtering Result of filtering


with ideal low pass with ideal low pass
filter of radius 15 filter of radius 30

Result of filtering
Result of filtering
with ideal low pass 49
with ideal low pass
filter of radius 230
filter of radius 80
6.1 Ideal Lowpass Filter (ILPF)

50
6.1 Ideal Lowpass Filter (ILPF)

Result of filtering
with ideal low pass
filter of radius 5

51
6.1 Ideal Lowpass Filter (ILPF)

Result of filtering
with ideal low pass
filter of radius 15

Ringing effect can be


obviously seen!
52
6.1 Ideal Lowpass Filter (ILPF)
•Ringing Effect

53
6.1 Ideal Lowpass Filter (ILPF)
•Ringing Effect

54
6.2 Butterworth Lowpass Filter (BLPF)
 The transfer function of a Butterworth lowpass filter
(BLPF) 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
Where D0 = Cut off frequency, N = filter order.
The shape of a Butterworth filter is controlled by a parameter called the
filter order.
➢ For large values of filter order, the Butterworth filter approaches the ideal
filter (ILPF). 55
➢ For lower values, the Butterworth filter is more like a Gaussian filter
(GLPF)
6.2 Butterworth Lowpass Filter (BLPF)

56
6.2 Butterworth Lowpass Filter (BLPF)

57
6.2 Butterworth Lowpass Filter (BLPF)

Result of filtering
with Butterworth
filter of order 2 and
cutoff radius 5

58
6.2 Butterworth Lowpass Filter (BLPF)

Result of filtering with


Butterworth filter of
order 2 and cutoff
radius 15

59
6.2 Butterworth Lowpass Filter (BLPF)
 Ringing increase as we increase the BLPF filter order n. For
n=1, BLPF has neither ringing nor negative values. For n=2,
BLPF has mid ringing and negative values. As n increases,
ringing increases. For n=20 BLPF is similar to ILPF.

60
6.2 Butterworth Lowpass Filter (BLPF)

61
6.3 Gaussian Lowpass Filter (GLPF)
 Gaussian lowpass filter (GLPF) transfer functions
have the form:

 D 2 ( u ,v ) / 2 D0 2
H (u, v)  e
 When 𝑫(𝒖, 𝒗) = 0 the GLPF transfer function is down to 1.
 When 𝑫(𝒖, 𝒗) = 𝑫𝟎 the GLPF transfer function is down to 0.607 of its
maximum value of 1.0.
62
6.3 Gaussian Lowpass Filter (GLPF)

63
6.3 Gaussian Lowpass Filter (GLPF)

64
6.4 Lowpass Filters Effects Compared

65
6.4 Lowpass Filters Effects Compared
Examples on Lowpass Filtering by GLPF

66
6.4 Lowpass Filters Effects Compared
Examples on Lowpass Filtering by GLPF
For human faces, the typical objective is to reduce the sharpness
of fine skin lines and small blemishes.

67
Agenda

1. Introduction
2.Frequency Domain and Fourier Transform
3.1D Discrete Fourier Transform
4.2D Discrete Fourier Transform
5.Filtering in the Frequency Domain
6.Smoothing Filters
7.Sharpening Filters

68
7 .Sharpening Filters
 Concept
•Cuts off (set to zero) all low frequency components that are a
specified distance D0 from the origin of the transform.

•Highpass filter can be obtained from lowpass filter by:


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

 Types
•Ideal Filter
•Butterworth Filter
69
•Gaussian Filter
7 .Sharpening Filters
 There are three Highpass Filters:

 Ideal Highpass Filters

 Butterworth Highpass Filters

 Gaussian Highpass Filters 70


7 .Sharpening Filters

71
7 .Sharpening Filters

72
7 .1 Ideal Highpass Filter (IHPF)
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

73
7 .1 Ideal Highpass Filter (IHPF)

74
D0 = 15 D0 = 30 D0 = 80
7 .2 Butterworth Highpass Filter (BHPF)
The Butterworth high pass filter is given as:
1
H (u , v) 
1  [ D0 / D (u , v)]2n

where n is the order and D0 is the cut off distance as


before

75
7 .2 Butterworth Highpass Filter (BHPF)

D0 = 15 D0 = 80

76
D0 = 30
7 .3 Gaussian Highpass Filter (GHPF)
The Gaussian high pass filter is given as:
 D 2 ( u ,v ) / 2 D0 2
H (u, v)  1  e
where D0 is the cut off distance as before

77
7 .3 Gaussian Highpass Filter (GHPF)

D0 = 15 D0 = 80

78
D0 = 30
7 .4 Highpass Filters Effects Compared

79
Thank You
80

You might also like