You are on page 1of 28

IChenLin,AssistantProfessor

Dept.ofCS,NationalChiao TungUniversity

ComputerVision:7.CameraModels(a)

Objective
Geometriccameramodels
Intrinsicandextrinsicparameters
Projectionequations
Projection equations

Textbook:
DavidA.ForsythandJeanPonce,ComputerVision:AModernApproach,PrenticeHall,New
Jersey,2003.
Plentyofslidesaremodifiedfromthereferencelecturenotesorprojectpages:
Prof.J.Rehg,ComputerVision,GeorgiaInst.ofTech.
Prof.T.Darrell,ComputerVisionandApplications,MIT.
Prof T Darrell Computer Vision and Applications MIT
Prof.D.A.Forsyth,ComputerVision,UIUC.

2D coordinate frames & points


2Dcoordinateframes&points
Coordinatesxandy
Foramoregeneralcoordinaterepresentation,weusuallyuse
avectorform.
t f
j

x = op i

p =(x,y)T

y = op j
i
o

2D lines
2Dlines
Linel:ax+by=c <>(a,b)T(x,y)=c

p=(x,y)T

c
(a,b)T

Homogeneous coordinates
Homogeneouscoordinates
Uniformtreatmentofpointsandlines
Linepointincidence:lTp=0
j

staythesamewhenscaled:
p=(x,y,1)T~(kx,kx,k)T

l=(a,b,c)T~(ka,kb,kc)T

(a,b)T
i

Homogeneous coordinates (cont )


Homogeneouscoordinates(cont.)
Furthermore,
Weusehomogenouscoordinatestocombinerotationand
translationintosameframework:matrixtransformation.
Itallowseasytransformationbetweenframes common
betweencomputervisionandgraphics.

Camera pose
Camerapose
Toapplythecameramodel,objectsinthescenemustbe
expressedincameracoordinates.
y
c
w

x
z

z
World
Coordinates

Camera
Coordinates

Calibrationtargetlookstiltedfromcamera
viewpoint.Thiscanbeexplainedasa
difference in coordinate systems.
differenceincoordinatesystems.

Rigid body transformations


Rigidbodytransformations
Need
Needawaytospecifythesixdegreesoffreedomofarigid
a way to specify the six degreesoffreedom of a rigid
body.
3rotationand3translationDOFs.
3 rotation and 3 translation DOFs.
R,t:theextrinsicparameters.
v (vx, vy, vz)
w (wx, wy, wz)
c

y (0, 1, 0)
optic axis

u (ux, uy, uz)

x (1,0,0)
z (0,0,1)

Notations
Superscriptreferencescoordinateframe
Superscript references coordinate frame
APiscoordinatesofPinframeA
BPiscoordinatesofPinframeB

A x
A
A
P = y OP =
A z

kA

iA

OA

jA

) (

x iA +

) ( zk )

y jA +

Translation
B

P= P+ (OA )
A

kB

kA

iA

OA

iB
jA
P

OB

jB

Translation
Usinghomogeneouscoordinates,translationcanbe
expressedasamatrixmultiplication.
B

P = A P + BO A

BP I
=
1 0

OA AP

1 1

Translationiscommutative

Rotation
uuuv
OP = ( iA

jA

B
A

Ax
A
k A ) y = ( iB
Az

jB

P = AB R A P

meansdescribingframeAin
Thecoordinatesystemof
frameB

Bx
B
kB ) y
Bz

Rotation (fromframeAtoB)
Rotation
(from frame A to B)
i A .i B
B
i .j
R
=
A
A B
i A .k B

= B i A

k A .i B
k A . jB

k A .k B

jA .i B
j A . jB
jA .k B
B

jA

k A

A i TB
A T
= jB
A k TB

Orthogonal matrix: R-1 = RT

Example: Rotation about z axis


Example:Rotationaboutzaxis
What is the rotation matrix?

Combine 3 to get arbitrary rotation


