ClassifyPattern AddTrainItem Method (IImage, String)Cognex VisionPro 9.21

Creates a ClassifyTrainItem object and adds it to the LabeledImages. returns the image id;.

Namespace: Cognex.Vision.ViDiEL
Assembly: Cognex.Vision.ViDiELClassify.Net (in Cognex.Vision.ViDiELClassify.Net.dll) Version: 9.21.0.0
Syntax

public string AddTrainItem(
	IImage image,
	string className
)

Return Value

Type: String
Exceptions

ExceptionCondition
ImageExceptionIf the image is not allocated.
ImageExceptionIf the image is not Image8Grey or Image24PlanarColor.
InternalErrorExceptionIf the supplied image could not subsampled.
Remarks

This method will perform the following:

  • Will call AddImage
  • Will try to locate the label, if not found, will call AddClass
  • Add a train item using the image id and the class id.
  • If the pattern is trained, the pattern will become untrained.

Changed Raised when the value of this property changes. The following state flags may be affected:

See Also