# Calibrate

Utilizing four user-specified points, Calibrate creates a 2D transformation to convert between pixel and real-world coordinate systems.

## About Calibrate

The Calibrate function requires user-specified points, expressed in two different coordinate systems: The real-world physical coordinate system of the object being captured, and the pixel coordinates of the object's image. To accomplish this, Calibrate requires the extraction of features from an image using a Vision Tools. Then, those feature locations are entered as both real-world and pixel coordinates.

During the calibration phase, an image is acquired that contains features with known locations in real-world coordinates. Using a vision tool, such as FindLine, the features in the image are located and reported in pixel coordinates.

Note: The origin of the pixel coordinates is always the upper-left corner of the upper-left pixel.

Next, both the pixel and real-world coordinates are entered as the Pixel Point and World Point parameters; for the Pixel Point coordinates, Cell References to a vision tool's X and Y values is used, while a numeric value is entered to express the World Point real-world coordinates. Then the tool computes the 2D transformation between the pixel and real-world coordinates, producing a Calib structure that represents the transformation.

Calibrate also accounts for the following transformations:

- translation in two dimensions
- rotation about three axes
- scale in two dimensions
- perspective distortion
- parallelogramming or skewing

Note: When using a Calibrate function, the physical and optical set-up (the lens, sensor and the physical relationship between the sensor and the scene being acquired) must be the same for both the calibration and run-time operation. If any of these items is altered, the system must be re-calibrated. Therefore, it is recommended that the same sensor and lens be used to both calibrate and process the run-time images. The sensor and lens must also retain their original set-up and calibration settings. For example, changing the acquisition format (by altering the resolution) or moving the sensor will invalidate the computed 2D transformation that maps pixel to real-world coordinates.

## Calibrate Inputs

Pixel Point 0 to N | Specifies the pixel coordinates of a pixel-to-world association.
X | The image x-coordinate.
Y | The image y-coordinate.
World Point 0 to N | Specifies the real-world coordinates of a pixel-to-world association.
X | The x-axis coordinate, as a world value.
Y | The y-axis coordinate, as a world value.

## Calibrate Outputs

Returns | A Calib data structure containing the coefficients that define the transformation between the two coordinate systems.