SlideShare a Scribd company logo
1 of 64
Download to read offline
CAP5415
Computer Vision
Yogesh S Rawat
yogesh@ucf.edu
HEC-241
CAP5415 - Lecture 3 [Filtering] 1
8/30/2021
Filtering
Lecture 3
CAP5415 - Lecture 3 [Filtering] 2
8/30/2021
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
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
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
CAP5415 - Lecture 3 [Filtering] 6
8/30/2021
Digitization of 1D function
CAP5415 - Lecture 3 [Filtering] 7
8/30/2021
Digitization of 2D function
Digitization of 3D function
CAP5415 - Lecture 3 [Filtering] 8
8/30/2021
Digitization of an arc
CAP5415 - Lecture 3 [Filtering] 9
8/30/2021
Gray scale digital image
CAP5415 - Lecture 3 [Filtering] 10
Brightness
or intensity
Danny Alexander
8/30/2021
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
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
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
CAP5415 - Lecture 3 [Filtering] 14
domain
range
8/30/2021
Digitization
RGB Channels
CAP5415 - Lecture 3 [Filtering] 15
8/30/2021
Sampling
8/30/2021 CAP5415 - Lecture 3 [Filtering] 16
Quantization
CAP5415 - Lecture 3 [Filtering] 17
8/30/2021
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
CAP5415 - Lecture 3 [Filtering] 19
8/30/2021
Gray scale image
CAP5415 - Lecture 3 [Filtering] 20
Source: F.F. Li
8/30/2021
Color image
Image – other examples
CAP5415 - Lecture 3 [Filtering] 21
Danny Alexander
8/30/2021
Image Histogram
CAP5415 - Lecture 3 [Filtering] 22
8/30/2021
Histogram Example
CAP5415 - Lecture 3 [Filtering] 23
Use ImageJ and/or FIJI Credit: Klette 2012.
8/30/2021
Intensity profiles for selected (two) rows
CAP5415 - Lecture 3 [Filtering] 24
8/30/2021
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
Noise
• Ioriginal(x,y) – true pixel value at (x,y)
• n(x,y) - noise at (x,y)
• Iobserved(x,y) = Ioriginal(x,y) + n(x,y) additive noise
CAP5415 - Lecture 3 [Filtering] 26
8/30/2021
Noise
• Ioriginal(x,y) – true pixel value at (x,y)
• n(x,y) - noise at (x,y)
• Iobserved(x,y) = Ioriginal(x,y) * n(x,y) multiplicative noise
CAP5415 - Lecture 3 [Filtering] 27
8/30/2021
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
Uniform distribution
8/30/2021 CAP5415 - Lecture 3 [Filtering] 29
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
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
[ ] [ ]
[ ]
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
Filtering
• Modify pixels based on some function of neighborhood
8/30/2021 CAP5415 - Lecture 3 [Filtering] 33
Filtering
• Output is linear combination of the neighborhood pixels
8/30/2021 CAP5415 - Lecture 3 [Filtering] 34
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
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
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
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
Example: Finite Difference
CAP5415 - Lecture 3 [Filtering] 39
Derivative Masks
Backward difference
Forward difference
Central difference
[-1 1]
[1 -1]
[-1 0 1]
8/30/2021
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
Derivative of Images
CAP5415 - Lecture 3 [Filtering] 41










−
−
−

1
0
1
1
0
1
1
0
1
3
1
x
f
Derivative masks










−
−
−

1
1
1
0
0
0
1
1
1
3
1
y
f
















=
20
20
20
10
10
20
20
20
10
10
20
20
20
10
10
20
20
20
10
10
20
20
20
10
10
I
















=
0
0
0
0
0
0
0
10
10
0
0
0
10
10
0
0
0
10
10
0
0
0
0
0
0
x
I
8/30/2021
Derivative of Images
CAP5415 - Lecture 3 [Filtering] 42










−
−
−

1
0
1
1
0
1
1
0
1
3
1
x
f
Derivative masks










−
−
−

