Skip to contents

calibrateCamera finds a camera's intrinsic and extrinsic parameters from several views of a calibration pattern.

Usage

calibrateCamera(
  ref_points,
  img_points,
  nrow,
  ncol,
  fixed_point = 1,
  maxit = 30,
  eps = .Machine$double.eps
)

Arguments

ref_points

List of matrices of calibration pattern points for each view, in the calibration pattern coordinate space. Each matrix should have the same dimensions as the corresponding matrix in img_points.

img_points

List of matrices of the projections of the calibration pattern points in each view. If fixed_point > 0, the same calibration pattern must be used in each view and it must be fully visible. Moreover, all matrices must have the same dimensions and all points in the calibration pattern should be roughly close to a plane. The calibration target has to be rigid, or at least static if the camera (rather than the calibration target) is shifted when grabbing views. See findChessboardCorners and cornerSubPix for more information about generating projection matrices from images of the calibration pattern.

nrow, ncol

The number of rows and columns of the images used to capture different views of the calibration pattern.

fixed_point

The index of the reference point in ref_points[[1]] to be fixed (default: 1). Usually the top-right corner point of the calibration pattern is recommended to be fixed. If fixed_point = 0, then no point is fixed and a less precise calibration algorithm is then used.

maxit

The maximum number of iterations of the detection algorithm (default: 30).

eps

The desired accuracy or change in parameters at which the iterative algorithm stops (default: .Machine$double.eps).

Value

A list of matrices:

  • camera_matrix:a 3x3 camera intrinsic matrix.

  • dist_coeffs:a single row matrix with 4, 5, 8, 12 or 14 elements representing distortion coefficients.

  • r_vecs:a 3xlength(img_points) matrix of the rotation vectors estimated for each calibration pattern view. Together with the translation vectors below, this is equivalent to the position of the calibration pattern with respect to the camera coordinate space.

  • t_vecs:a 3xlength(img_points) matrix of the translation vectors estimated for each calibration pattern view. Together with the rotation vectors above, this is equivalent to the position of the calibration pattern with respect to the camera coordinate space.

  • new_ref_points:If fixed_point > 0, this is an updated matrix of calibration pattern points. The coordinates might be scaled based on the fixed point defined above. The returned coordinates are accurate only if the above mentioned fixed point is accurate. If fixed_point = 0, an empty matrix is returned instead.

References

Bouguet, J.-Y. (2022). Camera Calibration Toolbox for Matlab. CaltechDATA. https://doi.org/10.22002/D1.20164

Strobl, K. H., & Hirzinger, G. (2011, November). More accurate pinhole camera calibration with imperfect planar target. 2011 IEEE International Conference on Computer Vision Workshops (ICCV Workshops). 2011 IEEE International Conference on Computer Vision Workshops (ICCV Workshops), Barcelona, Spain. https://doi.org/10.1109/iccvw.2011.6130369

Zhang, Z. (2000). A flexible new technique for camera calibration. IEEE Transactions on Pattern Analysis and Machine Intelligence, 22(11), 1330–1334. https://doi.org/10.1109/34.888718

Author

Simon Garnier, garnier@njit.edu

Examples

# See the help vignette:
if (FALSE)  vignette("z8_calib", package = "Rvision")