You are here: Start » AVL.NET » AVL.CreateUndistortionMap(AvlNet.Matrix, AvlNet.LensDistortion, int?, int?, AvlNet.Vector2D, float, float, float, float, AvlNet.ImageFormat, AvlNet.InterpolationMethod, AvlNet.SpatialMap, AvlNet.Region)

AVL.CreateUndistortionMap(AvlNet.Matrix, AvlNet.LensDistortion, int?, int?, AvlNet.Vector2D, float, float, float, float, AvlNet.ImageFormat, AvlNet.InterpolationMethod, AvlNet.SpatialMap, AvlNet.Region)

Namespace:AvlNet
Assembly:AVL.NET.dll

Syntax


public static void CreateUndistortionMap(
	AvlNet.Matrix inCameraMatrix,
	AvlNet.LensDistortion inDistortion,
	int? inMapWidth,
	int? inMapHeight,
	AvlNet.Vector2D inMapShift,
	float inMapRotation,
	float inCameraRotationY,
	float inCameraRotationX,
	float inCameraRotationZ,
	AvlNet.ImageFormat inImageFormat,
	AvlNet.InterpolationMethod inInterpolationMethod,
	out AvlNet.SpatialMap outSpatialMap,
	out AvlNet.Region outOutputRegion
)

Parameters

inCameraMatrix
Type: AvlNet.Matrix
inDistortion
Type: AvlNet.LensDistortion
inMapWidth
Type: System.Nullable<System.Int32>
inMapHeight
Type: System.Nullable<System.Int32>
inMapShift
Type: AvlNet.Vector2D
inMapRotation
Type: System.Single
inCameraRotationY
Type: System.Single
inCameraRotationX
Type: System.Single
inCameraRotationZ
Type: System.Single
inImageFormat
Type: AvlNet.ImageFormat
inInterpolationMethod
Type: AvlNet.InterpolationMethod
outSpatialMap
Type: AvlNet.SpatialMap
outOutputRegion
Type: AvlNet.Region

Description

After determining the intrinsic camera matrix, and intrinsic distortion coefficients using CalibrateCamera, this filter can be used to undo distortion of the images (undistortion).

The undistortion is performed through a general spatial transformation, using RemapImage. The result is a SpatialMap, i.e. a description of this transformation.

Examples

A calibration pattern: original - before undistortion.

A calibration pattern: remapped using RemapImage.
The SpatialMap used was generated with CreateUndistortionMap, for inInterpolationMethod = NearestNeighbour and Bilinear.

Remarks

The interpolation method chosen affects the speed of image remapping. Nearest neighbour is the fastest method, but bilinear interpolation provides higher quality.

The inImageFormat input describes dimensions and pixel format of the images that will be remapped with a RemapImage filter. Also an example image may be connected to this input and the format information will be extracted from it.

The outOutputRegion describes the region of valid pixels. If it does not cover the output area, it should be passed to RemapImage, to suppress the invalid pixels. To increase coverage, provide different values for inMapHeight and inMapWidth - to limit the output area to a valid region.

Errors

Error type Description
DomainError Empty camera matrix on input in CreateUndistortionMap.
DomainError Camera matrix must be 3x3 in CreateUndistortionMap.
DomainError Format of an empty image on input in CreateUndistortionMap.

See also