Professional Documents
Culture Documents
Camera Calibration
Camera Calibration
((X,Y,Z)
, , )
P
origin
p
(x,y)
principal point
(optical
center)
fX
x=
Z
fY
principal
p p y=
point Z
⎛ x ⎞ ⎛ fX ⎞ ⎡ f 0 0⎤ ⎛ X ⎞
⎜ ⎟ ⎜ ⎟ ⎢ ⎥ ⎜ ⎟
⎜ y ⎟ ~ ⎜ fY ⎟ = ⎢ 0 f 0⎥ ⎜ Y ⎟
⎜1⎟ ⎜ Z ⎟ ⎢0 1⎥⎦⎝⎜ Z ⎟⎠
⎝ ⎠ ⎝ ⎠ ⎣ 0
Pinhole camera model
((X,Y,Z)
, , )
P
origin
p
(x,y)
principal point
(optical y
center)
x
⎛ x ⎞ ⎛ fX ⎞ ⎡ f 0 0⎤ ⎛ X ⎞
⎜ ⎟ ⎜ ⎟ ⎢ ⎥ ⎜ ⎟
⎜ y ⎟ ~ ⎜ fY ⎟ = ⎢ 0 f 0⎥ ⎜ Y ⎟
⎜1⎟ ⎜ Z ⎟ ⎢0 1⎦⎥⎜⎝ Z ⎟⎠
⎝ ⎠ ⎝ ⎠ ⎣ 0
Pinhole camera model
((X,Y,Z)
, , )
P
origin
p
(x,y)
principal point
(optical y
center)
x
⎛ x ⎞ ⎛ fX ⎞ ⎡ f 0 x0 ⎤⎛ X ⎞
⎜ ⎟ ⎜ ⎟ ⎢ ⎥ ⎜ ⎟
⎜ y ⎟ ~ ⎜ fY ⎟ = ⎢ 0 f y0 ⎥ ⎜ Y ⎟
⎜1⎟ ⎜ Z ⎟ ⎢0 1 ⎦⎥⎜⎝ Z ⎟⎠
⎝ ⎠ ⎝ ⎠ ⎣ 0
Intrinsic matrix
K = ⎢⎢ 0 fy yc ⎥⎥
⎢⎣ 0 0 1 ⎥⎦
Intrinsic matrix
No distortion
Barrel
Pin Cushion Distortion
No distortion
Telephoto lens
Pin cushion
Modeling distortion
Distortion-Free: With Distortion:
X
fX 1. Project (X, Y, Z) xn =
x= to “normalized”
normalized
Z
Z image coordinates Y
yn =
Z
fY
y=
Z r 2 = xn2 + yn2
2. Apply radial distortion (
xd = xn 1 + κ 1r 2 + κ 2 r 4 )
yd = y (1 + κ r
n 1
2
+κ r )
2
4
3. Apply
pp y focal length
g x = fxd + xc
translate image center y = fyd + yc
⎛ X '⎞ ⎛X⎞
⎜ ⎟ ⎜ ⎟
⎜ Y ' ⎟ = R 3×3 ⎜ Y ⎟ + t
⎜ Z'⎟ ⎜Z⎟
⎝ ⎠ ⎝ ⎠
⎛ x⎞ ⎡ f 0 xc ⎤
⎛X⎞
⎜ ⎟ x ~ K [R t ]X
⎜ ⎟ ⎢
yc ⎥[R t ]⎜ ⎟
⎥ ⎜Y ⎟
⎜ y⎟ ~ ⎢0 f
⎜1⎟ ⎢0 Z
⎝ ⎠ ⎣ 0 1 ⎥⎦ ⎜ ⎟ extrinsic matrix
⎜1⎟
⎝ ⎠
Two kinds of parameters
⎛X⎞ ⎛X⎞
⎛ x⎞ ⎡ f 0 xc ⎤ ⎜ ⎟ ⎡a b c d ⎤⎜ ⎟
⎜ ⎟ ⎢
yc ⎥[R t ]⎜ ⎟ = ⎢ e
⎥ ⎜Y ⎟ ⎢ ⎥ ⎜Y ⎟
⎜ y⎟ ~ ⎢0 f f g h ⎥⎜ ⎟
⎜1⎟ ⎢0 Z Z
⎝ ⎠ ⎣ 0 1 ⎥⎦ ⎜ ⎟ ⎢⎣ i j k l ⎥⎦⎜⎜ ⎟⎟
⎜1⎟
⎝ ⎠ ⎝1⎠
Other projection models
Orthographic projection
Image World
• Scaled orthographic
– Also called “weak perspective”
• Affine projection
– Also called “paraperspective”
Fun with perspective
Perspective cues
Perspective cues
Fun with perspective
Ames room
Forced perspective in LOTR
Elijah Wood: 5' 6" (1.68 m) Ian McKellen 5' 11" (1.80 m)
Camera calibration
Camera calibration
⎛X⎞ ⎛X⎞
⎛ x⎞ ⎡ f 0 xc ⎤ ⎜ ⎟ ⎡a b c d ⎤⎜ ⎟
⎜ ⎟ ⎢
yc ⎥[R t ]⎜ ⎟ = ⎢ e
⎥ ⎜Y ⎟ ⎢ ⎥ ⎜Y ⎟
⎜ y⎟ ~ ⎢0 f f g h ⎥⎜ ⎟
⎜1⎟ ⎢0 Z Z
⎝ ⎠ ⎣ 0 1 ⎥⎦ ⎜ ⎟ ⎢⎣ i j k l ⎥⎦⎜⎜ ⎟⎟
⎜1⎟
⎝ ⎠ ⎝1⎠
• Estimate both intrinsic and extrinsic
parameters
• Mainly, two categories:
1. Using objects with known geometry as
reference
2. Self calibration (structure from motion)
Camera calibration approaches
• Directly estimate 11
unknowns in the M matrix
using known 3D points
((Xi,Yi,Zi)
, , ) and measured
feature positions (ui,vi)
x ~ K [R t ]X = MX
Linear regression
Linear regression
⎡m00 ⎤
⎢m ⎥
⎢ 01 ⎥
⎢m02 ⎥
⎢ ⎥
⎢ m03 ⎥
⎢ m10 ⎥
⎡Xi Yi Zi 1 0 0 0 0 − ui X i − uiYi − ui Z i ⎤ ⎢ ⎥ ⎡ui ⎤
⎢0 ⎥ ⎢ m11 ⎥ = ⎢ ⎥
⎣ 0 0 0 Xi Yi Zi 1 − vi X i − viYi − viYi ⎦ ⎢ ⎥ ⎣ vi ⎦
m
⎢ 12 ⎥
⎢ m13 ⎥
⎢m ⎥
⎢ 20 ⎥
⎢ m21 ⎥
⎢ ⎥
⎣m22 ⎦
Linear regression
⎡ m00 ⎤
⎢m ⎥
⎢ 01 ⎥
⎢ m02 ⎥
⎢ ⎥
⎡ X 1 Y1 Z1 1 0 0 0 0 − u1 X 1 − u1Y1 − u1Z1 ⎤ ⎢ m03 ⎥
⎢ 0 0 0 0 X 1 Y1 Z1 1 − v1 X 1 − v1Y1 − v1Y1 ⎥ ⎢ m10 ⎥
⎢ ⎥ ⎢ ⎥ ⎡ui ⎤
⎢ M ⎥ ⎢ m11 ⎥ = ⎢ v ⎥
⎢ X N YN Z N 1 0 0 0 0 − uN X N − u N YN − u N Z N ⎥ ⎢ ⎥ ⎣ i ⎦
m12
⎢ 0 0 0 0 X N YN Z N 1 − vN X N − v N YN − v N YN ⎥ ⎢ ⎥
⎣ ⎦ ⎢ m13 ⎥
⎢m ⎥
⎢ 20 ⎥
⎢ m21 ⎥
⎢ ⎥
⎣m22 ⎦
⇔ A ( Ax − b) = 0
T
⇔x= A A A b
T
(
−1 T
)
Normal equation (Differential Interpretation)
E (x) = Ax − b
2
E (x) = Ax − b
2
= (Ax − b ) (Ax − b )
T
= (x T
A −b
T T
)(Ax − b )
Carl Friedrich Gauss
= x A Ax − b Ax − x A b + b b
T T T T T T
(
= x A Ax − A b x − A b x + b b
T T T
)
T
( T
)
T T
∂E
= 2 A Ax − 2 A b
T T
∂x Who
h invented
i d Least Square?
S ?
Nonlinear optimization
2 2
N
1 ⎛ m00 X i + m01Yi + m02 Z i + m03 ⎞ 1 ⎛ m10 X i + m11Yi + m12 Z i + m13 ⎞
= ∑ 2 ⎜⎜ ui − ⎟⎟ + 2 ⎜⎜ vi − ⎟⎟
i =1 σ i ⎝ m20 X i + m21Yi + m22 Z i + 1 ⎠ σ i ⎝ m20 X i + m21Yi + m22 Z i + 1 ⎠
number of parameters
Nonlinear least square fitting
Function minimization
Least square is related to function minimization.
• Directly estimate 11
unknowns in the M matrix
using known 3D points
(Xi,Yi,Zi) and measured
feature positions (ui
(ui,vi)
vi)
x ~ K [R t ]X = MX
Camera Model:
Recap: Calibration
• Directly estimate 11
unknowns in the M matrix
using known 3D points
(Xi,Yi,Zi) and measured
feature positions (ui
(ui,vi)
vi)
x ~ K [R t ]X = MX
Linear Approach:
Recap: Calibration
• Directly estimate 11
unknowns in the M matrix
using known 3D points
(Xi,Yi,Zi) and measured
feature positions (ui
(ui,vi)
vi)
x ~ K [R t ]X = MX
NonLinear Approach:
2 2
N
⎛ m00 X i + m01Yi + m02 Z i + m03 ⎞ ⎛ m10 X i + m11Yi + m12 Z i + m13 ⎞
∑ ⎜⎜ ui −
i =1 ⎝
⎟⎟ + ⎜⎜ vi −
m20 X i + m21Yi + m22 Z i + 1 ⎠ ⎝ m20 X i + m21Yi + m22 Z i + 1 ⎠
⎟⎟
Practical Issue