Sei sulla pagina 1di 5

ZHANG’S CAMERA CALIBRATION:STEP BY STEP

LUCAS TEIXEIRA, MARCELO GATTASS, AND MANUEL FERNANDEZ

1. Introduction
In this text we present an implementation of the algorithm for camera cali-
bration proposed by Zhengyou Zhang in ”A Flexible New Technique for Camera
Calibration”. Our implementation seeks to be as close as possible to the algorithm
described by Zhang. The technique proposed by Zhang only requires the camera to
observe a planar pattern shown at a few (at least two) different orientations. In the
camera’s model used we consider the intrinsic parameters, the extrinsic parameters
and the radial lens distortion. This method proposes an analytic solution to solve
these parameters and then create the best approximation using a minimization
method.

2. Description of the implantation


Inputs:
• Three groups of pair points, in each group contain at least 8 pair points
corresponding image(m) to the model(M)
• size of image - h and w
Steps:
(1) Normalize all image points.
• build the normalization of matrix N
 2.0 
w 0 −1
N = 0 2.0
h −1  matrix0 s normalization
0 0 1
• For all groups
– For all image points m do m̃’ = Nm̃
 
u  
u
m̃ = v
  ⇔m= image point
v
1
(2) Computes the homography (H’) for each group - see details on appendix 1
(3) Estimate the value of B:
• Build matrix V
 
B11 B12 B13
B =  B12 B22 B23  , symetric.
B13 B23 B33

Date: July 06, 2006.


Key words and phrases. Camera calibration, calibration from planes, 2D pattern, absolute
conic, projective mapping, lens distortion, closed-form solution, maximum likelihood estimation,
flexible setup.
1
2 LUCAS TEIXEIRA, MARCELO GATTASS, AND MANUEL FERNANDEZ

 
b= B11 B12 B22 B13 B23 B33

 
Pi0 Pi1 (Pi0 Pi1 + Pi3 Pi1 ) Pi3 Pi4 (Pi0 Pi7 + Pi6 Pi1 ) (Pi3 Pi7 + Pi6 Pi7 ) Pi6 Pi7
Gi =
Pi20 − Pi21 2(Pi0 Pi1 − Pi3 Pi1 ) Pi23 − Pi24 2(Pi0 Pi7 − Pi6 Pi1 ) 2(Pi3 Pi7 − Pi6 Pi7 ) Pi26 − Pi27
 
G1
 G2 
V =
 
.. 
 . 
Gk
• Solve the system Vb=0, where b is the variable
• From solution b build B
(4) From B estimate parameter of A’
• Solve these calculations and mount A’
 0
α γ 0 u00

A0 =  0 β 0 v00  normalized homography


0 0 1

B12 B13 − B11 B23


(1) v00 = 2
B13 B22 − B12

2
B12 + v00 (B12 B13 − B11 B23 )
(2) λ0 = B33 −
B11
r
0 λ0
(3) α =
B11
s
λ0 B11
(4) β0 = 2
B11 B22 − B12

−B12 α2 β
(5) γ0 =
λ0

γ 0 v0 B13 α02
(6) u00 = −
β0 λ0

γ 0 v0 B13 α02
(7) u00 = −
β0 λ0
• For obtain A : Solve
A = N −1 A0
 
α γ u0
A =  0 β v0 
0 0 1
ZHANG’S CAMERA CALIBRATION:STEP BY STEP 3

(5) Estimate the matrix K:


input: -matrix A
-One of the homographies of the matrix K will be relative to the coordinate
system
• Undo normalization homography if necessary
H = N −1 H 0
 
| | |
H =  h1 h2 h 3 
| | |
• Computes the parameter of K

K = [R t]
   
| | | t1
R =  r1 r2 r3  , t =  t2 
| | | t3
1
(8) λr1 =
kA−1 h 1k

1
(9) λr2 =
kA−1 h 2k

λr 1 + λ r2
(10) λr 3 =
2

(11) r1 = λr1 A−1 h1

(12) r2 = λr2 A−1 h2

(13) r3 = r1 × r2

(14) t = λr3 A−1 h3


• minimize error using Levenberg-Marquardt
(6) Calculate the radial distortion
(ui − u0 )(x2i + yi2 ) (ui − u0 )(x2i + yi2 )
 
Di =
(vi − v0 )(x2i + yi2 ) (vi − v0 )(x2i + yi2 )
 
(uui − ui )
di =
(uvi − vi )
 
D1
 D2 
D= . 
 
 .. 
Dn
4 LUCAS TEIXEIRA, MARCELO GATTASS, AND MANUEL FERNANDEZ

 
k1
k=
k2
 
d1
 d2 
d=
 
.. 
 . 
dn
• Mount matrix D and d
• solve the system Dk = d, where k is the variable.
• minimize error using Levenberg-Marquardt

3. Appendix 1
Computes the homography (H)
input: list of pairs of points, each pair is composed for a point M of the model and
a point m that is the projection of point M in the image
   
P0 P1 P2 −− h̄1 −−
H =  P3 P4 P5  =  −− h̄2 −−  homography
P6 P7 P8 −− h̄3 −−
 
M̃1T 0T −u1 M̃1T
 
X1 Y1 W1 0 0 0 −u1 X1 −u1 Y1 −u1 W1

 0T M̃1T −v1 M̃1T  
  0 0 0 X1 Y1 W1 −v1 X1 −v1 Y1 −v1 W1 
M̃2T 0T −u2 M̃2T

X2 Y2 W2 0 0 0 −u2 X2 −u2 Y2 −u2 W2
   
   
0T M̃2T −v2 M̃2T 0 0 0 X2 Y2 W2 −v2 X2 −v2 Y2 −v2 W2
  
L= = 

 ..   .. 
.

.
  
   
 M̃nT 0T −un M̃nT Xn Yn Wn 0 0 0 −un Xn −un Yn −un Wn
   

0T M̃nT −vn M̃nT 0 0 0 Xn Yn Wn −vn Xn −vn Yn −vn Wn
 
  Xi
Xi  Yi 
M̃i =  Yi  ⇔   0 

Wi
Wi
 
P0
 P1 
 
 T   P2 
 
h̄1  P3 
 
T 
x = h̄2
 =  P4 


T  P5 
h̄3  
 P6 
 
 P7 
P8
• mount the matrix L
• solve the system Lx = 0, where x is the variable.
• minimize error using Levenberg-Marquardt.
ZHANG’S CAMERA CALIBRATION:STEP BY STEP 5

E-mail address, Lucas: weblucas@terra.com.br

E-mail address, Marcelo: mgattass@tecgraf.puc-rio.br

E-mail address, Manuel: manuel@tecgraf.puc-rio.br

Potrebbero piacerti anche