| MIL 10 User Guide
| Customize Help

Uniform calibration and other calibration modes



See also
Availability
Not available in MIL-Lite

Available in MIL

When you use McalAlloc() to create the calibration context, you have to specify the calibration mode. MIL supports the following calibration modes:

  • Uniform mode.

  • Piecewise linear interpolation mode.

  • Perspective transformation mode.

  • Tsai-based mode.

  • Robotics mode.

The following table provides a side-by-side feature comparison of the different calibration modes supported by MIL:

Feature

Uniform

Linear interpolation

Perspective transformation

Tsai-based

Robotics

Supports camera movement parallel to the image plane

X

X

X

X

X

Supports full 3-dimensional camera movement

X

X

Supports working with coordinates that lie outside the calibration grid

N/A

(less accurate)

X

X

X

Calculates the position of the robot base

X

Calibrates with a single image only

(none needed)

X

X

X

Allows calibrating with the camera perpendicular to the camera calibration plane (0º angle of incidence)

X

X

X

X

Supports telecentric lenses

X

X

Supports one-dimensional distortions obtained from line-scan cameras

X

X

X

Corrects rotation, scale, and perspective distortion

X

X

X

X

Corrects lens distortion

X

X

X

Corrects all types of distortion

X

Corrects lens distortion only and keeps other distortions uncorrected

X

X

Models the camera explicitly

X

X

Estimates the position of the camera and other known objects using known world points

X

X

Allows retrieval of the position and orientation of the robot's base coordinate system

X

Allows proper calibration of cameras used for 3D reconstruction by M3dmapCalibrate() and M3dmapTriangulate() functions

X

X

Uniform mode

The most basic calibration mode available is the uniform mode. This simple, uniform calibration can only map a linear translation, rotation, and scaling between the pixel and world coordinate systems.

For a uniform calibration, you do not need to allocate a calibration context or call McalGrid() or McalList(), making it the fastest to set up. To provide uniform calibration information to an image, call McalUniform() and specify the scale, rotation, and offset between pixel and world coordinate systems.

You can also allocate a calibration context using McalAlloc() with M_UNIFORM_TRANSFORMATION. The context can be calibrated by calling McalGrid() or McalList(), which will determine the best linear mapping between the pixel and world coordinate system.

If you pass a uniformly calibrated image to McalTransformImage(), the image will be rotated to remove the angle between the relative and pixel coordinate systems, and the scales will be adjusted to produce square pixels.

You can also specify a third dimension to be used in a uniform calibration for depth maps when using the 3D Reconstruction module. You can call McalControl() with M_GRAY_LEVEL_SIZE_Z to specify how the gray level of each pixel maps to world coordinates, and with M_WORLD_POS_Z to specify what gray level corresponds to a height of 0 in world units.

Piecewise linear interpolation mode

Piecewise linear interpolation mode can compensate for any kind of distortion. In general, you should use this mode. It is very accurate for points located inside the working area. However, it is less accurate for points outside the working area. The piecewise linear interpolation mode fits a piecewise linear interpolation function to the specified set of images coordinates and their real-world equivalents. It performs a mapping of each point in the image to a point in the real world using bilinear interpolation between adjacent points.

To allocate a piecewise linear interpolation calibration context, use McalAlloc() with M_LINEAR_INTERPOLATION.

Note that piecewise linear interpolation mode does not support changing the distance between the camera and the camera calibration plane. Re-calibration is required in this case.

Perspective transformation mode

The perspective transformation mode can compensate for rotation, translation, scale, and perspective distortions. For such distortions, the perspective transformation mode is accurate for points inside and outside the working area. This mode cannot compensate for non-linear distortions such as lens distortions. The perspective transformation mode best fits a global perspective transformation function to the set of image coordinates and their real-world equivalents. It finds a projection of an image in a field of view into a 2D plane.

To allocate a perspective transformation calibration context, use McalAlloc() with M_PERSPECTIVE_TRANSFORMATION.

Note that perspective transformation mode does not support changing the distance between the camera and the camera calibration plane. Re-calibration is required in this case.

Tsai-based mode

