Title: Caltechs Matlab Calibration Toolbox
1Caltechs Matlab Calibration Toolbox
- Jason Derenick
- 23 November 2004
- CSE 497
2Discussion Outline
- Camera Model Derivation
- Two-step Calibration Procedure
- Caltech Matlab Toolbox Example
3Camera Model Derivation
- Based on the Pinhole Camera Model
- Map a world point and map to the camera frame
4Camera Model Derivation
- Project the camera point to the image plane
- Scale (convert metric units to pixels) and
translate
5Camera Model Derivation
- Problems
- Pinhole Model is only an approximation
- Does not account for any distortion
- Radial Distortion
- Tangential Distortion
- etc
- Solution
- Extend the model!
6Camera Model Derivation
where
7Calibration Procedure
- Traditional two-step process
- Direct Linear Transformation (DLT)
- Non-linear Parameter Approximation (NLPA)
8Step 1 DLT
- Step 1 Approximate the projection matrix
9Step 1 DLT (contd)
- Step 2 Apply RQ decomposition to get physical
parameters
where
l defines an overall scaling factor M defines the
rotation from object coordinates to camera
coordinates T defines the associated translation
10Step 2 NLPA
- Distortion parameters are non-linear
- Minimize the objective function
- Popular Least Squares Estimators
- Gauss-Newton Method
- Levenberg-Marquardt Least Squares Method
- Use the parameters from the DLT step as the
inputs into the algorithm
11Calibration Toolbox
- Done by Caltech for use in Matlab
- C language version available through Intel
- Automates much of the work
- Easy to use ?
12Calibration Toolbox Example
- Simple interface (calib_gui)
- Easy image loading (mosaic)
13Calibration Toolbox Example
- Extracting control points
Processing image 1... Using (wintx,winty)(5,5) -
Window size 11x11 (Note To reset the
window size, run script clearwin) Click on the
four extreme corners of the rectangular complete
pattern (the first clicked corner is the
origin)... Size dX of each square along the X
direction (30mm) 28.57 Size dY of each
square along the Y direction (30mm) 28.57 If
the guessed grid corners (red crosses on the
image) are not close to the actual corners, it is
necessary to enter an initial guess for the
radial distortion factor kc (useful for subpixel
detection) Need of an initial guess for
distortion? (no, otheryes)
14Calibration Toolbox Example
- Important global variables
- est_aspect_ratio
- center_optim
- est_dist
- est_alpha
15Calibration Toolbox Example
- Run calibration (4th order radial distortion)
Aspect ratio optimized (est_aspect_ratio 1) -gt
both components of fc are estimated
(DEFAULT). Principal point optimized
(center_optim1) - (DEFAULT). To reject principal
point, set center_optim0 Skew optimized
(est_alpha1). To disable skew estimation, set
est_alpha0. Distortion not fully estimated
(defined by the variable est_dist) Main
calibration optimization procedure - Number of
images 10 Gradient descent iterations
1...2...3...4...5...6...7...8...9...10...11...12..
.13...done Estimation of uncertainties...done Ca
libration results after optimization (with
uncertainties) Focal Length fc
814.36984 815.11998 4.86640 4.89023
Principal point cc 319.55863
285.07307 7.15010 7.58552 Skew
alpha_c -0.00011 0.00145 gt
angle of pixel axes 90.00624 0.08282
degrees Distortion kc -0.07795
-0.13038 0.00626 0.00694 0.00000
0.02625 0.15967 0.00261 0.00245 0.00000
Pixel error err 0.19417 0.16891
Note The numerical errors are approximately
three times the standard deviations (for
reference). Recommendation The skew
coefficient alpha_c is found to be equal to zero
(within its uncertainty). You may
want to reject it from the optimization by
setting est_alpha0 and run Calibration
16Calibration Toolbox Example
- Run calibration (1st order radial distortion)
Aspect ratio optimized (est_aspect_ratio 1) -gt
both components of fc are estimated
(DEFAULT). Principal point optimized
(center_optim1) - (DEFAULT). To reject principal
point, set center_optim0 Skew optimized
(est_alpha1). To disable skew estimation, set
est_alpha0. Distortion not fully estimated
(defined by the variable est_dist) Fourth
order distortion not estimated (est_dist(2)0).
Sixth order distortion not estimated
(est_dist(5)0) - (DEFAULT) . Tangential
distortion not estimated (est_dist(34)11).
Main calibration optimization procedure - Number
of images 10 Gradient descent iterations
1...done Estimation of uncertainties...done Cali
bration results after optimization (with
uncertainties) Focal Length fc
815.34614 814.35043 5.14073 5.11624
Principal point cc 303.11904
269.20520 4.96774 4.21919 Skew
alpha_c -0.00020 0.00145 gt
angle of pixel axes 90.01120 0.08288
degrees Distortion kc -0.08866
0.00000 0.00000 0.00000 0.00000
0.01190 0.00000 0.00000 0.00000 0.00000
Pixel error err 0.21453 0.17335
Note The numerical errors are approximately
three times the standard deviations (for
reference). Recommendation The skew
coefficient alpha_c is found to be equal to zero
(within its uncertainty). You may
want to reject it from the optimization by
setting est_alpha0 and run Calibration
17Calibration Toolbox Example
Pixel error err 0.19417 0.16888
(all active images) Selected image 8 Selected
point index 6 Pattern coordinates (in units of
(dX,dY)) (X,Y)(5,5) Image coordinates (in
pixel) (416.78,330.49) Pixel error
(0.37285,0.34993) Window size (wintx,winty)
(5,5)
18Calibration Toolbox Example
19Calibration Toolbox Example
- Visualization based on extrinsic parameters
20Calibration Toolbox Example
Distorted
Rectified
21Calibration Toolbox Example
- Extracting extrinsic parameters from new images
Computation of the extrinsic parameters from an
image of a pattern The intrinsic camera
parameters are assumed to be known (previously
computed) Image name (full name without
extension) Image20 Image format ('r''ras',
'b''bmp', 't''tif', 'p''pgm', 'j''jpg',
'm''ppm') t Extraction of the grid corners on
the image Window size for corner finder (wintx
and winty) wintx ( 5) winty ( 5)
Window size 11x11 Click on the four extreme
corners of the rectangular complete pattern (the
first clicked corner is the origin)... Size dX of
each square along the X direction (30mm)
28.57 Size dY of each square along the Y
direction (30mm) 28.57 Corner
extraction... Extrinsic parameters Translation
vector Tc_ext 29.244884 92.195482
583.628874 Rotation vector omc_ext
2.129890 -1.074042 0.492619 Rotation
matrix Rc_ext 0.585544 -0.810243
0.025397 -0.547842
-0.418616 -0.724313
0.597501 0.410204 -0.689003 Pixel
error err 0.07427 0.16239
22References
- A Four-step Camera Calibration Procedure with
Implicit Image Correction,Heikkila and Silven,
CVPR97 - Camera Calibration Toolbox for Matlab
http//www.vision.caltech.edu/bouguetj/calib_doc/h
tmls/ref.html
23Questions/Comments