Camera Parameters - UCF Computer Science · 1 CAP5415 Computer Vision Spring 2003 Khurram...

11
1 CAP5415 Computer Vision Spring 2003 Khurram Hassan-Shafique Camera Parameters X Y Z C Image plane Focal plane M m ( 29 ( ( 29 ( 29 C C C Z Y X , , ( ( 29 ( 29 f v u C C , , From Perspective Projection ( 29 ( ( 29 ( 29 ( 29 ( 29 S U Z Y f v S U Z X f u C C C C C C = - = = - = ( ( 29 ( 29 - - = 1 0 1 0 0 0 0 0 0 0 0 C C C Z Y X f f S V U

Transcript of Camera Parameters - UCF Computer Science · 1 CAP5415 Computer Vision Spring 2003 Khurram...

Page 1: Camera Parameters - UCF Computer Science · 1 CAP5415 Computer Vision Spring 2003 Khurram Hassan-Shafique Camera Parameters X Y Z C Image plane Focal plane M m (X (C ),Y C,Z C) (u(C),v(C),

1

CAP5415 Computer VisionSpring 2003

Khurram Hassan-Shafique

Camera Parameters

X

Y

Z C

Image plane

Focal plane

M

m

( ) ( ) ( )( )CCC ZYX ,,

( ) ( )( )fvu CC ,,

From Perspective Projection

( )( )

( )

( )( )

( ) S

U

Z

Yfv

S

U

Z

Xfu

C

CC

C

CC

=−=

=−=

( )

( )

( )

�����

�����

���

���

−−

=���

���

10100

000

000

C

C

C

Z

Y

X

f

f

S

V

U

Page 2: Camera Parameters - UCF Computer Science · 1 CAP5415 Computer Vision Spring 2003 Khurram Hassan-Shafique Camera Parameters X Y Z C Image plane Focal plane M m (X (C ),Y C,Z C) (u(C),v(C),

2

Camera Parameters

X

Y

Z C

Image plane

Focal plane

M

m

( ) ( ) ( )( )CCC ZYX ,,

u

v

i

j

I

JJkj

Iki

v

u

==

( )

( )

( )

( )

( )

( )

���

���

���

���

=���

���

+���

���

���

���

=���

���

1100

0

0

01100

00

00

10

0

0

0c

c

v

uc

c

v

uI

I

v

u

vk

uk

v

u

v

u

k

k

v

u

( ) ( )( )II vu ,

( ) ( )( )fvu CC ,,

Camera Parameters( )

( )

( )

( )

���

���

���

���

=���

���

1100

0

0

10

0c

c

v

uI

I

v

u

vk

uk

v

u

( )

( )

���

���

���

���

=���

���

S

V

U

vk

uk

S

V

U

v

unew

new

100

0

0

0

0

Equation 3

( )( )

( )( )

S

Vv

S

Uu

newI

newI

=

= ( )

( )S

Vv

S

Uu

C

C

=

=

Page 3: Camera Parameters - UCF Computer Science · 1 CAP5415 Computer Vision Spring 2003 Khurram Hassan-Shafique Camera Parameters X Y Z C Image plane Focal plane M m (X (C ),Y C,Z C) (u(C),v(C),

3

Camera Parameters

( )

( )

( )

( )

( )

�����

�����

���

���

−−

���

���

=���

���

���

���

=���

���

10100

000

000

100

0

0

100

0

0

0

0

0

0

C

C

C

v

u

v

unew

new

Z

Y

X

f

f

vk

uk

S

V

U

vk

uk

S

V

U

Equation 1:

( )

( )

( )

�����

�����

���

���

−−

=���

���

10100

000

000

C

C

C

Z

Y

X

f

f

S

V

U

Camera Parameters( )

( )

( )

( )

( )

�����

�����

���

���

−−

=���

���

10100

00

00

0

0

C

C

C

v

unew

new

Z

Y

X

vfk

ufk

S

V

U

( )

( )

( )

( )

( )

�����

�����

���

���

−−

=���

���

10100

00

00

0

0

C

C

C

v

u

new

new

Z

Y

X

vf

uf

S

V

U

vv

uu

fkf

fkf

==

Equation 4

Page 4: Camera Parameters - UCF Computer Science · 1 CAP5415 Computer Vision Spring 2003 Khurram Hassan-Shafique Camera Parameters X Y Z C Image plane Focal plane M m (X (C ),Y C,Z C) (u(C),v(C),

4

Camera Parameters

Intrinsic Parameters (Do not depend on camera position):

0

0

.4

.3

.2

.1

v

u

fkf

fkf

vv

uu

==

Intrinsic Parameters( )

( )

( )

( )

( )

�����

�����

���

���

−−

=���

���

10100

00

00

0

0

C

C

C

v

u

new

new

Z

Y

X

vf

uf

S

V

U

( ) ( ) ( )

( )

( )

( )���

���

=���

���

==CT

CT

CT

C

T

T

T

CI

MQ

MQ

MQ

M

Q

Q

Q

PMm

3

2

1

3

2

1

Page 5: Camera Parameters - UCF Computer Science · 1 CAP5415 Computer Vision Spring 2003 Khurram Hassan-Shafique Camera Parameters X Y Z C Image plane Focal plane M m (X (C ),Y C,Z C) (u(C),v(C),

5

Calculating Camera Center (from Intrinsic Parameters)

( ) ( )

( )

( )

( )���

���

=���

���

=CT

CT

CT

C

T

T

T

I

MQ

MQ

MQ

M

Q

Q

Q

m

3

2

1

3

2

1

[ ] 011

=��

���

�′=��

���

� CpP

CP

0=+′� pCP

( ) pPC 1−′−=�

Extrinsic Parameters

X

Y

Z C

Image plane

Focal plane

M

m

( ) ( ) ( )( )CCC ZYX ,,

u

v

i

j

I

JJkj

Iki

v

u

==

( ) ( )( )II vu ,

( ) ( )( )fvu CC ,,Z

Y

X

( ) ( ) ( )( )WWW ZYX ,,

By Rigid Body Transformation:( )

( )

( )

( )

( )

( )( ) ( )WC

W

W

W

C

C

C

DMMZ

Y

X

TR

Z

Y

X

=�

�����

�����

��

���

�=

�����

�����

×

××

1

10

131

1333

Page 6: Camera Parameters - UCF Computer Science · 1 CAP5415 Computer Vision Spring 2003 Khurram Hassan-Shafique Camera Parameters X Y Z C Image plane Focal plane M m (X (C ),Y C,Z C) (u(C),v(C),

6

Camera Model( ) ( ) ( ) ( ) ( ) ( )WIWCCI PDMmDMMPMm =�== ,

( )

( )

( )

( )

( )

�����

�����

��

���

���

���

−−

=���

���

×

××

1

100100

00

00

31

13330

0

W

W

W

v

u

new

new

Z

Y

X

TRvf

uf

S

V

U

���

���

=���

���

=

Z

Y

X

T

T

T

T

rrr

rrr

rrr

R and Let

333231

232221

131211

Camera Model

( )( ) ( ) ( )

( ) ( ) ( )

( )( ) ( ) ( )

( ) ( ) ( )Z

WWWY

WWW

vI

ZWWW

XWWW

uI

TZrYrXr

TZrYrXrfvv

TZrYrXr

TZrYrXrfuu

++++++−=−

++++++−=−

333231

2322210

333231

1312110

Page 7: Camera Parameters - UCF Computer Science · 1 CAP5415 Computer Vision Spring 2003 Khurram Hassan-Shafique Camera Parameters X Y Z C Image plane Focal plane M m (X (C ),Y C,Z C) (u(C),v(C),

7

Suggested Reading� Chapter 3, Olivier Faugeras, "Three Dimensional

Computer Vision", MIT Press, 1993

� Chapter 2, David A. Forsyth and Jean Ponce, "Computer Vision: A Modern Approach"

� Chapter 1, Mubarak Shah, "Fundamentals of Computer Vision"

Estimating Camera Parameters

( )11,vu

( )22 ,vu

( )33 ,vu

( )NN vu ,

( )111 ,, ZYX

( )222 ,, ZYX

( )333 ,, ZYX

( )NNN ZYX ,,

Page 8: Camera Parameters - UCF Computer Science · 1 CAP5415 Computer Vision Spring 2003 Khurram Hassan-Shafique Camera Parameters X Y Z C Image plane Focal plane M m (X (C ),Y C,Z C) (u(C),v(C),

8

Estimating Camera Parameters

( )( ) ( ) ( )

( ) ( ) ( )

( )( ) ( ) ( )

( ) ( ) ( )Z

Wi

Wi

Wi

YW

iW

iW

iv

Ii

ZW

iW

iW

i

XW

iW

iW

iu

Ii

TZrYrXr

TZrYrXrfvv

TZrYrXr

TZrYrXrfuu

++++++−=−

++++++−=−

333231

2322210

333231

1312110

( ) ( )iiiii ZYXvu ,, and ,pair ingcorrespondeach For

secondby equation first thedividing and 0 and Let 00 === vuf

f

v

( ) ( ) ( ) ( )( ) ( ) ( ) ( ) ( )( )XW

iW

iW

iI

iYW

iW

iW

iI

i TZrYrXrvTZrYrXru +++=+++ 131211232221 α( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) 0131211232221 =+++−+++ X

Ii

Wi

Ii

Wi

Ii

Wi

IiY

Ii

Wi

Ii

Wi

Ii

Wi

Ii TvrZvrYvrXvTurZurYurXu αααα

Estimating Camera Parameters( ) ( )iiiii ZYXvu ,, and ,pair ingcorrespondeach For

( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) 087654321 =+++−+++ vvvZvvYvvXvvuvZuvYuvXu Ii

Wi

Ii

Wi

Ii

Wi

Ii

Ii

Wi

Ii

Wi

Ii

Wi

Ii

XY TvTv

rvrv

rvrv

rvrv

αααα

========

84

137233

126222

115211

0=Av

[ ]Tvvvvvvvvv 87654321=Compute v by SVD decomposition of A=UDVT (The solution vector is the column of V corresponding to null (or smallest) singular value) in D.

Page 9: Camera Parameters - UCF Computer Science · 1 CAP5415 Computer Vision Spring 2003 Khurram Hassan-Shafique Camera Parameters X Y Z C Image plane Focal plane M m (X (C ),Y C,Z C) (u(C),v(C),

9

Estimating Camera ParametersComputing Scale Factor

( )TXY TrrrTrrr�v

v

αααα 131211232221

thenector,solution v obtained thebeLet

=

( ) γγ =++=++

=++2

232

222

2122

322

21

223

222

221 have we,1 Since

rrrvvv

rrr

Estimating Camera ParametersComputing α

( ) γααγ =++=++

=++2

232

222

21222

726

25

223

222

221 have we,1 Since

rrrvvv

rrr

Computing Sign of γ( ) ( ) ( )( )

signs theReverse

0 If 131211 >+++ xWWW TZrYrXrx

Page 10: Camera Parameters - UCF Computer Science · 1 CAP5415 Computer Vision Spring 2003 Khurram Hassan-Shafique Camera Parameters X Y Z C Image plane Focal plane M m (X (C ),Y C,Z C) (u(C),v(C),

10

Estimating Camera ParametersComputing third row of Rotation Matrix

213 rrr ×=

Computing Zvu Tff and ,

( ) ( ) ( ) ( )( ) ( ) ( ) ( )( )XW

iW

iW

iuZW

iW

iW

iI

i TZrYrXrfTZrYrXru +++−=+++ 131211333231

( ) ( )iiiii ZYXvu ,, and ,pair ingcorrespondeach For

bf

TA

u

Z =��

���

� Solve

Estimating Camera Parameters Computing Image Center ( )00 ,vu

Let T be a triangle on the image plane defined by the threeVanishing points of three mutually orthogonal sets of Parallel lines in space. The image center is the orthocenter of T

Page 11: Camera Parameters - UCF Computer Science · 1 CAP5415 Computer Vision Spring 2003 Khurram Hassan-Shafique Camera Parameters X Y Z C Image plane Focal plane M m (X (C ),Y C,Z C) (u(C),v(C),

11

Suggested Readings:� Chapter 6, Emanuele Trucco, Alessandro Verri,

"Introductory Techniques for 3-D Computer Vision", Prentice Hall, 1998

� Chapter 1, Mubarak Shah, "Fundamentals of Computer Vision"