Professional Documents
Culture Documents
Camera Calibration
Camera Calibration
1
0
0
0
1 0 0
0 0
0 0
s
s
s
z
y
x
f
f
w
v
u
w v y w u x
i i
/ , / = =
If world and image points are represented by homogeneous
vectors, central projection is a linear transformation:
Transformation From Lengths to Pixels
s
s
i
s
s
i
z
y
f y
z
x
f x
=
=
Image point
(x
i
, y
i
, f)
x
pix
y
pix
s
s s
y i y pix
s
s s
x i x pix
z
y z y
k f y y k y
z
x z x
k f x x k x
0
0
0
0
+
= + =
+
= + =
y
x
1
0
0
0
1 0 0
0
0
'
'
'
0
0
s
s
s
y
x
z
y
x
y
x
w
v
u
' / '
' / '
w v y
w u x
pix
pix
=
=
then
y y
x x
k f
k f
=
=
with
Image center
x
0
y
0
Transformation uses:
image center (x
0
, y
0
)
scaling factors k
x
and k
y
Internal Camera Parameters
1
0
0
0
1 0 0
0
'
'
'
0
0
s
s
s
y
x
z
y
x
y
x s
w
v
u
y y
x x
k f
k f
=
=
with
x
and
y
focal lengths in pixels
x
0
and y
0
coordinates of image center in pixels
Added parameter s is skew parameter
K is called calibration matrix. Five degrees of freedom.
K is a 3x3 upper triangular matrix
' / '
' / '
w v y
w u x
pix
pix
=
=
[ ]
3 3
0 | I K =
0 1 0 0
0 0 1 0
0 0 0 1
1 0 0
0
0
0
0
1 0 0
0
0
0
0
0
y
x s
y
x s
y
x
y
x
S
S
S
z
y
x
S
S
S
Z
Y
X
T
T
T
z
y
x
K.k J.k I.k
K.j J.j I.j
K.i J.i I.i
Z
CO = T translation vector
Homogeneous Coordinates
S
S
S
z
y
x
S
S
S
Z
Y
X
T
T
T
z
y
x
K.k J.k I.k
K.j J.j I.j
K.i J.i I.i
1 1 1
S
S
S
z
y
x
S
S
S
Z
Y
X
T
T
T
z
y
x
0 0 0
K.k J.k I.k
K.j J.j I.j
K.i J.i I.i
1
1
1
S
S
S
S
S
S
Z
Y
X
z
y
x
T
3
0
T R
From Camera Coordinates
to World Coordinates 3
(X
s
, Y
s
, Z
s
)
(x
s
, y
s
, z
s
)
O
M
X
z
x
k
i
I
K
J
j
C
K ) - J ) - I ) - k j i
OC - OM CM
C S C S C S S S S
Z Z Y Y X X z y x ( ( ( + + = + +
=
K.i ) - J.i ) - I.i ) -
C S C S C S S
Z Z Y Y X X x ( ( ( + + =
) C - (X R x
cam
~
=
Z
) C -R (T
~
=
system coordinate in world expressed OC vector is C
~
Here we use instead of T
Homogeneous Coordinates 2
1
1
~
1
S
S
S
S
S
S
Z
Y
X
z
y
x
T
3
0
C R - R
C R -
~
Linear Transformation from
World Coordinates to Pixels
1
1
~
1
S
S
S
S
S
S
Z
Y
X
z
y
x
T
3
0
C R - R
[ ]
1
'
'
'
s
s
s
z
y
x
w
v
u
3 3
0 | I K
[ ]
1
1
~
'
'
'
S
S
S
Z
Y
X
w
v
u
T
3
3 3
0
C R - R
0 | I K
1
'
'
'
S
S
S
Z
Y
X
w
v
u
P
X P x =
Combine camera projection and coordinate
transformation matrices into a single matrix P
P has 11 degrees of freedom:
5 from triangular calibration matrix K, 3 from R and 3 from
P is a fairly general 3 x 4 matrix
left 3x3 submatrix KR is non-singular
Properties of Matrix P
[ ] X
0
C R - R
0 | I K x
T
3
3 3
=
1
~
[ ] [ ] [ ] C - | I R C R - R
0
C R - R
0 | I
3
T
3
3 3
~ ~
1
~
= =
[ ]X C - | I R K x
3
~
=
[ ] C - | I R K P
3
~
=
C
~
Further simplification of P:
Calibration
1. Estimate matrix P using scene points and
their images
2. Estimate the interior parameters and the
exterior parameters
Left 3x3 submatrix of P is product of upper-
triangular matrix and orthogonal matrix
[ ] C - | I R K P
3
~
=
Finding Camera Translation
Find homogeneous coordinates of C in the
scene
C is the null vector of matrix P
P C = 0:
Find null vector C of P using SVD
C is the unit singular vector of P corresponding to the
smallest singular value (the last column of V, where P
= U D V
T
is the SVD of P)
[ ] C - | I R K P
3
~
=
0
0
0
0
1
1 0 0
0 1 0
0 0 1
c
c
c
c
c
c
Z
Y
X
Z
Y
X
Finding Camera Orientation and
Internal Parameters
Left 3x3 submatrix Mof P is of form M=K R
K is an upper triangular matrix
R is an orthogonal matrix
Any non-singular square matrix Mcan be
decomposed into the product of an upper-
triangular matrix K and an orthogonal matrix R
using the RQ factorization
Similar to QR factorization but order of 2 matrices is
reversed
RQ Factorization of M
Compute
Multiply Mby R
x
. The resulting term at (3,2) is zero
because of the values selected for c and s
Multiply the resulting matrix by R
y
, after selecting c and
s so that the resulting term at position (3,1) is set to zero
Multiply the resulting matrix by R
z
, after selecting c and
s so that the resulting term at position (2,1) is set to zero
=
1 0 0
0 ' ' ' '
0 ' ' ' '
,
' 0 '
0 1 0
' 0 '
,
0
0
0 0 1
c s
s c
c s
s c
c s
s c
z y x
R R R
2 / 1 2
33
2
32
32
2 / 1 2
33
2
32
33
) (
,
) ( m m
m
s
m m
m
c
+
=
+
=
R K R R R K M K R R R M
T
x
T
y
T
z z y x
= = =
Computing Matrix P
Use corresponding image and scene points
3D points X
i
in world coordinate system
Images x
i
of X
i
in image
Write x
i
= P X
i
for all i
Similar problem to finding projectivity
matrix H (i.e. homography) in homework
Improved Computation of P
x
i
= P X
i
involves homogeneous
coordinates, thus x
i
and P X
i
just have to be
proportional:
Let p
1
T
, p
2
T
, p
3
T
be the 3 row vectors of P
=
i
T
3
i
T
2
i
T
1
i
X p
X p
X p
X P
0 =
i i
X P x
=
i
T
1 i i
T
2 i
i
T
3 i i
T
1 i
i
T
2 i i
T
3 i
i i
X p X p
X p X p
X p X p
X P x
' '
' '
' '
v u
u w
w v
0
' '
' '
' '
=
3
2
1
T
4
T
i i
T
i i
T
i i
T
4
T
i i
T
i i
T
i i
T
4
p
p
p
0 X X
X 0 X
X X 0
u v
u w
v w
vector 1 12 a is
p
p
p
3
2
1
Improved Computation of P,
contd
Third row can be obtained from sum of u
i
times first row - v
i
times second row
So we get 2 independent equations in 11
unknowns (ignoring scale)
With 6 point correspondences, we get
enough equations to compute matrix P
0
' '
' '
' '
=
3
2
1
T
4
T
i i
T
i i
T
i i
T
4
T
i i
T
i i
T
i i
T
4
p
p
p
0 X X
X 0 X
X X 0
u v
u w
v w
A p = 0
Solving A p = 0
Linear system A p = 0
When possible, have at least 5 times as
many equations as unknowns (28 points)
Minimize || A p || with the constraint
|| p || = 1
P is the unit singular vector of A corresponding
to the smallest singular value (the last column
of V, where A = U D V
T
is the SVD of A)
Called Direct Linear Transformation (DLT)
Improving P Solution with
Nonlinear Minimization
Find p using DLT
Use as initialization for nonlinear
minimization of
Use Levenberg-Marquardt iterative minimization
2
) , (
i
i
i
PX x
d
Radial Distortion
We have assumed that lines are imaged as
lines
Not quite true for real lenses
Significant error for cheap optics and for short
focal lengths
Scene
Image
Corrected image
Radial Distortion Modeling
In pixel cordinates the correction is written
Minimize
using lines known to be straight
(x,y) is radial projection of (x,y) on straight line
... 1 ) (
) ( ) (
) ( ) (
) ( ) (
2
2 1
2
0
2
0
2
0 0
0 0
+ + + =
+ =
=
=
r r r L
y y x x r
y y r L y y
x x r L x x
c
c
with
(x
0
, y
0
)
(x, y)
(x
c
, y
c
)
+ =
i
2 2
2 1
) ' ( ) ' ( ) , (
ci i ci i
y y x x f
(x, y)
(x, y)
Distorted line
And ideal line:
References
Multiple View Geometry in Computer Vision, R.
Hartley and A. Zisserman, Cambridge University
Press, 2000, pp. 138-183
Three-Dimensional Computer Vision: A
Geometric Approach, O. Faugeras, MIT Press,
1996, pp. 33-68
A Versatile Camera Calibration Technique for
3D Machine Vision, R. Y. Tsai, IEEE J. Robotics
& Automation, RA-3, No. 4, August 1987, pp.
323-344