The following procedure provides a basic methodology for using the StringReader step:
Import an existing or create a new String Reader Context using the MIL String Reader Interactive Utility.
Optionally, adjust the overall settings to control the general processing of all strings.
Optionally, adjust the string model specific settings to control specific string attributes.
Optionally, adjust the font specific settings to control specific font and character attributes.
Run the project to the StringReader step to ensure your project works as you expect.
To apply the same setting to multiple models at once, use the Apply multiple dialog, accessible from the setting's Alternate options button.
A StringReader context groups the string models and fonts definitions and settings in a StringReader file.
When a StringReader step is first inserted into your project, you will be able to choose to Import or Create a new String Reader context using an interactive utility from the Configuration pane. For more information on how to create one, see the Creating and testing a context using the MIL String Reader Interactive Utility section later in this chapter.
The String Reader context you import or create must contain at least one font definition.
Once you have created or imported a context, you can adjust overall settings which will affect all the results of the StringReader step.
Add, edit, rename, or delete a string model, if necessary.
Set the Total number of strings to be read for the context.
You can also set the number of strings to read for each individual string model. See the Adjust the string model specific settings subsection of this section.
Draw the search region, if needed. To do so interactively, use
the
Define a region () toolbar button in the
Project toolbar. See the
Search regions section in
Chapter 2: Building a project for more information.
Change the Search speed depending on the quality of the source image. A higher speed can be used with clean, high-contrast images.
Increasing the speed can decrease the robustness of the operation if your image is not clean.
Set a Timeout (in milliseconds). If the read operation times out, all the strings read up to that point will be returned.
If your characters are very faint, or there is a lot of background noise, you might need to adjust the Minimum contrast. It sets the minimum intensity difference between character and background. Increasing the minimum contrast will typically speed up the read operation, as long as the level is less than the contrast of the actual characters.
You can set an alternate Space character or Separator character to insert into the result string, for example an underscore or a linefeed. The character must be specified with its ASCII code (95 for an underscore for example).
All these settings are optional. The default values will work for most applications.
A string model is a container, within the StringReader context, that holds all the settings and constraints that control how to read one or many specific strings in the target image.
Set the Number of strings to read for this string model.
Note that if the context's number of string to read is reached, the read operation stops, regardless of any outstanding string model setting.
Optimize by stopping the search as soon as one candidate with a score above the Certainty level is found.
Set the Foreground property to Black or White depending on the color of the text to read. If it is not always the same, set it to BlackOrWhite.
Set Minimum and Maximum size to the minimum and maximum number of characters the string can contain.
Specify the Maximum consecutive spaces to control whether several groups of characters on the same line should be considered part of the same string. If they are separated by less than this number of spaces, they will be included in the same string, and no space characters are reported in the result.
Modify the default string and character Acceptance, Homogeneity, Similarity score values if needed. The default values are generally appropriate for most applications. For more information on these properties, see the StringReader step scores section later in this chapter.
Set Constraints rules for specific character locations in the string. The rules can include which font, which type of characters (for example digits or uppercase), or even specific characters that must appear in certain positions.
For more information on some of the advanced settings available for string models, see the Creating and testing a context using the MIL String Reader Interactive Utility section later in this chapter.
A font is a container, within the StringReader context, that holds a list of characters (ASCII or Unicode) with each character's corresponding representation. In a given font, each character must be unique. Only strings containing characters that are associated with a StringReader font can be read.
You cannot add or delete a font from Matrox Design Assistant. To do so, you will need to edit the context in the MIL String Reader Interactive Utility.
You can adjust settings on a character basis for each font from the Configuration pane. Each character has a Baseline and Character type property.
The Baseline is the imaginary horizontal line on which the majority of the characters in the string rest, as shown below:
By default, the baseline for system fonts will be taken from the font's file. For user-defined fonts, the baseline will be autocomputed. If you need to specify the baseline of a character, you can set it to as a percentage of the height of the character. For example, the correct baseline for the hyphen ('-') would be approximately -250% of its height, while the correct baseline for the 'y' would be approximately +26.7% of its height as shown below:
The Character type property defines whether a character should be classified as a punctuation type or regular type character.