0% found this document useful (0 votes)
23 views38 pages

Lucal Kannade Optical Flow

The document outlines the course content for CS 678 on Optical Flow and Tracking, including key readings and topics such as visual motion, motion fields, and the optical flow concept. It discusses the challenges of tracking features across multiple frames, including issues like ambiguity and drift, and introduces the Shi-Tomasi feature tracker for reliable motion estimation. The document also covers mathematical concepts related to motion estimation and the conditions for solvability in optical flow analysis.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views38 pages

Lucal Kannade Optical Flow

The document outlines the course content for CS 678 on Optical Flow and Tracking, including key readings and topics such as visual motion, motion fields, and the optical flow concept. It discusses the challenges of tracking features across multiple frames, including issues like ambiguity and drift, and introduces the Shi-Tomasi feature tracker for reliable motion estimation. The document also covers mathematical concepts related to motion estimation and the conditions for solvability in optical flow analysis.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 38

Optical Flow and Tracking

CS 678

Spring 2018
Readings

• Reading: FP Chapter 17, 25.4


• Chapter 8 (Introductory Techniques for 3D Computer
Vision, by Trucco and Verri) – on optical flow
• Szeliski, 8.4

Some slides from Lazebnik


Visual motion

slides adapted from S. Seitz, R. Szeliski, M. Pollefeys


Motion and perceptual organization
• Sometimes, motion is the only cue
Motion and perceptual organization
• Even “impoverished” motion data can evoke a
strong percept

G. Johansson, “Visual Perception of Biological Motion and a Model For Its


Analysis", Perception and Psychophysics 14, 201-211, 1973.
Motion and perceptual organization
• Even “impoverished” motion data can evoke a
strong percept

G. Johansson, “Visual Perception of Biological Motion and a Model For Its


Analysis", Perception and Psychophysics 14, 201-211, 1973.
Uses of motion
• Estimating 3D structure
• Segmenting objects based on motion cues
• Learning and tracking dynamical models
• Recognizing events and activities
• Improving video quality (motion
stabilization)
Motion field
• The motion field is the projection of the 3D
scene motion into the image
Motion field and parallax
• X(t) is a moving 3D point X(t+dt)
X(t) V
• Velocity of scene point: V =
dX/dt
• x(t) = (x(t),y(t)) is the
projection of X in the
image
• Apparent velocity v in the
image: given by
v x(t+dt)
components vx = dx/dt and
vy = dy/dt x(t)

• These components are


known as the motion field
of the image
Motion field and parallax
X(t+dt)
To find image velocity v, differentiate X(t) V
x=(x,y) with respect to t (using quotient
rule):

v x(t+dt)

x(t)

Image motion is a function of both the 3D motion (V) and the


depth of the 3D point (Z)
Motion field and parallax
• Pure translation: V is constant everywhere
Motion field and parallax
• Pure translation: V is constant everywhere

• The length of the motion vectors is inversely


proportional to the depth Z
• Vz is nonzero:
– Every motion vector points toward (or away from) the vanishing point
of the translation direction

objects in the distance appear to move more slowly


than the objects close to the camera.
Motion field and parallax
• Pure translation: V is constant everywhere

• The length of the motion vectors is inversely


proportional to the depth Z
• Vz is nonzero:
– Every motion vector points toward (or away from) the vanishing point
of the translation direction
• Vz is zero:
– Motion is parallel to the image plane, all the motion vectors are
parallel
Optical flow
• Definition: optical flow is the apparent motion
of brightness patterns in the image
• Ideally, optical flow would be the same as the
motion field
• Have to be careful: apparent motion can be
caused by lighting changes without any actual
motion
– Think of a uniform rotating sphere under fixed
lighting
vs. a stationary sphere under moving illumination
Estimating optical flow

I(x,y,t–1) I(x,y,t)

• Given two subsequent frames, estimate the apparent


motion field u(x,y) and v(x,y) between them

• Key assumptions
• Brightness constancy: projection of the same point looks the
same in every frame
• Small motion: points do not move very far
• Spatial coherence: points move like their neighbors
The brightness constancy constraint

I(x,y,t–1) I(x,y,t)

Brightness Constancy Equation:

Linearizing the right side using Taylor expansion:

Hence,
The brightness constancy constraint

• How many equations and unknowns per pixel?


– One equation, two unknowns

• Intuitively, what does this constraint mean?

• The component of the flow perpendicular to the


gradient (i.e., parallel to the edge) is unknown
The brightness constancy constraint

