System MarshalByRefObject
Cognex.VisionPro.Implementation CogObjectBase
Cognex.VisionPro.Implementation CogSerializableObjectBase
Cognex.VisionPro.Implementation CogSerializableChangedEventBase
Cognex.VisionPro.OCRMax CogOCRMaxClassifier
Namespace: Cognex.VisionPro.OCRMax
Assembly: Cognex.VisionPro.OCRMax (in Cognex.VisionPro.OCRMax.dll) Version: 75.1.0.0
The CogOCRMaxClassifier type exposes the following members.
| Name | Description | |
|---|---|---|
| CogOCRMaxClassifier |
Construct a default CogOCRMaxClassifier object.
| |
| CogOCRMaxClassifier(CogOCRMaxClassifier) |
Constructs a deep copy of the supplied CogOCRMaxClassifier object.
| |
| CogOCRMaxClassifier(SerializationInfo, StreamingContext) |
Serialization constructor for CogOCRMaxClassifier.
|
| Name | Description | |
|---|---|---|
| CreateObjRef | Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. (Inherited from MarshalByRefObject.) | |
| Equals | (Inherited from Object.) | |
| Execute(CogOCRMaxChar, CogOCRMaxClassifierRunParams) |
Classify a single character. The input CogOCRMaxChar contains an image of
the character, as well as a Metrics property which define the
character's mark rectangle and cell rectangle. Typically the input
CogOCRMaxChar.CharacterCode is set to Unknown because the character has
not yet been classified.
| |
| Execute(IEnumerable CogOCRMaxChar , CogOCRMaxClassifierRunParams) |
Classify a collection of characters.
| |
| Execute(CogOCRMaxClassifierRunParams, IList CogOCRMaxSegmenterPositionResult ) |
Classify the line of segmented characters contained in the
CogOCRMaxSegmenterLineResult.
| |
| Execute(CogOCRMaxSegmenterLineResult, CogOCRMaxClassifierRunParams) |
Classify the line of segmented characters contained in the
CogOCRMaxSegmenterLineResult.
| |
| Execute(CogOCRMaxSegmenterPositionResult, CogOCRMaxClassifierRunParams) |
Classify a single segmented character.
| |
| Execute(CogOCRMaxChar, CogOCRMaxClassifierRunParams, CogOCRMaxSwapCharSet) |
Classify a single character. The input CogOCRMaxChar contains an image of
the character, as well as a Metrics property which define the
character's mark rectangle and cell rectangle. Typically the input
CogOCRMaxChar.CharacterCode is set to Unknown because the character has
not yet been classified.
| |
| Execute(IEnumerable CogOCRMaxChar , CogOCRMaxClassifierRunParams, CogOCRMaxSwapCharSet) |
Classify a collection of characters.
| |
| Execute(CogOCRMaxClassifierRunParams, CogOCRMaxSwapCharSet, IList CogOCRMaxSegmenterPositionResult ) |
Classify the line of segmented characters contained in the
CogOCRMaxSegmenterLineResult.
| |
| Execute(CogOCRMaxSegmenterLineResult, CogOCRMaxClassifierRunParams, CogOCRMaxSwapCharSet) |
Classify the line of segmented characters contained in the
CogOCRMaxSegmenterLineResult.
| |
| Execute(CogOCRMaxSegmenterPositionResult, CogOCRMaxClassifierRunParams, CogOCRMaxSwapCharSet) |
Classify a single segmented character.
| |
| Finalize | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.) | |
| GetAttributes |
Implements the corresponding member of the ICustomTypeDescriptor interface.
May be overridden in derived classes to provide custom type information.
(Inherited from CogObjectBase.) | |
| GetClassName |
Implements the corresponding member of the ICustomTypeDescriptor interface.
May be overridden in derived classes to provide custom type information.
(Inherited from CogObjectBase.) | |
| GetComponentName |
Implements the corresponding member of the ICustomTypeDescriptor interface.
May be overridden in derived classes to provide custom type information.
(Inherited from CogObjectBase.) | |
| GetConverter |
Implements the corresponding member of the ICustomTypeDescriptor interface.
May be overridden in derived classes to provide custom type information.
(Inherited from CogObjectBase.) | |
| GetDefaultEvent |
Implements the corresponding member of the ICustomTypeDescriptor interface.
May be overridden in derived classes to provide custom type information.
(Inherited from CogObjectBase.) | |
| GetDefaultProperty |
Implements the corresponding member of the ICustomTypeDescriptor interface.
May be overridden in derived classes to provide custom type information.
(Inherited from CogObjectBase.) | |
| GetEditor |
Implements the corresponding member of the ICustomTypeDescriptor interface.
May be overridden in derived classes to provide custom type information.
(Inherited from CogObjectBase.) | |
| GetEvents |
Implements the corresponding member of the ICustomTypeDescriptor interface.
May be overridden in derived classes to provide custom type information.
(Inherited from CogObjectBase.) | |
| GetEvents( Attribute ) |
Implements the corresponding member of the ICustomTypeDescriptor interface.
May be overridden in derived classes to provide custom type information.
(Inherited from CogObjectBase.) | |
| GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | |
| GetLifetimeService | Retrieves the current lifetime service object that controls the lifetime policy for this instance. (Inherited from MarshalByRefObject.) | |
| GetObjectData |
Implements the GetObjectData method of the ISerializable interface.
(Inherited from CogSerializableObjectBase.) | |
| GetProperties |
Implements the corresponding member of the ICustomTypeDescriptor interface.
May be overridden in derived classes to provide custom type information.
(Inherited from CogObjectBase.) | |
| GetProperties( Attribute ) |
Implements the corresponding member of the ICustomTypeDescriptor interface.
May be overridden in derived classes to provide custom type information.
(Inherited from CogObjectBase.) | |
| GetPropertyOwner |
Implements the corresponding member of the ICustomTypeDescriptor interface.
May be overridden in derived classes to provide custom type information.
(Inherited from CogObjectBase.) | |
| GetType | Gets the Type of the current instance. (Inherited from Object.) | |
| InitializeLifetimeService | Obtains a lifetime service object to control the lifetime policy for this instance. (Inherited from MarshalByRefObject.) | |
| MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
| MemberwiseClone(Boolean) | Creates a shallow copy of the current MarshalByRefObject object. (Inherited from MarshalByRefObject.) | |
| OnChanged(Int64) |
This method should be called internally whenever the object's state may
have changed.
(Inherited from CogSerializableChangedEventBase.) | |
| OnChanged(CogChangedEventArgs) |
This method may be called internally whenever a derived object's state
may have changed and the derived object expresses this change via a
derived CogChangedEventArgs class.
(Inherited from CogSerializableChangedEventBase.) | |
| OnDeserialization |
Called when to complete the deserialziation of the
CogOCRMaxClassifier.
| |
| ResumeAndRaiseChangedEvent |
Re-enables raising of the Changed event after SuspendChangedEvent
has been called, and raises the Changed event 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.
(Inherited from CogSerializableChangedEventBase.) | |
| SuspendChangedEvent |
Temporarily suspends the raising of the Changed event. May be called
more than once, and a corresponding call to ResumeAndRaiseChangedEvent
must be made for each call to SuspendChangedEvent.
(Inherited from CogSerializableChangedEventBase.) | |
| ToString | (Inherited from Object.) | |
| Train |
Trains the classifier using the current font and train params.
| |
| Untrain |
Untrains the classifier.
|
| Name | Description | |
|---|---|---|
| SfFont |
This bit will be set in the EventArgs of a Changed event every time the
value returned by Font may have changed.
| |
| SfNextSf | ||
| SfTimeout |
This bit will be set in the EventArgs of a Changed event every time the
value returned by Timeout may have changed.
| |
| SfTimeoutEnabled |
This bit will be set in the EventArgs of a Changed event every time the
value returned by TimeoutEnabled may have changed.
| |
| SfTrained |
This bit will be set in the EventArgs of a Changed event every time the
value returned by Trained may have changed.
| |
| SfTrainOnRun |
This bit will be set in the EventArgs of a Changed event every time the
value returned by TrainOnRun may have changed.
| |
| SfTrainParams |
This bit will be set in the EventArgs of a Changed event every time the
value returned by TrainParams may have changed.
| |
| SfTrainTimeout |
This bit will be set in the EventArgs of a Changed event every time the
value returned by TrainTimeout may have changed.
| |
| SfTrainTimeoutEnabled |
This bit will be set in the EventArgs of a Changed event every time the
value returned by TrainTimeoutEnabled may have changed.
|
| Name | Description | |
|---|---|---|
| ChangedEventSuspended |
If nonzero, indicates that the raising of the Changed event has been
suspended. This value is incremented when SuspendChangedEvent is called
and decremented when ResumeAndRaiseChangedEvent is called.
(Inherited from CogSerializableChangedEventBase.) | |
| Font |
Contains the CogOCRMaxChars (images of individual characters) used to train
the classifier.
| |
| HasChanged | (Inherited from CogSerializableChangedEventBase.) | |
| StateFlags |
Returns the complete set of state flags supported on this object. The
flags may be indexed by name as shown in the following C# code snippet:
if (changedObject.StateFlags["Color"] & eventArgs.StateFlags) { ... }
(Inherited from CogSerializableChangedEventBase.) | |
| Timeout |
Gets or sets the timeout for running the classifier in milliseconds.
| |
| TimeoutEnabled |
Enables the timeout for the classifier.
| |
| Trained |
The classifier is a trained operator. This property reflects whether or
not the classifier is in a trained state.
| |
| TrainOnRun |
Controls the classifier's execute behavior when the classifier is not
trained.
| |
| TrainParams |
Parameters which control how the classifier is trained. Changing the
train params of a trained classifier will cause it to become untrained.
| |
| TrainTimeout |
Gets or sets the timeout for classifier training in milliseconds.
| |
| TrainTimeoutEnabled |
Enables the timeout for classifier training.
|
| Name | Description | |
|---|---|---|
| Changed |
This event is raised when one or more parts of the object's state may
have changed.
(Inherited from CogSerializableChangedEventBase.) |
CogOCRMaxChar objects each contain an Image of the character as well as that character's Key and Metrics. The Key contains the character's character code; a Unicode UTF-32 code point which determines which 'letter' the CogOCRMaxChar corresponds to. The Metrics contain two regions (the mark rectangle and the cell rectangle) which define the location of the character in the image. The mark rectangle of a character is a tight bounding box enclosing all of foreground (e.g. ink) pixels in the character image. The cell rectangle is a bounding box that encloses not only all of the foreground (e.g. ink) pixels of a character image, but also typically additional padding region. Cell rectangles are typically height of the full line of text containing the character. Ideally, all of the cell rectangles in a line of text touch their adjacent neighbors. The CogOCRMaxChar class contains additional information as well, but the classifier only considers the rectified image, its mark rectangle, its cell rectangle, and the 32-bit character code.
The run-time character rectified images don't have to be exactly the same as the train-time character rectified images - in other words, the classifier should handle slight rotation, arbitrary x-scale and y-scale, and reasonable variation in terms of character texture and background texture.
In order to run the classifier it must first be trained. The OCRMax Classifier is trained by adding one or more examples of CogOCRMaxChars for each possible run-time character to the Classifier's Font. The OCRMax Classifier determines the character of the input CogOCRMaxChar by comparing its image to the training instances and finding the best match.
Handling Scale Variation by Resampling to Fixed Size:
The OCRMax Classifier is designed to handle x-scale/y-scale/uniform-scale/aspect variations in the run-time character in the rectified image. The OCRMax Classifier always resamples each rectified image to a predetermined size (the same resampled size is used for both train-time rectified images and run-time rectified images).
Note that the classifier can be set to rescale while maintaining the rectified image's aspect ratio. In this case each character can be resampled to a different width, although they will all be resampled to the same height.
Confidence/Confusion:
The OCRMax Classifier determines not only the classification (character code/instance) of the run-time rectified image, but it also reports the score of that classification and the confidence of that classification. The score is an indication of the closeness of the match to the training instances. The confidence is computed as the difference between the score of the classification (the highest scoring training instance) and the score of the next-highest classification (the highest scoring training instance from a different class). The OCRMax Classifier result includes a status (Read, Confused, or Failed) indicating the quality of the result:
The status is Read if its score satisfies the accept threshold and the confidence score satisfies the confidence threshold.
The status is Confused if the score satisfies the accept threshold but either (a) the confidence score does not satisfy the confidence threshold, or (b) a classification validation check does not pass.
The classification validation check attempts to verify that the highest scoring candidate is the correct classification. If this validation fails, the classifier result is marked as Confused, and the confidence score is set to 0. The result of this validation does not affect the result score.
When the result is Confused, the confusionExplanation member of the classifier result indicates whether it was due to the confidence score being too low, or due to a failure of the classification validation check.
Note: If the classifier has only 1 training character, the confidence score will be set to the score and the confusionCharacter will be default constructed.
The status is Failed if the score does not satisfy the accept threshold.
Note: If the highest scoring character does not satisfy the accept threshold, then the confidence score will be set to 0 and the alternative character vector will be empty, and the confusion character will be a default constructed character.
In addition to determining the classification, the score, and the confidence score, the OCRMax Classifier also reports a set of alternative classifications. The alternative classifications are all of the classes which induce sufficiently high scores. The confusion character is defined to be the highest scoring alternative character that is not a swap character of the highest scoring character. There will always be at least one alternative character/confusion character so long as the highest scoring character met the accept threshold and so long as there is at least one other (nonswap) class with nonzero score. Note that the alternative classifications are computed in a more sophisticated manner than simplify finding all classifications which induce scores satisfying the accept threshold. Instead, the alternative classifications are computed as any class which induced a score satisfying the following alternative score threshold:
"(the lowest score that is greater than or equal to the accept threshold) - (confidence threshold)" plus one different character more than that.
The alternative characters are sorted in order of decreasing score.
Swap Characters:
Note that the OCRMax Classifier optionally takes a swap character set (CogOCRMaxSwapCharSet) as input. If a swap character set is specified, then the confidence score is defined as the difference between the score of the highest scoring classification and the score of the next-highest classification which is not swappable with the highest scoring classification.
Scale Filters:
The OCRMax Classifier allows the user to optionally specify x-scale/y-scale filter ranges, which specify the acceptable scale factors between the train-time character mark rectangles and the run-time character mark rectangles. Only classes/instances that satisfy the scale constraints are compared against the rectified image.
Handling Spaces:
The OCRMax Classifier handles space characters differently from nonspace characters. In particular, users specify whether input characters are to be classified as spaces.
The current classifier behavior is to pass through all space characters with the specified score, with no alternative characters, and with the confidence score set to be equal to the score.
Notes:
The OCRMax Classifier analyzes each rectified image's character cell rectangle with respect to the rectified image's character mark rectangle. The classifier algorithm expects the mark rectangle to be relatively accurate and it expects the cell rectangle to be less accurate. Consequently, the classifier algorithm, for the most part, ignores the pixels in between the rectified image's character cell rectangle and the rectified image's mark rectangle. The classifier algorithm mainly considers the size and position of the cell rectangle window. The classifier algorithm requires that the cell rectangle be specified for every training/runtime character.