1
6.891
Computer Vision and Applications
- Prof. Trevor. Darrell
Lecture 2:
– Linear Filters and Convolution (review) – Fourier Transform (review) – Sampling and Aliasing (review)
Readings: F&P Chapter 7.1-7.6
6.891 Computer Vision and Applications Prof. Trevor. Darrell - - PowerPoint PPT Presentation
6.891 Computer Vision and Applications Prof. Trevor. Darrell Lecture 2: Linear Filters and Convolution (review) Fourier Transform (review) Sampling and Aliasing (review) Readings: F&P Chapter 7.1-7.6 1 Recap: Cameras,
1
Lecture 2:
– Linear Filters and Convolution (review) – Fourier Transform (review) – Sampling and Aliasing (review)
Readings: F&P Chapter 7.1-7.6
2
3
Forsyth&Ponce
y f y z x f x ' ' ' '
4
) sin( ) cot( v z y v u z y z x u Г
we can write this as:
5
Forsyth&Ponce
W C W C W C
W C C W
Extrinsic
6
3 2 1 z y x T T T
2 3 1
pixel coordinates world coordinates z is in the camera coordinate system, but we can solve for that, since , leading to:
z P m
1
7
) ( ) (
3 2 3 1
i i i
P m v m P m u m
into a big matrix:
2 1 1 1 1 1 1 1
T n n T n T T n n T T n T T T T T T
P m P m v P m P m u
2 3 1
8
– Linear Filters and Convolution – Fourier Transform – Sampling and Aliasing
– sign-up sheet – introductions
9
5 1 4 1 7 1 5 3 10 Local image data 7 Modified image data Some function
10
5 1 4 1 7 1 5 3 10 0.5 0.5 0 1 Local image data kernel 7 Modified image data
11
k
,
12
Pixel offset coefficient 1.0
13
Pixel offset coefficient 1.0 Filtered (no change)
14
Pixel offset coefficient
1.0
15
Pixel offset coefficient
1.0 shifted
16
Pixel offset coefficient
0.3
17
Pixel offset coefficient
0.3 Blurred (filter applied in both dimensions).
18
Pixel offset coefficient 0.3
8 filtered 2.4 impulse
19
Pixel offset coefficient 0.3
8 filtered 4 8 4 impulse edge Pixel offset coefficient 0.3
8 filtered 2.4
20
“be like” their neighbours
– surfaces turn slowly – relatively few reflectance changes
processes to be independent from pixel to pixel
suppresses noise, for appropriate noise models
– the parameter in the symmetric Gaussian – as this parameter goes up, more pixels are involved in the average – and the image gets more blurred – and noise is more effectively suppressed
21
The effects of smoothing Each row shows smoothing with gaussians of different width; each column shows different realisations of an image of gaussian noise.
22
2.0
1.0
23
2.0 1.0 Filtered (no change)
24
2.0 0.33
25
Pixel offset coefficient
0.3 Blurred (filter applied in both dimensions).
26
2.0 0.33
27
2.0 0.33 Sharpened
28
coefficient
8 Sharpened (differences are accentuated; constant areas are left untouched). 11.2 1.7
8
29
before after
30
– change in reflectance – change in object – change in illumination – noise
– linear filters to estimate image gradient – mark points where gradient magnitude is particularly large wrt neighbours (ideally, curves of such points).
31
– smooth before differentiation – two convolutions to smooth, then differentiate? – actually, no - we can use a derivative of Gaussian filter
associative
32
The scale of the smoothing filter affects derivative estimates, and also the semantics of the edges recovered.
1 pixel 3 pixels 7 pixels
33
Gabor filters (Gaussian modulated harmonics) at different scales and spatial frequencies Top row shows anti-symmetric (or odd) filters, bottom row the symmetric (or even) filters.
34
Fourier transform, or Wavelet transform, or Steerable pyramid transform
transformed image
35
Same basis functions are used for the inverse transform U transpose and complex conjugate
36
discrete domain
Г
1 ln
M k N l N M km i
1 ln
M k N l N M km i
37
To get some sense of what basis elements look like, we plot a basis element --- or rather, its real part --- as a function of x,y for some fixed u, v. We get a function that is constant when (ux+vy) is constant. The magnitude of the vector (u, v) gives a frequency, and its direction gives an orientation. The function is a sinusoid with this frequency along the direction, and constant perpendicular to the direction.
38
Here u and v are larger than in the previous slide.
39
And larger still...
40
function is complex
– difficult to plot, visualize – instead, we can think of the phase and magnitude of the transform
complex transform
magnitude of the complex transform
– all natural images have about the same magnitude transform – hence, phase seems to matter, but magnitude largely doesn’t
– Take two pictures, swap the phase transforms, compute the inverse - what does the result look like?
41
42
This is the magnitude transform
cheetah pic
43
This is the phase transform
cheetah pic
44
45
This is the magnitude transform
pic
46
This is the phase transform
pic
47
Reconstruction with zebra phase, cheetah magnitude
48
Reconstruction with cheetah phase, zebra magnitude
49
50
51
52
53
54
55
56
57
58
59
60
4052
61
62
63
64
65
66
67
68
69
Forsyth&Ponce
70
Oppenheim, Schafer and Buck, Discrete-time signal processing, Prentice Hall, 1999
Discrete-time, continuous frequency Fourier transform
71
Discrete-time, continuous frequency Fourier transform pairs
Oppenheim, Schafer and Buck, Discrete-time signal processing, Prentice Hall, 1999
73
Bracewell, The Fourier Transform and its Applications, McGraw Hill 1978
74
Bracewell, The Fourier Transform and its Applications, McGraw Hill 1978
75
Bracewell, The Fourier Transform and its Applications, McGraw Hill 1978
76
Bracewell, The Fourier Transform and its Applications, McGraw Hill 1978
77
78
Consider a (circular) convolution of g and h
79
h g f
Take DFT of both sides
80
h g f
g DFT n m F
, [
Write the DFT and convolution explicitly
1 ,
M u N v N vn M um i l k
81
h g f
g DFT n m F
, [
Move the exponent in
1 ,
] , [ ] , [ ,
M u N v N vn M um i l k
e l k h l v k u g n m F
1 ,
M u N v l k N vn M um i
82
h g f
g DFT n m F
, [
Change variables in the sum
1 ,
] , [ ] , [ ,
M u N v N vn M um i l k
e l k h l v k u g n m F
1 ,
] , [ ] , [
M u N v l k N vn M um i
l k h e l v k u g
Г Г
1 ,
k M k l N l l k N n l M m k i
83
h g f
g DFT n m F
, [
Perform the DFT (circular boundary conditions)
1 ,
] , [ ] , [ ,
M u N v N vn M um i l k
e l k h l v k u g n m F
1 ,
] , [ ] , [
M u N v l k N vn M um i
l k h e l v k u g
Г Г
1 ,
] , [ ] , [
k M k l N l l k N n l M m k i
l k h e g
k N M km i
, ln
84
h g f
g DFT n m F
, [
Perform the other DFT (circular boundary conditions)
1 ,
] , [ ] , [ ,
M u N v N vn M um i l k
e l k h l v k u g n m F
1 ,
] , [ ] , [
M u N v l k N vn M um i
l k h e l v k u g
Г Г
1 ,
] , [ ] , [
k M k l N l l k N n l M m k i
l k h e g
k N M km i
l k h e n m G
, ln
] , [ ,
85
86
Pixel offset coefficient 1.0 Filtered (no change)
1 1 ln
k N l N M km i
87
Pixel offset coefficient
1.0 shifted
M m i M k N l N M km i
1 1 ln
1.0 Constant magnitude, linearly shifted phase
88
Pixel offset coefficient
0.3 blurred
M k N l N M km i
1 1 ln
Low-pass filter 1.0
89
2.0 0.33 sharpened
M k N l N M km i
1 1 ln
high-pass filter 1.0 2.3
90
91
Sampling in 1D takes a continuous function and replaces it with a vector of values, consisting of the function’s values at a set of sample points. We’ll assume that these sample points are on a regular grid, and can place one at each integer for convenience.
92
Sampling in 2D does the same thing, only in 2D. We’ll assume that these sample points are on a regular grid, and can place one at each integer point for convenience.
93
– the delta function – model on right Sample2D f (x,y)
i
(x i, y j)
i
94
F Sample2D f (x,y)
(x i,y j)
i
(x i, y j)
i
95
96
97
– In the next few slides – Typically, small phenomena look bigger; fast phenomena can look slower – Common phenomenon
98
Resample the checkerboard by taking
In the case of the top left board, new representation is reasonable. Top right also yields a reasonable representation. Bottom left is all black (dubious) and bottom right has checks that are too big.
99
Constructing a pyramid by taking every second pixel leads to layers that badly misrepresent the top layer
100
that high frequencies lead to trouble with sampling.
frequencies before sampling – multiply the FT of the signal with something that suppresses high frequencies
– or convolve with a low-pass filter
– multiplying FT by Gaussian is equivalent to convolving image with Gaussian.
101
Sampling without smoothing. Top row shows the images, sampled at every second pixel to get the next; bottom row shows the magnitude spectrum of these images.
102
Sampling with smoothing. Top row shows the images. We get the next image by smoothing the image with a Gaussian with sigma 1 pixel, then sampling at every second pixel to get the next; bottom row shows the magnitude spectrum of these images.
103
Sampling with smoothing. Top row shows the images. We get the next image by smoothing the image with a Gaussian with sigma 1.4 pixels, then sampling at every second pixel to get the next; bottom row shows the magnitude spectrum of these images.
104
Analyze crossed gratings…
105
Analyze crossed gratings…
106
Analyze crossed gratings…
107
Analyze crossed gratings… Where does perceived near horizontal grating come from?
108