Title: Stanford CS223B Computer Vision, Winter 2006 Lecture 7 Optical Flow
1Stanford CS223B Computer Vision, Winter
2006Lecture 7 Optical Flow
- Professor Sebastian Thrun
- CAs Dan Maynes-Aminzade, Mitul Saha, Greg
Corrado - Slides by Gary Bradski, Intel Research and
Stanford SAIL
2(No Transcript)
3Optical Flow Outline
- Examples
- Formal definition, 1D case
- From 1D to 2D Aperture Problem
- Course motion and pyramids
- Flow Segmentation
4Optical Flow
Picture from Khurram Hassan-Shafique CAP5415
Computer Vision 2003
5Optical Flow, Example
6Another Example in Robotics
2) Use optical flow for near-far association
3) Associate known driveability with visually
similar regions
1) Rich local sensor data determines drivability
7Optical Flow, Example
Harris Corners
David Stavens, Andrew Lookingbill, David Lieb
(CS223B 2004)
8Optical Flow, Example
Optical flow
David Stavens, Andrew Lookingbill, David Lieb
(CS223B 2004)
9Optical Flow, Example
Reward
David Stavens, Andrew Lookingbill, David Lieb
(CS223B 2004)
10Optical Flow, Example
Particle Filter
David Stavens, Andrew Lookingbill, David Lieb
(CS223B 2004)
11Optical Flow, Example
Result
David Stavens, Andrew Lookingbill, David Lieb
(CS223B 2004)
12Conference Paper
David Stavens, Andrew Lookingbill, David Lieb
(CS223B 2004)
13Optical Flow Outline
- Examples
- Formal definition, 1D case
- From 1D to 2D Aperture Problem
- Course motion and pyramids
- Flow Segmentation
14Optical Flow
Image tracking
3D computation
Image sequence (single camera)
Tracked sequence
3D structure 3D trajectory
15What is Optical Flow?
16Optical Flow Break Down?
?
From Marc Pollefeys COMP 256 2003
17Optical Flow AssumptionsBrightness Constancy
Slide from Michael Black, CS143 2003
18Optical Flow Assumptions
Slide from Michael Black, CS143 2003
19Optical Flow Assumptions
Slide from Michael Black, CS143 2003
20Optical Flow 1D Case
Brightness Constancy Assumption
21Tracking in the 1D case
22Tracking in the 1D case
23Tracking in the 1D case
Iterating helps refining the velocity vector
Converges in about 5 iterations
24Algorithm for 1D tracking
25Optical Flow Outline
- Examples
- Formal definition, 1D case
- From 1D to 2D Aperture Problem
- Course motion and pyramids
- Flow Segmentation
26From 1D to 2D tracking
1D
Shoot! One equation, two velocity (u,v) unknowns
27From 1D to 2D tracking
We get at most Normal Flow with one point we
can only detect movement perpendicular to the
brightness gradient. Solution is to take a patch
of pixels Around the pixel of interest.
Slide from Michael Black, CS143 2003
28How does this show up visually?Known as the
Aperture Problem
29Aperture Problem Exposed
Motion along just an edge is ambiguous
30Aperture Problem Example
31Aperture Problem in Real Life
32From 1D to 2D tracking
The Math is very similar
Window size here 5x5 or 11x11
33More DetailSolving the aperture problem
- How 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 pixels neighbors have
the same (u,v) - If we use a 5x5 window, that gives us 25
equations per pixel!
From Khurram Hassan-Shafique CAP5415 Computer
Vision 2003
34Lukas-Kanade flow
- Prob we have more equations than unknowns
From Khurram Hassan-Shafique CAP5415 Computer
Vision 2003
35Conditions 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 l1 and l2 of ATA should not be too
small - ATA should be well-conditioned
- l1/ l2 should not be too large (l1 larger
eigenvalue)
From Khurram Hassan-Shafique CAP5415 Computer
Vision 2003
36Eigenvectors of ATA
- Suppose (x,y) is on an edge. What is ATA?
From Khurram Hassan-Shafique CAP5415 Computer
Vision 2003
37Edge
- large gradients, all the same
- large l1, small l2
From Khurram Hassan-Shafique CAP5415 Computer
Vision 2003
38Low texture region
- gradients have small magnitude
- small l1, small l2
From Khurram Hassan-Shafique CAP5415 Computer
Vision 2003
39High textured region
- gradients are different, large magnitudes
- large l1, large l2
From Khurram Hassan-Shafique CAP5415 Computer
Vision 2003
40Observation
- This is a two image problem BUT
- Can measure sensitivity by just looking at one of
the images! - This tells us which pixels are easy to track,
which are hard - very useful later on when we do feature
tracking... - Once suggestion Track Harris Corners!
From Khurram Hassan-Shafique CAP5415 Computer
Vision 2003
41Optical Flow, Example
Harris Corners
David Stavens, Andrew Lookingbill, David Lieb
(CS223B 2004)
42Optical Flow, Example
Optical flow
David Stavens, Andrew Lookingbill, David Lieb
(CS223B 2004)
43Optical Flow Outline
- Examples
- Formal definition, 1D case
- From 1D to 2D Aperture Problem
- Course motion and pyramids
- Flow Segmentation
44Revisiting the small motion assumption
- Is this motion small enough?
- Probably notits much larger than one pixel (2nd
order terms dominate) - How might we solve this problem?
From Khurram Hassan-Shafique CAP5415 Computer
Vision 2003
45Reduce the resolution!
From Khurram Hassan-Shafique CAP5415 Computer
Vision 2003
46Coarse-to-fine optical flow estimation
47Coarse-to-fine optical flow estimation
run iterative L-K
48Multi-resolution Lucas Kanade Algorithm
49Optical Flow Results
From Khurram Hassan-Shafique CAP5415 Computer
Vision 2003
50Optical Flow Results
From Khurram Hassan-Shafique CAP5415 Computer
Vision 2003
51Optical Flow Outline
- Examples
- Formal definition, 1D case
- From 1D to 2D Aperture Problem
- Course motion and pyramids
- Flow Segmentation
52Problem
- Multiple motion types in the image
- (e.g., moving cars on 280 or El Camino Real)
53Motion Template Idea
54Motion Segmentation Algorithm
- Stamp the current motion history template with
the system time and overlay it on top of the
others
55Motion Segmentation Algorithm
- Measure gradients of the overlaid motion history
templates
56Motion Segmentation Algorithm
- Threshold large gradients to get rid of motion
template edges resulting from too large of a time
delay
57Motion Segmentation Algorithm
- Find boundaries of most recent motions
- Walk around boundary
- If drop not too high, Flood fill downwards to
segment motions
Segmented Motion
Segmented Motion
58Motion Segmentation Algorithm
- Actually need a two-pass algorithm for labeling
all motion segments - Fill downwards At bottom, turn around and fill
upwards. - Keep the union of these fills as the segmented
motion.
59Motion Template for Motion Segmentation and
Gesture
Overlay silhouettes, take gradient for normal
optical flow. Flood fill to segment motions.
Motion Segmentation
Motion Segmentation
Pose Recognition
Gesture Recognition