introduction to computer vision - brown university · 2009. 11. 3. · cs143 intro to computer...

44
©Michael J. Black CS143 Intro to Computer Vision Introduction to Computer Vision Michael J. Black Nov 2009 Perspective projection and affine motion

Upload: others

Post on 29-Aug-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Introduction to Computer Vision - Brown University · 2009. 11. 3. · CS143 Intro to Computer Vision ©Michael J. Black Affine Flow Small motion assumption * e.g. at video frame

©Michael J. Black CS143 Intro to Computer Vision

Introduction to Computer Vision

Michael J. Black

Nov 2009

Perspective projection and affine

motion

Page 2: Introduction to Computer Vision - Brown University · 2009. 11. 3. · CS143 Intro to Computer Vision ©Michael J. Black Affine Flow Small motion assumption * e.g. at video frame

©Michael J. Black CS143 Intro to Computer Vision

Page 3: Introduction to Computer Vision - Brown University · 2009. 11. 3. · CS143 Intro to Computer Vision ©Michael J. Black Affine Flow Small motion assumption * e.g. at video frame

©Michael J. Black CS143 Intro to Computer Vision

Goals

• Today

– Perspective projection

– 3D motion

• Wed

– Projects

• Friday

– Regularization and robust statistics

Page 4: Introduction to Computer Vision - Brown University · 2009. 11. 3. · CS143 Intro to Computer Vision ©Michael J. Black Affine Flow Small motion assumption * e.g. at video frame

©Michael J. Black

Reading

• Szeliski

– 2.2.2: 2D tranformations including affine

– 2.1.3: 3D transformations including rotation

matrices (more detailed than we need)

– 2.1.4: 3D to 2D projections

CS143 Intro to Computer Vision

Page 5: Introduction to Computer Vision - Brown University · 2009. 11. 3. · CS143 Intro to Computer Vision ©Michael J. Black Affine Flow Small motion assumption * e.g. at video frame

©Michael J. Black CS143 Intro to Computer Vision

Affine Flow

Page 6: Introduction to Computer Vision - Brown University · 2009. 11. 3. · CS143 Intro to Computer Vision ©Michael J. Black Affine Flow Small motion assumption * e.g. at video frame

©Michael J. Black CS143 Intro to Computer Vision

Why Affine?

• Where does this affine approximation come from?

• All our models are approximations to the world. What are the assumptions in the affine approximation?

• For this we need some geometry.

Page 7: Introduction to Computer Vision - Brown University · 2009. 11. 3. · CS143 Intro to Computer Vision ©Michael J. Black Affine Flow Small motion assumption * e.g. at video frame

©Michael J. Black CS143 Intro to Computer Vision

Pinhole cameras

• Abstract camera model - box with a small hole in it.

• Easy to build but needs a lot of light.

Page 8: Introduction to Computer Vision - Brown University · 2009. 11. 3. · CS143 Intro to Computer Vision ©Michael J. Black Affine Flow Small motion assumption * e.g. at video frame

©Michael J. Black CS143 Intro to Computer Vision

The equation of projection

Image plane

Page 9: Introduction to Computer Vision - Brown University · 2009. 11. 3. · CS143 Intro to Computer Vision ©Michael J. Black Affine Flow Small motion assumption * e.g. at video frame

©Michael J. Black CS143 Intro to Computer Vision

Perspective Projection

f

(x,y,z)

(x’,y’)

X

Z

Y

O

Move image plane in

front of focal point

(image not inverted)

Optical Axis

Camera

coordinate

frame

Many to one

Page 10: Introduction to Computer Vision - Brown University · 2009. 11. 3. · CS143 Intro to Computer Vision ©Michael J. Black Affine Flow Small motion assumption * e.g. at video frame

©Michael J. Black CS143 Intro to Computer Vision

Perspective Projection

f

(x,y,z)

(x’,y’)

X

Z

Y

O

Short focal length

means wider field of

view.

