Assembly: Cognex.VisionPro.PMAlign (in Cognex.VisionPro.PMAlign.dll) Version: 87.0.0.0
Property Value
Type: ICogRegion| Event Type | Reason |
|---|---|
| CogPMAlignPattern Changed | Fires when the value of this property changes. The following state flag may be affected: |
| CogPMAlignPattern Changed | Fires when the value of this property changes and the pattern was untrained. The following state flags may be affected: |
Region of interest in the TrainImage that will be used to train the pattern. A NULL TrainRegion indicates that the entire TrainImage will be used to train the PMAlign pattern.
You can specify any type of region for the training region (CogRectangle, CogRectangleAffine, CogCircle, CogEllipse, and so on). If you specify a region type other than a Rectangle, the tool uses PatMax masking to train only the features within the specified region.
Note: This CogPMAlignPattern will sink changed events for the region that you supply. Whenever the region changes, this CogPMAlignPattern will become untrained.
Default Value: An CogRectangleAffine
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(); }