The Optical Flow Field

47
The Optical Flow Field Caltech, Oct. 2004 Lihi Zelnik-Manor

Transcript of The Optical Flow Field

Page 1: The Optical Flow Field

The Optical Flow Field

Caltech, Oct. 2004

Lihi Zelnik-Manor

Page 2: The Optical Flow Field

Optical Flow

Where did each pixel in image 1 go to in image 2

Page 3: The Optical Flow Field

Optical Flow

Pierre Kornprobst's Demo

Page 4: The Optical Flow Field

Introduction• Given a video sequence with

camera/objects moving we can betterunderstand the scene if we find the motionsof the camera/objects.

Page 5: The Optical Flow Field

Scene Interpretation

• How is the camera moving?• How many moving objects are there?• Which directions are they moving in?• How fast are they moving?• Can we recognize their type of motion (e.g.

walking, running, etc.)?

Page 6: The Optical Flow Field

Applications

• Recover camera ego-motion.

Result by MobilEye (www.mobileye.com)

Page 7: The Optical Flow Field

Applications

• Motion segmentation

Result by: L.Zelnik-Manor, M.Machline, M.Irani“Multi-body Segmentation: Revisiting Motion Consistency” To appear, IJCV

Page 8: The Optical Flow Field

Applications

• Structure from Motion

Input Reconstructed shape

Result by: L. Zhang, B. Curless, A. Hertzmann, S.M. Seitz“Shape and motion under varying illumination: Unifying structure from motion, photometric

stereo, and multi-view stereo” ICCV’03

Page 9: The Optical Flow Field

Examples of Motion fields

Forwardmotion

Rotation Horizontaltranslation

Closerobjects

appear tomove faster!!

Page 10: The Optical Flow Field

Motion Field & Optical Flow Field

• Motion Field = Real world 3D motion• Optical Flow Field = Projection of the

motion field onto the 2d image

3D motion vector

2D opticalflow vector

( )vu,u =r

CCD

Page 11: The Optical Flow Field

When does it break?

The screen isstationary yet

displays motion

Homogeneousobjects

generate zerooptical flow.

Fixed sphere.Changing light

source.

Non-rigidtexture motion

Page 12: The Optical Flow Field

The Optical Flow Field

Still, in many cases it does work….

• Goal:Find for each pixel a velocity vectorwhich says:– How quickly is the pixel moving across the image– In which direction it is moving

( )vu,u =r

Page 13: The Optical Flow Field

How do we actually do that?

Page 14: The Optical Flow Field

Estimating Optical Flow

• Assume the image intensity is constant

( )tyxI ,, ( )dttdyydxxI +++ ,,=

I

Time = t Time = t+dt

Page 15: The Optical Flow Field

Brightness ConstancyEquation

( ) ( )dttdyydxxItyxI +++= ,,,,

( ) dtt

Idyy

Idxx

ItyxI

!

!+

!

!+

!

!+= ,,

First order Taylor Expansion

0=++ dtIdyIdxI tyx

Simplify notations:

Divide by dt and denote:

dt

dxu =

dt

dyv =

tyx IvIuI !=+

Problem I: Oneequation, two

unknowns

Page 16: The Optical Flow Field

Time t+dt

Problem II:“The Aperture Problem”

Time t

?Time t+dt

Where did the blue point move to?We need additional constraints

• For points on a line of fixed intensity we can onlyrecover the normal flow

Page 17: The Optical Flow Field

Use Local InformationSometimes enlarging the aperture can help

Page 18: The Optical Flow Field

Local smoothnessLucas Kanade (1984)

Assume constant (u,v) in small neighborhood

tyx IvIuI !=+ [ ] tyx Iv

uII !="

#

$%&

'

!!!

"

#

$$$

%

&

'=!"

#$%

&

!!!

"

#

$$$

%

&

MM

2

1

22

11

t

t

yx

yx

I

I

v

uII

II

bA =ur

Page 19: The Optical Flow Field

Lucas Kanade (1984)

bA =ur

( ) bAAATT

1

u!

=r

Goal: Minimize2

u bA !r

bAAATT

=ur

2x2 2x1 2x1

Method: Least-Squares

Page 20: The Optical Flow Field

How does Lucas-Kanadebehave?

!!"

#

$$%

&=

''

''2

2

yyx

yxxT

III

IIIAA

We want this matrix to be invertible.

i.e., no zero eigenvalues

( ) bAAATT

1

u!

=r

Page 21: The Optical Flow Field

How does Lucas-Kanadebehave?

• Edge becomes singularAAT

( )yx II ,( )xy II ,!

!"

#$%

&=!

"

#$%

&'!"

#$%

&