Combine3togetarbitraryrotation
Euler
Eulerangles:Z,X
angles: Z X,YY
Heading,pitchroll:worldZ,newX,newY
Threebasicmatrices:ordermatters,butwe
Three basic matrices: order matters but wellllprobablynot
probably not
focusonthat
i ( ) 0
cos(( ) sin(
RZ ( ) = sin( ) cos( ) 0
0
0
1

0
0
1
RX ( ) = 0 cos( ) sin( )
0 sin(( ) cos(( )

cos( ) 0 sin( )
RY ( ) = 0
1
0
sin( ) 0 cos( )

Remind:applyingcoordinaterotation isequaltoapplyingrotation toobjects.

Rotation in homogeneous coordinates


Rotationinhomogeneouscoordinates
U
Usinghomogeneouscoordinates,rotationcanbeexpressed
i h
di
i
b
d
asamatrixmultiplication.
B

P = AB R A P

B P AB R 0 A P
=

1 0 1 1

Rotationisnotcommutative

Rigid transformations
Rigidtransformations

P = R P + OA
B
A

Rigid transformations (cont )


Rigidtransformations(cont.)
Unifiedtreatmentusinghomogeneouscoordinates.
Unified treatment using homogeneous coordinates

B P 1
=
1 0
AB R
= T
0

O A AB R 0 A P


1 0 1 1
B

OA A P

1 1

Invertible!

B P B AP
= AT
1
1

Perspective camera model


Perspectivecameramodel
Lineartransformationofperspectiveprojectioncoordinate.
u
p = v = [ I
w

X
1 0 0 0
Y

0]P = 0 1 0 0
Z
0 0 1 0
1

Recoverimage(normalized)coordinatebyprojection.
u
X
u =
=
w
Z
v
Y
v =
=
w
Z

Perspective projection
Perspectiveprojection
Recallperspectiveprojection
R ll
i
j i

http://commons.wikimedia.org/wiki/
File:Taiwan_HighSpeedRail_Train_Business_Class_Car.JPG

Affine camera model


Affinecameramodel
Pretend depth is constant (often OK !)
u =

X
Zr

v=

Y
Zr

Can also be written as a linear transformation :


X
u
1 0 0 0
v = 1 0 1 0 0 Y
Z
Z
r
w
0 0 0 Z r 1

Normalized Image coordinates


NormalizedImagecoordinates

1
O
u=X/Z = dimensionless !
u=X/Z=dimensionless!

Pixel units
Pixelunits
Pixelsareonagridofacertaindimension

f
O
u=k f X/Z = in pixels !
u=kfX/Z=inpixels!

[f]=m(inmeters)
[k]=pixels/m

Pixel coordinates
Pixelcoordinates
Weputthepixelcoordinateoriginontopleft
p
p
g
p

f
O
u=u0 +kfX/Z
+ k f X/Z

Pixel coordinates in 2D
Pixelcoordinatesin2D
(0 5 0 5)
(0.5,0.5)

640

X
Y
u0 + kf ,vv 0 + lf

Z
Z
480

( 0,v0)
(u

(640.5,480.5)
j

Intrinsic parameters (in references)


Intrinsicparameters(inreferences)
3 3 Calibratio
C lib ti n Matrix
M ti K
X
u
s u0 1 0 0 0
Y

p = v = K [ I 0] P =
v0 0 1 0 0
Z
w

1 0 0 1 0
1
Recover image (Euclidean) coordinates by normalizing :
u X + sY

u= =
+ u0
w
Z
v Y
v= =
+ v0
w Z

skew
5 Degrees of Freedom !
5DegreesofFreedom!

Intrinsic parameters (in the textbook)


Intrinsicparameters(inthetextbook)
3 3 Calibratio
C lib ti n Matrix
M ti K
x
u

0 1 0
0 0
u

p = v = K [ I
v0 0 1 0 0
z
sin
z

1
1 0 0 1 0
1
Recover image (Euclidean) coordinates by normalizing :

0] P =

u=
v=

x cot
y

z sin

+ v0

+ u0

cot

Combining intrinsic and extrinsic param


Combiningintrinsicandextrinsicparam.
Perspectiveprojectionmapping(includingintrinsicand
extrinsicparameters).
u
1

p = v = K [ I
z
1

1
= K wc R
z

c
w

0]TP =

cot

sin

1
O P = MP
z
5+6DOF=11!

u0 1 0 0 0

wc R

v0 0 1 0 0
0 0 1 0 0
1

x
y
c

O
w

1 z

1