TrainingImage Object (ITrainingImage Interface)

This object represents a single training image. It contains character image which can be used during user pattern training.

The training image can be set in two ways: you can load a region of an image document as a training image using the SetImageData method, or load an image from memory using the SetBitmapBits method.

Important! You should set the SmallCharsHeight and BaseLine properties to correct values; otherwise, the trained pattern will not function properly.

The bottom edge of most characters (except those with descenders, like p, g, Q) is the base line.

The SmallCharsHeight property should be equal to the height of the lowercase letters in the line without ascenders or descenders (like c, a, o), even when you are training the pattern for an uppercase letter or a letter which has ascender/descender/diacritics (like A, b, y, or é).

The BaseLine property should be equal to the distance from the top edge of the enclosing rectangle to the base line. Therefore, SmallCharsHeight = BaseLine for lowercase letters without ascender/diacritics (like m, e, u). For letters without descenders, BaseLine is equal to the letter height.

Show an illustration


Name Type Description
Application Engine, read-only Returns the Engine object.
BaseLine int

Contains the distance, in pixels, from the base line to the top edge of the cropped image of the character. The base line is the line on which the characters are located. The top edge of the image is determined by the character orientation.

By default, the value of this property is 0, but you must specify the correct value of this property.

SmallCharsHeight int

Specifies the height of small characters in pixels on the source image.

By default, the value of this property is 0, but you must specify the correct value of this property.


Name Description
SetBitmapBits Sets the training image data from the buffer in memory. The image should be isotropic (that is its horizontal resolution should equal the vertical one), black-and-white with 1 bit per pixel encoding.
SetImageData Sets the training image data from the region of an image document.

Related objects

Object Diagram

Output parameter

This object is the output parameter of the following methods:

Input parameter

This object is passed as an input parameter to the InsertAt, Add methods of the TrainingImagesCollection object.

See also


Recognizing with Training

Training User Patterns

Working with Properties

24.03.2023 8:51:52

Usage of Cookies. In order to optimize the website functionality and improve your online experience ABBYY uses cookies. You agree to the usage of cookies when you continue using this site. Further details can be found in our Privacy Notice.