((

((0

0

2

2

x

y

yyx

yxx

I

I

III

III

0 eigenvaluer with eigenvecto is !"

#$%

&'

x

y

I

I

Page 22: The Optical Flow Field

How does Lucas-Kanadebehave?

• Homogeneous 0 eigenvalues0!AAT

( ) 0, !yx II

Page 23: The Optical Flow Field

How does Lucas-Kanadebehave?

• Textured regions two high eigenvalues

( ) 0, !yx II

Page 24: The Optical Flow Field

How does Lucas-Kanadebehave?

• Edge becomes singular

0!AAT

AAT

• Homogeneous regions low gradients

• High texture

Page 25: The Optical Flow Field

Other break-downs

• Brightness constancy is not satisfied

• A point does not move like its neighbors– what is the ideal window size?

• The motion is not small (Taylor expansion doesn’t hold)

Correlation based methods

Regularization based methods

Use multi-scale estimation

Page 26: The Optical Flow Field

Multi-Scale Flow Estimation

image It-1 image I

Gaussian pyramid of image It Gaussian pyramid of image It+1

image It+1image Itu=10 pixels

u=5 pixels

u=2.5 pixels

u=1.25 pixels

Page 27: The Optical Flow Field

Multi-Scale Flow Estimation

image It-1 image I

Gaussian pyramid of image It Gaussian pyramid of image It+1

image It+1image It

run Lucas-Kanade

run Lucas-Kanade

warp & upsample

.

.

.

Page 28: The Optical Flow Field

Result by: L.Zelnik-Manor, M.Machline, M.Irani“Multi-body Segmentation: Revisiting Motion Consistency” To appear, IJCV

Examples: Motion BasedSegmentation

Input Segmentation result

Page 29: The Optical Flow Field

Result by: L.Zelnik-Manor, M.Machline, M.Irani“Multi-body Segmentation: Revisiting Motion Consistency” To appear, IJCV

Examples: Motion BasedSegmentation

Input Segmentation result

Page 30: The Optical Flow Field

Other break-downs

• Brightness constancy is not satisfied

• A point does not move like its neighbors– what is the ideal window size?

• The motion is not small (Taylor expansion doesn’t hold)

Correlation based methods

Regularization based methods

Use multi-scale estimation

Page 31: The Optical Flow Field

RegularizationHorn and Schunk (1981)

Add global smoothness term

( ) ( ) dydxvvuuED

yxyxs !! +++= 2222

Smoothness error:

( ) dydxIvIuIED

tyxc !! ++=2Error in brightness

constancy equation

sc EE !+Minimize:

Solve by calculus of variations

Page 32: The Optical Flow Field

Robust EstimationBlack & Anandan (1993)

Regularization can over-smooth across edges

Use “smarter” regularization

( ) ( ) ( )[ ] dydxvvuuIvIuI yxyxD

tyx ,, 221 !!"!## +++

Minimize:

Brightness constancy Smoothness

Page 33: The Optical Flow Field

Examples: Motion BasedSegmentation

•Optical Flow estimation by: M. J . Black and P. Anandan, “A framework for the robust estimation of optical flow”, ICCV’93•Segmentation by: L.Zelnik-Manor, M.Machline, M.Irani “Multi-body Segmentation: Revisiting Motion Consistency” To appear, IJCV

Input Segmentation result

Page 34: The Optical Flow Field

Affine Motion

For panning camera or planar surfaces:

ypxppv

ypxppu

654

321

++=

++=

tyx IypxppIypxppI !=+++++ )()( 654321

[ ] tyyyxxx IyIxIIyIxII !=pr

Only 6 parameters to solve for Better results

Page 35: The Optical Flow Field

Segmentation of Affine Motion

= +

Input Segmentation result

Result by: L.Zelnik-Manor, M.Irani“Multi-frame estimation of planar motion”, PAMI 2000

Page 36: The Optical Flow Field

Panoramas

Motion estimation by Andrew Zisserman’s group

Input

Page 37: The Optical Flow Field

Stabilization

Result by: L.Zelnik-Manor, M.Irani“Multi-frame estimation of planar motion”, PAMI 2000

Page 38: The Optical Flow Field

Layered Representation

Estimate dominant motion parameters

Reject pixels which do not fit

Convergence

Restart on remaining pixels

For scenes with multiple affine motions

Page 39: The Optical Flow Field

Some Results

Nebojsa Jojic and Brendan Frey, "Learning Flexible Sprites in Video Layers“, CVPR 2001.

Page 40: The Optical Flow Field

Action Recognition

• A bit more fun

Page 41: The Optical Flow Field

“Recognizing Action at a Distance”A.A. Efros, A.C. Berg, G. Mori, J. Malik

Image frame Optical flow

Use optical flow as a template for frame classification

Page 42: The Optical Flow Field

“Recognizing Action at a Distance”A.A. Efros, A.C. Berg, G. Mori, J. Malik

Image frame Optical flow

blurred

Page 43: The Optical Flow Field

“Recognizing Action at a Distance”A.A. Efros, A.C. Berg, G. Mori, J. Malik

Database:

Test sequence:

For each frame in test sequence find closest frame in database

Page 44: The Optical Flow Field

“Recognizing Action at a Distance”A.A. Efros, A.C. Berg, G. Mori, J. Malik

•Red bars show classification results

Page 45: The Optical Flow Field

“Recognizing Action at a Distance”A.A. Efros, A.C. Berg, G. Mori, J. Malik

View “Greg In World Cup” video

Page 46: The Optical Flow Field

References on Optical FlowLucas-Kanade method:• B.D. Lucas and T. Kanade “An Iterative Image Registration Technique with an

Application to Stereo Vision” IJCAI '81 pp. 674-679

• S. Baker and I. Matthews “Lucas-Kanade 20 Years On: A Unifying Framework”IJCV, Vol. 56, No. 3, March, 2004, pp. 221 - 255.http://www.ri.cmu.edu/projects/project_515.html (papers + code)

Regularization based methods:• B. K. P. Horn and B. Schunck, "Determining Optical Flow," Artificial Intelligence, 17

(1981), pp. 185-203

• Black, M. J. and Anandan, P., “A framework for the robust estimation of optical flow”,ICCV’93, May, 1993, pp. 231-236 (papers + code)

Comparison of various optical flow techniques:Barron, J.L., Fleet, D.J., and Beauchemin, S. “Performance of optical flowtechniques”. IJCV, 1994, 12(1):43-77

Layered representation (affine):James R. Bergen P. Anandan Keith J. Hanna Rajesh Hingorani “Hierarchical Model-Based Motion Estimation” ECCV’92, pp. 237-- 252

Page 47: The Optical Flow Field

That’s all for today