Optical Flow: Constant Flow Computer Vision 16-385 Carnegie Mellon - - PowerPoint PPT Presentation

optical flow constant flow
SMART_READER_LITE
LIVE PREVIEW

Optical Flow: Constant Flow Computer Vision 16-385 Carnegie Mellon - - PowerPoint PPT Presentation

Optical Flow: Constant Flow Computer Vision 16-385 Carnegie Mellon University (Kris Kitani) Optical Flow (a.k.a., Video Stabilization, Tracking, Stereo Matching, Registration) Given a pair of images { I t , I t +1 } Estimate the optical flow


slide-1
SLIDE 1

Optical Flow: Constant Flow

Computer Vision 16-385

Carnegie Mellon University (Kris Kitani)

slide-2
SLIDE 2

Given a pair of images Estimate the optical flow field

Optical Flow

(a.k.a., Video Stabilization, Tracking, Stereo Matching, Registration)

{v(pi), u(pi)}

{It, It+1}

slide-3
SLIDE 3

spatial derivative

  • ptical flow

temporal derivative

Ixu + Iyv + It = 0

Ix = ∂I ∂x Iy = ∂I ∂y u = dx dt v = dy dt It = ∂I ∂t How can we use the brightness constancy equation to estimate the optical flow?

slide-4
SLIDE 4

Ixu + Iyv + It = 0

known unknown We need at least ____ equations to solve for 2 unknowns.

slide-5
SLIDE 5

Ixu + Iyv + It = 0

known unknown Where do we get more equations (constraints)?

slide-6
SLIDE 6

Ixu + Iyv + It = 0

Where do we get more equations (constraints)? Assume that the surrounding patch (say 5x5) has ‘constant flow’

slide-7
SLIDE 7

Flow is locally smooth Neighboring pixels have same displacement

Using a 5 x 5 image patch, gives us 25 equations Assumptions:

slide-8
SLIDE 8

Flow is locally smooth Neighboring pixels have same displacement

Using a 5 x 5 image patch, gives us 25 equations Assumptions:

Ix(p1)u + Iy(p1)v = −It(p1) Ix(p2)u + Iy(p2)v = −It(p2) . . . Ix(p25)u + Iy(p25)v = −It(p25)

slide-9
SLIDE 9

Flow is locally smooth Neighboring pixels have same displacement

Using a 5 x 5 image patch, gives us 25 equations 2 6 6 6 4 Ix(p1) Iy(p1) Ix(p2) Iy(p2) . . . . . . Ix(p25) Iy(p25) 3 7 7 7 5  u v

  • = −

2 6 6 6 4 It(p1) It(p2) . . . It(p25) 3 7 7 7 5 Assumptions: Matrix form

slide-10
SLIDE 10

Flow is locally smooth Neighboring pixels have same displacement

Using a 5 x 5 image patch, gives us 25 equations 2 6 6 6 4 Ix(p1) Iy(p1) Ix(p2) Iy(p2) . . . . . . Ix(p25) Iy(p25) 3 7 7 7 5  u v

  • = −

2 6 6 6 4 It(p1) It(p2) . . . It(p25) 3 7 7 7 5

A

x

b

25 × 2

2 × 1

25 × 1

How many equations? How many unknowns? How do we solve this?

Assumptions:

slide-11
SLIDE 11

Least squares approximation

ˆ x = arg min

x

||Ax − b||2 A>Aˆ x = A>b

is equivalent to solving

slide-12
SLIDE 12

To obtain the least squares solution solve:

Least squares approximation

ˆ x = arg min

x

||Ax − b||2 A>Aˆ x = A>b

is equivalent to solving

2 4 P

p∈P

IxIx P

p∈P

IxIy P

p∈P

IyIx P

p∈P

IyIy 3 5  u v

  • = −

2 4 P

p∈P

IxIt P

p∈P

IyIt 3 5 where the summation is over each pixel p in patch P

A>A A>b

ˆ x

x = (A>A)1A>b

slide-13
SLIDE 13

To obtain the least squares solution solve:

Least squares approximation

ˆ x = arg min

x

||Ax − b||2 A>Aˆ x = A>b

is equivalent to solving

2 4 P

p∈P

IxIx P

p∈P

IxIy P

p∈P

IyIx P

p∈P

IyIy 3 5  u v

  • = −

2 4 P

p∈P

IxIt P

p∈P

IyIt 3 5 where the summation is over each pixel p in patch P

A>A A>b

ˆ x

Sometimes called ‘Lucas-Kanade Optical Flow’
 (can be interpreted to be a special case of the LK method with a translational warp model)

slide-14
SLIDE 14

A>Aˆ x = A>b

When is this solvable? ATA should be invertible ATA should not be too small ATA should be well conditioned

λ1 and λ2 should not be too small λ1/λ2 should not be too large (λ1=larger eigenvalue)

slide-15
SLIDE 15

2 4 P

p∈P

IxIx P

p∈P

IxIy P

p∈P

IyIx P

p∈P

IyIy 3 5 Where have you seen this before?

A>A =

slide-16
SLIDE 16

2 4 P

p∈P

IxIx P

p∈P

IxIy P

p∈P

IyIx P

p∈P

IyIy 3 5 Where have you seen this before? Harris Corner Detector!

slide-17
SLIDE 17

Implications

  • Corners are when λ1, λ2 are big; this is also when

Lucas-Kanade optical flow works best

  • Corners are regions with two different directions of

gradient (at least)

  • Corners are good places to compute flow!

What happens when you have no ‘corners’?

slide-18
SLIDE 18

You want to compute optical flow. What happens if the image patch contains only a line?

slide-19
SLIDE 19

ApertureProblem

In which direction is the line moving?

small visible image patch

slide-20
SLIDE 20

ApertureProblem

In which direction is the line moving?

small visible image patch

slide-21
SLIDE 21

ApertureProblem

slide-22
SLIDE 22

ApertureProblem

slide-23
SLIDE 23

ApertureProblem

slide-24
SLIDE 24

ApertureProblem

slide-25
SLIDE 25

Want patches with different gradients to the avoid aperture problem

slide-26
SLIDE 26

Want patches with different gradients to the avoid aperture problem

slide-27
SLIDE 27

1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4 5 5 5 5

  • 1

1 1

  • 2

2 2

  • 3

3 3

  • 4

4 4

y x y x

  • ptical flow: (1,1)

H(x,y) = y I(x,y)

It(3, 3) = I(3, 3) − H(3, 3) = −1

Ixu + Iyv + It = 0

Iy(3, 3) = 1

Ix(3, 3) = 0

v = 1

We recover the v of the optical flow but not the u. This is the aperture problem.

Compute gradients Solution: