# TransformImage

TransformImage generates an Image data structure that accounts for distortion by using a Calib data structure produced by a CalibratePoints function.

Note: This function only outputs greyscale images.

## TransformImage Overview

TransformImage generates an Image data structure, using a CalibratePoints Calib data structure and the Image data structure being referenced by the ExtractCalibrationPoints function as arguments, that accounts for linear, non-linear and lens distortion to return an "undistorted" version of the image. This new output image has an internal 2D transformation and is based in real-world coordinates.

Note: The TransformImage training period, which takes place when the function is added to the spreadsheet, when the specified region is changed or when a job with the function is loaded, may take as long as 3 seconds on an In-Sight vision system with a 640 x 480 resolution, and as long as 30 seconds on a vision system with a 1600 x 1200 resolution.

## TransformImage Inputs

Parameter | Description
Image | This parameter must reference a spreadsheet cell that contains an Image data structure; by default, this parameter references A0, the cell containing the AcquireImage data structure. This parameter can also reference other Image data structures, such as those returned by the Image Vision Data Access Functions or Coordinate Transforms Functions.
Calibration | This argument must reference a spreadsheet cell that contains a valid Calib data structure created by any Calibrate function.
Region | Also known as the Region of Interest (ROI), specifies the region of the image that undergoes analysis; creates an Interactive Graphics Mode that can be transformed and rotated. With this parameter selected, by pressing the Maximize Region button on the property sheet's Job Edit toolbar, the region will automatically be stretched to cover the entire image.
X | The x-offset of the origin, in fixture coordinates..
Y | The y-offset of the origin, in fixture coordinates.
Width | The dimension along the region's y-axis.
Height | The dimension along the region's x-axis.
Image Scale | Specifies the scale at which the transformed image is displayed. The minimum setting is 0.01, the maximum is 10.00 and the default setting is 1.000.
Reference Point | Specifies the origin reference point for the transformation.
0 = Image Center (default) | The reference point will be the center of the image.
1 = Region Center | The reference point will be the center of the ROI.
Show | Specifies the display mode for TransformImage graphics on the image.
0 = hide all | All graphics will be hidden, except when the cell containing the TransformImage function is highlighted in the spreadsheet.
1 = result graphics only | The undistorted image will be displayed at all times.
2 = input and result graphics | The input image region and undistorted image will be displayed at all times.

## TransformImage Outputs

Returns | An Image data structure containing the processed image, or #ERR if any of the input parameters are invalid. The new output image is based in real-world coordinates; In-Sight Vision Tools that reference this image will report results in real-world coordinate values. Note: The contents of the processed image region in the Image data structure are not saved with the job.