3DCV_lec02_Calibration
3DCV_lec02_Calibration
1
Appetizer: Scene Flow
View of one camera of the stereo camera
slow
Mathematical How to solve the How to How to How to estimate How to minimize
Description optimization estimate estimate multiple camera the ICP error?
& How to find the problem Homographies? F and E Matrix? parameters?
Camera Parameters of calibration? How to triangulate?
Get 3D points
from Align multiple
L2: Camera Calibration L6/L7: Structure from Motion (SfM) L10: Point Cloud Registration
Multiple Views Point Clouds
Estimation of
Mapping 3D-2D Point Multiple Bundle Align multiple Iterative Closest
Intrinsic and Extrinsic Triangulation Drift
3D to 2D Correspondences Views Adjustment Point Clouds Point (ICP)
Parameters
How to constrain
the correspondence Introduce artificial features
search to a line?
L5: Epipolar Geometry L9: Structured Light L12/13/14: Selected Topics
Artificial Features
Mapping 2D point to Fundamental Essential Binary Phase Various additional
through an
line in second view Matrix Matrix Coding Shifting applications of 3DCV
active device
3
Overview
• Camera parameters
• Intrinsic parameters
• Extrinsic parameters
• Calibration procedure
• Computing camera matrix 𝑃
• Extracting extrinsic parameters 𝑅, 𝑡
• Extracting calibration matrix 𝐾
• Advanced calibration
• Representation of 3D rotation
4
Recall: Modeling projection
•Projection equations
• Compute intersection with Π’ of ray from P = (x,y,z) to O
• Derived using similar triangles
6
Slide by Steve Seitz
Perspective Projection Matrix
x
1 0 0 0 x
0 1 0 0 y = y x y
(f' , f' )
z z z
0 0 1 / f ' 0 z / f ' divide by the third
1 coordinate
7
Perspective Projection Matrix
Camera to World to 3D
2D Perspective
pixel coord.
point = trans. matrix
projection matrix camera coord.
trans. matrix
point
(3x1) (3x4) (4x1)
(3x3) (4x4)
8
Perspective Projection
For simplicity, we use the virtual image plane in front of the camera.
- Same results in the image plane (same image) but
- All variables/values are positive, ie. in front of the camera center and the horizontal flip of the image (what is simpler)
Definition used in
Computer Vision
(equivalent to the
previous formula) 9
Overview
• Homogenous coordinates and central linear projection
• Camera parameters
• Intrinsic parameters
• Extrinsic parameters
• Calibration procedure
• Computing camera matrix 𝑃
• Extracting extrinsic parameters 𝑅, 𝑡
• Extracting calibration matrix 𝐾
• Advanced calibration
• Representation of 3D rotation
10
Intrinsic Parameters – Pixel Coordinates
• Transformation uses:
▪ Principal point (𝑥0, 𝑦0)
▪ Scaling factors 𝑘𝑥 and 𝑘𝑦
11
Intrinsic Parameters - Calibration Matrix 𝐾
• Intrinsic parameters:
▪ α𝑥 = 𝑓𝑘𝑥 and α𝑦 = 𝑓𝑘𝑦 : “Focal lengths” in pixels
▪ 𝑥0 and 𝑦0 : Coordinates of principal point in pixels
▪ Added parameter 𝑠 is skew parameter
▪ Position of the principal point on the image (𝑥0, 𝑦0), in the optimal case
this is the image center (width/2, height/2).
▪ Focal length 𝑓.
▪ Scaling factors for row and column pixels 𝑘𝑥 and 𝑘𝑦 .
▪ Skew parameter 𝑠.
▪ Lens distortion.
13
Extrinsic Parameters
– World Coordinates and Camera Coordinates
14
Extrinsic Parameters – World Frame to Camera Frame
Rotation matrix
15
Extrinsic Parameters – Coordinate Transformation
16
Camera Matrix 𝑃 – Putting everything together
17
Overview
• Camera parameters
• Intrinsic parameters
• Extrinsic parameters
• Calibration procedure
• Computing camera matrix 𝑃
• Extracting extrinsic parameters 𝑅, 𝑡
• Extracting calibration matrix 𝐾
• Advanced calibration
• Representation of 3D rotation
18
Calibration – Procedure
• Calibration means finding the function (defined by the camera)
that maps 3D points to 2D image plane.
19
Calibration – Calibration Target
• Calibration target: Two perpendicular planes with chessboard pattern.
1. We know the 3D positions of the corners with respect to a coordinates system defined
on the target.
2. Place a camera in front of the target and we can locate the corresponding corners on
the image. This gives us the correspondences.
3. Recover the equation that describes imaging projection and camera’s internal
parameters. At the same time, also recover the relative orientation between the camera
and the target (pose).
20
Calibration – Finding Correspondences
• Multiple ways to find correspondences:
▪ Corner detector.
▪ Canny Edge detector plus fitting lines to the detected edges. Find the
intersections of the lines
▪ Manual input.
21
Calibration – Computing the Camera Matrix 𝑃
▪ 𝐱 i = 𝑃𝐗 i , 𝐱 i = (𝑥i , 𝑦i ), 𝐗 i = (𝑋i , 𝑌i , 𝑍i ), i = 1, …
22
Calibration – Computing the Camera Matrix P
23
Calibration – Computing the Camera Matrix P
▪ The third row can be obtained from the sum of 𝑢′i times the first row and
−𝑣′i times the second row.
Rank 2
24
Calibration – Computing the Camera Matrix 𝑃
▪ Linear system.
25
Calibration – Extracting Extrinsics
26
Calibration – Extracting Translation
27
Calibration – Extracting Rotation and Calibration Matrix
• Next we want to find the camera orientation and the internal parameters of the camera:
28
Calibration – Degenerate Case
Calibration points 𝐗 i , i = 1, … can not lie on the same plane!
In this case there would exist a mapping with only 8 degrees of freedom (called homography
→ next lecture).
Fitting a 𝑃-Matrix with 11 DOF is not uniquely defined!
29
Calibration – Back-Projection Error
▪ Compare their projections with the corresponding pixel coordinates of the points.
30
Advanced Calibration – Further Improvement
▪ Use received linear calibration as initialization for nonlinear methods for refinement.
▪ LM is more robust to local minima than e.g. the Gauss–Newton algorithm and the
method of gradient descent.
31
Advanced Calibration – Nonlinear Distortions
▪ Radial distortions (Barrel) Tangential distortions
32
Advanced Calibration - Nonlinear Distortions
• Dealing with (radial) distortion parameters
▪ Usually the points of a captured checkerboad are radially distorted.
→ Alternatingly estimate
▪ nter a enter
Intrinsic textit
a e textit
parameters , ) nter
, ) a entertextit a e x i,textit
i ) x i, i )
▪ Distortion parameters
ho ho o nload o nload ho erif ho oerif
nload o nload erif erif
▪ Notations for projected points in normalized image coordinates and pixel coordinates:
nter a e ongrightarro
nter a e begin align hat x xi xi nter a e begin align hat x i
xi xi
i
eriferif
ho o nload
ho o nload erif ho o nload
33
nter a e
nter textit
a e textit
, ) nter
, ) a entertextit
a e x i,textit
i ) x i, i )
Advanced
nter a e Calibration
begin align begin-pma
Nonlinear Distortions
nter a e begin align begin
ho ho o nload o nload ho erif ho oerif
nload o nload eri
▪ Relation between pixel and normalized image coordinates (assuming image plane with f=1)
▪ (Same relation for the distorted case)
34
nter a e
nter textit
a e textit
, ) nter
, ) a entertextit
a e x i,textit
i ) x i, i )
ho o nload erif
nter a e begin align hat 0
▪ hoInserting the above relations into Brown’s distortion model, we get the following equation in case of 𝑥𝑖 :
o nload erif
nter a e begin align hat 0
ho o nload erif
▪ Simplified:
35
nter a e
nter textit
a e textit
, ) nter
, ) a entertextit
a e x i,textit
i ) x i, i )
nter a e begin align hat 0
Advanced Calibrationerif- Nonlinear Distortions
ho o nload
ho ho o nload o nload ho erif ho oerif
nload o nload eri
• nter adistortion
Dealing with (radial) e beginparameters
align begin pmatrix
ho o nload erif
▪ Stacking the above equations for each point in each image, we get the following system of equations:
36
Advanced Calibration – Image Rectification
37
Calibration – Exemplarily Calibration Steps
38
Calibration – Direct Linear Calibration
• Advantage
▪ Very simple to formulate and solve.
• Disadvantages
▪ oesn’t tell o the camera parameters.
▪ oesn’t model radial distortion.
▪ Hard to impose constraints (e.g., known focal length).
▪ oesn’t minimize the right error f nction.
39
Calibration – Other Approach
42
Rotation – 3D Rotation Matrix
or
43
Rotation – Euler Angle
• Euler’s Theorem: Any two independent orthonormal coordinate frames can be related by a sequence of rotations (not
more than three) about coordinate axes, where no two successive rotations may be about the same axis.
• A sequence of rotations around the principle axes is called an Euler Angle Sequence.
• We just multiply a sequence of rotation matrices to build a matrix from a set of Euler angles.
44
Rotation – Euler Angle
• Euler angles for rotation 𝑹 = 𝑹𝒛𝑹𝒚𝑹𝒙:
45
Rotation – Euler Angle
46
Rotation – Euler Angle
▪ Rotation angles like roll (around x-axis), pitch (around y-axis) and yaw
(around z-axis) are often used in literature and in a lot of applications
(vehicles, aircrafts, robotics, etc).
X
Y
47
Rotation – Axis Angle
▪ Singularity at 𝜃 = 0.
48
Rotation – Quaternions
▪ Quaternion is a 4D vector:
49
Rotation – Quaternions
50
THANK YOU!
51