Camera Calibration Toolbox for Matlab |
Description of the calibration parameters
After calibration, the list of parameters may be stored in the matab file Calib_Results by clicking on Save. The list of variables may be separated into two categories: Intrinsic parameters and extrinsic parameters.
Intrinsic parameters (camera model):
The internal camera model is very similar to that used by Heikkil伯a> and Silven at the University of Oulu in Finland. Visit their online calibration page, and their publication page. We specifically recommend their CVPR'97 paper: A Four-step Camera Calibration Procedure with Implicit Image Correction.
The list of internal parameters:
∙ Focal length: The focal length in pixels is stored in the 2x1 vector fc.
∙ Principal point: The principal point coordinates are stored in the 2x1 vector cc.
∙ Skew coefficient: The skew coefficient defining the angle between the x and y pixel axes is stored in the scalar alpha_c.
∙ Distortions: The image distortion coefficients (radial and tangential distortions) are stored in the 5x1 vector kc.
Definition of the intrinsic parameters:
Let P be a point in space of coordinate vector XXc = [Xc;Yc;Zc] in the camera reference frame.
Let us project now that point on the image plane according to the intrinsic parameters (fc,cc,alpha_c,kc).
Let xn be the normalized (pinhole) image projection:
Let us project now that point on the image plane according to the intrinsic parameters (fc,cc,alpha_c,kc).
Let xn be the normalized (pinhole) image projection:
Let r2 = x2 + y2.
After including lens distortion, the new normalized point coordinate xd is defined as follows:
After including lens distortion, the new normalized point coordinate xd is defined as follows:
where dx is the tangential distortion vector:
Therefore, the 5-vector kc contains both radial and tangential distortion coefficients (obse
rve that the coefficient of 6th order radial distortion term is the fifth entry of the vector kc).
It is worth noticing that this distortion model was first introduced by Brown in 1966 and called "Plumb Bob" model (radial polynomial + "thin prism" ). The tangential distortion is due to "decentering", or imperfect centering of the lens components and other manufacturing defects in a compound lens. For more details, refer to Brown's original publications listed in the reference page.
It is worth noticing that this distortion model was first introduced by Brown in 1966 and called "Plumb Bob" model (radial polynomial + "thin prism" ). The tangential distortion is due to "decentering", or imperfect centering of the lens components and other manufacturing defects in a compound lens. For more details, refer to Brown's original publications listed in the reference page.
Once distortion is applied, the final pixel coordinates x_pixel = [xp;yp] of the projection of P on the image plane is:
Therefore, the pixel coordinate vector x_pixel and the normalized (distorted) coordinate vector xd are related to each other through the linear equation:
where tool工具箱KK is known as the camera matrix, and defined as follows:
In matlab, this matrix is stored in the variable KK after calibration. Observe that fc(1) and fc(2) are the focal distance (a unique value in mm) expressed in units of horizontal and vertical pixels. Both components of the vector fc are usually very similar. The ratio fc(2)/fc(1), often called "aspect ratio", is different from 1 if the pixel in the CCD array are not square. Therefore, the camera model naturally handles non-square pixels. In addition, the coefficient alpha_c encodes the angle between the x and y sensor axes. Consequently, pixels are even allowed to be non-rectangular. Some authors refer to that type of model as "affine distortion" model.
In addition to computing estimates for the intrinsic parameters fc, cc, kc and alpha_c, the toolbox also returns estimates of the uncertainties on those parameters. The matlab variables containing those uncertainties are fc_error, cc_error, kc_error, alpha_c_error. For information, those vectors are approximately three times the standard deviations of the errors of estimation.
Here is an example of output of the toolbox after optimization:
In this case fc = [657.30254 ; 657.74391] and fc_error = [0.28487 ; 0.28937], cc = [302.71656 ; 242.33386], cc_error = [0.59115 ; 0.55710], ...
Important Convention: Pixel coordinates are defined such that [0;0] is the center of the upper left pixel of the image. As a result, [nx-1;0] is center of the upper right corner pixel, [0;ny-1] is the center of the lower left corner pixel and [nx-1;ny-1] is the center of the lower right corner pixel where nx and ny are the width and height of the image (for the images of the first example, nx=640 and ny=480). One matlab function provided in the toolbox computes that direct pixel projection map. This function is project_points2.m. Thi
s function takes in the 3D coordinates of a set of points in space (in world reference frame or camera reference frame) and the intrinsic camera parameters (fc,cc,kc,alpha_c), and returns the pixel projections of the points on the image plane. See the information given in the function.
The inverse mapping:
The inverse problem of computing the normalized image projection vector xn from the pixel coordinate x_pixel is very useful in most machine vision applications. However, because of the high degree distortion model, there exists no general algebraic expression for this inverse map (also called normalization). In the toolbox however, a numerical implementation of inverse mapping is provided in the form of a function: normalize.m. Here is the way the function should be called: xn = normalize(x_pixel,fc,cc,kc,alpha_c). In that syntax, x_pixel and xn may consist of more than one point coordinates. For an example of call, see the matlab function compute_extrinsic_init.m.
Reduced camera models:
Currently manufactured cameras do not always justify this very general optical model. For example, it now customary to assume rectangular pixels, and thus assume zero skew (alpha_c=0). It is in fact a default setting of the toolbox (the skew coefficient not being estimated). Furthermore, the very generic (6th order radial + tangential) distortion model is often not considered completely. For standard field of views (non wide-angle cameras), it is often not necessary (and not recommended) to push the radial component of distortion model beyond the 4th order (i.e. keeping kc(5)=0). This is also a default setting of the toolbox. In addition, the tangential component of distortion can often be discarded (justified by the fact that most lenses currently manufactured do not have imperfection in centering). The 4th order symmetric radial distortion with no tangential component (the last three component of kc are set to zero) is actually the distortion model used by Zhang. Another very common distortion model for good optical systems or narrow field of view lenses is the second order symmetric radial distortion model. In that model, only the first component of the vector kc is estimated, while the other four are set to zero. This model i
s also commonly used when a few images are used for calibration (too little data to estimate a more complex model). Aside from distortions and skew, other model reductions are possible. For example, when only a few images are used for calibration (e.g. one, two or three images) the principal point cc is often very difficult to estimate reliably . It is known to be one of the most difficult part of the native perspective projection model to estimate (ignoring lens distortions). If this is the case, it is sometimes better (and recommended) to set the principal point at the center of the image (cc = [(nx-1)/2;(ny-1)/2]) and not estimate it further. Finally, in few rare instances, it may be necessary to reject the aspect ratio fc(2)/fc(1) from the estimation. Although this final model reduction step is possible with the toolbox, it is generally not recommended as the aspect ratio is often 'easy' to estimate very reliably. For more information on how to perform model selection with the toolbox, visit the page describing the first calibration example.
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论