Page 11: Introduction to Computer Vision - Brown University · 2009. 11. 3. · CS143 Intro to Computer Vision ©Michael J. Black Affine Flow Small motion assumption * e.g. at video frame

©Michael J. Black CS143 Intro to Computer Vision

Perspective Projection

f

(x,y,z)

(x’,y’)

X

Z

Y

r

r’

O

Page 12: Introduction to Computer Vision - Brown University · 2009. 11. 3. · CS143 Intro to Computer Vision ©Michael J. Black Affine Flow Small motion assumption * e.g. at video frame

©Michael J. Black CS143 Intro to Computer Vision

Perspective Projection

f

(x,y,z)

(x’,y’)

X

Z

Y

r

r’

z

O

Page 13: Introduction to Computer Vision - Brown University · 2009. 11. 3. · CS143 Intro to Computer Vision ©Michael J. Black Affine Flow Small motion assumption * e.g. at video frame

©Michael J. Black CS143 Intro to Computer Vision

Perspective Projection

f

(x,y,z)

(x’,y’)

X

Z

Y

r

r’

z

O

Page 14: Introduction to Computer Vision - Brown University · 2009. 11. 3. · CS143 Intro to Computer Vision ©Michael J. Black Affine Flow Small motion assumption * e.g. at video frame

©Michael J. Black CS143 Intro to Computer Vision

Perspective Projection

f

(x,y,z)

(x’,y’)

X

Z

Y

r

r’

z

=f

z

x ' =fx

z

y ' =fy

z

O

(important slide)

Page 15: Introduction to Computer Vision - Brown University · 2009. 11. 3. · CS143 Intro to Computer Vision ©Michael J. Black Affine Flow Small motion assumption * e.g. at video frame

©Michael J. Black CS143 Intro to Computer Vision

Distant objects are smaller

Page 16: Introduction to Computer Vision - Brown University · 2009. 11. 3. · CS143 Intro to Computer Vision ©Michael J. Black Affine Flow Small motion assumption * e.g. at video frame

©Michael J. Black CS143 Intro to Computer Vision

Orthographic Projection

X

Z

Y

Assume an infinite focal

length and that the world is

infinitely far away.

Page 17: Introduction to Computer Vision - Brown University · 2009. 11. 3. · CS143 Intro to Computer Vision ©Michael J. Black Affine Flow Small motion assumption * e.g. at video frame

©Michael J. Black CS143 Intro to Computer Vision

Weak Perspective (scaled orthography)

X

Z

Y

Assume variation in depth is small relative to the distance from the camera.

Approximate scene as a fronto-parallel plane

Page 18: Introduction to Computer Vision - Brown University · 2009. 11. 3. · CS143 Intro to Computer Vision ©Michael J. Black Affine Flow Small motion assumption * e.g. at video frame

©Michael J. Black CS143 Intro to Computer Vision

Weak Perspective (scaled orthography)

X

Z

Y

Page 19: Introduction to Computer Vision - Brown University · 2009. 11. 3. · CS143 Intro to Computer Vision ©Michael J. Black Affine Flow Small motion assumption * e.g. at video frame

©Michael J. Black CS143 Intro to Computer Vision

Claim

For small motions, affine flow approximates

the motion of a plane viewed under

orthographic projection.

u = vx = a1x + a2y + a3v = vy = a4x + a5y + a6

uv

=x y 1 0 0 0

0 0 0 x y 1

a1a2a3a4a5a6

Page 20: Introduction to Computer Vision - Brown University · 2009. 11. 3. · CS143 Intro to Computer Vision ©Michael J. Black Affine Flow Small motion assumption * e.g. at video frame

©Michael J. Black CS143 Intro to Computer Vision

Recall: 3D motion

Page 21: Introduction to Computer Vision - Brown University · 2009. 11. 3. · CS143 Intro to Computer Vision ©Michael J. Black Affine Flow Small motion assumption * e.g. at video frame