1
1
1
0
0
0
1
1
1
3
1
y
f
8/30/2021
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
CAP5415 - Lecture 3 [Filtering] 44
a. Original image
b. Laplacian operator
c. Horizontal derivative
d. Vertical derivative
8/30/2021
Example
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
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
Convolution
CAP5415 - Lecture 3 [Filtering] 47
• Convolution is associative
I
G
F
I
G
F *
)
*
(
)
*
(
* =
8/30/2021
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
Gaussian filter
8/30/2021 CAP5415 - Lecture 3 [Filtering] 49
Gaussian filter
8/30/2021 CAP5415 - Lecture 3 [Filtering] 50
Gaussian filter
8/30/2021 CAP5415 - Lecture 3 [Filtering] 51
Gaussian filter
8/30/2021 CAP5415 - Lecture 3 [Filtering] 52
Gaussian filter
8/30/2021 CAP5415 - Lecture 3 [Filtering] 53
Gaussian filter
8/30/2021 CAP5415 - Lecture 3 [Filtering] 54
Gaussian filter - properties
• Most common natural model
8/30/2021 CAP5415 - Lecture 3 [Filtering] 55
https://studiousguy.com/real-life-examples-normal-distribution/
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
Filtering Examples - 1
CAP5415 - Lecture 3 [Filtering] 57
0 0 0
0 1 0
0 0 0
* =
8/30/2021
Filtering Examples - 2
CAP5415 - Lecture 3 [Filtering] 58
0 0 0
1 0 0
0 0 0
* =
8/30/2021
Filtering Examples - 3
CAP5415 - Lecture 3 [Filtering] 59
1 1 1
1 1 1
1 1 1
9
1
* =
8/30/2021
Filtering Examples - 4
CAP5415 - Lecture 3 [Filtering] 60
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
25
1
* =
8/30/2021
Filtering Examples - 5
CAP5415 - Lecture 3 [Filtering] 61
* =
Gaussian Smoothing
8/30/2021
Filtering Examples - 6
CAP5415 - Lecture 3 [Filtering] 62
Gaussian Smoothing Smoothing by Averaging
8/30/2021
Filtering Examples - 7
CAP5415 - Lecture 3 [Filtering] 63
After additive
Gaussian Noise
After Averaging After Gaussian Smoothing
8/30/2021
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

More Related Content

Similar to Lecture-3-Filtering-Part-I.pdf

Brain tumor segmentation using asymmetry based histogram thresholding and k m...
Brain tumor segmentation using asymmetry based histogram thresholding and k m...Brain tumor segmentation using asymmetry based histogram thresholding and k m...
Brain tumor segmentation using asymmetry based histogram thresholding and k m...
eSAT Publishing House
 
Deep Local Parametric Filters for Image Enhancement
Deep Local Parametric Filters for Image EnhancementDeep Local Parametric Filters for Image Enhancement
Deep Local Parametric Filters for Image Enhancement
Sean Moran
 
ImageSegmentation (1).ppt
ImageSegmentation (1).pptImageSegmentation (1).ppt
ImageSegmentation (1).ppt
NoorUlHaq47
 

Similar to Lecture-3-Filtering-Part-I.pdf (20)

Multimedia Security - JPEG Artifact details
Multimedia Security - JPEG Artifact detailsMultimedia Security - JPEG Artifact details
Multimedia Security - JPEG Artifact details
 
Learning Convolutional Neural Networks for Graphs
Learning Convolutional Neural Networks for GraphsLearning Convolutional Neural Networks for Graphs
Learning Convolutional Neural Networks for Graphs
 
COM2304: Intensity Transformation and Spatial Filtering – III Spatial Filters...
COM2304: Intensity Transformation and Spatial Filtering – III Spatial Filters...COM2304: Intensity Transformation and Spatial Filtering – III Spatial Filters...
COM2304: Intensity Transformation and Spatial Filtering – III Spatial Filters...
 
06 spatial filtering DIP
06 spatial filtering DIP06 spatial filtering DIP
06 spatial filtering DIP
 
International Journal of Engineering Inventions (IJEI)
International Journal of Engineering Inventions (IJEI)International Journal of Engineering Inventions (IJEI)
International Journal of Engineering Inventions (IJEI)
 
RBF2.ppt
RBF2.pptRBF2.ppt
RBF2.ppt
 
ijecct
ijecctijecct
ijecct
 
Digital Image Fundamentals - II
Digital Image Fundamentals - IIDigital Image Fundamentals - II
Digital Image Fundamentals - II
 
Spatial Filtering in intro image processingr
Spatial Filtering in intro image processingrSpatial Filtering in intro image processingr
Spatial Filtering in intro image processingr
 
2. filtering basics
2. filtering basics2. filtering basics
2. filtering basics
 
Build Your Own 3D Scanner: 3D Scanning with Structured Lighting
Build Your Own 3D Scanner: 3D Scanning with Structured LightingBuild Your Own 3D Scanner: 3D Scanning with Structured Lighting
Build Your Own 3D Scanner: 3D Scanning with Structured Lighting
 
Visual Quality for both Images and Display of Systems by Visual Enhancement u...
Visual Quality for both Images and Display of Systems by Visual Enhancement u...Visual Quality for both Images and Display of Systems by Visual Enhancement u...
Visual Quality for both Images and Display of Systems by Visual Enhancement u...
 
Brain tumor segmentation using asymmetry based histogram thresholding and k m...
Brain tumor segmentation using asymmetry based histogram thresholding and k m...Brain tumor segmentation using asymmetry based histogram thresholding and k m...
Brain tumor segmentation using asymmetry based histogram thresholding and k m...
 
Df4201720724
Df4201720724Df4201720724
Df4201720724
 
Presentation
PresentationPresentation
Presentation
 
Image segmentation
Image segmentationImage segmentation
Image segmentation
 
Deep Local Parametric Filters for Image Enhancement
Deep Local Parametric Filters for Image EnhancementDeep Local Parametric Filters for Image Enhancement
Deep Local Parametric Filters for Image Enhancement
 
Image Compression using K-Means Clustering Method
Image Compression using K-Means Clustering MethodImage Compression using K-Means Clustering Method
Image Compression using K-Means Clustering Method
 
Performance Evaluation of 2D Adaptive Bilateral Filter For Removal of Noise F...
Performance Evaluation of 2D Adaptive Bilateral Filter For Removal of Noise F...Performance Evaluation of 2D Adaptive Bilateral Filter For Removal of Noise F...
Performance Evaluation of 2D Adaptive Bilateral Filter For Removal of Noise F...
 
ImageSegmentation (1).ppt
ImageSegmentation (1).pptImageSegmentation (1).ppt
ImageSegmentation (1).ppt
 

Recently uploaded

Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
MsecMca
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
amitlee9823
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
dollysharma2066
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ssuser89054b
 

Recently uploaded (20)

Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
 
Intro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfIntro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdf
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 

Lecture-3-Filtering-Part-I.pdf

  • 1. CAP5415 Computer Vision Yogesh S Rawat yogesh@ucf.edu HEC-241 CAP5415 - Lecture 3 [Filtering] 1 8/30/2021
  • 2. Filtering Lecture 3 CAP5415 - Lecture 3 [Filtering] 2 8/30/2021
  • 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
  • 8. Digitization of 3D function CAP5415 - Lecture 3 [Filtering] 8 8/30/2021
  • 9. Digitization of an arc CAP5415 - Lecture 3 [Filtering] 9 8/30/2021
  • 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
  • 14. CAP5415 - Lecture 3 [Filtering] 14 domain range 8/30/2021 Digitization
  • 15. RGB Channels CAP5415 - Lecture 3 [Filtering] 15 8/30/2021
  • 16. Sampling 8/30/2021 CAP5415 - Lecture 3 [Filtering] 16
  • 17. Quantization CAP5415 - Lecture 3 [Filtering] 17 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
  • 19. CAP5415 - Lecture 3 [Filtering] 19 8/30/2021 Gray scale image
  • 20. CAP5415 - Lecture 3 [Filtering] 20 Source: F.F. Li 8/30/2021 Color image
  • 21. Image – other examples CAP5415 - Lecture 3 [Filtering] 21 Danny Alexander 8/30/2021
  • 22. Image Histogram CAP5415 - Lecture 3 [Filtering] 22 8/30/2021
  • 23. Histogram Example CAP5415 - Lecture 3 [Filtering] 23 Use ImageJ and/or FIJI Credit: Klette 2012. 8/30/2021
  • 24. Intensity profiles for selected (two) rows CAP5415 - Lecture 3 [Filtering] 24 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
  • 26. Noise • Ioriginal(x,y) – true pixel value at (x,y) • n(x,y) - noise at (x,y) • Iobserved(x,y) = Ioriginal(x,y) + n(x,y) additive noise CAP5415 - Lecture 3 [Filtering] 26 8/30/2021
  • 27. Noise • Ioriginal(x,y) – true pixel value at (x,y) • n(x,y) - noise at (x,y) • Iobserved(x,y) = Ioriginal(x,y) * n(x,y) multiplicative noise CAP5415 - Lecture 3 [Filtering] 27 8/30/2021
  • 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
  • 29. Uniform distribution 8/30/2021 CAP5415 - Lecture 3 [Filtering] 29
  • 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
  • 39. Example: Finite Difference CAP5415 - Lecture 3 [Filtering] 39 Derivative Masks Backward difference Forward difference Central difference [-1 1] [1 -1] [-1 0 1] 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
  • 41. Derivative of Images CAP5415 - Lecture 3 [Filtering] 41           − − −  1 0 1 1 0 1 1 0 1 3 1 x f Derivative masks           − − −  1 1 1 0 0 0 1 1 1 3 1 y f                 = 20 20 20 10 10 20 20 20 10 10 20 20 20 10 10 20 20 20 10 10 20 20 20 10 10 I                 = 0 0 0 0 0 0 0 10 10 0 0 0 10 10 0 0 0 10 10 0 0 0 0 0 0 x I 8/30/2021
  • 42. Derivative of Images CAP5415 - Lecture 3 [Filtering] 42           − − −  1 0 1 1 0 1 1 0 1 3 1 x f Derivative masks           − − −  1 1 1 0 0 0 1 1 1 3 1 y f 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
  • 47. Convolution CAP5415 - Lecture 3 [Filtering] 47 • Convolution is associative I G F I G 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
  • 49. Gaussian filter 8/30/2021 CAP5415 - Lecture 3 [Filtering] 49
  • 50. Gaussian filter 8/30/2021 CAP5415 - Lecture 3 [Filtering] 50
  • 51. Gaussian filter 8/30/2021 CAP5415 - Lecture 3 [Filtering] 51
  • 52. Gaussian filter 8/30/2021 CAP5415 - Lecture 3 [Filtering] 52
  • 53. Gaussian filter 8/30/2021 CAP5415 - Lecture 3 [Filtering] 53
  • 54. Gaussian filter 8/30/2021 CAP5415 - Lecture 3 [Filtering] 54
  • 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
  • 57. Filtering Examples - 1 CAP5415 - Lecture 3 [Filtering] 57 0 0 0 0 1 0 0 0 0 * = 8/30/2021
  • 58. Filtering Examples - 2 CAP5415 - Lecture 3 [Filtering] 58 0 0 0 1 0 0 0 0 0 * = 8/30/2021
  • 59. Filtering Examples - 3 CAP5415 - Lecture 3 [Filtering] 59 1 1 1 1 1 1 1 1 1 9 1 * = 8/30/2021
  • 60. Filtering Examples - 4 CAP5415 - Lecture 3 [Filtering] 60 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 25 1 * = 8/30/2021
  • 61. Filtering Examples - 5 CAP5415 - Lecture 3 [Filtering] 61 * = Gaussian Smoothing 8/30/2021
  • 62. Filtering Examples - 6 CAP5415 - Lecture 3 [Filtering] 62 Gaussian Smoothing Smoothing by Averaging 8/30/2021
  • 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