Tsai-based mode is a calibration mode based on Roger Y. Tsai's algorithm. This mode models your camera as a pinhole camera and can compensate for rotation, translation, scale, perspective, and radial lens distortions. Tsai-based mode is a true 3D calibration technique which actually determines the distance and orientation between the modeled camera and the image plane. This allows for results to be inquired with respect to any defined plane. This mode allows for camera rotation about any axis without re-calibrating; you only need to specify the camera movement which has occurred. The mode requires a minimum of 6 points to perform a successful calibration and accuracy increases with the number of points. To allocate a Tsai-based calibration context, use McalAlloc() with M_TSAI_BASED.

Tsai-based mode calculates several intrinsic and extrinsic attributes of the pinhole camera that is used to model the real-world camera. Intrinsic attributes characterize properties of the camera itself (such as the focal length and the radial distortion), whereas extrinsic attributes characterize the camera's position and orientation.

Tsai-based mode does not estimate the following two intrinsic attributes that are needed for accurate calibration; you can adjust their values set by default if not correct:

  • Aspect ratio of the camera's charge-coupled device (CCD) elements. This refers to the ratio of the horizontal dimension of a single CCD element to its vertical dimension. Tsai-based mode sets this ratio to 1 by default. If the aspect ratio given by the camera manufacturer is not 1, specify its actual aspect ratio using McalControl() with M_CCD_ASPECT_RATIO.

  • Principal point. This refers to the point of intersection of the camera's optical axis with the image plane. You can specify the principal point using McalControl() with M_PRINCIPAL_POINT_X and M_PRINCIPAL_POINT_Y, prior to calibrating. If McalGrid() is used for calibration, the principal point will default to the central point of the image plane. If McalList() is used for calibration, it is mandatory to set the principal point prior to calibrating. In this case, it is recommended to set the principal point to the central pixel of the captured image.

To successfully perform a full calibration using Tsai-based mode, you must ensure that the optical axis of your camera is at least 30º away from the axis perpendicular to the camera calibration plane. This angle provides the image perspective needed by Tsai-based mode to estimate some intrinsic and extrinsic attributes. For camera setups that require a camera whose optical axis is perpendicular to the camera calibration plane, you must perform two calibrations: the first calibration must be performed with the camera inclined with respect to the camera calibration plane, using McalGrid() or McalList() with M_FULL_CALIBRATION; the second calibration must be performed after repositioning the camera, such that its optical axis is perpendicular to the camera calibration plane, using McalGrid() or McalList() with M_DISPLACE_CAMERA_COORD. Instead of calibrating a second time, you can, alternatively, move the camera coordinate system using McalSetCoordinateSystem() if the movement is known with great precision. If you want to move the camera coordinate system by moving the tool coordinate system, you must first move the tool coordinate system as described in the Special considerations concerning the tool and camera coordinate systems subsection of the Moving coordinate systems to reflect camera setup changes section later in this chapter.

Since this mode requires that the image has perspective distortion, you should not use this mode when using a camera with a telecentric lens; telecentric lenses negate perspective effects.

Robotics mode

Robotics mode is a true 3D calibration technique that supports the robot base coordinate system. In addition to estimating camera's intrinsic and extrinsic attributes, this mode also estimates the position and orientation of the robot base coordinate system with respect to the absolute coordinate system. Like the Tsai-based mode, robotics mode models the camera as an ideal pinhole camera. Therefore, the robotics mode estimates the same camera attributes estimated by Tsai-based mode. It also allows for results to be inquired with respect to any defined plane.

To allocate a calibration context in robotics mode, use McalAlloc() with M_3D_ROBOTICS. Robotics mode requires at least three calls to McalGrid() or McalList() with M_ACCUMULATE before performing a full calibration with M_FULL_CALIBRATION. Before each call, you must move the camera to a different position, and set the position of the tool coordinate system with respect to the robot base coordinate system using McalSetCoordinateSystem(). To calibrate a camera setup in 3D robotics mode, perform the following steps in addition to the ones listed at the beginning of the chapter:

  • Get the position and orientation of the tool holding the camera, with respect to the robot base, using the robot software.

  • Set the position and orientation for the tool coordinate system in the calibration context with respect to the robot base coordinate system using McalSetCoordinateSystem().

  • Call McalGrid() or McalList() with M_ACCUMULATE to store calibration points in the calibration context.

  • Physically move the camera to a new position over the working area. You must rotate the tool along at least two non-parallel axes.

  • Repeat the previous steps at least twice, to make a minimum total of three calls with M_ACCUMULATE.

Since this mode requires that the image has perspective distortion, you should not use this mode when using a camera with a telecentric lens; telecentric lenses negate perspective effects.