+ All Categories
Home > Documents > CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic...

CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic...

Date post: 22-Apr-2021
Category:
Upload: others
View: 3 times
Download: 0 times
Share this document with a friend
62
Motion models CS 4495 Computer Vision – A. Bobick Aaron Bobick School of Interactive Computing CS 4495 Computer Vision Motion Models
Transcript
Page 1: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

Aaron BobickSchool of Interactive Computing

CS 4495 Computer VisionMotion Models

Page 2: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

Outline • Last time: dense motion: optic flow

• Brightness constancy constraint equation• Lucas-Kanade

• 2D Motion models• Bergen, ’92• Pyramids • Layers

• Motion fields from 3D motions

• Parametric motion

Page 3: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

Visual motion

Many slides adapted from S. Seitz, R. Szeliski, M. Pollefeys, K. Grauman and others…

Page 4: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

Motion estimation: Optical flow

Will start by estimating motion of each pixel separatelyThen will consider motion of entire image

Page 5: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

Problem definition: optical flow

How to estimate pixel motion from image I(x,y,t) to I(x,y,t) ?• Solve pixel correspondence problem

– given a pixel in I(x,y,t), look for nearby pixels of the same color in I(x,y,t+1)

Key assumptions• color constancy: a point in I(x,y, looks the same in I(x,y,t+1)

– For grayscale images, this is brightness constancy• small motion: points do not move very far

This is called the optical flow problem

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

Page 6: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

0 ( , , 1) ( , , )( , , 1) ( , , )

[ ( , , 1) ( , )]

,

x y

x y

t x y

t

I x u y v t I x y tI x y t I u I v I x y tI x y t I x y I u I v

I I u I vI I u v

= + + + −≈ + + + −

≈ + − + +

≈ + +

≈ +∇ ⋅ < >

Optical flow equation• Combining these two equations

In the limit as u and v go to zero, this becomes exact

Brightness constancy constraint equation0x y tI u I v I+ + =

0 ,tI I u v= +∇ ⋅ < >

Page 7: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

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

2 unknowns, one equation

edge

(u,v)

(u’,v’)

gradient

(u+u’,v+v’)

0x y tI u I v I+ + =0 ,tI I u v= +∇ ⋅ < > or

Page 8: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

Aperture problem

Page 9: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

Solving 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 pixel’s neighbors have the same (u,v)

• If we use a 5x5 window, that gives us 25 equations per pixel!

Page 10: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

Lukas-Kanade flow• Prob: 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 (1981)

• minimum least squares solution given by solution (in d) of:Solution: solve least squares problem

Page 11: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

Eigenvectors of ATA

• Recall the Harris corner detector: M = ATA is 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• The other eigenvector is orthogonal to it

Page 12: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

Violating assumptions in Lucas-Kanade• The motion is large (larger than a pixel)

• Not-linear: Iterative refinement• Local minima: coarse-to-fine estimation

• A point does not move like its neighbors• Motion segmentation

• Brightness constancy does not hold• Do exhaustive neighborhood search with normalized correlation -

tracking features – maybe SIFT – more later….

Page 13: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

Violating assumptions in Lucas-Kanade• The motion is large (larger than a pixel)

• Not-linear: Iterative refinement• Local minima: coarse-to-fine estimation

• A point does not move like its neighbors• Motion segmentation

• Brightness constancy does not hold• Do exhaustive neighborhood search with normalized correlation -

tracking features – maybe SIFT – more later….

Page 14: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

Not tangent: Iterative RefinementIterative Lukas-Kanade Algorithm

1. Estimate velocity at each pixel by solving Lucas-Kanade equations2. Warp It towards It+1 using the estimated flow field

• - use image warping techniques3. Repeat until convergence

Page 15: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

Optical Flow: Iterative Estimation

xx0

Initial guess: Estimate:

estimate update

(using d for displacement here instead of u)

Page 16: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

Optical Flow: Iterative Estimation

xx0

estimate update

Initial guess: Estimate:

Page 17: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

Optical Flow: Iterative Estimation

xx0

Initial guess: Estimate:Initial guess: Estimate:

estimate update

Page 18: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

Optical Flow: Iterative Estimation

xx0

Page 19: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

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 20: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

Optical Flow: Aliasing

Temporal aliasing causes ambiguities in optical flow because images can have many pixels with the same intensity.I.e., how do we know which ‘correspondence’ is correct?

nearest match is correct (no aliasing)

nearest match is incorrect (aliasing)

To overcome aliasing: coarse-to-fine estimation.

actual shift

estimated shift

Page 21: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

Reduce the resolution!

Page 22: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

image 2image 1

Gaussian pyramid of image 1 Gaussian pyramid of image 2

image 2image 1 u=10 pixels

u=5 pixels

u=2.5 pixels

u=1.25 pixels

Coarse-to-fine optical flow estimation

Page 23: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

image Iimage J

Gaussian pyramid of image 1 Gaussian pyramid of image 2

image 2image 1

Coarse-to-fine optical flow estimation

run iterative L-K

run iterative L-Kwarp

warp & upsample

Upsample flow

.

.

.

Page 24: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

Multi-scale

Page 25: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

Remember: Image sub-sampling

Throw away every other row and column to create a 1/2 size image

- called image sub-sampling

1/4

1/8

S. Seitz

Page 26: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

Bad image sub-sampling

1/4 (2x zoom) 1/8 (4x zoom)

Aliasing! What do we do?

1/2

S. Seitz

Page 27: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

Gaussian (lowpass) pre-filtering

G 1/4

G 1/8

Gaussian 1/2

Solution: filter the image, then subsampleS. Seitz

Page 28: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

Subsampling with Gaussian pre-filtering

G 1/4 G 1/8Gaussian 1/2

S. Seitz

Page 29: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

Band-pass filteringGaussian Pyramid (low-pass images)

These are “bandpass” images (almost).Laplacian Pyramid (subband images)

Page 30: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

Laplacian Pyramid

• How can we reconstruct (collapse) this pyramid into the original image?

Need this!

Originalimage

Page 31: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

Image Pyramids

Known as a Gaussian Pyramid [Burt and Adelson, 1983]

S. Seitz

Page 32: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

Computing the Laplacian Pyramid

Need Gk to reconstruct

ReduceExpand

Page 33: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

Reduce and Expand

Reduce

Apply “5-tap” separablefilter to make reduced

image.

Page 34: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

Reduce and Expand

Reduce Expand

Apply “5-tap” separable filter to make reduced

image.

Apply different “3-tap” separable filters for even and odd pixels to make

expanded image...

Page 35: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

Just ExpandApply different “3-tap” separable filters for even and

odd pixels to make expanded image.

Even Odd

Coarser

Finer

Page 36: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

What can you do with band limited imaged?

Page 37: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

Apples and Oranges in bandpass

L0

L2

L4

Reconstructed

Page 38: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

Applying pyramids to LK

Page 39: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

Coarse-to-fine global motion estimation

Reduce

Reduce

Reduce

Reduce

LK

LK

LK

Warp

Warp

Warpx2 Expand

x2 Expand

Final <u(x,y), v(x,y)>

x2 Expand

Page 40: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

Multi-resolution Lucas Kanade Algorithm

Compute Iterative LK at highest level

Initialize 𝑢𝑢𝐾𝐾+1,𝑣𝑣𝐾𝐾+1 = 0 at size of level K+1

For Each Level i from K to 0•Upsample 𝑢𝑢𝑖𝑖+1, 𝑣𝑣𝑖𝑖+1 to create 𝑢𝑢𝑖𝑖

𝑝𝑝, 𝑣𝑣𝑖𝑖𝑝𝑝flow fields of now twice

resolution as level i+1.•Multiply 𝑢𝑢𝑖𝑖

𝑝𝑝, 𝑣𝑣𝑖𝑖𝑝𝑝 by 2 to get predicted flow

•Warp 𝐼𝐼2 according to predicted flow •Compute It –temporal derivative •Apply LK to get 𝑢𝑢𝑖𝑖𝛿𝛿 , 𝑣𝑣𝑖𝑖𝛿𝛿 (the correction in flow)•Add corrections to obtain the flow u(i), v(i) at ith level, i.e.,

𝑢𝑢𝑖𝑖 = 𝑢𝑢𝑖𝑖𝑝𝑝 + 𝑢𝑢𝑖𝑖𝛿𝛿; 𝑣𝑣𝑖𝑖 = 𝑣𝑣𝑖𝑖

𝑝𝑝 + 𝑣𝑣𝑖𝑖𝛿𝛿

Page 41: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

Optical Flow Results

* From Khurram Hassan-Shafique CAP5415 Computer Vision 2003

Page 42: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

Optical Flow Results

* From Khurram Hassan-Shafique CAP5415 Computer Vision 2003

Page 43: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

Moving to models• Previous method(s) give dense flow with little or no

constraint between locations (smoothness is either explicit or implicit).

• Suppose you “know” that motion is constrained, e.g. • Small rotation about horizontal or vertical axis (or both) that is very

close to a translation.• Distant independent moving objects

• In this case you might “model” the flow… Ready for another old slide?

Page 44: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

Motion models

Translation

2 unknowns

Similarity

4 unknowns

Perspective

8 unknowns

Affine

6 unknowns

Page 45: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

Focus of Expansion (FOE) - Example

Page 46: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

Full motion model• From physics or elsewhere:

[ ]

−−

−=

00

0

12

13

23

aaaa

aaaxV R T= Ω× +

+

−−

−≈

Z

Y

x

T

T

T

XY

XZ

YZ

Z

Y

X

VVV

ZYX

VVV

00

0

ωωωωωω

=

Z

Y

X

VVV

=

Z

Y

X

T

T

T

VVV

=

Z

Y

X

ωωω

Velocity Vector

Translational Component of Velocity

Angular Velocity

Page 47: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

General motion

ZVy

ZVf

ZV

ZYf

ZVf

ZYVZVfvv

ZVx

ZVf

ZV

ZXf

ZVf

ZXVZVfvu

ZYZYZYy

ZXZXZXx

−=

−=

−==

−=

−=

−==

2

2

ZYfy

ZXfx

=

=

( , ) 1 ( , ) ( , )( , ) ( , )

u x yx y x y

v x y Z x y

= +

A T B Ω

Take derivatives:

0( , )

0f x

x yf y

− = −

A2

2

( ) / ( ) /( , )

( ) / ( ) /xy f f x f y

x yf y f xy f x

− += + − −

B

Where T is translation vector, Ω is rotation

Why is Z onlyhere?

Page 48: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

If a plane and perspective…

0aX bY cZ d+ + + =

21 2 3 7 8

24 5 6 7 8

( , )

( , )

u x y a a x a y a x a xy

v x y a a x a y a xy a y

= + + + +

= + + + +

Page 49: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

If a plane and orthographic…

1 2 3

4 5 6

( , )( , )

u x y a a x a yv x y a a x a y

= + += + +

Affine!

Page 50: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

0)()( 654321 ≈++++++ tyx IyaxaaIyaxaaI

• Substituting into the brightness constancy equation:

yaxaayxvyaxaayxu

654

321

),(),(

++=++=

• Each pixel provides 1 linear constraint in 6 unknowns

[ ] 2∑ ++++++= tyx IyaxaaIyaxaaIaErr )()()( 654321

• Least squares minimization:

Affine motion

0≈+⋅+⋅ tyx IvIuI

Page 51: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

Affine motion•Can sum gradients over window or entire image:

•Minimize squared error (robustly)

•This is an example of parametric flow – can substitute any linear model easily. Others with some work.

[ ] 2∑ ++++++= tyx IyaxaaIyaxaaIaErr )()()( 654321

1 11 1 1 1

2 22 2 2 2

3

4

5

6

x x x y y y t

x x x y y y t

nx x n x n y y n y n t

aI I x I y I I x I y I

aI I x I y I I x I y I

aaa

I I x I y I I x I y Ia

⋅ = −

Page 52: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

Hierarchical model-based flow

James R. Bergen, P. Anandan, Keith J. Hanna, Rajesh Hingorani: “Hierarchical Model-Based Motion Estimation," ECCV 1992: 237-252

Page 53: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

Now, if different motion regions…

Page 54: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

Layered motion• Basic idea: break image sequence into “layers” each of

which has a coherent motion

J. Wang and E. Adelson. Layered Representation for Motion Analysis. CVPR 1993.

Page 55: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

What are layers?• Each layer is defined by an alpha mask and an affine

motion model

J. Wang and E. Adelson. Layered Representation for Motion Analysis. CVPR 1993.

Page 56: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

yaxaayxvyaxaayxu

654

321

),(),(

++=++=

Local flow estimates

Motion segmentation with an affine model

J. Wang and E. Adelson. Layered Representation for Motion Analysis. CVPR 1993.

Page 57: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

Motion segmentation with an affine model

yaxaayxvyaxaayxu

654

321

),(),(

++=++= Equation of a plane

(parameters a1, a2, a3 can be found by least squares)

J. Wang and E. Adelson. Layered Representation for Motion Analysis. CVPR 1993.

Page 58: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

Motion segmentation with an affine model

yaxaayxvyaxaayxu

654

321

),(),(

++=++=

1D example

u(x,y)

Local flow estimate

Segmented estimate Line fitting

Equation of a plane(parameters a1, a2, a3 can be

found by least squares)

True flow

“Foreground”

“Background”

Occlusion

J. Wang and E. Adelson. Layered Representation for Motion Analysis. CVPR 1993.

Page 59: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

How do we estimate the layers?• Compute local flow in a coarse-to-fine fashion• Obtain a set of initial affine motion hypotheses

• Divide the image into blocks and estimate affine motion parameters in each block by least squares• Eliminate hypotheses with high residual error

• Perform k-means clustering on affine motion parameters• Merge clusters that are close and retain the largest clusters to

obtain a smaller set of hypotheses to describe all the motions in the scene

• Iterate until convergence:• Assign each pixel to best hypothesis

• Pixels with high residual error remain unassigned• Perform region filtering to enforce spatial constraints• Re-estimate affine motions in each region

J. Wang and E. Adelson. Layered Representation for Motion Analysis. CVPR 1993.

Page 60: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

Example result

J. Wang and E. Adelson. Layered Representation for Motion Analysis. CVPR 1993.

Page 61: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

Recovering image motion• Feature-based methods (e.g. SIFT, Ransac, regression)

• Extract visual features (corners, textured areas) and track them -sometimes over multiple frames

• Sparse motion fields, but possibly robust tracking• Good for global motion

• Suitable especially when image motion is large (10-s of pixels)• PS4!

• Direct-methods (e.g. optical flow)• Directly recover image motion from spatio-temporal image

brightness variations• Dense, local motion fields, but more sensitive to appearance

variations• Suitable for video and when image motion is small (< 10 pixels)• PS5!!!

Page 62: CS 4495 Computer Vision Motion Modelsafb/classes/CS4495-Fall2014/...Last time: dense motion: optic flow • Brightness constancy constraint equation • Lucas-Kanade • 2D Motion

Motion modelsCS 4495 Computer Vision – A. Bobick

End CS4495


Recommended