Ali Farhadi Many slides from Steve Seitz and Larry Zitnick What is an image F Image Operations functions of functions F Image Operations functions of functions ID: 778185
Download The PPT/PDF document "Images and Filters CSE 455" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Slide1
Images and Filters
CSE 455Ali Farhadi
Many slides from Steve Seitz and Larry
Zitnick
Slide2What is an image?
Slide3Slide4Slide5F
( ) =
Image Operations
(functions of functions)
Slide6F
( ) =
Image Operations
(functions of functions)
Slide7F
( ) =
Image Operations
(functions of functions)
0.1
0
0.8
0.9
0.9
0.9
0.2
0.40.30.6000.10.50.90.90.20.40.30.6000.10.90.90.20.40.30.6000.10.5
Slide8F
( , ) =
Image Operations
(functions of functions)
0.23
Slide9Local image functions
F
( ) =
Slide100
0
0
0
0
0
0
0
0
0
0
0000000000009090909090000009090909090000009090909090000009009090900
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
00000000000000909090909000000909090909000000909090909000000900909090000009090909090000000000000009000000000000000000
Credit: S. Seitz
Image filtering
1
1
1
1
1
1
1
1
1
Slide110
0
0
0
0
0
0
0
0
0
0
0000000000009090909090000009090909090000009090909090000009009090900
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
10
0
0
0
0
0
0
0
0
000000000000000909090909000000909090909000000909090909000000900909090000009090909090000000000000009000000000000000000
Image filtering
1
1
1
1
1
1
1
1
1
Credit: S. Seitz
Slide120
0
0
0
0
0
0
0
0
0
0
0000000000009090909090000009090909090000009090909090000009009090900
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
10
20
0
0
0
0
0
0
0
0000000000000000909090909000000909090909000000909090909000000900909090000009090909090000000000000009000000000000000000
Image filtering
1
1
1
1
1
1
1
1
1
Credit: S. Seitz
Slide130
0
0
0
0
0
0
0
0
0
0
0000000000009090909090000009090909090000009090909090000009009090900
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
10
20
30
0
0
0
0
0
0
00000000000000000909090909000000909090909000000909090909000000900909090000009090909090000000000000009000000000000000000
Image filtering
1
1
1
1
1
1
1
1
1
Credit: S. Seitz
Slide140
10
20
30
30
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
90
0
90
909000000909090909000000000000000900000000000000000
0
Image filtering111111111Credit: S. Seitz
Slide150
10
20
30
30
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
90
0
90
909000000909090909000000000000000900000000000000000
0
Image filtering111111111Credit: S. Seitz?
Slide160
10
20
30
30
50
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
90
0
90909000000909090909000000000000000900000000000000000
0
Image filtering111111111Credit: S. Seitz?
Slide170
0
0
0
0
0
0
0
0
0
0
0000000000009090909090000009090909090000009090909090000009009090900
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
10
20
30
30
30
20
10
020406060604020030609090906030030508080906030030508080906030020305050604020102030303030201010101000000
Image filtering
111111111Credit: S. Seitz
Slide18What does it do?
Replaces each pixel with an average of its neighborhood
Achieve smoothing effect (remove sharp features)
1
1
1
1
1
1
1
1
1Slide credit: David Lowe (UBC)Box Filter
Slide19Smoothing with box filter
Slide20Practice with linear filters
0
0
0
0
1
0
0
0
0
Original
?Source: D. Lowe
Slide21Practice with linear filters
0
0
0
0
1
0
0
0
0
Original
Filtered (no change)Source: D. Lowe
Slide22Practice with linear filters
0
0
0
1
0
0
0
0
0
Original
?Source: D. Lowe
Slide23Practice with linear filters
0
0
0
1
0
0
0
0
0
Original
Shifted leftBy 1 pixelSource: D. Lowe
Slide24Practice with linear filters
Original
1
1
1
1
1
1
1
1
1
000020000-?Source: D. Lowe
Slide25Practice with linear filters
Original
1
1
1
1
1
1
1
1
1
000020000-Sharpening filter Accentuates differences with local averageSource: D. Lowe
Slide26Sharpening
Source: D. Lowe
Slide27Other filters
-1
0
1
-2
0
2
-1
0
1
Vertical Edge
(absolute value)Sobel
Slide28Other filters
-1
-2
-1
0
0
0
1
2
1
Horizontal Edge
(absolute value)Sobel
Slide29Basic gradient filters
0
0
0
1
0
-1
0
0
0
0
-1000001010-1orHorizontal GradientVertical Gradient10-1or
Slide30Gaussian filter
*
=
Input image
f
Filter
h
Output image
g
Compute empirically
Slide31Gaussian vs. mean filters
What does real blur look like?
Slide32Spatially-weighted average
0.003 0.013 0.022 0.013 0.003
0.013 0.059 0.097 0.059 0.013
0.022 0.097 0.159 0.097 0.022
0.013 0.059 0.097 0.059 0.013
0.003 0.013 0.022 0.013 0.003
5 x 5, = 1
Slide credit: Christopher Rasmussen
Important filter: Gaussian
Slide33Smoothing with Gaussian filter
Slide34Smoothing with box filter
Slide35Gaussian filters
What parameters matter here?
Variance
of Gaussian: determines extent of smoothing
Source: K.
Grauman
Slide36Smoothing with a Gaussian
…
Parameter
σ
is the “scale” / “width” / “spread” of the Gaussian kernel, and controls the amount of smoothing.
Source: K.
Grauman
Slide37First and second derivatives
*
=
Slide38First and second derivatives
Original
First Derivative x
Second Derivative x, y
What are these good for?
Slide39Subtracting filters
Original
Second Derivative
Sharpened
Slide40for some
Combining filters
*
*
0
0
0
0
0
0
0
0000-101000000000000000000-1000-14-1000-10000000==It’s also true:
Slide41Combining Gaussian filters
More blur than either individually (but less than )
*
=
?
Slide42Separable filters
*
=
Compute Gaussian in horizontal direction, followed by the vertical direction.
Not all filters are separable.
Freeman and
Adelson
, 1991
Much faster!
Slide43Sums of rectangular regions
243
239
240
225
206
185
188
218
211
206
21622524223921811067313415221320620822124324212358948213277108208208215235217115212243236247139912092082112332081312222192261961147420821321423221713111677150695652201228223232232182186184179159123
93
232
235
235
232
236
201
154
216
133
129
81
175
252
241
240
235
238
230
128
172
138
65
63
234
249
241
245
237
236
247
143
59
78
10
94
255
248
247
251
234
237
245
193
55
33
115
144
213255253251248245161
128149109138654715623925519010739102947311458177511372332331481682031794327171281726121602552551092226193524How do we compute the sum of the pixels in the red box?After some pre-computation, this can be done in constant time for any box.This “trick” is commonly used for computing Haar wavelets (a fundemental building block of many object recognition approaches.)
Slide44Sums of rectangular regions
The trick is to compute an “integral image.” Every pixel is the sum of its neighbors to the upper left.
Sequentially compute using:
Slide45Sums of rectangular regions
A
B
C
D
Solution is found using:
A + D – B - C
Slide46Linear vs. Non-Linear Filters
Gaussian and Median Filters
Slide47Spatially varying filters
Some filters vary spatially.
Useful for
deblurring
.
Durand, 02
Slide48*
*
*
input
output
Same Gaussian kernel everywhere.
Slides courtesy of
Sylvian
Paris
Constant blur
Slide49*
*
*
input
output
The kernel shape depends on the image content.
Slides courtesy of
Sylvian
Paris
Bilateral filter
Maintains edges when blurring!
Slide50Borders
What to do about image borders:
black
fixed
periodic
reflected