A pyramid is a structure whose outer surfaces are triangular and converge to a single step at the top, making the shape roughly a pyramid in the geometric sense. The base of a pyramid can be trilateral, quadrilateral, or of any polygon shape. As such, a pyramid has at least three outer triangular surfaces. Wikipedia
पिरामिड जैसे ज्यामितीय आकार से मिलती जुलती संरचनाओं को पिरामिड कहते हैं। विश्व में बहुत सी संरचनाएँ पिरैमिड के आकार की हैं जिनमें मिस्र के पिरामिड बहुत प्रसिद्ध हैं। पिरामिड आकार की संरचनाओं की सबसे बड़ी विशेषता यह है कि इसके भार का अधिकांश भाग जमीन के पास होता हैA pyramid is a structure whose outer surfaces are triangular and converge to a single step at the top, making the shape roughly a pyramid in the geometric sense. The base of a pyramid can be trilateral, quadrilateral, or of any polygon shape. As such, a pyramid has at least three outer triangular surfaces. Wikipedia
पिरामिड जैसे ज्यामितीय आकार से मिलती जुलती संरचनाओं को पिरामिड कहते हैं। विश्व में बहुत सी संरचनाएँ पिरैमिड के आकार की हैं जिनमें मिस्र के पिरामिड बहुत प्रसिद्ध हैं। पिरामिड आकार की संरचनाओं की सबसे बड़ी विशेषता यह है कि इसके भार का अधिकांश भाग जमीन के पास होता है
3. Outline
• Image as a function
• Extracting useful information from Images
• Histogram
• Edges
• Smoothing/Removing noise
• Convolution/Correlation
• Image Derivatives/Gradient
• Filtering (linear)
• Read Szeliski, Chapter 3.
• Read Shah, Chapter 2.
• Read/Program CV with Python, Chapters 1 and 2.
CAP5415 - Lecture 3 [Filtering] 3
8/30/2021
4. Digitization
• Computers use discrete form of the images
• The process transforming continuous space into
discrete space is called digitization
CAP5415 - Lecture 3 [Filtering] 4
Image
Sampling+
Quantization
Digital Image
8/30/2021
5. Digitization
• Function
y = f(x)
• Domain of a function
• Range of a function
• Sampling
• Discretization of domain
• Quantization
• Discretization of range
8/30/2021 CAP5415 - Lecture 3 [Filtering] 5
y = f(x)
x
y
6. CAP5415 - Lecture 3 [Filtering] 6
8/30/2021
Digitization of 1D function
7. CAP5415 - Lecture 3 [Filtering] 7
8/30/2021
Digitization of 2D function
10. Gray scale digital image
CAP5415 - Lecture 3 [Filtering] 10
Brightness
or intensity
Danny Alexander
8/30/2021
11. Definition
• An image P is a function defined on a (finite) rectangular
subset G of a regular planar orthogonal array.
• G is called (2D) grid, and an element of G is called a pixel.
• P assigns a value of P(p) to each p G
CAP5415 - Lecture 3 [Filtering] 11
8/30/2021
12. Definition
• An image P is a function defined on a (finite) rectangular
subset G of a regular planar orthogonal array.
• G is called (2D) grid, and an element of G is called a pixel.
• P assigns a value of P(p) to each p G
CAP5415 - Lecture 3 [Filtering] 12
8/30/2021
13. Definition
• Pictures are not only sampled
• They are also quantized
• they may have only a finite number of possible values
• i.e., 0 to 255, 0-1, …
CAP5415 - Lecture 3 [Filtering] 13
8/30/2021
18. Resolution
• Also a display parameter
• defined in dots per inch (DPI) or
• measure of spatial pixel density
• standard value for recent screen technologies is 72 dpi.
• Recent printer resolutions are in 300 dpi and/or 600 dpi.
CAP5415 - Lecture 3 [Filtering] 18
8/30/2021
25. Image noise
• Light Variations
• Camera Electronics
• Surface Reflectance
• Lens
• Noise is random,
• it occurs with some probability
• It has a distribution
8/30/2021 CAP5415 - Lecture 3 [Filtering] 25
28. Gaussian Noise
CAP5415 - Lecture 3 [Filtering] 28
( ) 2
2
2
)
(
,
n
e
n
g
y
x
n
−
=
Probability Distribution
n is a random variable
)
(n
g
8/30/2021
n
30. Salt and pepper noise
• Each pixel is randomly made black or white with a uniform probability
distribution
CAP5415 - Lecture 3 [Filtering] 30
➔ Salt-pepper
8/30/2021
31. Image filtering
• Image filtering: compute function of local neighborhood at
each position
CAP5415 - Lecture 3 [Filtering] 31
8/30/2021
]
,
[
]
,
[
]
,
[
,
l
n
k
m
I
l
k
f
n
m
h
l
k
+
+
=
I=image
f=filter
h=output
2d coords=m,n
2d coords=k,l
[ ] [ ]
[ ]
32. Image filtering
• Image filtering: compute function of local neighborhood at
each position
• Enhance images
• Denoise, resize, increase contrast, etc.
• Extract information from images
• Texture, edges, distinctive points, etc.
• Detect patterns
• Template matching
CAP5415 - Lecture 3 [Filtering] 32
8/30/2021
33. Filtering
• Modify pixels based on some function of neighborhood
8/30/2021 CAP5415 - Lecture 3 [Filtering] 33
34. Filtering
• Output is linear combination of the neighborhood pixels
8/30/2021 CAP5415 - Lecture 3 [Filtering] 34
35. Derivatives and Average
• Derivative: rate of change
• Speed is a rate of change of a distance, X=V.t
• Acceleration is a rate of change of speed, V=a.t
• Average: mean
• Dividing the sum of N values by N
CAP5415 - Lecture 3 [Filtering] 35
8/30/2021
36. Derivative
CAP5415 - Lecture 3 [Filtering] 36
x
x f
x
f
x
x
x
f
x
f
dx
df
=
=
−
−
= →
)
(
)
(
)
(
lim 0
3
4
2
4
2 x
x
dx
dy
x
x
y
+
=
+
=
x
x
e
x
dx
dy
e
x
y
−
−
−
+
=
+
=
)
1
(
cos
sin
8/30/2021
37. Discrete Derivative
CAP5415 - Lecture 3 [Filtering] 37
)
(
1
)
1
(
)
(
x
f
x
f
x
f
dx
df
=
−
−
=
)
(
)
1
(
)
( x
f
x
f
x
f
dx
df
=
−
−
=
)
(
)
(
)
(
lim 0 x
f
x
x
x
f
x
f
dx
df
x
=
−
−
= →
8/30/2021
38. Discrete Derivative / Finite Difference
CAP5415 - Lecture 3 [Filtering] 38
)
(
)
1
(
)
1
( x
f
x
f
x
f
dx
df
=
−
−
+
=
)
(
)
1
(
)
( x
f
x
f
x
f
dx
df
=
+
−
=
)
(
)
1
(
)
( x
f
x
f
x
f
dx
df
=
−
−
= Backward difference
Forward difference
Central difference
8/30/2021
40. Derivative in 2-D
CAP5415 - Lecture 3 [Filtering] 40
)
,
( y
x
f
Given function
=
=
y
x
f
f
y
y
x
f
x
y
x
f
y
x
f )
,
(
)
,
(
)
,
(
Gradient vector
2
2
)
,
( y
x f
f
y
x
f +
=
Gradient magnitude
y
x
f
f
1
tan−
=
Gradient direction
8/30/2021
43. Averages
CAP5415 - Lecture 3 [Filtering] 43
• Mean
n
I
n
I
I
I
I
n
i
i
n
=
=
+
+
= 1
2
1
n
I
w
n
I
w
I
w
I
w
I
n
i
i
i
n
n
=
=
+
+
+
= 1
2
2
1
1
8/30/2021
• Weighted mean
44. CAP5415 - Lecture 3 [Filtering] 44
a. Original image
b. Laplacian operator
c. Horizontal derivative
d. Vertical derivative
8/30/2021
Example
45. Correlation (linear relationship)
CAP5415 - Lecture 3 [Filtering] 45
( ) ( )
=
k l
l
k
h
l
k
f
h
f ,
,
Kernel
Image
=
=
h
f
h1 h2 h3
h4 h5 h6
h7 h8 h9
h
f1 f2 f3
f4 f5 f6
f7 f8 f9
9
9
8
8
7
7
6
6
5
5
4
4
3
3
2
2
1
1
h
f
h
f
h
f
h
f
h
f
h
f
h
f
h
f
h
f
h
f
+
+
+
+
+
+
+
+
=
f
8/30/2021
46. Convolution
CAP5415 - Lecture 3 [Filtering] 46
( ) ( )
−
−
=
k l
l
k
h
l
k
f
h
f ,
,
*
Kernel
Image
=
=
h
f h7 h8 h9
h4 h5 h6
h1 h2 h3
h9 h8 h7
h6 h5 h4
h3 h2 h1
h1 h2 h3
h4 h5 h6
h7 h8 h9
h
flip
X −
flip
Y −
f1 f2 f3
f4 f5 f6
f7 f8 f9
1
9
2
8
3
7
4
6
5
5
6
4
7
3
8
2
9
1
*
h
f
h
f
h
f
h
f
h
f
h
f
h
f
h
f
h
f
h
f
+
+
+
+
+
+
+
+
=
f
8/30/2021
48. Correlation and Convolution
• Convolution is a filtering operation
• expresses the amount of overlap of one function as it is shifted over another
function
• Correlation compares the similarity of two sets of data
• relatedness of the signals!
CAP5415 - Lecture 3 [Filtering] 48
8/30/2021
55. Gaussian filter - properties
• Most common natural model
8/30/2021 CAP5415 - Lecture 3 [Filtering] 55
https://studiousguy.com/real-life-examples-normal-distribution/
56. Gaussian filter - properties
• Most common natural model
• Smooth function, it has infinite number of derivatives
• It is Symmetric
• Fourier Transform of Gaussian is Gaussian.
• Convolution of a Gaussian with itself is a Gaussian.
• Gaussian is separable; 2D convolution can be performed by two 1-D
convolutions
• There are cells in eye that perform Gaussian filtering.
8/30/2021 CAP5415 - Lecture 3 [Filtering] 56
63. Filtering Examples - 7
CAP5415 - Lecture 3 [Filtering] 63
After additive
Gaussian Noise
After Averaging After Gaussian Smoothing
8/30/2021
64. Questions?
CAP5415 - Lecture 3 [Filtering] 64
Sources for this lecture include materials from works by Mubarak Shah, S.
Seitz, James Tompkin and Ulas Bagci
8/30/2021