45
Camera Models CMPUT 498/613 CMPUT 498/613 Richard Hartley and Andrew Zisserman, Multiple View Geometry , Cambridge University Publishers, 2000 Readings: HZ Ch 6, 7

Camera Models CMPUT 498/613 Richard Hartley and Andrew Zisserman, Multiple View Geometry, Cambridge University Publishers, 2000 Readings: HZ Ch 6, 7

  • View
    227

  • Download
    7

Embed Size (px)

Citation preview

Page 1: Camera Models CMPUT 498/613 Richard Hartley and Andrew Zisserman, Multiple View Geometry, Cambridge University Publishers, 2000 Readings: HZ Ch 6, 7

Camera Models

CMPUT 498/613CMPUT 498/613

Richard Hartley and Andrew Zisserman, Multiple View Geometry, Cambridge University Publishers, 2000

Readings: HZ Ch 6, 7

Page 2: Camera Models CMPUT 498/613 Richard Hartley and Andrew Zisserman, Multiple View Geometry, Cambridge University Publishers, 2000 Readings: HZ Ch 6, 7

Hierarchy of cameras

Camera center

Image plane Object plane

X0(origin)xpersp

Perspective:

xparap

Para-perspective:

First order approximation of perspective

z

y

x

persp

t

t

t

f

f

P

k

j

i

1

xorth

Orthographic:

1Ty

x

orth t

t

P

0

j

i

Weak perspective:

xwp

11 Ty

x

wp t

t

k

k

P

0

j

i

Page 3: Camera Models CMPUT 498/613 Richard Hartley and Andrew Zisserman, Multiple View Geometry, Cambridge University Publishers, 2000 Readings: HZ Ch 6, 7

Examples of camera projections

perspective Orthographic (parallel)

Page 4: Camera Models CMPUT 498/613 Richard Hartley and Andrew Zisserman, Multiple View Geometry, Cambridge University Publishers, 2000 Readings: HZ Ch 6, 7

Animal eye:

a looonnng time ago.

Pinhole perspective projection: Brunelleschi, XVth Century.Camera obscura: XVIth Century.

Photographic camera:Niepce, 1816.

Page 5: Camera Models CMPUT 498/613 Richard Hartley and Andrew Zisserman, Multiple View Geometry, Cambridge University Publishers, 2000 Readings: HZ Ch 6, 7

