Back to Adaptive Vision Studio website

You are here: Start » Filter Reference » Camera Calibration » CalibrateCamera

CalibrateCamera


Finds the camera intrinsic and extrinsic parameters from the input arrays of image and real-world coordinates.

Name Type Range Description
inObjectPoints Point3DArrayArray Array, for each view: array of 3D points of the calibration pattern.
inImagePoints Point2DArrayArray Array, for each view: array of corresponding 2D points in the picture.
inImageWidth Integer 1 - Image width, only used to initialize camera matrix, not used when inInitialCameraMatrix present.
inImageHeight Integer 1 - Image height, only used to initialize camera matrix, not used when inInitialCameraMatrix present.
inFixPrincipalPoint Bool The principal point is not changed during the global optimization. It stays in the center of the image, or as in the initial camera matrix.
inFixAspectRatio Bool The functions considers only fy as a free parameter. The ratio fx/fy stays 1, or as in the initial camera matrix.
inZeroTangentDist Bool Tangential distortion coefficients (p_1, p_2) are assumed zero.
inInitialCameraMatrix Matrix* Optional initial camera matrix, required for inFixPrincipalPoint and inFixAspectRatio.
inUseRationalModel Bool
inUseThinPrismModel Bool
outCameraMatrix Matrix
outDistortion LensDistortion
outUnitScales RealArray Image scale: px / mm
outCameraPositions Position3DArray Positions of cameras in world coordinate system for the views
outError Real Final re-projection error value

Applications

Recognition of lens distortion. Usually followed by CreateUndistortionMap.

Description

The coordinates of 3D object points and their corresponding 2D projections in each view must be specified. That may be achieved by using an object with a known geometry and easily detectable feature points. Such an object is called a calibration rig or calibration pattern. One example is a chessboard (see DetectChessboardGrid).

When camera matrix and distortion coefficients are calculated, one can create undistortion maps using CreateUndistortionMap function. These maps can be applied to images using RemapImage.

Examples

Description of usage of this filter can be found in examples and tutorial: Calibration with Chessboard (Advanced), Removing Camera Lens Distortion: Square pattern.

Remarks

Currently, automatic initialization of intrinsic parameters (when inInitialCameraMatrix is not specified) is only implemented for planar calibration patterns (where Z-coordinates of the object points must be all zeros). 3D calibration rigs can also be used as long as initial camera matrix is provided.

Providing inImageWidth and inImageHeight is important, when inInitialCameraMatrix is not specified. This is used to determine the principal point (part of the initial camera matrix). If this point is assumed to be far from the actual image center, false tangential distortion can be determined by the calibration algorithm. This manifests itself especially when the number of point correspondences is relatively small.

Errors

This filter can throw an exception to report error. Read how to deal with errors here: Error Handling

Error type Description
DomainError Fixing principal point requested, but no initial camera matrix passed in CalibrateCamera.
DomainError Fixing aspect ratio requested, but no initial camera matrix passed in CalibrateCamera.
DomainError Missing inImagePoints or inObjectPoints in CalibrateCamera.
DomainError Inconsistent sizes of inImagePoints and inObjectPoints in CalibrateCamera.
DomainError Error in CalibrateCamera: Error message

Complexity Level

This filter is available on Basic Complexity Level.

See Also