• How many equations and unknowns per pixel?


– One equation, two unknowns

• Intuitively, what does this constraint mean?

• The component of the flow perpendicular to the


gradient (i.e., parallel to the edge) is unknown
gradient
(u,v)
If (u, v) satisfies the equation,
so does (u+u’, v+v’) if (u’,v’)
(u+u’,v+v’)
edge
The aperture problem

Perceived motion
The aperture problem

Actual motion
The barber pole illusion

http://en.wikipedia.org/wiki/Barberpole_illusion
The barber pole illusion

http://en.wikipedia.org/wiki/Barberpole_illusion
The barber pole illusion

http://en.wikipedia.org/wiki/Barberpole_illusion
Solving the aperture problem
• How to get more equations for a pixel?
• Spatial coherence constraint: pretend the pixel’s neighbors
have the same (u,v)
– If we use a 5x5 window, that gives us 25 equations per pixel

B. Lucas and T. Kanade. An iterative image registration technique with an application to


stereo vision. In Proceedings of the International Joint Conference on Artificial
Intelligence, pp. 674–679, 1981.
Solving the aperture problem
• Least squares problem:

• When is this system solvable?


• What if the window contains just a single straight edge?

B. Lucas and T. Kanade. An iterative image registration technique with an application to


stereo vision. In Proceedings of the International Joint Conference on Artificial
Intelligence, pp. 674–679, 1981.
Conditions for solvability
• “Bad” case: single straight edge
Conditions for solvability
• “Good” case
Lucas-Kanade flow
• Linear least squares problem

Solution given by

The summations are over all pixels in the window

B. Lucas and T. Kanade. An iterative image registration technique with an application to


stereo vision. In Proceedings of the International Joint Conference on Artificial
Intelligence, pp. 674–679, 1981.
Lucas-Kanade flow

• Recall the Harris corner detector: M = ATA is


the second moment matrix
• We can figure out whether the system is
solvable by looking at the eigenvalues of the
second moment matrix
• The eigenvectors and eigenvalues of M relate to edge
direction and magnitude
• The eigenvector associated with the larger eigenvalue
points in the direction of fastest intensity change, and the
other eigenvector is orthogonal to it
Interpreting the eigenvalues
Classification of image points using eigenvalues
of the second moment matrix:
λ2 “Edge”
λ2 >> λ1
“Corner”
λ1 and λ2 are large,
λ1 ~ λ2

λ1 and λ2 are small “Flat” “Edge”


region λ1 >> λ2

λ1
Uniform region

– gradients have small magnitude


– small λ1, small λ2
– system is ill-conditioned
Edge

– gradients have one dominant direction


– large λ1, small λ2
– system is ill-conditioned
High-texture or corner region

– gradients have different directions, large magnitudes


– large λ1, large λ2
– system is well-conditioned
Errors in Lucas-Kanade
• The motion is large (larger than a pixel)
– Iterative refinement
– Coarse-to-fine estimation
– Exhaustive neighborhood search (feature
matching)
• A point does not move like its neighbors
– Motion segmentation
• Brightness constancy does not hold
– Exhaustive neighborhood search with normalized
correlation
Feature tracking
• So far, we have only considered optical flow
estimation in a pair of images
• If we have more than two images, we can
compute the optical flow from each frame to
the next
• Given a point in the first image, we can in
principle reconstruct its path by simply
“following the arrows”
Tracking challenges
• Ambiguity of optical flow
– Need to find good features to track
• Large motions, changes in appearance,
occlusions, disocclusions
– Need mechanism for deleting, adding new
features
• Drift – errors may accumulate over time
– Need to know when to terminate a track
Tracking over many frames
• Select features in first frame
• For each frame:
– Update positions of tracked features
• Discrete search or Lucas-Kanade (or a combination of
the two)
– Terminate inconsistent tracks
• Compute similarity with corresponding feature in the
previous frame or in the first frame where it’s visible
– Find more features to track
Shi-Tomasi feature tracker
• Find good features using eigenvalues of
second-moment matrix
– Key idea: “good” features to track are the ones whose motion can be
estimated reliably
• From frame to frame, track with Lucas-Kanade
– This amounts to assuming a translation model for frame-to-frame
feature movement
• Check consistency of tracks by affine registration to
the first observed instance of the feature
– Affine model is more accurate for larger displacements
– Comparing to the first frame helps to minimize drift

J. Shi and C. Tomasi. Good Features to Track. CVPR 1994.

You might also like