Train Method

NI Vision for Visual Basic

Train Method

Syntax

NIOCR.Train Image, CharacterValue, [ObjectIndex], [Regions]

Return Type

Long

Purpose

Assigns character values to the objects that NI Vision identifies in the image. The newly trained characters are appended to the existing trained character set. An image can contain no more than 255 objects.

Remarks

Use this method with U8, RGB32, and HSL32 image types.

Parameters

Image as CWIMAQImage

Source image for this operation.

CharacterValue as String

If you pass ObjectIndex, this parameter specifies the value of the object at the index specified by ObjectIndex and must not exceed 255 characters in length. If you do not pass ObjectIndex, each character in this parameter is the value for the object at the corresponding index in the set of objects that the function identified within the ROI in Image. The length of the string in the latter case must match the number of objects identified within the ROI.

ObjectIndex as Variant

Specifies the index of the object that you want to train in the set of objects that are identified within the ROI. To train all the objects identified in the ROI, do not pass this parameter.

Regions as Variant

CWIMAQRegions object that specifies the region of the image on which the method performs this operation. To use the entire image for this operation, do not supply this parameter.