Professional Documents
Culture Documents
Filtering and Edge Detection 1
Filtering and Edge Detection 1
Filtering and Edge Detection 1
231
148
• “grayscale”
(or “intensity”): [0,255]
• “color”
– RGB: [R, G, B]
[249, 215, 203]
– Lab: [L, a, b]
– HSV: [H, S, V]
Slide partially based on Stanford U. CS131 Slide credit: Dr. Mubarak Shah
• Quite useful ☺
Slide partially based on Stanford U. CS131 Slide credit: Dr. Mubarak Shah
Slide partially based on Stanford U. CS131 Slide credit: Dr. Bernd Girod
Cartesian coordinates
Notation for
discrete
functions
• A color image:
In-painting
Bertamio et al
Slide partially based on Stanford U. CS131
(Filter)
Slide partially based on Stanford U. CS131
Equivalent notations:
1 1 1
1 1 1
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0
0 0
0 0
0 90
90 0
0 90
90 90
90 90
90 0
0 0
0
0
0 0
0 0
0 90
90 90
90 90
90 90
90 90
90 0
0 0
0
0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0
Courtesy of S. Seitz
0
0 0
0 90
90 0
0 0
0 0
0 0
0 0
0 0
0 0
0
0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 10
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 0 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 0 0 0 0 0 0 0
0 0 90 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 10 20
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 0 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 0 0 0 0 0 0 0
0 0 90 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 10 20 30
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 0 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 0 0 0 0 0 0 0
0 0 90 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 10 20 30 30
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 0 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 0 0 0 0 0 0 0
0 0 90 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 10 20 30 30 30 20 10
0 0 0 90 90 90 90 90 0 0 0 20 40 60 60 60 40 20
0 0 0 90 90 90 90 90 0 0 0 30 60 90 90 90 60 30
0 0 0 90 90 90 90 90 0 0 0 30 50 80 80 90 60 30
0 0 0 90 0 90 90 90 0 0 0 30 50 80 80 90 60 30
0 0 0 90 90 90 90 90 0 0 0 20 30 50 50 60 40 20
0 0 0 0 0 0 0 0 0 0 10 20 30 30 30 30 20 10
0 0 90 0 0 0 0 0 0 0 10 10 10 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
In summary:
• This filter “Replaces” each
pixel with an average of its 1 1 1
neighborhood. 1 1 1
1 1 1
• Achieve smoothing effect
(remove sharp features)
• Homogeneity
• Superposition
f[k] h[k]
h[-2-k]
f[k] g[-2]
h[-1-k]
f[k] g[-1]
h[-k]
f[k] g[0]
h[1-k]
f[k] g[1]
h[2-k]
f[k] g[2]
h[n-k]
f[k] g[n]
?
•0 •0 •0
* •0 •1 •0
•0 •0 •0
=
Original
Courtesy of D Lowe
Slide partially based on Stanford U. CS131
•0 •0 •0
* •0 •1 •0
•0 •0 •0
=
Original Filtered
Courtesy of D Lowe
(no change)
?
•0 •0 •0
* •0 •0 •1
•0 •0 •0
=
Original
Courtesy of D Lowe
Slide partially based on Stanford U. CS131
•0 •0 •0
* •0 •0 •1
•0 •0 •0
=
Original Shifted right
Courtesy of D Lowe
By 1 pixel
= ?
•1 •1 •1
* •1 •1 •1
•1 •1 •1
Original
Courtesy of D Lowe
Slide partially based on Stanford U. CS131
•1 •1 •1
* •1 •1 •1
•1 •1 •1
=
Original Blur (with a
Courtesy of D Lowe
box filter)
-
•0 •0 •0 •1 •1 •1
•0 •2 •0
•0 •0 •0
•1 •1 •1
•1 •1 •1
=?
(Note that filter sums to 1)
Original
“details of the image”
Courtesy of D Lowe
•0 •0 •0 •0 •0 •0 •1 •1 •1
•0 •1 •0 + •0 •1 •0 •1 •1 •1
•0 •0 •0 •0 •0 •0 •1 •1 •1
– =
+a =
-
•0 •0 •0 •1 •1 •1
•0 •2 •0
•0 •0 •0
•1 •1 •1
•1 •1 •1 =
Original
Courtesy of D Lowe
Sharpening filter: Accentuates differences with local average
N1 ×M1
Slide partially based on Stanford U. CS131
• zero “padding”
f • edge value replication
h • mirror extension
• more (beyond the scope of this class)
(g* is defined as the complex conjugate of g. In this class, g(n,m) are real numbers, hence g*=g.)
Slide partially based on Stanford U. CS131
scanline
Figure from “Computer Vision for Interactive Computer Graphics,” W.Freeman et al, IEEE Computer Graphics and Applications,
1998 copyright 1998, IEEE
Slide partially based on Stanford U. CS131 Forsyth and Ponce, Computer Vision: A Modern Approach, Fig. 4.16
f*h f**h