Title: Stanford CS223B Computer Vision, Winter 200809 Lecture 4 Camera Calibration
1Stanford CS223B Computer Vision, Winter
2008/09Lecture 4 Camera Calibration
- Professor Sebastian Thrun
- CAs Ethan Dreyfuss, Young Min Kim, Alex Teichman
2Todays Goals
- Calibration Problem definition
- Solution by nonlinear Least Squares
- Solution via Singular Value Decomposition
- Homogeneous Coordinates
- Distortion
- Calibration Software
3Camera Calibration
Perspective Equations
Feature Extraction
4Perspective Projection, Remember?
O
X
x
f
Z
5Intrinsic Camera Parameters
- Determine the intrinsic parameters of a camera
(with lens) - What are Intrinsic Parameters?
- (can you name 7?)
6Intrinsic Parameters
O
X
f
Z
7Intrinsic Camera Parameters
- Intrinsic Parameters
- Focal Length f
- Pixel size sx , sy
- Image center ox , oy
- (Nonlinear radial distortion coefficients k1 ,
k2) - Calibration Determine the intrinsic parameters
of a camera
8Why Intrinsic Parameters Matter
9Questions
- Can we determine the intrinsic parameters by
exposing the camera to many known objects? - If so,
- How often do we have to see the object?
- How many features on the object do we need?
10Example Calibration Pattern
Calibration Pattern Object with features of
known size/geometry
11Harris Corner Detector(see slides in last
lecture)
12Intrinsics and Extrinsics
- Intrinsics
- Focal Length f
- Pixel size sx , sy
- Image center ox , oy
- Extrinsics
- Location and orientation of k-th calib. pattern
13Calibration
- Known calibration object, many views
- Compute intrinsics and extrinsics
- (Retain intrinsics, toss extrinsics)
14Why Tilt the Board?
15Experiment 1 Parallel Board
16Projective Perspective of Parallel Board
30cm
10cm
20cm
17Experiment 2 Tilted Board
18Projective Perspective of Tilted Board
30cm
10cm
20cm
500cm
50cm
100cm
19Perspective Camera Model
- Step 1 Transform into camera coordinates
- Step 2 Transform into image coordinates
20Perspective Camera Model
- Step 1 Transform into camera coordinates
- Step 2 Transform into image coordinates
21The Full Perspective Camera Model
22The Calibration Problem
- Given
- Calibration pattern with N corners
- K views of this calibration pattern
- Recover the intrinsic parameters
- Well also recover the extrinsics, but we wont
care about them -
23Calibration Questions
- Can we determine the intrinsic parameters by
exposing the camera to many known objects? - If so,
- How often do we have to see the object?
- How many features on the object do we need?
- Do we need to see object at angle? Yes.
24Todays Goals
- Calibration Problem definition
- Solution by nonlinear Least Squares
- Solution via Singular Value Decomposition
- Homogeneous Coordinates
- Distortion
- Calibration Software
25Calibration constraints
- Step 1 Transform into camera coordinates
- Step 2 Transform into image coordinates
26Camera Calibration
27Calibration by nonlinear Least Squares
- Least Mean Square
- Gradient descent
28The Calibration Problem Quiz
- Given
- Calibration pattern with N corners
- K views of this calibration pattern
- How large would N and K have to be?
- Can we recover all intrinsic parameters?
29Intrinsic Parameters, Degeneracy
O
X
f
Z
30Summary Parameters, Revisited
- Extrinsic
- Rotation
- Translation
- Intrinsic
- Focal length
- Pixel size
- Image center coordinates
31The Calibration Problem Quiz
- Given
- Calibration pattern with N corners
- K views of this calibration pattern
- How large would N and K have to be?
- Can we recover all intrinsic parameters?
NO
32Constraints
- N points
- K images ? 2NK constraints
- 4 intrinsics (distortion 2)
- 6K extrinsics
- ? need 2NK 6K4
- ? (N-3)K 2
Hint may not be co-linear
33The Calibration Problem Quiz
need (N-3)K 2
Hint may not be co-linear
34Problem with Least Squares
- Many parameters (slow)
- Many local minima! (slower)
35Todays Goals
- Calibration Problem definition
- Solution by nonlinear Least Squares
- Solution via Singular Value Decomposition
- Homogeneous Coordinates
- Distortion
- Calibration Software
36SVD Solution
- Replace rotation matrix by arbitrary matrix
- Transform into linear set of equations
- Solve via SVD
- Enforce rotation matrix
- Solve for remaining parameters
37Perspective Camera Model
- Step 1 Transform into camera coordinates
- Step 2 Transform into image coordinates
38Homogeneous Coordinates
(Homogeneous Coordinates)
(nonlinear perspective projection)
39Affine Problem Relaxation
?
40Affine Problem Relaxation
?
41Calibration via SVD see Trucco/Verri
42Calibration via SVD
Ngt7 points, not coplanar
43Calibration via SVD
44Calibration via SVD
Known X Y Z, x, y Unknown v
A has rank 7 (without proof)
45Calibration via SVD
- Remaining Problem
- See book
46Summary, SVD Solution
- Replace rotation matrix by arbitrary matrix
- Transform into linear set of equations
- Solve via SVD
- Enforce rotation matrix (see book)
- Solve for remaining parameters (see book)
47Comparison
- Nonlinear least squares
- Gaussian image noise
- Many local minima
- Iterative
- Can incorporate non-linear distortion
- Singular Value Decomp.
- Gaussian parameter noise (algebraic)
- No local minima
- Closed form
- Cannot handle distortion
48Todays Goals
- Calibration Problem definition
- Solution by nonlinear Least Squares
- Solution via Singular Value Decomposition
- Homogeneous Coordinates
- Distortion
- Calibration Software
49Homogeneous Coordinates
- Idea In homogeneous coordinates most operations
become linear! - Extract Image Coordinates by Z-normalization
50Todays Goals
- Calibration Problem definition
- Solution by nonlinear Least Squares
- Solution via Singular Value Decomposition
- Homogeneous Coordinates
- Distortion
- Calibration Software
51Advanced CalibrationNonlinear Distortions
- Barrel and Pincushion
- Tangential
52Barrel and Pincushion Distortion
tele
wideangle
53Models of Radial Distortion
distance from center
54Image Rectification (to be continued)
55Distorted Camera Calibration
- Set k1k20, solve for undistorted case
- Find optimal k1,k2via nonlinear least squares
- Iterate
- ?Tends to generate good calibrations
56Tangential Distortion
cheap CMOS chip
cheap lens
image
cheap glue
cheap camera
57Todays Goals
- Calibration Problem definition
- Solution by nonlinear Least Squares
- Solution via Singular Value Decomposition
- Homogeneous Coordinates
- Distortion
- Calibration Software
58Calibration Software Matlab
59Calibration Software OpenCV
60State-of-the-art calibration
- Z. Zhang Flexible Camera Calibration By Viewing
a Plane From Unknown Orientations (1999) - Solves correspondence problem
- Works with planar calibration pad
- Works well in practice
61Your Homework Assignment
62Summary
- Calibration Problem definition
- Solution by nonlinear Least Squares
- Solution via Singular Value Decomposition
- Homogeneous Coordinates
- Distortion
- Calibration Software
- NOT DISCUSSED correspondence