CogPMRedLinePattern Train Method Cognex VisionPro 9.20
Trains this PMRedLine pattern. If the pattern is already trained then it will be untrained and retrained.

Namespace: Cognex.VisionPro.PMRedLine
Assembly: Cognex.VisionPro.PMRedLine (in Cognex.VisionPro.PMRedLine.dll) Version: 80.0.0.0
Syntax

public void Train()
Events

Event TypeReason
ICogChangedEvent Changed Fires when this method changes the Trained state of the pattern. The following state flags may be affected:
ICogChangedEvent Changed Fires when this method trains the pattern successfully and also computes new granularity limits. The following state flags may be affected:
Exceptions

ExceptionCondition
CogSecurityViolationException Licensing for this operation cannot be confirmed. See Understanding VisionPro Security for more information.
CogOperatorNoTrainImageException The TrainImage is null.
CogImageNoPixelsException The TrainImage has no allocated pixels.
CogImageBadTypeException The TrainImage you supplied is not a CogImage8Grey.
CogOperatorInvalidRegionException The TrainRegion falls completely outside of the TrainImage. Or has an invalid SelectedSpaceName.
CogTimeoutExpiredException The pattern training took longer than the enabled TrainTimeout value.
Remarks

A PMRedLine pattern must be trained before it can be used to search for pattern instances. The trained pattern holds information needed for fast searching at runtime. For example, it holds the location of the pattern features that are to be found in the runtime input image.

Once your pattern is trained you can search for instances of the pattern in a runtime input image. You can do this in one of two ways:

  1. You can call the Execute(ICogImage, ICogRegion, CogPMRedLineRunParams) method of this class, or
  2. You can call the Run  method of a CogPMRedLineTool class that contains this pattern object.

See Also