©Michael J. Black CS143 Intro to Computer Vision

Motion Models

3D Rigid Motion

Page 22: Introduction to Computer Vision - Brown University · 2009. 11. 3. · CS143 Intro to Computer Vision ©Michael J. Black Affine Flow Small motion assumption * e.g. at video frame

©Michael J. Black CS143 Intro to Computer Vision

Rotation

Review: Ch 2.1.3, Euclidean Geometry

Rotation matrix: orthogonal with determinant =1

RT= R 1 det(R) = 1

Page 23: Introduction to Computer Vision - Brown University · 2009. 11. 3. · CS143 Intro to Computer Vision ©Michael J. Black Affine Flow Small motion assumption * e.g. at video frame

©Michael J. Black CS143 Intro to Computer Vision

Rotation

Review: Ch 2.1.3, Euclidean Geometry

Page 24: Introduction to Computer Vision - Brown University · 2009. 11. 3. · CS143 Intro to Computer Vision ©Michael J. Black Affine Flow Small motion assumption * e.g. at video frame

©Michael J. Black CS143 Intro to Computer Vision

Assumption: Small Motion

(If is small)

Page 25: Introduction to Computer Vision - Brown University · 2009. 11. 3. · CS143 Intro to Computer Vision ©Michael J. Black Affine Flow Small motion assumption * e.g. at video frame

©Michael J. Black CS143 Intro to Computer Vision

3D Motion

Page 26: Introduction to Computer Vision - Brown University · 2009. 11. 3. · CS143 Intro to Computer Vision ©Michael J. Black Affine Flow Small motion assumption * e.g. at video frame

©Michael J. Black CS143 Intro to Computer Vision

Assumption: Planar World +

Orthographic Projection

Page 27: Introduction to Computer Vision - Brown University · 2009. 11. 3. · CS143 Intro to Computer Vision ©Michael J. Black Affine Flow Small motion assumption * e.g. at video frame

©Michael J. Black CS143 Intro to Computer Vision

Assumption: Planar World

a1 = Yb

a3 = Y a + TXa2 = Yc Z

a4 = Z Xb

a5 = Xc

a6 = TY X a

Substitute:

u = vx = a1x + a2y + a3v = vy = a4x + a5y + a6

Page 28: Introduction to Computer Vision - Brown University · 2009. 11. 3. · CS143 Intro to Computer Vision ©Michael J. Black Affine Flow Small motion assumption * e.g. at video frame

©Michael J. Black CS143 Intro to Computer Vision

Affine Flow

Small motion assumption

* e.g. at video frame rate

Planar surface

* look at only a small region of the scene

Orthographic projection

* surface distant from camera

* long focal length

u = vx = a1x + a2y + a3v = vy = a4x + a5y + a6

Page 29: Introduction to Computer Vision - Brown University · 2009. 11. 3. · CS143 Intro to Computer Vision ©Michael J. Black Affine Flow Small motion assumption * e.g. at video frame

©Michael J. Black CS143 Intro to Computer Vision

Assumptions

What might be wrong with this?

Is there a probabilistic interpretation?

Minimize the negative log.

Page 30: Introduction to Computer Vision - Brown University · 2009. 11. 3. · CS143 Intro to Computer Vision ©Michael J. Black Affine Flow Small motion assumption * e.g. at video frame

©Michael J. Black CS143 Intro to Computer Vision

Multiple Motions

Page 31: Introduction to Computer Vision - Brown University · 2009. 11. 3. · CS143 Intro to Computer Vision ©Michael J. Black Affine Flow Small motion assumption * e.g. at video frame

©Michael J. Black CS143 Intro to Computer Vision

Occlusion

occlusion disocclusion shear

Multiple motions within a finite region.

Page 32: Introduction to Computer Vision - Brown University · 2009. 11. 3. · CS143 Intro to Computer Vision ©Michael J. Black Affine Flow Small motion assumption * e.g. at video frame

