computer vision linear tracking jan-michael frahm comp 256 some slides from welch & bishop

43
Computer Vision Linear Tracking Jan-Michael Frahm COMP 256 Some slides from Welch & Bishop

Post on 22-Dec-2015

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Computer Vision Linear Tracking Jan-Michael Frahm COMP 256 Some slides from Welch & Bishop

ComputerVision

Linear Tracking

Jan-Michael FrahmCOMP 256

Some slides from Welch & Bishop

Page 2: Computer Vision Linear Tracking Jan-Michael Frahm COMP 256 Some slides from Welch & Bishop

ComputerVision

2

Tracking

Tracking is the problem of generating an inference about the motion of an object given a sequence of images.

The key technical difficulty is maintaining an accurate representation of the posterior on object position given measurements, and doing so efficiently.

Page 3: Computer Vision Linear Tracking Jan-Michael Frahm COMP 256 Some slides from Welch & Bishop

ComputerVision

3

Examples of tracking

Page 4: Computer Vision Linear Tracking Jan-Michael Frahm COMP 256 Some slides from Welch & Bishop

ComputerVision

4

Model for tracking

• Object has internal state – Capital indicates random variable– Small represents particular value

• Obtained measurements in frame i are– Value of the measurement

iX

iYiy

iXix

Page 5: Computer Vision Linear Tracking Jan-Michael Frahm COMP 256 Some slides from Welch & Bishop

ComputerVision

5

General Steps of Tracking

1. Prediction: What is the next state of the object given past measurements

2. Data association: Which measures are relevant for the state?

3. Correction: Compute representation of the state from prediction and measurements.

1100 ,, iii yYyYXP

iiiii yYyYyYXP ,,, 1100

Page 6: Computer Vision Linear Tracking Jan-Michael Frahm COMP 256 Some slides from Welch & Bishop

ComputerVision

6

Tracking

predictpredict correctcorrect

Page 7: Computer Vision Linear Tracking Jan-Michael Frahm COMP 256 Some slides from Welch & Bishop

ComputerVision

7

• Only immediate past matters

• Measurements depend only on current state

Important simplifications

Fortunately it doesn’t limit to much!

Independence Assumptions

111 ,, iiii XXPXXXP

ikjiiikji XYYPXYPXYYYP ,,,,,

Page 8: Computer Vision Linear Tracking Jan-Michael Frahm COMP 256 Some slides from Welch & Bishop

ComputerVision

8

Linear Dynamic Models

• State is linear transformed plus Gaussian noise

• Relevant measures are linearly obtained from state plus Gaussian noise

• Sufficient to maintain mean and standard deviation

idiii xDNx ,~ 1

imiii xMNy ,~

Page 9: Computer Vision Linear Tracking Jan-Michael Frahm COMP 256 Some slides from Welch & Bishop

ComputerVision

9

A really simple exampleWe are on a boat at night and lost our position

We know:

• star position

Page 10: Computer Vision Linear Tracking Jan-Michael Frahm COMP 256 Some slides from Welch & Bishop

ComputerVision

10

Constant Velocity

p is position of boat, v is velocity of boat

state is

We only measure position so

1 ii pp

IDi

IM i

ii pX

1 iii XDX

Page 11: Computer Vision Linear Tracking Jan-Michael Frahm COMP 256 Some slides from Welch & Bishop

ComputerVision

11

Marc makes a measurement

14121086420-2

,

Conditional Density Function

