imaqReadText

NI Vision for LabWindows/CVI Function

imaqReadText

Usage

ReadTextReport* imaqReadText(const Image* image, const CharSet* set, const ROI* roi, const ReadTextOptions* readOptions, const OCRProcessingOptions* processingOptions, const OCRSpacingOptions* spacingOptions);

Purpose

Reads the text from the image. The function identifies all objects in the image based on the attributes that you set, and then compares each object with every trained character. For each object, the function selects the character that most closely matches the object. The function uses the substitution character for any object that does not match any of the trained characters.

Note  This function is obsolete. The replacement function is imaqReadText2().

Image Types Supported

IMAQ_IMAGE_U8, IMAQ_IMAGE_RGB, IMAQ_IMAGE_HSL

Parameters

Name

Type

Description

image const Image* The source image for this operation.
set const CharSet* The character set this function operates on. To create a character set, use imaqCreateCharSet(). This parameter is required and cannot be NULL.
roi const ROI* The ROI that the function performs this operation on. Pass NULL to use the entire image for this operation.
readOptions const ReadTextOptions* The options you use to configure how the function reads text.
processingOptions const OCRProcessingOptions* The options you use to configure how the function processes the contents of the image before attempting to read text.
spacingOptions const OCRSpacingOptions* The size and spacing constraints you can apply to characters in the image.

Return Value

Type

Description

ReadTextReport* On success, this function returns a report that contains information about the text contained in the image. On failure, the function returns NULL. To get extended error information, call imaqGetLastError(). When you finish with the character information, call imaqDispose() to dispose of it.

Parameter Discussion

readOptions—Set readOptions to NULL to use the following default reading options:

validChars NULL
numValidChars 0
substitutionChar ?
readStrategy IMAQ_READ_AGGRESSIVE
acceptanceLevel 700
aspectRatio 400
readResolution IMAQ_LOW_RESOLUTION

processingOptions—Set processingOptions to NULL to use the following default processing options:

mode IMAQ_COMPUTED_UNIFORM
lowThreshold 0
highThreshold 255
blockCount 4
fastThreshold FALSE
biModalCalculation FALSE
darkCharacters TRUE
removeObjectsTouchingROI FALSE
erosionCount 0

spacingOptions—Set spacingOptions to NULL to use the following default spacing options:

minCharSpacing 1
minCharSize 20
maxCharSize 65536
maxHorizontalElementSpacing 1
maxVerticalElementSpacing 0
minBoundingRectWidth 1
maxBoundingRectWidth 65536
minBoundingRectHeight 1
maxBoundingRectHeight 65536
autoSplit FALSE