You are here: Start » AVL.NET » AVL.CalibrateCamera(AvlNet.Point3D[][], AvlNet.Point2D[][], int, int, bool, bool, bool, AvlNet.Matrix, bool, bool, AvlNet.Matrix, AvlNet.LensDistortion, float[], AvlNet.Position3D[], float)

AVL.CalibrateCamera(AvlNet.Point3D[][], AvlNet.Point2D[][], int, int, bool, bool, bool, AvlNet.Matrix, bool, bool, AvlNet.Matrix, AvlNet.LensDistortion, float[], AvlNet.Position3D[], float)

Namespace:AvlNet
Assembly:AVL.NET.dll

Syntax


public static void CalibrateCamera(
	AvlNet.Point3D[][] inObjectPoints,
	AvlNet.Point2D[][] inImagePoints,
	int inImageWidth,
	int inImageHeight,
	bool inFixPrincipalPoint,
	bool inFixAspectRatio,
	bool inZeroTangentDist,
	AvlNet.Matrix inInitialCameraMatrix,
	bool inUseRationalModel,
	bool inUseThinPrismModel,
	out AvlNet.Matrix outCameraMatrix,
	out AvlNet.LensDistortion outDistortion,
	out float[] outUnitScales,
	out AvlNet.Position3D[] outCameraPositions,
	out float outError
)

Parameters

inObjectPoints
Type: AvlNet.Point3D
inImagePoints
Type: AvlNet.Point2D
inImageWidth
Type: System.Int32
inImageHeight
Type: System.Int32
inFixPrincipalPoint
Type: System.Boolean
inFixAspectRatio
Type: System.Boolean
inZeroTangentDist
Type: System.Boolean
inInitialCameraMatrix
Type: AvlNet.Matrix
inUseRationalModel
Type: System.Boolean
inUseThinPrismModel
Type: System.Boolean
outCameraMatrix
Type: AvlNet.Matrix
outDistortion
Type: AvlNet.LensDistortion
outUnitScales
Type: System.Single
outCameraPositions
Type: AvlNet.Position3D
outError
Type: System.Single

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.

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

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

See also