©Michael J. Black CS143 Intro to Computer Vision

Coherent Motion

Possibly Gaussian.

Page 33: Introduction to Computer Vision - Brown University · 2009. 11. 3. · CS143 Intro to Computer Vision ©Michael J. Black Affine Flow Small motion assumption * e.g. at video frame

©Michael J. Black CS143 Intro to Computer Vision

Multiple Motions

Definitely not Gaussian.

Page 34: Introduction to Computer Vision - Brown University · 2009. 11. 3. · CS143 Intro to Computer Vision ©Michael J. Black Affine Flow Small motion assumption * e.g. at video frame

©Michael J. Black CS143 Intro to Computer Vision

Multiple Motions

What is the “best” fitting translational motion?

Page 35: Introduction to Computer Vision - Brown University · 2009. 11. 3. · CS143 Intro to Computer Vision ©Michael J. Black Affine Flow Small motion assumption * e.g. at video frame

©Michael J. Black CS143 Intro to Computer Vision

Multiple Motions

Least squares fit.

X

Page 36: Introduction to Computer Vision - Brown University · 2009. 11. 3. · CS143 Intro to Computer Vision ©Michael J. Black Affine Flow Small motion assumption * e.g. at video frame

©Michael J. Black CS143 Intro to Computer Vision

Simpler problem: fitting a line to data

y

x

Page 37: Introduction to Computer Vision - Brown University · 2009. 11. 3. · CS143 Intro to Computer Vision ©Michael J. Black Affine Flow Small motion assumption * e.g. at video frame

©Michael J. Black CS143 Intro to Computer Vision

y

x

Page 38: Introduction to Computer Vision - Brown University · 2009. 11. 3. · CS143 Intro to Computer Vision ©Michael J. Black Affine Flow Small motion assumption * e.g. at video frame

©Michael J. Black CS143 Intro to Computer Vision

y

x

Page 39: Introduction to Computer Vision - Brown University · 2009. 11. 3. · CS143 Intro to Computer Vision ©Michael J. Black Affine Flow Small motion assumption * e.g. at video frame

©Michael J. Black CS143 Intro to Computer Vision

y

x

Page 40: Introduction to Computer Vision - Brown University · 2009. 11. 3. · CS143 Intro to Computer Vision ©Michael J. Black Affine Flow Small motion assumption * e.g. at video frame

©Michael J. Black CS143 Intro to Computer Vision

Robust Statistics

• Recover the best fit to the majority of the

data.

• Detect and reject outliers.

History.

Page 41: Introduction to Computer Vision - Brown University · 2009. 11. 3. · CS143 Intro to Computer Vision ©Michael J. Black Affine Flow Small motion assumption * e.g. at video frame

©Michael J. Black CS143 Intro to Computer Vision

Estimating the mean

0 2 4 6

Gaussian distribution

3

Mean is the optimal solution to:

residual

Page 42: Introduction to Computer Vision - Brown University · 2009. 11. 3. · CS143 Intro to Computer Vision ©Michael J. Black Affine Flow Small motion assumption * e.g. at video frame

©Michael J. Black CS143 Intro to Computer Vision

Estimating the Mean

The mean maximizes this likelihood:

The negative log gives (with sigma=1):

“least squares” estimate

Page 43: Introduction to Computer Vision - Brown University · 2009. 11. 3. · CS143 Intro to Computer Vision ©Michael J. Black Affine Flow Small motion assumption * e.g. at video frame

©Michael J. Black CS143 Intro to Computer Vision

Estimating the mean

0 2 4 6

Page 44: Introduction to Computer Vision - Brown University · 2009. 11. 3. · CS143 Intro to Computer Vision ©Michael J. Black Affine Flow Small motion assumption * e.g. at video frame

©Michael J. Black CS143 Intro to Computer Vision

Estimating the mean

0 2 4

What happens if we change just one measurement?

With a single “bad” data point I can move the mean

arbitrarily far.

6+