TT ZfYZfXZYX )/,/(),,(

101

0

0

1

Z

Y

X

f

f

Z

fY

fX

Z

Y

X

Pinhole camera model

Page 6: Camera Models CMPUT 498/613 Richard Hartley and Andrew Zisserman, Multiple View Geometry, Cambridge University Publishers, 2000 Readings: HZ Ch 6, 7

Pinhole camera model

101

0

0

Z

Y

X

f

f

Z

fY

fX

101

01

01

1Z

Y

X

f

f

Z

fY

fX

PXx

0|I)1,,(diagP ff

Page 7: Camera Models CMPUT 498/613 Richard Hartley and Andrew Zisserman, Multiple View Geometry, Cambridge University Publishers, 2000 Readings: HZ Ch 6, 7

Principal point offset

Tyx

T pZfYpZfXZYX )/,/(),,(

principal pointT

yx pp ),(

101

0

0

1

Z

Y

X

pf

pf

Z

ZpfY

ZpfX

Z

Y

X

y

x

x

x

Page 8: Camera Models CMPUT 498/613 Richard Hartley and Andrew Zisserman, Multiple View Geometry, Cambridge University Publishers, 2000 Readings: HZ Ch 6, 7

Principal point offset

101

0

0

Z

Y

X

pf

pf

Z

ZpfY

ZpfX

y

x

x

x

camX0|IKx

1y

x

pf

pf

K calibration matrix

Page 9: Camera Models CMPUT 498/613 Richard Hartley and Andrew Zisserman, Multiple View Geometry, Cambridge University Publishers, 2000 Readings: HZ Ch 6, 7

Camera rotation and translation

C~

-X~

RX~

cam

X10

RCR

1

10

C~

RRXcam

Z

Y

X

camX0|IKx XC~

|IKRx

t|RKP C~

Rt PXx

Page 10: Camera Models CMPUT 498/613 Richard Hartley and Andrew Zisserman, Multiple View Geometry, Cambridge University Publishers, 2000 Readings: HZ Ch 6, 7

CCD camera

1yx

xx

p

p

K

11y

x

x

x

pf

pf

m

m

K

Page 11: Camera Models CMPUT 498/613 Richard Hartley and Andrew Zisserman, Multiple View Geometry, Cambridge University Publishers, 2000 Readings: HZ Ch 6, 7

Finite projective camera

1yy

xx

p

ps

K

C~

|IKRP

non-singular

11 dof (5+3+3)

decompose P in K,R,C?

4p|MP 41pMC

~ MRK, RQ{finite cameras}={P4x3 | det M≠0}

If rank P=3, but rank M<3, then cam at infinity

Page 12: Camera Models CMPUT 498/613 Richard Hartley and Andrew Zisserman, Multiple View Geometry, Cambridge University Publishers, 2000 Readings: HZ Ch 6, 7

Camera anatomy

Camera centerColumn pointsPrincipal planeAxis planePrincipal pointPrincipal ray

Page 13: Camera Models CMPUT 498/613 Richard Hartley and Andrew Zisserman, Multiple View Geometry, Cambridge University Publishers, 2000 Readings: HZ Ch 6, 7

Column vectors

0

0

1

0

ppppp 43212

Image points corresponding to X,Y,Z directions and origin

Page 14: Camera Models CMPUT 498/613 Richard Hartley and Andrew Zisserman, Multiple View Geometry, Cambridge University Publishers, 2000 Readings: HZ Ch 6, 7

Row vectors

1p

p

p

0 3

2

1

Z

Y

X

y

x

T

T

T

1p

p

p0

3

2

1

Z

Y

X

w

yT

T

T

note: p1,p2 dependent on image reparametrization

Camera center

0PC null-space camera projection matrix, (3 plane intersection)

Page 15: Camera Models CMPUT 498/613 Richard Hartley and Andrew Zisserman, Multiple View Geometry, Cambridge University Publishers, 2000 Readings: HZ Ch 6, 7

The principal point

principal point

0,,,p̂ 3332313 ppp

330 Mmp̂Px

Page 16: Camera Models CMPUT 498/613 Richard Hartley and Andrew Zisserman, Multiple View Geometry, Cambridge University Publishers, 2000 Readings: HZ Ch 6, 7

Action of projective camera on point

PXx

MdDp|MPDx 4

Forward projection

Back-projection

xPX 1PPPP

TT IPP

(pseudo-inverse)

0PC

λCxPλX

1

p-μxM

1

pM-

0

xMμμX 4

-14

-1-1

xMd -1

CD

Page 17: Camera Models CMPUT 498/613 Richard Hartley and Andrew Zisserman, Multiple View Geometry, Cambridge University Publishers, 2000 Readings: HZ Ch 6, 7

Camera matrix decomposition

Finding the camera center

0PC (use SVD to find null-space)

Finding the camera orientation and internal parameters

KRM (use RQ decomposition ~QR)

Q R=( )-1= -1 -1QR

(if only QR, invert)

Page 18: Camera Models CMPUT 498/613 Richard Hartley and Andrew Zisserman, Multiple View Geometry, Cambridge University Publishers, 2000 Readings: HZ Ch 6, 7

When is skew non-zero?

1yy

xx

p

ps

K

1

arctan(1/s)

for CCD/CMOS, almost always s=0

Image from image, s≠0 possible(non coinciding principal axis)

HPresulting camera:

Page 19: Camera Models CMPUT 498/613 Richard Hartley and Andrew Zisserman, Multiple View Geometry, Cambridge University Publishers, 2000 Readings: HZ Ch 6, 7

Euclidean vs. projective

homography 44

0100

0010

0001

homography 33P

general projective interpretation

Meaningfull decomposition in K,R,t requires Euclidean image and space

Camera center is still valid in projective space

Principal plane requires affine image and space

Principal ray requires affine image and Euclidean space

Page 20: Camera Models CMPUT 498/613 Richard Hartley and Andrew Zisserman, Multiple View Geometry, Cambridge University Publishers, 2000 Readings: HZ Ch 6, 7

Cameras at infinity

00

dP

Camera center at infinity

0Mdet

Affine and non-affine cameras

Definition: affine camera has P3T=(0,0,0,1)

Page 21: Camera Models CMPUT 498/613 Richard Hartley and Andrew Zisserman, Multiple View Geometry, Cambridge University Publishers, 2000 Readings: HZ Ch 6, 7

Affine cameras

Page 22: Camera Models CMPUT 498/613 Richard Hartley and Andrew Zisserman, Multiple View Geometry, Cambridge University Publishers, 2000 Readings: HZ Ch 6, 7

Affine cameras

C~

rr

C~

rr

C~

rr

KC~

|IKRP3T3T

2T2T

1T1T

0

C~

r3T0 d

t

t

dt

t

t

3T

2T2T

1T1T

33T3T

32T2T

31T1T

r

C~

rr

C~

rr

K

r-C~

rr

r-C~

rr

r-C~

rr

KP

modifying p34 corresponds to moving along principal ray

Page 23: Camera Models CMPUT 498/613 Richard Hartley and Andrew Zisserman, Multiple View Geometry, Cambridge University Publishers, 2000 Readings: HZ Ch 6, 7

Affine cameras

003T

2T2T

1T1T

0

3T

2T2T

1T1T

0

0

/r

C~

rr

C~

rr

K

r

C~

rr

C~

rr

1

/

/

KP

dddd

d

d

dd

dd

t

t

t

t

t

t

now adjust zoom to compensate

0

2T2T

1T1T

0

C~

rr

C~

rr

KPlimP

dt

t

Page 24: Camera Models CMPUT 498/613 Richard Hartley and Andrew Zisserman, Multiple View Geometry, Cambridge University Publishers, 2000 Readings: HZ Ch 6, 7

Error in employing affine cameras

1

βrαrX

21

1

rβrαrX

321

XPXPXP t0

point on plane parallel with principal plane and through origin, then

general points

Δ

~

~

KXPx

0

0proj

d

y

x

0

affine~

~

KXPx

d

y

x

projxaffinex

0x

Page 25: Camera Models CMPUT 498/613 Richard Hartley and Andrew Zisserman, Multiple View Geometry, Cambridge University Publishers, 2000 Readings: HZ Ch 6, 7

Affine imaging conditions

0proj0

projaffine x-xx-xd

Approximation should only cause small error

1. much smaller than d0

2. Points close to principal point (i.e. small field of view)

Page 26: Camera Models CMPUT 498/613 Richard Hartley and Andrew Zisserman, Multiple View Geometry, Cambridge University Publishers, 2000 Readings: HZ Ch 6, 7

Decomposition of P∞

0

02x2

0

t~R~

10

x~KP

d

10

t~R~

10

x~K 02x2-1

0d

absorb d0 in K2x2

10

0R~

10

x~t~KK

10

x~Kt~R~

10

0K

10

x~t~KR~

K

02x22x2

0-12x22x202x22x2

10

0R~

10

x~K

10

t~R~

10

0KP 02x22x2

alternatives, because 8dof (3+3+2), not more

Page 27: Camera Models CMPUT 498/613 Richard Hartley and Andrew Zisserman, Multiple View Geometry, Cambridge University Publishers, 2000 Readings: HZ Ch 6, 7

Summary parallel projection

1000

0010

0001

P canonical representation

10

0KK 22 calibration matrix

principal point is not defined

Page 28: Camera Models CMPUT 498/613 Richard Hartley and Andrew Zisserman, Multiple View Geometry, Cambridge University Publishers, 2000 Readings: HZ Ch 6, 7

A hierarchy of affine cameras

Orthographic projection

Scaled orthographic projection

1000

0010

0001

P

10

tRH

10

r

r

P 22T

11T

t

t

k

t

t

/10

r

r

P 22T

11T

(5dof)

(6dof)

Page 29: Camera Models CMPUT 498/613 Richard Hartley and Andrew Zisserman, Multiple View Geometry, Cambridge University Publishers, 2000 Readings: HZ Ch 6, 7

A hierarchy of affine cameras

Weak perspective projection (useful infinite appr. of unknown CCD camera)

k

t

t

y

x

/10

r

r

1

α

α

P 22T

11T

(7dof)

Page 30: Camera Models CMPUT 498/613 Richard Hartley and Andrew Zisserman, Multiple View Geometry, Cambridge University Publishers, 2000 Readings: HZ Ch 6, 7

1. Affine camera=camera with principal plane coinciding with ∞

2. Affine camera maps parallel lines to parallel lines

3. No center of projection, but direction of projection PAD=0(point on ∞)

A hierarchy of affine cameras

Affine camera

k

t

ts

y

x

A

/10

r

r

1

α

α

P 22T

11T

(8dof)

1000P 2232221

1131211

tmmmtmmm

A

affine 44100000100001

affine 33P

A

Page 31: Camera Models CMPUT 498/613 Richard Hartley and Andrew Zisserman, Multiple View Geometry, Cambridge University Publishers, 2000 Readings: HZ Ch 6, 7

Hierarchy of cameras

Camera center

Image plane Object plane

X0(origin)xpersp

Perspective:

xparap

Para-perspective:

First order approximation of perspective

z

y

x

persp

t

t

t

f

f

P

k

j

i

1

xorth

Orthographic:

1Ty

x

orth t

t

P

0

j

i

Weak perspective:

xwp

11 Ty

x

wp t

t

k

k

P

0

j

i

Page 32: Camera Models CMPUT 498/613 Richard Hartley and Andrew Zisserman, Multiple View Geometry, Cambridge University Publishers, 2000 Readings: HZ Ch 6, 7

Other Cameras

Pushbroom cameras

T)(X X,Y,X,T T),,(PX wyx T)/,( wyx

Straight lines are not mapped to straight lines!

(otherwise it would be a projective camera)

(11dof)

Line cameras

ZYX

pppppp

yx

232221

131211

(5dof)

c~|IRKP 22222232

Null-space PC=0 yields camera centerAlso decomposition

Page 33: Camera Models CMPUT 498/613 Richard Hartley and Andrew Zisserman, Multiple View Geometry, Cambridge University Publishers, 2000 Readings: HZ Ch 6, 7

• Projection equationProjection equation

xxii=P=PiiXX

• Resection:Resection:– xxii,X P,X Pii

A 3D Vision Problem: Multi-view geometry - resection

Given image points and 3D points calculate camera projection matrix.

Page 34: Camera Models CMPUT 498/613 Richard Hartley and Andrew Zisserman, Multiple View Geometry, Cambridge University Publishers, 2000 Readings: HZ Ch 6, 7

Estimating camera matrix P

•Given a number of correspondences between 3-Given a number of correspondences between 3-

D points and their 2-D image projections D points and their 2-D image projections XXii x xii, we would like to determine the , we would like to determine the camera camera

projection matrixprojection matrix PP such that such that xxi i == PXPXii for for

all all ii

Page 35: Camera Models CMPUT 498/613 Richard Hartley and Andrew Zisserman, Multiple View Geometry, Cambridge University Publishers, 2000 Readings: HZ Ch 6, 7

A Calibration Target

courtesy of B. Wilburn

XZ

Y

Xi

xi

Page 36: Camera Models CMPUT 498/613 Richard Hartley and Andrew Zisserman, Multiple View Geometry, Cambridge University Publishers, 2000 Readings: HZ Ch 6, 7

Estimating P: The Direct Linear Transformation (DLT) Algorithm

• xxi i == PXPXii is an equation involving homogeneous is an equation involving homogeneous

vectors, so vectors, so PXPXii and and xxi i need only be in the same need only be in the same

direction, not strictly equaldirection, not strictly equal

• We can specify “same directionality” by using a We can specify “same directionality” by using a cross product formulation:cross product formulation:

Page 37: Camera Models CMPUT 498/613 Richard Hartley and Andrew Zisserman, Multiple View Geometry, Cambridge University Publishers, 2000 Readings: HZ Ch 6, 7

DLT Camera Matrix Estimation: Preliminaries

•Let the image point Let the image point xxii = ( = (xxii, , yyii, , wwii))TT

(remember that (remember that XXii has 4 elements) has 4 elements)

•Denoting the Denoting the jjth row of th row of PP by by ppjTjT (a 4-element (a 4-element row vector), we have: row vector), we have:

Page 38: Camera Models CMPUT 498/613 Richard Hartley and Andrew Zisserman, Multiple View Geometry, Cambridge University Publishers, 2000 Readings: HZ Ch 6, 7

DLT Camera Matrix Estimation: Step 1

•Then by the definition of the cross product, Then by the definition of the cross product,

xxi i PXPXii is: is:

Page 39: Camera Models CMPUT 498/613 Richard Hartley and Andrew Zisserman, Multiple View Geometry, Cambridge University Publishers, 2000 Readings: HZ Ch 6, 7

DLT Camera Matrix Estimation: Step 2

•The dot product commutes, so The dot product commutes, so ppjTjT XXii ==

XXTTii ppjj, and we can rewrite the preceding as:, and we can rewrite the preceding as:

Page 40: Camera Models CMPUT 498/613 Richard Hartley and Andrew Zisserman, Multiple View Geometry, Cambridge University Publishers, 2000 Readings: HZ Ch 6, 7

DLT Camera Matrix Estimation: Step 3

• Collecting terms, this can be rewritten as a Collecting terms, this can be rewritten as a matrix product:matrix product:

where where 00TT = (0, 0, 0, 0) = (0, 0, 0, 0). This is a . This is a 3 x 12 matrix times a 12-element column 3 x 12 matrix times a 12-element column vector vector pp = ( = (pp11TT, , pp22TT, , pp33TT))TT

Page 41: Camera Models CMPUT 498/613 Richard Hartley and Andrew Zisserman, Multiple View Geometry, Cambridge University Publishers, 2000 Readings: HZ Ch 6, 7

What We Just Did

Page 42: Camera Models CMPUT 498/613 Richard Hartley and Andrew Zisserman, Multiple View Geometry, Cambridge University Publishers, 2000 Readings: HZ Ch 6, 7

DLT Camera Matrix Estimation: Step 4

• There are only two linearly independent rows here There are only two linearly independent rows here – The third row is obtained by adding The third row is obtained by adding xxii times the first row to times the first row to yyii times the times the

second and scaling the sum by second and scaling the sum by -1/-1/wwii

Page 43: Camera Models CMPUT 498/613 Richard Hartley and Andrew Zisserman, Multiple View Geometry, Cambridge University Publishers, 2000 Readings: HZ Ch 6, 7

DLT Camera Matrix Estimation: Step 4

• So we can eliminate one row to obtain the So we can eliminate one row to obtain the

following linear matrix equation for the following linear matrix equation for the iith pair th pair of corresponding points:of corresponding points:

• Write this as Write this as AAii pp = = 00

Page 44: Camera Models CMPUT 498/613 Richard Hartley and Andrew Zisserman, Multiple View Geometry, Cambridge University Publishers, 2000 Readings: HZ Ch 6, 7

DLT Camera Matrix Estimation: Step 5

• Remember that there are 11 unknowns which Remember that there are 11 unknowns which generate the 3 x 4 homogeneous matrix generate the 3 x 4 homogeneous matrix PP

(represented in vector form by (represented in vector form by pp))• Each point correspondence yields 2 equations Each point correspondence yields 2 equations

(the two row of (the two row of AAii)) We need at least 5 ½ point correspondences to We need at least 5 ½ point correspondences to

solve for solve for pp• Stack Stack AAii to get homogeneous linear system to get homogeneous linear system AA p p

= 0= 0

Page 45: Camera Models CMPUT 498/613 Richard Hartley and Andrew Zisserman, Multiple View Geometry, Cambridge University Publishers, 2000 Readings: HZ Ch 6, 7

Experiment: