ImageGear for C and C++ on Windows v19.6 - Updated
IG_REC_letters_get
API Reference Guide > Recognition Component API Reference > Recognition Component Functions Reference > Letter Access Functions > IG_REC_letters_get

Gets recognition data belonging to the page as an array of AT_REC_LETTER structures.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_REC_letters_get(
   HIG_REC_IMAGE hImage,
   LPAT_REC_LETTER* ppLetter,
   LPAT_INT pLength
);

Arguments:

Name Type Description
hImage HIG_REC_IMAGE Handle of the recognition image.
ppLetter LPAT_REC_LETTER* Pointer to an array of AT_REC_LETTER structures returned.
pLength LPAT_INT Pointer to a variable to receive a number of elements in the array.

Return Value:

Returns the number of ImageGear errors that occurred during this function call.

Supported Raster Image Formats:

See IG_REC_image_import.

Example:

 
Copy Code
HIGEAR higImage = 0;
AT_ERRCOUNT ErrCount = 0;
HIG_REC_IMAGE higRecImage = 0;
LPAT_REC_LETTER pLetters = NULL;
AT_INT nZoneCount = 0;
AT_INT nZoneIndex = 0;
AT_INT nLetterCount = 0;
AT_INT nLetterIndex = 0;

ErrCount += IG_load_file("Image.tif", &higImage); 
ErrCount += IG_REC_image_import(higImage, &higRecImage);
ErrCount += IG_REC_image_recognize(higRecImage);
ErrCount += IG_REC_zones_count_get(higRecImage, &nZoneCount);
ErrCount += IG_REC_letters_get(higRecImage, &pLetters, &nLetterCount);

for (nZoneIndex = 0; nZoneIndex < nZoneCount; ++nZoneIndex)
{
    for (nLetterIndex = 0; nLetterIndex < nLetterCount; ++nLetterIndex)
    {
        if (pLetters[nLetterIndex].ZoneIndex == nZoneIndex)
        {

            //...

        }
    }
}

ErrCount += IG_REC_free(pLetters);
ErrCount += IG_REC_image_delete(higRecImage);
ErrCount += IG_image_delete(higImage);

Remarks:

The function creates new memory object that must be destroyed with IG_REC_free when it is no longer needed.

The function returns 0 errors when the recognition data does not exist. IGW_REC_EXTENDED_WARNING is added to the error stack in this case. Check the error stack with IG_warning_check() to determine whether the recognition data is presented or not.

The function doesn't change the output parameters (*ppLetter and *pLength) in the case of an error or warning. Make sure to initialize them with zero before the call.

See Also

HIG_REC_IMAGE