ClassifyPattern ClassCognex VisionPro 9.21 SR1

This class holds all the objects needed to configure, train and run the classify tool.

Inheritance Hierarchy

System Object
  Cognex.Vision ShareableBase
    Cognex.Vision ChangedEventShareableBase
      Cognex.Vision.ViDiEL ClassifyPattern

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

public sealed class ClassifyPattern : ChangedEventShareableBase, 
	IObject

The ClassifyPattern type exposes the following members.

Constructors

  NameDescription
Public methodClassifyPattern

Constructs a default ClassifyPattern object.

Top
Methods

  NameDescription
Public methodAddClass

Creates a ClassifyClassItem object and adds it the Classes collection.

Public methodAddImage

Creates a ClassifyImageItem object and adds it the Images collection.

Public methodAddTrainItem(String, String)

Creates a ClassifyTrainItem object and adds it to the LabeledImages collection.

Public methodAddTrainItem(IImage, String)

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

Public methodClearClasses

Clears the Labels collection.

Public methodEquals
Compares the equality of this object with another.
(Overrides ChangedEventShareableBase Equals(Object).)
Public methodExecute

Runs the trained pattern on the input image and returns the result. The object in the input image should have the approximate appearance to the object in the train images with respect to position and orientation.

Public methodGetClass

Returns the class with the specified class id from Classes Collection.

Public methodGetHashCode
Returns the hash code of this object.
(Overrides ChangedEventShareableBase GetHashCode .)
Public methodGetImage

Returns the image with the specified image id from Images Collection.

Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodGetTypeMeta

Get the TypeMeta that describes the type of this object.

(Overrides ShareableBase GetTypeMeta .)
Public methodRemoveClassItem

Removes the class item from Classes Collection.

Public methodRemoveClassItemAt

Removes the class item at index from Classes Collection.

Public methodRemoveClassItemUsingId

Removes the class item with the specified class id from Classes Collection.

Public methodRemoveImageItem

Removes the image item from Images Collection.

Public methodRemoveImageItemAt

Removes the image item at index from Images Collection.

Public methodRemoveImageItemUsingId

Removes the image item with the specified image id from Images Collection.

Public methodRemoveTrainItem

Removes the train item from LabeledImages.

Public methodRemoveTrainItemAt

Removes the train item at index from LabeledImages.

Public methodRemoveTrainItemUsingImageId

Removes the train item with the specified image id from LabeledImages.

Public methodRenameClass

Rename a class in the Classes collection.

Public methodReset

Clears train data.

Public methodResumeAndRaiseChangedEvent

Re-enables raising of the ChangedEvent after SuspendChangedEvent has been called, and raises the ChangedEvent if the ChangedEventSuspended count is reduced to zero and any changes were made while events were suspended. Must be called once for each call to SuspendChangedEvent.

(Overrides ChangedEventShareableBase ResumeAndRaiseChangedEvent .)
Public methodSuspendChangedEvent

Temporarily suspends the raising of the ChangedEvent. May be called more than once, and a corresponding call to ResumeAndRaiseChangedEvent must be made for each call to SuspendChangedEvent.

(Overrides ChangedEventShareableBase SuspendChangedEvent .)
Public methodToString

Returns a human readable string that represents the object.

(Overrides Object ToString .)
Public methodTrain

Trains the pattern using the LabeledImages.

Top
Operators

  NameDescription
Public operatorStatic memberEquality
Compares the equality of two ClassifyPattern objects.
Public operatorStatic memberInequality
Compares the inequality of two ClassifyPattern objects.
Top
Fields

  NameDescription
Public fieldStatic memberSfClasses
Public fieldStatic memberSfImages
Public fieldStatic memberSfLabeledImages
Public fieldStatic memberSfPredictedResults
Public fieldStatic memberSfRegion
Public fieldStatic memberSfSelectedLabeledImage
Public fieldStatic memberSfSelectedUnlabeledImage
Public fieldStatic memberSfTrained
Public fieldStatic memberSfTrainResult
Top
Properties

  NameDescription
Public propertyChangedEventSuspended

Indicates if raising the ChangedEvent has been suspended.

(Overrides ChangedEventShareableBase ChangedEventSuspended.)
Public propertyClasses

Gets the class item collection.

Public propertyHandle (Overrides ChangedEventShareableBase Handle.)
Public propertyImages

Gets the image item collection.

Public propertyLabeledImages
Public propertyPredictedResults

The predicted results. Results from running the pattern on the unlabeled images.

Public propertyRegion
Get

Gets the rectangular region indicating the portion of the images that will be used for classification. A null Region indicates that the entire image will be used for classification.

Public propertySelectedLabeledImage
Get

Gets the selected labeled image index.

Public propertySelectedUnlabeledImage
Get

Gets the selected unlabeled image index.

Public propertyTrained

This property reflects the trained state of the pattern.

Public propertyTrainResult

The train result. The train result holds the model health of the trained pattern as well as the trained Labels (a StringCollection of label ids) and the train items' result.

Public propertyUnlabeledImages

Gets the image ids that are not labeled (not used in the ClassifyTrainItemCollection).

Top
Events

  NameDescription
Public eventChanged

The actual event.

(Overrides ChangedEventShareableBase Changed.)
Top
Remarks

There are 3 steps to configure the pattern:

  • Adding the images
    • When you add the image using AddImage, the image will be subsampled using the region if specified
    • The stored image in the Images is the subsampled images.
    • If the region changes in size after you added images, the images will all be lost.
    • The Images collection can't be modified directly, you must use the methods provided in this class.
    • When the image is added, a unique id is created for it in the form of "image_" + a unique index. The unique id can't be modified.
    • The Images collection contains a collection of ClassifyImageItem objects. Each ClassifyImageItem holds an image and it unique id.
  • Adding the Classes
    • When adding a class using AddClass, a ClassifyClassItem will created and added to the Classes collection.
    • The Classes collection can't be modified directly, you must use the methods provided in this class.
    • When the class is added, a unique id is created for it in the form of "class_" + a unique index. The unique id can't be modified.
  • Assigning the classes to the images
    • This class provides 2 AddTrainItem methods to perform this operation.
    • When an image is labeled successfully, an entry is added to the ClassifyTrainItemCollection.
    • Each item in the ClassifyTrainImageCollection consists of an image id, and a class id.

Because there is a lot of dependencies between the Classes, the Images and the LabeledImages collections can only be modified through methods. Also modifying any of these items that are used in training will cause the pattern to become untrained.

See Also