This class holds all the objects needed to configure, train and run the classify tool.
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.0.0
The ClassifyPattern type exposes the following members.
| Name | Description | |
|---|---|---|
| ClassifyPattern | Constructs a default ClassifyPattern object. |
| Name | Description | |
|---|---|---|
| AddClass | Creates a ClassifyClassItem object and adds it the Classes collection. | |
| AddImage | Creates a ClassifyImageItem object and adds it the Images collection. | |
| AddTrainItem(String, String) | Creates a ClassifyTrainItem object and adds it to the LabeledImages collection. | |
| AddTrainItem(IImage, String) | Creates a ClassifyTrainItem object and adds it to the LabeledImages. returns the image id;. | |
| ClearClasses | Clears the Labels collection. | |
| Equals | Compares the equality of this object with another. (Overrides ChangedEventShareableBase Equals(Object).) | |
| Execute | 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. | |
| GetClass | Returns the class with the specified class id from Classes Collection. | |
| GetHashCode | Returns the hash code of this object. (Overrides ChangedEventShareableBase GetHashCode .) | |
| GetImage | Returns the image with the specified image id from Images Collection. | |
| GetType | Gets the Type of the current instance. (Inherited from Object.) | |
| GetTypeMeta | Get the TypeMeta that describes the type of this object. | |
| RemoveClassItem | Removes the class item from Classes Collection. | |
| RemoveClassItemAt | Removes the class item at index from Classes Collection. | |
| RemoveClassItemUsingId | Removes the class item with the specified class id from Classes Collection. | |
| RemoveImageItem | Removes the image item from Images Collection. | |
| RemoveImageItemAt | Removes the image item at index from Images Collection. | |
| RemoveImageItemUsingId | Removes the image item with the specified image id from Images Collection. | |
| RemoveTrainItem | Removes the train item from LabeledImages. | |
| RemoveTrainItemAt | Removes the train item at index from LabeledImages. | |
| RemoveTrainItemUsingImageId | Removes the train item with the specified image id from LabeledImages. | |
| RenameClass | Rename a class in the Classes collection. | |
| Reset | Clears train data. | |
| ResumeAndRaiseChangedEvent | 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. | |
| SuspendChangedEvent | 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. | |
| ToString | Returns a human readable string that represents the object. | |
| Train | Trains the pattern using the LabeledImages. |
| Name | Description | |
|---|---|---|
| Equality | Compares the equality of two ClassifyPattern objects. | |
| Inequality | Compares the inequality of two ClassifyPattern objects. |
| Name | Description | |
|---|---|---|
| SfClasses | ||
| SfImages | ||
| SfLabeledImages | ||
| SfPredictedResults | ||
| SfRegion | ||
| SfSelectedLabeledImage | ||
| SfSelectedUnlabeledImage | ||
| SfTrained | ||
| SfTrainResult |
| Name | Description | |
|---|---|---|
| ChangedEventSuspended | Indicates if raising the ChangedEvent has been suspended. | |
| Classes | Gets the class item collection. | |
| Handle | (Overrides ChangedEventShareableBase Handle.) | |
| Images | Gets the image item collection. | |
| LabeledImages | Gets the ClassifyTrainItemCollection. | |
| PredictedResults | The predicted results. Results from running the pattern on the unlabeled images. | |
| Region | 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. | |
| SelectedLabeledImage | Get Gets the selected labeled image index. | |
| SelectedUnlabeledImage | Get Gets the selected unlabeled image index. | |
| Trained | This property reflects the trained state of the pattern. | |
| TrainResult | 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. | |
| UnlabeledImages | Gets the image ids that are not labeled (not used in the ClassifyTrainItemCollection). |
| Name | Description | |
|---|---|---|
| Changed | The actual event. |
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.