# Train Corrector

The TrainCorrector block holds a VisionPro CogCalibImageCorrector. When executed, this block uses its inputs to train the image corrector.

To run a trained image corrector, use the RunCorrector block.

## General Information

Class name: TrainCorrector

Namespace: Cognex.Designer.AlignPlus.ImageCorrector

Assembly: Cognex.Designer.AlignPlus.ImageCorrector.dll

## Inputs

Item | Type | Description
--- | --- | ---
HandEyeResult | CogHandEyeCalibrationResult | Hand-eye Calibration result for specific camera
TrainingImage | ICogImage | A reference image to use during training.
Untrain | Boolean | If true, this corrector will be untrained when executed in a sequence. If false or unconnected, this corrector will be trained when executed.

## Outputs

Item | Type | Description
--- | --- | ---
CorrectedTrainingImage | ICogImage | After training, the result of running the image corrector on the TrainingImage.

## Properties

These properties are described below in different groups:

- Corrected Pixel Adjustment

  Name | Type | Description
  --- | --- | ---
  Corrected Pixel X Axis Alignmen Source | Cognex.Designer.AlignPlus.ImageCorrector. CorrectorXAxisAlignmentSource | Get/set the source whose X axis will be aligned to the X axis of the corrected image Plate: during correction the X axis of the corrected image is aligned to the X axis of the calibration plate Raw: During correction the X axis of the corrected image is aligned to the X axis of the raw image Stage: During correction the X axis of the corrected image is aligned to the X axis of the stage If this property is changed, this corrector will become untrained.
  Corrected Pixel Match Handedness Source | Cognex.Designer.AlignPlus.ImageCorrector. CorrectorMatchHandednessSource | Allows the specification of the coordinate system whose handedness will be the same as the handedness of the corrected image. Raw- The corrected image will have the same handedness as the raw image (Raw2D) Plate - The corrected image will have the same handedness as the calibration plate (Plate2D) Stage - The corrected image will have the same handedness as the stage (Stage2D)
  Corrected Pixel Rotation (degrees) | Double | Get/set the rotation, in degrees, of the corrected image. This property allows you to rotate the image during correction. See the VisionPro CogCalibImageCorrector.CorrectedPixelRotation property. If this property is changed, this corrector will become untrained.
  Corrected Pixel Scaling | Double | Get/set an additional scaling factor to be applied during correction. See the VisionPro CogCalibImageCorrector.CorrectedPixelScaling property. If this property is changed, this corrector will become untrained.
  Corrected Pixel Handedness Swap | Boolean | Get/set the handedness of the corrected space. See the VisionPro CogCalibImageCorrector.SwapCorrectedHandedness property. If this property is changed, this corrector will become untrained.
  Is Trained | Boolean | Get if this corrector block is currently trained.
  Is Moving Camera | Boolean | Get if this corrector block was trained with a moving camera hand-eye result. Returns true if so, or false if this block was trained with a stationary camera hand-eye result. Returns false if this block is not trained.
  Max Error In Pixels | Double | Get/set the maximum error allowed during image correction, measured in pixels of the training image. See the VisionPro CogCalibImageCorrector.MaxErrorInPixels property.

- Destination Rectangle

  Name | Type | Description
  --- | --- | ---
  Use Destination Rectangle | Boolean | Get/set a boolean indicating if the "DestinationRectangle" properties will be used during training. The destination rectangle specifies which pixels will be present in the corrected image. The "DestinationRectangle" properties are in '.' space. See the VisionPro CogCalibImageCorrector.DestinationRectangle property. If UseDestinationRectangle is false (or not connected), all of the pixels in the corrected image will be output. Changes to this or any of the "DestinationRectangle" properties will cause this corrector to become untrained
  Destination Rectangle X | Double | Get/set the X origin of the destination rectangle. See the UseDestinationRectangle property.
  Destination Rectangle Y | Double | Get/set the Y origin of the destination rectangle. See the UseDestinationRectangle property.
  Destination Rectangle Width | Double | Get/set the width of the destination rectangle. See the UseDestinationRectangle property.
  Destination Rectangle Height | Double | Get/set the height of the destination rectangle. See the UseDestinationRectangle property.

- Parameters

  Name | Type | Description |
  --- | --- | --- | ---
  Is Moving Camera | Boolean | Get if this corrector block was trained with a moving camera hand-eye result. Returns true if so, or false if this block was trained with a stationary camera hand-eye result. Returns false if this block is not trained. |
  Is Trained | Boolean | Get if this corrector block is currently trained. |
  Max Error In Pixels | Double | Get/set the maximum error allowed during image correction, measured in pixels of the training image. See the VisionPro CogCalibImageCorrector.MaxErrorInPixels property. |
  PerformFastCorrection | Boolean | When true, instead of using the corrector to correct the image, the input image is passed without any correction. The Raw2DFromHome2D transform in hand-eye calibration result to compute an approximate imageFromClient transform |
  PlateHandednessFlipped | Boolean | Specifies the handedness of the Plate space. False: the calibrated space will have the same handedness as the raw (unadjusted) calibrated space. True: it will have the opposite handedness. |
  StageHandednessFlipped | Boolean | Specifies the handedness of the Stage space. False: the Stage space will have the same handedness as the raw (unadjusted) calibrated space. True: it will have the opposite handedness. |

## Methods

Void Untrain()

Untrains this image corrector. This function has no effect if the corrector is already untrained.