You are here: Start » AVL.NET » Function Reference » Computer Vision » Camera Calibration » AVL.CalibrateCamera_LineScan

AVL.CalibrateCamera_LineScan

Finds the line scan camera intrinsic parameters from calibration grid.

Namespace:AvlNet
Assembly:AVL.NET.dll

Syntax

C++
C#
 
public static void CalibrateCamera_LineScan
(
	IList<AvlNet.AnnotatedPoint2D> inImageGrid,
	float inGridSpacing,
	int inImageWidth,
	AvlNet.LensDistortionModelType inDistortionType,
	float inImagePointsStandardDeviation,
	AvlNet.LineScanCameraModel outCameraModel,
	out float outApproxScaleRatio
)

Parameters

Name Type Range Default Description
inImageGridSystem.Collections.Generic.IList<AvlNet.AnnotatedPoint2D>Annotated calibration grid.
inGridSpacingfloat<0.000001f, INF>Real-world distance between adjacent grid points.
inImageWidthint<1, INF>Image width, used for initial estimation of principal point.
inDistortionTypeAvlNet.LensDistortionModelTypePolynomialLens distortion model. Default value: Polynomial.
inImagePointsStandardDeviationfloat<0.0f, INF>0.1fAssumed uncertainty of inImagePoints. Used for robust optimization. Default value: 0.1f.
outCameraModelAvlNet.LineScanCameraModel
outApproxScaleRatiofloatApproximate scale ratio between Y and X. Useful for camera/encoder trigger rate configuration. When greater than 1, the image is stretched in Y dimension, when less than 1 it is compressed.

Description

The filter estimates intrinsic parameters of whole line scan camera system, which consist of a camera and a moving conveyor belt. Such approach, in contrast with area scan camera calibration, is necessary as the moving element of line scan camera system is tightly bound within the image acquisition geometry. This allows for handling distortions caused by:

  • intrinsic lens distortions
  • image shear caused by deviation from right angle between conveyor belt motion and the camera line
  • nonuniform image scaling caused by deviation from ideal encoder trigger period
  • 1D perspective effects caused by deviation from right angle between camera optical axis and the imaged plane

Calibration uses a planar calibration grid to perform robust minimization of RMS reprojection error - the square root of averaged squared distances between grid points as observed on the image and their associated grid coordinates projected onto image plane using estimated parameters.

The calibration routine cannot estimate focal length by itself, however it can be set to a fixed value via inFocalLength. The inFocalLength is measured in pixels, it can be calculated from the sensor and lens parameters:

where f_pix - focal length measured in pixels, f_lens - focal length of lens measured in millimeters, pp - sensor pixel pitch measured in millimeters per pixel, d - camera binning or/and image downscaling factor

The inFocalLength can also be obtained from angle of view:

where f_pix - focal length measured in pixels, w - image width, alpha - angle of view

Only the divisional and polynomial lens distortion models are supported for line scan cameras. The divisional supports most use cases and has predictable behaviour even when calibration data is sparse. Polynomial model may be more accurate but it needs a larger dataset of high quality calibration points across the whole image.

The filter provides a few methods for judging the feasibility of calculated solution.

  • The outRmsError is the final RMS reprojection error. The main contributor to that value is the random noise in inImageGrid points positions. Model mismatch will also result in increased outRmsError.
  • The outMaxReprojectionError is the maximum reprojection error, can be used to judge if there are outliers in the calibration data.
  • The outReprojectionErrorSegments consists of segments connecting input image points to reprojected world points, and thus it can be readily used for visualization of gross errors. The XY scatter plot of residual vectors (obtained by using SegmentVector on the outReprojectionErrorSegments) is a good insight into the residuals distribution, which in ideal case should follow a 2D gaussian distribution centered around point (0,0).

Examples

Left: calibration grid as captured by the line scan camera. Right: rectified image with shear distortion eliminated.

Remarks

Note, that the calibration routine assumes that the camera line spans the image along its width (i.e. consecutive image rows correspond to consecutive camera acquisitions).

Errors

List of possible exceptions:

Error type Description
DomainError Empty input grid
DomainError inGridSpacing needs to be positive
DomainError Thin prism lens distortion is not supported for line scan cameras.

Function Overrides

See also