Lecturer 7: Camera Calibration: Dandhi Kuswardhana, PH.D: EL462/ Visi Komputer
Lecturer 7: Camera Calibration: Dandhi Kuswardhana, PH.D: EL462/ Visi Komputer
Camera Calibration
A. Criminisi, M. Kemp, and A. Zisserman,Bringing Pictorial Space to Life: computer techniques for the
analysis of paintings, Proc. Computers and the History of Art, 2002
Things aren’t always as they appear…
http://en.wikipedia.org/wiki/Ames_room
Single-view ambiguity
X?
X?
X?
x
Single-view ambiguity
Single-view ambiguity
Image source
Anamorphic perspective
Image
source
( X ,Y , Z ) ( f X / Z , f Y / Z )
X X
f X f 0
Y Y x = PX
Z fY = f 0
Z
Z 1 0
1
1
Principal point
px
( X , Y , Z ) ( f X / Z + px , f Y / Z + p y )
X X
f X + Z px f px 0
Y Y
Z f Y + Z py = f py 0
Z
Z
1 0
1
1
Principal point offset
py principal point: ( px , p y )
px
X
f px 0
Y
= f py
0
Z
1 0
1
Principal point offset
py principal point: ( px , p y )
px
X X
px f p x 1 0 f px 0
Y Y
py = f py 1 0 = f py 0
Z Z
1 1 0 1 0
1
calibration matrix projection matrix
1
K [I | 0]
P = KI | 0
Pixel coordinates
1 1
Pixel size:
mx m y
mx f p x x x
K = my
f p y = y y
1 1 1
pixels/m m pixels
Camera rotation and translation
~
(
~ ~
X cam = R X − C )
coords. of point coords. of camera center
in camera frame in world frame
coords. of a point
in world frame
Camera rotation and translation
~
( ~ ~
X cam = R X − C )
3D transformation
matrix (4 x 4)
Camera rotation and translation
~
( ~ ~
X cam = R X − C )
3D transformation
matrix (4 x 4)
Camera rotation and translation
2D 3D transformation
transformation matrix (4 x 4)
perspective
matrix (3 x 3) projection
matrix (3 x 4)
Camera rotation and translation
Camera rotation and translation
~
t = − RC
Camera parameters P = K R t
• Intrinsic parameters
• Principal point coordinates
mx f p x x x
• Focal length K = my f p y = y y
• Pixel magnification factors 1 1 1
• Skew (non-rectangular pixels)
• Radial distortion
Camera parameters P = K R t
• Intrinsic parameters
• Principal point coordinates
• Focal length
• Pixel magnification factors
• Skew (non-rectangular pixels)
• Radial distortion
• Extrinsic parameters
~
• Rotation and translation relative
to world coordinate system
P = K R − RC
• What is the projection of the coords. of
camera center
camera center?
in world frame
~
~ C
PC = K R − RC = 0 The camera center is the
null space of the
1 projection matrix!
Camera calibration
x = K R t X
X
x * * * * Y
y = * * * *
Z
* * * *
1
Source: D. Hoiem
Camera calibration
• Given n points with known 3D coordinates Xi
and known image projections xi, estimate the
camera parameters
Xi
xi
P?
Camera calibration: Linear method
xi P1 X i
T
y P T X = 0
x i = PX i x i PX i = 0 i 2 i
1 P3T X i
0 − XTi yi XTi P1
T
X T
i 0 − xi X i P2 = 0
− yi XTi
T
xi X i 0 P3
X?
x2
x1
O1 O2
Triangulation
• We want to intersect the two visual rays
corresponding to x1 and x2, but because of
noise and numerical errors, they don’t meet
exactly
X?
x2
x1
O1 O2
Triangulation: Geometric approach
• Find shortest segment connecting the two
viewing rays and let X be the midpoint of that
segment
x2
x1
O1 O2
Triangulation: Nonlinear approach
Find X that minimizes
d (x1 , P1 X) + d (x 2 , P2 X)
2 2
X?
P1X
x2
x1
P2X
O1 O2
Triangulation: Linear approach
1 x1 = P1 X x1 P1 X = 0 [x1 ]P1 X = 0
2 x 2 = P2 X x 2 P2 X = 0 [x 2 ]P2 X = 0
0 − az a y bx
a b = az 0 − a x by = [a ]b
− a y ax 0 bz
Triangulation: Linear approach
1 x1 = P1 X x1 P1 X = 0 [x1 ]P1 X = 0
2 x 2 = P2 X x 2 P2 X = 0 [x 2 ]P2 X = 0
Camera 1 Camera 3
Camera 2
R1,t1 R2,t2 R3,t3
• Given 2D point correspondences between multiple images, compute
the camera parameters and the 3D points
Preview: Structure from motion
?
Camera 1 Camera 3
Camera 2
R1,t1 R2,t2 R3,t3
• Structure: Given known cameras and projections of the same 3D
point in two or more images, compute the 3D coordinates of that point
• Triangulation!
Preview: Structure from motion
Camera 1 Camera 3
R1,t1 ? Camera 2
R2,t2 ? ? R3,t3
• Motion: Given a set of known 3D points seen by a camera, compute
the camera parameters
• Calibration!
Useful reference