Train mode indicates whether a PMAlign pattern should be trained based on the pixel content of the training image or trained based on a synthetic pattern described by a collection of shape models.
Namespace: Cognex.VisionPro.PMAlignAssembly: Cognex.VisionPro.PMAlign (in Cognex.VisionPro.PMAlign.dll) Version: 65.1.0.0
Syntax
Property Value
Type: CogPMAlignTrainModeConstantsEvents
| Event Type | Reason |
|---|---|
| CogPMAlignPattern Changed | Fires when this property changes. The following state flag may be affected: |
| CogPMAlignPattern Changed | Fires when this property changes and the pattern becomes untrained. The following state flags may be affected: |
Exceptions
| Exception | Condition |
|---|---|
| ArgumentException | The supplied value is not a member of the CogPMAlignTrainModeConstants. |
Remarks
Train mode indicates whether a PMAlign pattern should be trained based on the pixel content of the training image or trained based on a synthetic pattern described by a collection of shape models. Changing the value of this property will untrain the pattern.
Default Value: Image
Examples
Imports Cognex.VisionPro Imports Cognex.VisionPro.PMAlign Private myPattern As New CogPMAlignPattern Private myParams As New CogPMAlignRunParams Private myResults As CogPMAlignResults Private Sub doTrain() myPattern.TrainAlgorithm = CogPMAlignTrainAlgorithmConstants.PatMaxAndPatQuick myPattern.TrainMode = CogPMAlignTrainModeConstants.Image myPattern.TrainImage = anImage myPattern.TrainRegion = trainRect myPattern.TrainRegionMode = CogRegionModeConstants.PixelAlignedBoundingBox myPattern.Origin.TranslationX = trainRect.CenterX myPattern.Origin.TranslationY = trainRect.CenterY myPattern.Train() end sub
using Cognex.VisionPro; using Cognex.VisionPro.PMAlign; private CogPMAlignPattern myPattern = new CogPMAlignPattern(); private CogPMAlignRunParams myParams =new CogPMAlignRunParams(); private CogPMAlignResults myResults; private void doTrain() { myPattern.TrainAlgorithm = CogPMAlignTrainAlgorithmConstants.PatMaxAndPatQuick; myPattern.TrainMode = CogPMAlignTrainModeConstants.Image; myPattern.TrainImage = anImage; myPattern.TrainRegion = trainRect; myPattern.TrainRegionMode = CogRegionModeConstants.PixelAlignedBoundingBox; myPattern.Origin.TranslationX = trainRect.CenterX; myPattern.Origin.TranslationY = trainRect.CenterY; myPattern.Train(); }
See Also