30
Cameras and Projections Dan Witzner Hansen Course web page: www.itu.dk/courses/MCV Email: [email protected]

Cameras and Projections Dan Witzner Hansen Course web page: Email: [email protected]

  • View
    216

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Cameras and Projections Dan Witzner Hansen Course web page:  Email: witzner@itu.dk

Cameras and Projections

Dan Witzner Hansen

Course web page:www.itu.dk/courses/MCV

Email:[email protected]

Page 2: Cameras and Projections Dan Witzner Hansen Course web page:  Email: witzner@itu.dk

Previously in Computer Vision….

• Homographies• Estimating homographies• Applications (Image rectification)

Page 3: Cameras and Projections Dan Witzner Hansen Course web page:  Email: witzner@itu.dk

Outline• Projections• Pinhole cameras• Perspective projection

– Camera matrix– Camera calibration matrix

• Affine Camera Models

Page 4: Cameras and Projections Dan Witzner Hansen Course web page:  Email: witzner@itu.dk

Single view geometry

Camera model

Camera calibration

Single view geom.

Page 5: Cameras and Projections Dan Witzner Hansen Course web page:  Email: witzner@itu.dk
Page 6: Cameras and Projections Dan Witzner Hansen Course web page:  Email: witzner@itu.dk

Pinhole camera model

TT ZfYZfXZYX )/,/(),,(

101

0

0

1

Z

Y

X

f

f

Z

fY

fX

Z

Y

X

Page 7: Cameras and Projections Dan Witzner Hansen Course web page:  Email: witzner@itu.dk

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 8: Cameras and Projections Dan Witzner Hansen Course web page:  Email: witzner@itu.dk

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 9: Cameras and Projections Dan Witzner Hansen Course web page:  Email: witzner@itu.dk

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 10: Cameras and Projections Dan Witzner Hansen Course web page:  Email: witzner@itu.dk

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 11: Cameras and Projections Dan Witzner Hansen Course web page:  Email: witzner@itu.dk

CCD camera

1yx

xx

p

p

K

11y

x

x

x

pf

pf

m

m

K

Page 12: Cameras and Projections Dan Witzner Hansen Course web page:  Email: witzner@itu.dk

Finite projective camera

1yx

xx

p

ps

K

1yx

xx

p

p

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 13: Cameras and Projections Dan Witzner Hansen Course web page:  Email: witzner@itu.dk

Camera anatomy

Camera centerColumn pointsPrincipal planeAxis planePrincipal pointPrincipal ray

Page 14: Cameras and Projections Dan Witzner Hansen Course web page:  Email: witzner@itu.dk

Camera center

0PC

null-space camera projection matrix

λ)C(1λAX

λ)PC(1λPAPXx

For all A all points on AC project on image of A,

therefore C is camera center

Image of camera center is (0,0,0)T, i.e. undefined

Finite cameras:

1

pM 41

C

Infinite cameras: 0Md,0

d

C

Page 15: Cameras and Projections Dan Witzner Hansen Course web page:  Email: witzner@itu.dk

Column vectors

0

0

1

0

ppppp 43212

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

Page 16: Cameras and Projections Dan Witzner Hansen Course web page:  Email: witzner@itu.dk

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

Page 17: Cameras and Projections Dan Witzner Hansen Course web page:  Email: witzner@itu.dk

The principal point

principal point

0,,,p̂ 3332313 ppp

330 Mmp̂Px

Page 18: Cameras and Projections Dan Witzner Hansen Course web page:  Email: witzner@itu.dk

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 19: Cameras and Projections Dan Witzner Hansen Course web page:  Email: witzner@itu.dk

Camera matrix decomposition

Finding the camera center

0PC (use SVD to find null-space)

432 p,p,pdetX 431 p,p,pdetY

421 p,p,pdetZ 321 p,p,pdetTFinding the camera orientation and internal parameters

KRM (use RQ decomposition ~QR)

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

(if only QR, invert)

Page 20: Cameras and Projections Dan Witzner Hansen Course web page:  Email: witzner@itu.dk

Euclidean vs. projective

homography 44

0100

0010

0001

homography 33P

general projective interpretation

Meaningful 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 21: Cameras and Projections Dan Witzner Hansen Course web page:  Email: witzner@itu.dk

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 22: Cameras and Projections Dan Witzner Hansen Course web page:  Email: witzner@itu.dk

Affine cameras

Page 23: Cameras and Projections Dan Witzner Hansen Course web page:  Email: witzner@itu.dk

Summary parallel projection

1000

0010

0001

P canonical representation

10

0KK 22 calibration matrix

principal point is not defined

Page 24: Cameras and Projections Dan Witzner Hansen Course web page:  Email: witzner@itu.dk

A hierarchy of affine cameras

Orthographic projection

Scaled orthographic projection

1000

0010

0001

P

10

tRH

10rr

P 21T

11T

tt

ktt

/10rr

P 21T

11T

(5dof)

(6dof)

Page 25: Cameras and Projections Dan Witzner Hansen Course web page:  Email: witzner@itu.dk

A hierarchy of affine cameras

Weak perspective projection

ktt

y

x

/10rr

αP 2

1T1

1T

(7dof)

Page 26: Cameras and Projections Dan Witzner Hansen Course web page:  Email: witzner@itu.dk

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

2. Affine camera maps parallel lines to parallel lines3. No center of projection, but direction of

projection PAD=0(point on P∞)

A hierarchy of affine camerasAffine camera

ktts

y

x

A

/10rr

αP 2

1T1

1T

(8dof)

1000P 2232221

1131211

tmmmtmmm

A

affine 44100000100001

affine 33P

A

Page 27: Cameras and Projections Dan Witzner Hansen Course web page:  Email: witzner@itu.dk

Next: Camera calibration

Page 28: Cameras and Projections Dan Witzner Hansen Course web page:  Email: witzner@itu.dk

The principal axis vector

3m

camcamcam X0|IKXPx T1,0,0mMdetv 3

camcam PP k vv 4k

4p|MC~

|IKRP k

0)Rdet(

vector defining front side of camera

(direction unaffected)

vmMdetv 43 kkk camcam PP k

because

Page 29: Cameras and Projections Dan Witzner Hansen Course web page:  Email: witzner@itu.dk

Depth of points

C~

X~

mCXPXPT3T3T3 w

(dot product)(PC=0)

1m;0det 3 MIf , then m3 unit vector in positive direction

3m

)sign(detMPX;depth

T

w

TX X,Y,Z,T

Page 30: Cameras and Projections Dan Witzner Hansen Course web page:  Email: witzner@itu.dk

When is skew non-zero?

1yx

xx

p

ps

K

1 g

arctan(1/s)

for CCD/CMOS, always s=0

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

HPresulting camera: