# OCRMax

The OCRMax function Functions are tools that are available in Spreadsheet for processing and analyzing acquisitions or other results. You can add functions to your Spreadsheet job to create tool chains and produce results for specific applications. reads or verifies a text string within a Region of Interest (ROI), after being trained with user-defined character fonts. OCRMax performs Optical Character Recognition through a process of segmentation and classification. Segmentation occurs first and uses threshold techniques to identify the areas of the image that appear to contain lines of text. After the text has been segmented into characters, the characters are trained and stored as a font database. Classification occurs during run-time, and is responsible for “reading” any text found after the function performs segmentation. This is done by comparing the images of the segmented characters to the trained characters in the font.

During the segmentation process, the OCRMax function determines the location of the line of text within the ROI, and calculates the angle, skew, and polarity of the text. The region is then normalized to remove unwanted noise before being binarized into foreground and background pixels. Within the binarized image, blob A blob is a group of pixels on the image that form a distinct pattern, typically used to represent objects, features, or areas of interest in object detection and segmentation tasks. analysis is performed to produce character fragments, with each character fragment representing a single blob. The character fragments are then grouped together to form characters, and the characters are assigned a character region. The character region is a tight, non-editable bounding box enclosing all of the foreground (such as ink) pixels in the ROI.

The line of text within the ROI is split into images of the individual characters, and each character is enclosed within a non-editable character rectangle. The ROI defines the approximate location, angle, and skew of the line of text. The Angle Range and Skew Range parameters on the Segmentation tab can be used to compensate for variations, if necessary.

## OCRMax Inputs

The OCRMax property sheet offers a number of settings to fine tune the results of the function. These can be accessed in the property sheet tabs: General, Segmentation, Train Font, Fielding, Results, and Diagnostics.

In addition, the Auto-Tune button in the OCRMax property sheet launches the Auto-Tune Dialog, which is used to automatically calculate the optimal Segmentation parameters, and train a font database. With one or more images loaded, and with the Auto-Tune dialog running, each image is examined to verify that the characters are being correctly segmented and classified. If the characters are not being correctly segmented, the Auto-Tune algorithm of the OCRMax function calculates the optimal Segmentation parameters that segment the current image, as well as the previously trained images. As more images are trained, the Auto-Tune algorithm of the OCRMax function becomes more reliable and accurate. Once satisfactory results are achieved, the Auto-Tune dialog is closed, the new Segmentation parameters are applied and the font database is updated with the newly trained characters.

Note: The Auto-Tune dialog provides two primary advantages over manually tuning the Segmentation parameters:

- Images only need to be cycled through once, instead of twice (once to tune the Segmentation parameters, and the second to train).
- Read accuracy should improve because the characters are trained automatically with the Segmentation parameters obtained during the tuning process.

## OCRMax Outputs

Returns | An OCRMax data structure containing the character string that was read, or #ERR if any of the input parameters are invalid.
Results | When OCRMax is initially inserted into a cell, a result table is automatically created in the spreadsheet with the following OCRMax Vision Data Access functions.
Label | Function | Description
String | GetString(OCRMax) | Returns the text string in the referenced data structure.
StringPass | GetPassed(OCRMax) | Returns the pass/fail status of the entire string in the referenced data structure.
Index |  | The indexed position of the character.
Char | GetChar(OCRMax, Index) | Returns the character at the indexed position in the referenced data structure.
Score | GetScore(OCRMax, Index) | Returns the match score (0 to 100) for the indexed character in the referenced data structure.
Passed | GetPassed(OCRMax, Index) | Returns the pass/fail status of the indexed character in the referenced data structure.
2nd Char | GetScore(OCRMax, Index0, [Index1]) | Returns the second highest scoring character.
2nd Score | GetScore(OCRMax, Index0, [Index1]) | Returns the score of the second highest scoring character.
Char Difference |  | Returns the difference between the Score and 2nd Score values of the indexed character.