0y 0m

),(00 myN 00 yx

00 m

Page 12: Computer Vision Linear Tracking Jan-Michael Frahm COMP 256 Some slides from Welch & Bishop

ComputerVision

12

Jan makes a measurement

Conditional Density Function

14121086420-2

,1y 1m

?1 x

?1

),(11 myN

Page 13: Computer Vision Linear Tracking Jan-Michael Frahm COMP 256 Some slides from Welch & Bishop

ComputerVision

13

Combine measurements & variances

14121086420-2

Conditional Density Function

Online weighted average!

),( 22 xN

)( 12212 xyKxx

221

21

2

2y

K

221

22 2

111

y

Page 14: Computer Vision Linear Tracking Jan-Michael Frahm COMP 256 Some slides from Welch & Bishop

ComputerVision

14

Rudolf Emil Kalman

• Born 1930 in Hungary• BS and MS from MIT• PhD 1957 from Columbia• Filter developed in 1960-61• Now retired

Page 15: Computer Vision Linear Tracking Jan-Michael Frahm COMP 256 Some slides from Welch & Bishop

ComputerVision

15

Kalman filter

• Just some applied math.

• A linear dynamic system: f(a+b) = f(a) + f(b)

• Noisy data in hopefully less noisy out.

• But delay is the price for filtering...

Page 16: Computer Vision Linear Tracking Jan-Michael Frahm COMP 256 Some slides from Welch & Bishop

ComputerVision

16

Predict Correct

KF operates by 1. Predicting the new state and its

uncertainty2. Correcting with the new measurement

predictpredict correctcorrect

Page 17: Computer Vision Linear Tracking Jan-Michael Frahm COMP 256 Some slides from Welch & Bishop

ComputerVision

17

What is it used for?

• Tracking missiles• Tracking heads/hands/drumsticks• Extracting lip motion from video• Fitting Bezier patches to point data• Lots of computer vision applications• Economics• Navigation

Page 18: Computer Vision Linear Tracking Jan-Michael Frahm COMP 256 Some slides from Welch & Bishop

ComputerVision

18

A really simple exampleWe are on a boat at night and lost our position

We know:

• move with constant velocity

• star position

Page 19: Computer Vision Linear Tracking Jan-Michael Frahm COMP 256 Some slides from Welch & Bishop

ComputerVision

19

But suppose we’re moving

• Not all the difference is error. Some may be motion

• KF can include a motion model

• Estimate velocity and position

14121086420-2

Page 20: Computer Vision Linear Tracking Jan-Michael Frahm COMP 256 Some slides from Welch & Bishop

ComputerVision

20

Process Model

• Describes how the state changes over time

• The state for the first example was scalar

• The process model was “nothing changes”

• A better model might be constant velocity motion

11 )( iii vtpp

1 ii vv

vpX

Page 21: Computer Vision Linear Tracking Jan-Michael Frahm COMP 256 Some slides from Welch & Bishop

ComputerVision

21

Measurement Model

“What you see from where you are” not

“Where you are from what you see”

Page 22: Computer Vision Linear Tracking Jan-Michael Frahm COMP 256 Some slides from Welch & Bishop

ComputerVision

22

Constant Velocity

p is position of boat, v is velocity of boat

state is

We only measure position so

11 )( iii vtpp

I

tIIDi 0

0IM i

vpX

1 iii XDX

Page 23: Computer Vision Linear Tracking Jan-Michael Frahm COMP 256 Some slides from Welch & Bishop

ComputerVision

23

State and Error Covariance

• First two moments of Gaussian process

Error Covariance

Process State (Mean)

ix

id

Page 24: Computer Vision Linear Tracking Jan-Michael Frahm COMP 256 Some slides from Welch & Bishop

ComputerVision

24

The Process Model

Uncertainty over intervalUncertainty over interval

State transitionState transition

Process dynamics

iiii wxDx 1

idi Nw ,0~

Difficult to determine

Page 25: Computer Vision Linear Tracking Jan-Michael Frahm COMP 256 Some slides from Welch & Bishop

ComputerVision

25

Measurement Model

Measurement uncertainty

Measurement uncertainty

Measurementmatrix

Measurementmatrix

Measurement relationship to state

imi Nv ,0~

iiii vxMy

Page 26: Computer Vision Linear Tracking Jan-Michael Frahm COMP 256 Some slides from Welch & Bishop

ComputerVision

26

Predict (Time Update)

a priori state, error covariance, measurement

1iii xDx

idTiiii DD

1 iii xMy

1ix

ix

i

1i

Page 27: Computer Vision Linear Tracking Jan-Michael Frahm COMP 256 Some slides from Welch & Bishop

ComputerVision

27

Measurement Update (Correct)

Kalman gainKalman gain

a posteriori state and error covariance

iiiiii xMyKxx

iiii MKI

ix

ix

i

iMinimizes posteriori

error covariance

Page 28: Computer Vision Linear Tracking Jan-Michael Frahm COMP 256 Some slides from Welch & Bishop

ComputerVision

28

The Kalman Gain

1 im

Tiii

Tiii MMMK

Weights between prediction and measurements to posteriori error covariance

For no measurement uncertainty 0im 111 iii

Ti

Tiii MMMMK

iiiiiiii yMxMyMxx 11

State is deduced only from measurement

Page 29: Computer Vision Linear Tracking Jan-Michael Frahm COMP 256 Some slides from Welch & Bishop

ComputerVision

29

The Kalman Gain

Simple univariate (scalar) example

m

K

a posteriori state and error covariance

iiii xyKxx

ii K 1

Page 30: Computer Vision Linear Tracking Jan-Michael Frahm COMP 256 Some slides from Welch & Bishop

ComputerVision

30

Summary

PREDICT CORRECT

1iii xDx

idTiiii DD

1

iiiiii xMyKxx

iiii MKI

1 im

Tiii

Tiii MMMK

Page 31: Computer Vision Linear Tracking Jan-Michael Frahm COMP 256 Some slides from Welch & Bishop

ComputerVision

31

Estimating a Constant

The state transition matrix ID

iiiii wxwDxx

11

iiiii vxvMxy

The measurement matrix IM

Prediction

1ii xx

idii

1

Page 32: Computer Vision Linear Tracking Jan-Michael Frahm COMP 256 Some slides from Welch & Bishop

ComputerVision

32

Measurement Update

imi

iiK

iiiii xyKxx

iii K1

Page 33: Computer Vision Linear Tracking Jan-Michael Frahm COMP 256 Some slides from Welch & Bishop

ComputerVision

33

Setup/Initialization

510id

00 x

10

Page 34: Computer Vision Linear Tracking Jan-Michael Frahm COMP 256 Some slides from Welch & Bishop

ComputerVision

34

State and Measurements = 0.1im

1.0

im

Page 35: Computer Vision Linear Tracking Jan-Michael Frahm COMP 256 Some slides from Welch & Bishop

ComputerVision

35

Error Covariance

2)( i

Page 36: Computer Vision Linear Tracking Jan-Michael Frahm COMP 256 Some slides from Welch & Bishop

ComputerVision

36

State and Measurements = 1im

Page 37: Computer Vision Linear Tracking Jan-Michael Frahm COMP 256 Some slides from Welch & Bishop

ComputerVision

37

State and Measurements = 0.01

im

Page 38: Computer Vision Linear Tracking Jan-Michael Frahm COMP 256 Some slides from Welch & Bishop

ComputerVision

38

Example camera pose estimation

Page 39: Computer Vision Linear Tracking Jan-Michael Frahm COMP 256 Some slides from Welch & Bishop

ComputerVision

39

Kalman Filter Web Site

http://www.cs.unc.edu/~welch/kalman/

• Electronic and printed references– Book lists and recommendations– Research papers– Links to other sites– Some software

• News

Page 40: Computer Vision Linear Tracking Jan-Michael Frahm COMP 256 Some slides from Welch & Bishop

ComputerVision

40

Java-Based KF Learning Tool• On-line 1D simulation• Linear and non-linear• Variable dynamics

http://www.cs.unc.edu/~welch/kalman/

Page 41: Computer Vision Linear Tracking Jan-Michael Frahm COMP 256 Some slides from Welch & Bishop

ComputerVision

41

KF Course Web Page

http://www.cs.unc.edu/~tracker/ref/s2001/kalman/index.html

( http://www.cs.unc.edu/~tracker/ )

• Java-Based KF Learning Tool• KF web page

Page 42: Computer Vision Linear Tracking Jan-Michael Frahm COMP 256 Some slides from Welch & Bishop

ComputerVision

42

Closing Remarks

• Try it!– Not too hard to understand or program

• Start simple– Experiment in 1D– Make your own filter in Matlab, etc.

• Note: the Kalman filter “wants to work”– Debugging can be difficult– Errors can go un-noticed

Page 43: Computer Vision Linear Tracking Jan-Michael Frahm COMP 256 Some slides from Welch & Bishop

ComputerVision

43

Relevant References

• Azarbayejani, Ali, and Alex Pentland (1995). “Recursive Estimation of Motion, Structure, and Focal Length,” IEEE Trans. Pattern Analysis and Machine Intelligence 17(6): 562-575.

• Dellaert, Frank, Sebastian Thrun, and Charles Thorpe (1998). “Jacobian Images of Super-Resolved Texture Maps for Model-Based Motion Estimation and Tracking,” IEEE Workshop on Applications of Computer Vision (WACV'98), October, Princeton, NJ, IEEE Computer Society.

• http://mac-welch.cs.unc.edu/~welch/COMP256/