TrainFont

Trains font characters. When TrainFont is selected from the Insert Function Dialog, the OCV/OCR Font Training dialog is automatically opened. For more information, see How to Train a Font for the ReadText and VerifyText Functions.

Note: The TrainFont, ReadText and VerifyText functions are only available on In-Sight vision systems using In-Sight firmware 4.x.x, and are not available on In-Sight vision systems running In-Sight firmware 5.1.0 and later. For a complete list of models and supported firmware versions, see Firmware Versions.

About In-Sight Fonts

A font is a set of up to 255 character models that are "trained"using one or more character instances extracted from an image. Each character model in a trained font must be assigned a label.

A trained font is stored in a Font data structure.

  • VerifyText compares the characters in a text string with the existing character models stored in a font to verify the contents of the text string (OCV). For more information, see VerifyText.
  • ReadText compares the characters in a text string with the character models in a font to "read" the string (OCR). For more information, see ReadText
Note: Only Fonts with uniform character sizes should be trained. The size of the corresponding character segments should also be uniform. If font sizes differ, create separate TrainFont structures. Also, train characters as a block so that character spacing can be learned.

TrainFont Inputs

Syntax: TrainFont(Image,Show)

Parameter Description

Image

This argument must reference a spreadsheet cell that contains a valid Image data structure. By default, the cell referenced is A0, the cell containing the Image data structure returned by AcquireImage. For more information, see AcquireImage.

Show

Specifies the display mode for TrainFont graphics on the image when a Font data structure is selected in the spreadsheet.

Note: The value for the Show parameter can be modified in the Formula Bar once the function has been inserted into the spreadsheet. For more information, see Spreadsheet Cell Execution and Editing Reference.

0 = hide all (default)

All graphics will be hidden.

1 = database instances

Displays the database instances associated with the trained models when the cell containing the TrainFont function is highlighted in the spreadsheet.

2 = trained models

Displays the trained models when the cell containing the TrainFont function is highlighted in the spreadsheet.

TrainFont Outputs

Returns

A Font data structure containing a database of character models.

TrainFont Vision Data Access Functions

The following data elements can be accessed using Vision Data Access functions. For more information, see Text (OCV/OCR)

GetFontLabel(Font, Index)

Returns the label of the indexed character model from the referenced Font data structure.

GetFontName(Font)

Returns the name of the font from the referenced Font data structure.

GetFontNumCharacter(Font)

Returns the number of character models in the referenced Font data structure.