![Page 1: Motion Estimation Readings: Ch 9: 9.1-9.3 plus papers](https://reader035.vdocuments.net/reader035/viewer/2022062422/56812da5550346895d92c82c/html5/thumbnails/1.jpg)
1
Motion EstimationReadings: Ch 9: 9.1-9.3 plus papers
• change detection• optical flow analysis• Lucas-Kanade method with pyramid structure• Ming Ye’s improved method
![Page 2: Motion Estimation Readings: Ch 9: 9.1-9.3 plus papers](https://reader035.vdocuments.net/reader035/viewer/2022062422/56812da5550346895d92c82c/html5/thumbnails/2.jpg)
2
Why estimate motion?
We live in a 4-D world
Wide applications• Object Tracking
• Camera Stabilization
• Image Mosaics
• 3D Shape Reconstruction (SFM)
• Special Effects (Match Move)
![Page 3: Motion Estimation Readings: Ch 9: 9.1-9.3 plus papers](https://reader035.vdocuments.net/reader035/viewer/2022062422/56812da5550346895d92c82c/html5/thumbnails/3.jpg)
3
Frame from an ARDA Sample Video
![Page 4: Motion Estimation Readings: Ch 9: 9.1-9.3 plus papers](https://reader035.vdocuments.net/reader035/viewer/2022062422/56812da5550346895d92c82c/html5/thumbnails/4.jpg)
4
Change detection for surveillance• Video frames: F1, F2, F3, …• Objects appear, move, disappear• Background pixels remain the same (simple case)
• How do you detect the moving objects?
• Simple answer: pixelwise subtraction
![Page 5: Motion Estimation Readings: Ch 9: 9.1-9.3 plus papers](https://reader035.vdocuments.net/reader035/viewer/2022062422/56812da5550346895d92c82c/html5/thumbnails/5.jpg)
5
Example: Person detected entering room
• Pixel changes detected as difference components
• Regions are (1) person, (2) opened door, and (3) computer monitor.
• System can know about the door and monitor. Only the person region is “unexpected”.
![Page 6: Motion Estimation Readings: Ch 9: 9.1-9.3 plus papers](https://reader035.vdocuments.net/reader035/viewer/2022062422/56812da5550346895d92c82c/html5/thumbnails/6.jpg)
6
Change Detection via Image Subtraction
for each pixel [r,c] if (|I1[r,c] - I2[r,c]| > threshold) then Iout[r,c] = 1 else Iout[r,c] = 0
Perform connected components on Iout.
Remove small regions.
Perform a closing with a small disk for merging close neighbors.
Compute and return the bounding boxes B of each remaining region.
What assumption does this make about the changes?
![Page 7: Motion Estimation Readings: Ch 9: 9.1-9.3 plus papers](https://reader035.vdocuments.net/reader035/viewer/2022062422/56812da5550346895d92c82c/html5/thumbnails/7.jpg)
7
Change analysis
Known regions are ignored and system attends to the unexpected region of change. Region has bounding box similar to that of a person. System might then zoom in on “head” area and attempt face recognition.
![Page 8: Motion Estimation Readings: Ch 9: 9.1-9.3 plus papers](https://reader035.vdocuments.net/reader035/viewer/2022062422/56812da5550346895d92c82c/html5/thumbnails/8.jpg)
8
Optical flow
![Page 9: Motion Estimation Readings: Ch 9: 9.1-9.3 plus papers](https://reader035.vdocuments.net/reader035/viewer/2022062422/56812da5550346895d92c82c/html5/thumbnails/9.jpg)
9
Problem definition: optical flow
How to estimate pixel motion from image H to image I?• Solve pixel correspondence problem
– given a pixel in H, look for nearby pixels of the same color in I
Key assumptions• color constancy: a point in H looks the same in I
– For grayscale images, this is brightness constancy
• small motion: points do not move very far
This is called the optical flow problem
![Page 10: Motion Estimation Readings: Ch 9: 9.1-9.3 plus papers](https://reader035.vdocuments.net/reader035/viewer/2022062422/56812da5550346895d92c82c/html5/thumbnails/10.jpg)
10
Optical flow constraints (grayscale images)
Let’s look at these constraints more closely• brightness constancy: Q: what’s the equation?
• small motion: (u and v are less than 1 pixel)– suppose we take the Taylor series expansion of I:
H(x, y) = I(x+u, y+v)
![Page 11: Motion Estimation Readings: Ch 9: 9.1-9.3 plus papers](https://reader035.vdocuments.net/reader035/viewer/2022062422/56812da5550346895d92c82c/html5/thumbnails/11.jpg)
11
Optical flow equationCombining these two equations
What is It ? The time derivative of the image at (x,y)
How do we calculate it?
The x-component ofthe gradient vector.
![Page 12: Motion Estimation Readings: Ch 9: 9.1-9.3 plus papers](https://reader035.vdocuments.net/reader035/viewer/2022062422/56812da5550346895d92c82c/html5/thumbnails/12.jpg)
12
Optical flow equation
Q: how many unknowns and equations per pixel?
Intuitively, what does this constraint mean?
• The component of the flow in the gradient direction is determined
• The component of the flow parallel to an edge is unknown
1 equation, but 2 unknowns (u and v)
![Page 13: Motion Estimation Readings: Ch 9: 9.1-9.3 plus papers](https://reader035.vdocuments.net/reader035/viewer/2022062422/56812da5550346895d92c82c/html5/thumbnails/13.jpg)
13
Lukas-Kanade flowHow to get more equations for a pixel?
• Basic idea: impose additional constraints– most common is to assume that the flow field is smooth locally– one method: pretend the pixel’s neighbors have the same (u,v)
» If we use a 5x5 window, that gives us 25 equations per pixel!
![Page 14: Motion Estimation Readings: Ch 9: 9.1-9.3 plus papers](https://reader035.vdocuments.net/reader035/viewer/2022062422/56812da5550346895d92c82c/html5/thumbnails/14.jpg)
14
RGB versionHow to get more equations for a pixel?
• Basic idea: impose additional constraints– most common is to assume that the flow field is smooth locally– one method: pretend the pixel’s neighbors have the same (u,v)
» If we use a 5x5 window, that gives us 25*3 equations per pixel!
![Page 15: Motion Estimation Readings: Ch 9: 9.1-9.3 plus papers](https://reader035.vdocuments.net/reader035/viewer/2022062422/56812da5550346895d92c82c/html5/thumbnails/15.jpg)
15
Lukas-Kanade flowProb: we have more equations than unknowns
• The summations are over all pixels in the K x K window• This technique was first proposed by Lukas & Kanade
for stereo matching (1981)
Solution: solve least squares problem• minimum least squares solution given by solution (in d) of:
![Page 16: Motion Estimation Readings: Ch 9: 9.1-9.3 plus papers](https://reader035.vdocuments.net/reader035/viewer/2022062422/56812da5550346895d92c82c/html5/thumbnails/16.jpg)
16
Conditions for solvability
• Optimal (u, v) satisfies Lucas-Kanade equation
When is This Solvable?• ATA should be invertible • ATA should not be too small due to noise
– eigenvalues 1 and 2 of ATA should not be too small• ATA should be well-conditioned
– 1/ 2 should not be too large (1 = larger eigenvalue)
![Page 17: Motion Estimation Readings: Ch 9: 9.1-9.3 plus papers](https://reader035.vdocuments.net/reader035/viewer/2022062422/56812da5550346895d92c82c/html5/thumbnails/17.jpg)
17
Edges cause problems
– large gradients, all the same
– large1, small 2
![Page 18: Motion Estimation Readings: Ch 9: 9.1-9.3 plus papers](https://reader035.vdocuments.net/reader035/viewer/2022062422/56812da5550346895d92c82c/html5/thumbnails/18.jpg)
18
Low texture regions don’t work
– gradients have small magnitude
– small1, small 2
![Page 19: Motion Estimation Readings: Ch 9: 9.1-9.3 plus papers](https://reader035.vdocuments.net/reader035/viewer/2022062422/56812da5550346895d92c82c/html5/thumbnails/19.jpg)
19
High textured region work best
– gradients are different, large magnitudes
– large1, large 2
![Page 20: Motion Estimation Readings: Ch 9: 9.1-9.3 plus papers](https://reader035.vdocuments.net/reader035/viewer/2022062422/56812da5550346895d92c82c/html5/thumbnails/20.jpg)
20
Errors in Lukas-KanadeWhat are the potential causes of errors in this procedure?
• Suppose ATA is easily invertible• Suppose there is not much noise in the image
When our assumptions are violated• Brightness constancy is not satisfied• The motion is not small• A point does not move like its neighbors
– window size is too large
– what is the ideal window size?
![Page 21: Motion Estimation Readings: Ch 9: 9.1-9.3 plus papers](https://reader035.vdocuments.net/reader035/viewer/2022062422/56812da5550346895d92c82c/html5/thumbnails/21.jpg)
21
Revisiting the small motion assumption
Is this motion small enough?• Probably not—it’s much larger than one pixel (2nd order terms dominate)
• How might we solve this problem?
![Page 22: Motion Estimation Readings: Ch 9: 9.1-9.3 plus papers](https://reader035.vdocuments.net/reader035/viewer/2022062422/56812da5550346895d92c82c/html5/thumbnails/22.jpg)
22
Reduce the resolution!
![Page 23: Motion Estimation Readings: Ch 9: 9.1-9.3 plus papers](https://reader035.vdocuments.net/reader035/viewer/2022062422/56812da5550346895d92c82c/html5/thumbnails/23.jpg)
23
image Iimage H
Gaussian pyramid of image H Gaussian pyramid of image I
image Iimage H u=10 pixels
u=5 pixels
u=2.5 pixels
u=1.25 pixels
Coarse-to-fine optical flow estimation
![Page 24: Motion Estimation Readings: Ch 9: 9.1-9.3 plus papers](https://reader035.vdocuments.net/reader035/viewer/2022062422/56812da5550346895d92c82c/html5/thumbnails/24.jpg)
24
image Iimage J
Gaussian pyramid of image H Gaussian pyramid of image I
image Iimage H
Coarse-to-fine optical flow estimation
run iterative L-K
run iterative L-K
warp & upsample
.
.
.
![Page 25: Motion Estimation Readings: Ch 9: 9.1-9.3 plus papers](https://reader035.vdocuments.net/reader035/viewer/2022062422/56812da5550346895d92c82c/html5/thumbnails/25.jpg)
25
A Few Details• Top Level
• Apply L-K to get a flow field representing the flow from the first frame to the second frame.
• Apply this flow field to warp the first frame toward the second frame.
• Rerun L-K on the new warped image to get a flow field from it to the second frame.
• Repeat till convergence.
• Next Level• Upsample the flow field to the next level as the first guess of
the flow at that level.• Apply this flow field to warp the first frame toward the second
frame.• Rerun L-K and warping till convergence as above.
• Etc.
![Page 26: Motion Estimation Readings: Ch 9: 9.1-9.3 plus papers](https://reader035.vdocuments.net/reader035/viewer/2022062422/56812da5550346895d92c82c/html5/thumbnails/26.jpg)
26
The Flower Garden Video
What should theoptical flow be?
![Page 27: Motion Estimation Readings: Ch 9: 9.1-9.3 plus papers](https://reader035.vdocuments.net/reader035/viewer/2022062422/56812da5550346895d92c82c/html5/thumbnails/27.jpg)
27
Robust Visual Motion Analysis: Piecewise-Smooth Optical Flow
Ming YeMing YeElectrical Engineering
University of Washington
![Page 28: Motion Estimation Readings: Ch 9: 9.1-9.3 plus papers](https://reader035.vdocuments.net/reader035/viewer/2022062422/56812da5550346895d92c82c/html5/thumbnails/28.jpg)
28
Structure From Motion
Estimated horizontal motionRigid scene + camera translation
Depth map
![Page 29: Motion Estimation Readings: Ch 9: 9.1-9.3 plus papers](https://reader035.vdocuments.net/reader035/viewer/2022062422/56812da5550346895d92c82c/html5/thumbnails/29.jpg)
29
Scene Dynamics Understanding
• Surveillance• Event analysis• Video compression
Estimated horizontal motion
Motion smoothness
Brighter pixels =>largerspeeds.
Motionboundariesare smooth.
![Page 30: Motion Estimation Readings: Ch 9: 9.1-9.3 plus papers](https://reader035.vdocuments.net/reader035/viewer/2022062422/56812da5550346895d92c82c/html5/thumbnails/30.jpg)
30
Target Detection and Tracking
A tiny airplane --- only observable by its distinct motion
Tracking results
![Page 31: Motion Estimation Readings: Ch 9: 9.1-9.3 plus papers](https://reader035.vdocuments.net/reader035/viewer/2022062422/56812da5550346895d92c82c/html5/thumbnails/31.jpg)
31
Problem Statement:
Assuming only brightness conservation and piecewise-smooth motion, find the optical flow to best describe the intensity change in three frames.
Estimating Piecewise-Smooth Optical Flowwith Global Matching and Graduated Optimization
![Page 32: Motion Estimation Readings: Ch 9: 9.1-9.3 plus papers](https://reader035.vdocuments.net/reader035/viewer/2022062422/56812da5550346895d92c82c/html5/thumbnails/32.jpg)
32
Approach: Matching-Based Global Optimization
• Step 1. Robust local gradient-based method for high-quality initial flow estimate.
• Step 2. Global gradient-based method to improve the flow-field coherence.
• Step 3. Global matching that minimizes energy by a greedy approach.
![Page 33: Motion Estimation Readings: Ch 9: 9.1-9.3 plus papers](https://reader035.vdocuments.net/reader035/viewer/2022062422/56812da5550346895d92c82c/html5/thumbnails/33.jpg)
33
Global Energy DesignGlobal energy
s sites all
)()( sSsB VEVEE
• V is the optical flow field.
• Vs is the optical flow at pixel (site) s.
• EB is the brightness conservation error.
• ES is the flow smoothness error in a neighborhood about pixel s.
![Page 34: Motion Estimation Readings: Ch 9: 9.1-9.3 plus papers](https://reader035.vdocuments.net/reader035/viewer/2022062422/56812da5550346895d92c82c/html5/thumbnails/34.jpg)
34
Global Energy DesignBrightness error
warping error
)),(()(sBsWsB VeVE
|))(||,)(min(|)( sssssW IVIIVIVe
22
2
),(x
xx
Error function: where is a scale parameter.
I-(Vs) is the warped intensity in the previous frame.I+(Vs) is the warped intensity in the next frame.
I- I I+
![Page 35: Motion Estimation Readings: Ch 9: 9.1-9.3 plus papers](https://reader035.vdocuments.net/reader035/viewer/2022062422/56812da5550346895d92c82c/html5/thumbnails/35.jpg)
35
Global Energy Design
Smoothness error
8
)|,(|8
1)(
s
s
NnSnsiS VVVE
22
2
),(x
xx
Error function:
Smoothness error is computed in a neighborhood around pixel s.
Vnw Vn Vne
Vw Vs Ve
Vsw Vs Vse
![Page 36: Motion Estimation Readings: Ch 9: 9.1-9.3 plus papers](https://reader035.vdocuments.net/reader035/viewer/2022062422/56812da5550346895d92c82c/html5/thumbnails/36.jpg)
36
Overall Algorithm
Image pyramid
1PI
pI
0I
10
pV
pIwarp
pwI
pV0
Calculate gradients
ii SBpV ,,0
Global matchingpV2
Projection
Level p
Level p-1
Local OFC
pwI
Global OFCpV1pV1
![Page 37: Motion Estimation Readings: Ch 9: 9.1-9.3 plus papers](https://reader035.vdocuments.net/reader035/viewer/2022062422/56812da5550346895d92c82c/html5/thumbnails/37.jpg)
37
Advantages
Best of Everything• Local OFC
– High-quality initial flow estimates– Robust local scale estimates
• Global OFC– Improve flow smoothness
• Global Matching– The optimal formulation– Correct errors caused by poor gradient quality and hierarchical
process
Results: fast convergence, high accuracy, simultaneous motion boundary detection
![Page 38: Motion Estimation Readings: Ch 9: 9.1-9.3 plus papers](https://reader035.vdocuments.net/reader035/viewer/2022062422/56812da5550346895d92c82c/html5/thumbnails/38.jpg)
38
Experiments
• Experiments were run on several standard test videos.
• Estimates of optical flow were made for the middle frame of every three.
• The results were compared with the Black and Anandan algorithm.
![Page 39: Motion Estimation Readings: Ch 9: 9.1-9.3 plus papers](https://reader035.vdocuments.net/reader035/viewer/2022062422/56812da5550346895d92c82c/html5/thumbnails/39.jpg)
39
TS: Translating SquaresHomebrew, ideal setting, test performance upper bound
64x64, 1pixel/frame
Groundtruth (cropped),Our estimate looks the same
![Page 40: Motion Estimation Readings: Ch 9: 9.1-9.3 plus papers](https://reader035.vdocuments.net/reader035/viewer/2022062422/56812da5550346895d92c82c/html5/thumbnails/40.jpg)
40
TS: Flow Estimate Plots
LS BA S1 (S2 is close)
S3 looks the same as the groundtruth.
S1, S2, S3: results from our Step I, II, III (final)
![Page 41: Motion Estimation Readings: Ch 9: 9.1-9.3 plus papers](https://reader035.vdocuments.net/reader035/viewer/2022062422/56812da5550346895d92c82c/html5/thumbnails/41.jpg)
41
TT: Translating Tree
150x150 (Barron 94)
BA 2.60 0.128 0.0724S3 0.248 0.0167 0.00984
)(e )(pix||e )(pixe BA
S3
e: error in pixels, cdf: culmulative distribution function for all pixels
![Page 42: Motion Estimation Readings: Ch 9: 9.1-9.3 plus papers](https://reader035.vdocuments.net/reader035/viewer/2022062422/56812da5550346895d92c82c/html5/thumbnails/42.jpg)
42
DT: Diverging Tree
150x150 (Barron 94)
BA 6.36 0.182 0.114S3 2.60 0.0813 0.0507
)(e )(pix||e )(pixe BA
S3
![Page 43: Motion Estimation Readings: Ch 9: 9.1-9.3 plus papers](https://reader035.vdocuments.net/reader035/viewer/2022062422/56812da5550346895d92c82c/html5/thumbnails/43.jpg)
43
YOS: Yosemite Fly-Through
BA 2.71 0.185 0.118S3 1.92 0.120 0.0776
)(e )(pix||e )(pixe
BAS3
316x252 (Barron, cloud excluded)
![Page 44: Motion Estimation Readings: Ch 9: 9.1-9.3 plus papers](https://reader035.vdocuments.net/reader035/viewer/2022062422/56812da5550346895d92c82c/html5/thumbnails/44.jpg)
44
TAXI: Hamburg Taxi
256x190, (Barron 94)max speed 3.0 pix/frame
LMS BA
Error map Smoothness errorOurs
![Page 45: Motion Estimation Readings: Ch 9: 9.1-9.3 plus papers](https://reader035.vdocuments.net/reader035/viewer/2022062422/56812da5550346895d92c82c/html5/thumbnails/45.jpg)
45
Traffic
512x512(Nagel)
max speed:6.0 pix/frame
BA
Error map Smoothness errorOurs
![Page 46: Motion Estimation Readings: Ch 9: 9.1-9.3 plus papers](https://reader035.vdocuments.net/reader035/viewer/2022062422/56812da5550346895d92c82c/html5/thumbnails/46.jpg)
46
Pepsi Can
201x201(Black)
Max speed:2pix/frame
BA
Ours
Smoothness error
![Page 47: Motion Estimation Readings: Ch 9: 9.1-9.3 plus papers](https://reader035.vdocuments.net/reader035/viewer/2022062422/56812da5550346895d92c82c/html5/thumbnails/47.jpg)
47
FG: Flower Garden
360x240 (Black)Max speed: 7pix/frame
BA LMS
Error map Smoothness errorOurs