Professional Documents
Culture Documents
IT5409 Ch3 Filters 20200228 v3 Part2 New Template
IT5409 Ch3 Filters 20200228 v3 Part2 New Template
IT5409 Ch3 Filters 20200228 v3 Part2 New Template
Computer Vision
Course
School of Information and
Communication Technology
1
2/20/24
Computer Vision
Chapter 3. Image Processing
(Part 2)
Computer Vision Group
School of Information and Communications Technology
Contents
2
2/20/24
Arithmetical/Logical Operations
• AND operation
• OR operation
• Image subtraction
• Image addition
AND operation
3
2/20/24
OR operation
Image Addition
4
2/20/24
Average Images
10
10
5
2/20/24
Image subtraction
11
11
Image subtraction
12
12
6
2/20/24
Image subtraction
13
13
Image multiplication
14
7
2/20/24
Operations on images
Source : www.nte.montaigne.u-bordeaux.fr/SuppCours/5314/Dai/TraitImage01-02.ppt
15
15
Exercise
16
16
8
2/20/24
Binary images
18
Binary images
• Two pixel values: foreground (object, 1) and
background (0)
• Be used
• To mark region(s) of interest
• As results of thresholding method
19
9
2/20/24
Thresholding
• Given a grayscale image or an intermediate matrix à
threshold to create a binary output.
20
Thresholding
• Given a grayscale image or an intermediate matrix à
threshold to create a binary output.
Example: background subtraction
- =
21
10
2/20/24
Thresholding
• Given a grayscale image or an intermediate matrix à
threshold to create a binary output.
22
Thresholding
• Given a grayscale image or an intermediate matrix à
threshold to create a binary output.
Example: color-based detection
23
11
2/20/24
Issues
24
Morphological operators
• Main components
• Structuring element
• Operators:
• Basic operators: Dilation, Erosion
• Others: Opening, Closing, …
25
12
2/20/24
Dilation
26
Erosion
13
2/20/24
Structuring elements
28
Dilation
𝑨 ⊕S
Structuring element
S
29
14
2/20/24
Dilation
• As max filter
• Can be applied both on
• binary images
• or grayscale images
Mask /
Structuring element
30
Erosion
• If all pixels of S are onto object pixels (A), then the central pixel belongs to
object
• Otherwise (i.e. a mask pixel is background), set to background
𝑨 ⊝S
Structuring
element
S
31
15
2/20/24
Erosion
• As min filter
• Can be applied both on
• binary images
• or grayscale images
Mask /
Structuring element
32
2D example
33
16
2/20/24
Opening
34
Closing
demo: http://bigwww.epfl.ch/demo/jmorpho/start.php
35
17
2/20/24
Opening vs Closing
Structuring element
Opening
Closing
36
• We loop over all the image to give a unique number (label) for each region
• All pixels from the same region must have the same number (label)
• Objectifs:
• Counting objects
• Separating objets
• Creating a mask for each object
• …
37
18
2/20/24
38
39
19
2/20/24
40
41
20
2/20/24
42
43
21
2/20/24
44
• Solutions
• We continue, go and back two ways, until no
new change in labels
45
22
2/20/24
46
• Regions labeling
• We use 4-connexity
• Each loop, we compare 2 neighbors
• Edge labeling
• 8-connexity
• Each loop, we compare 4 neighbors
47
23
2/20/24
Contents
Frequencies in images
Intensity profile
49
49
24
2/20/24
Frequencies in images
50
50
Low frequencies
51
51
25
2/20/24
High frequencies
52
52
53
53
26
2/20/24
Frequencies in a signal
54
Fourier series
Hays
55
27
2/20/24
Example
g = +
t
Coefficient
Slides: Efros
56
56
Fourier Transform
f(x) |F(𝟂)|
signal Fourier transform
of signal
57
57
28
2/20/24
Fourier Series
58
Fourier Series
≈ +
59
29
2/20/24
Fourier Series
≈ +
60
Fourier Series
≈ +
61
30
2/20/24
Fourier Series
≈ +
62
Fourier Series
≈ +
63
31
2/20/24
Fourier Series
64
The math
65
32
2/20/24
Amplitude: Phase:
I (w )
A = ± R(w ) 2 + I (w ) 2
f = tan -1
R(w )
66
67
33
2/20/24
68
68
69
69
34
2/20/24
70
70
Example: Music
Slide: Hoiem
71
35
2/20/24
2D FFT
• Continuous FFT:
• Inverse FFT:
72
2D FFT - discrete
73
36
2/20/24
Function cosin 2D
74
74
Separability of 2D DFT
75
75
37
2/20/24
Separabilty of 2D DFT
(a) Original image (b) DFT of each row of a (c) DFT of each column of b
f(x,y) F1(x,v) F(u,v)
76
76
Properties of 2D DFT
77
77
38
2/20/24
DC Component
• Recall that
78
78
Enhanced Spectra
Original image Spectra | F(u,v) |
log (1+ | F(u,v) |)
Frequency
domain
Spatial
domain
79
79
39
2/20/24
Real part
Original image
Complex part
80
80
Point (0,0)
81
40
2/20/24
I II Point (0,0)
(0,0) (-M/2 , -N/2 )
IV III
82
82
Real part
Original image
Complex part
83
83
41
2/20/24
84
84
http://sharp.bu.edu/~slehar/fourier/fourier.html#filtering
More: http://www.cs.unm.edu/~brayer/vision/fourier.html
85
85
42
2/20/24
+ =
86
86
Fourier decomposition
Natural image Frequency coefficients (amplitude)
f(x,y) |F(𝟂)|
What does it mean to be at pixel x,y?
What does it mean to be more or less bright in the Fourier decomposition image?
Slide by Steve Seitz
87
43
2/20/24
Fourier Bases
Green = sine
Blue = cosine
88
Fourier Bases
89
89
44
2/20/24
2D Fourier Transform
90
Basis reconstruction
Danny Alexander
91
91
45
2/20/24
Basis reconstruction
92
92
2D Fourier transform
93
93
46
2/20/24
94
94
FFT
FFT
=
Inverse FFT
95
47
2/20/24
96
96
97
48
2/20/24
Low-pass filter
f(x,y) F(u,v)
filter
g(x,y) G(u,v)
98
98
1 D(u,v) £ D0 D(u,v) = Ö u2 + v2
H(u,v) =
0 D(u,v) > D0 D0 = cut off frequency
H(u,v)
H(u,v)
1
v
u 0 D0 D(u,v)
99
99
49
2/20/24
100
IFFT sinc(x)
H(u,v) h(x,y)
101
101
50
2/20/24
250
200
150
100
50
0
0 50 100 150 200 250
102
102
H(u,v) H(u,v)
1
1/ e
v
u 0 D0 D(u,v)
-D2(u,v)/(2D20)
H(u,v) = e D(u,v) = Ö u2 + v2
103
103
51
2/20/24
104
104
300
250
200
150
100
50
0
0 50 100 150 200 250 300
105
105
52
2/20/24
1
0.1 0.8
0.6
0.05 0.4
0.2
0 0
0 50 100 -50 0 50
Image Domain Frequency Domain
106
106
High-pass filter
0 D(u,v) £ D0 D(u,v) = Ö u2 + v2
H(u,v) =
1 D(u,v) > D0 D0 = cut off frequency
H(u,v)
H(u,v)
v 1
u 0 D0 D(u,v)
107
107
53
2/20/24
H(u,v)
H(u,v)
1
v
1- 1 / e
u 0 D0 D(u,v)
-D2(u,v)/(2D20)
H(u,v) = 1 - e
D(u,v) = Ö u2 + v2
108
108
High-pass filtering
−1 −1 −1
ℎ&(3𝑥3) = −1 8 −1
−1 −1 −1
109
109
54
2/20/24
110
110
111
111
55
2/20/24
Band-pass filtering
0 D(u,v) £ D0 - w D(u,v) = Ö u2 + v2
2
w w
H(u,v) = 1 D0- 2
£ D(u,v) £ D0 + 2
D0 = cut off frequency
w
0 D(u,v) > D0 + 2 w = band-width
H(u,v) H(u,v)
1
v
D(u,v)
0 D0- w D0 D0+w
2 2
u
Can be obtained by multiplying the filter functions of a low-pass and
of a high-pass in the frequency domain
112
112
Brayer
113
56
2/20/24
114
115
57
2/20/24
Hybrid Images
116
Contents
58
2/20/24
118
119
59
2/20/24
120
121
60
2/20/24
122
123
61
2/20/24
Illustration of PCA
124
Illustration of PCA
125
62
2/20/24
126
127
63
2/20/24
128
129
64
2/20/24
Eigenfaces example
130
Eigenfaces example
131
65
2/20/24
Eigenfaces examples
132
133
66
2/20/24
THANK YOU !
67