Products | Support | Send comments on this topic. | Email a link to this topic. | Back to Getting Started | Help Version 18.0.10.23
LEADTOOLS OCR C DLL Help

L_Doc2GetRecognizedWords

Show in webframe

#include "ltdoc2.h"

L_LTDOC2_API L_INT EXT_FUNCTION L_Doc2GetRecognizedWords(hDoc, nPageIndex, ppRecogWords, uStructSize, pnWordsCount)

L_HDOC2 hDoc;

/* handle to the OCR document.*/

L_INT nPageIndex;

/* page index */

pRECOGWORDS2 * ppRecogWords;

/* address of a pointer to a RECOGWORDS2 structure */

L_UINT uStructSize;

/* size of the structure */

L_INT * pnWordsCount;

/* pointer to a variable to be updated */

Gets all recognized words for the specified recognized page.

Parameter

Description

hDoc

Handle to the OCR document.

nPageIndex

Index of the recognized page from which to get the recognized words. This index is zero-based.

ppRecogWords

Address of a pointer to a RECOGWORDS2 structure into which an array of RECOGWORDS2 structures will be allocated and updated.

uStructSize

Size in bytes, of the structure pointed to by ppRecogWords. Should be set to sizeof(RECOGWORDS2).

pnWordsCount

Pointer to a variable to be updated with the number of elements in the ppRecogWords array.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

This function updates ppRecogWords with an array containing all of the recognized words for the specified recognized page. Memory for the array of structures pointed to by ppRecogWords is allocated by this function.

This function also updates the variable pointed to by pnWordsCount with the number of recognized words.

Once the ppRecogWords parameter is no longer needed, free the memory associated with it by calling the L_Doc2FreeRecognizedWords function.

This function should only be called after successfully starting a recognition process by calling the L_Doc2Recognize function.

The L_Doc2GetRecognizedWords function just combines the recognized characters for the specified page into words. To change the contents of the recognized words, change the set of recognized characters by calling the L_Doc2SetRecognizedCharacters function. To save the updated recognized characters to a file, call the L_Doc2SaveResultsToFile function.

Required DLLs and Libraries

LTDOC2

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions:

L_Doc2Recognize, L_Doc2SaveResultsToFile, L_Doc2GetRecognizedCharacters, L_Doc2SetRecognizedCharacters, L_Doc2FreeRecognizedCharacters, L_Doc2FreeRecognizedWords, L_Doc2GetRecognizedCharactersColors

Topics:

OCR Functions: Recognition

 

Recognizing Document Pages

Example

L_LTDOC2TEX_API  L_INT Doc2GetRecognizedWordsExample(L_HDOC2 hDoc)
{
   L_INT nRet;
   pRECOGWORDS2 pRecogWords = NULL;
   L_INT nWordsCount = 0;

   nRet = L_Doc2GetRecognizedWords(hDoc, 0, &pRecogWords, sizeof(RECOGWORDS2), &nWordsCount);
   if (nRet == SUCCESS)
   {
      L_TCHAR szBuffer[1500];
      wsprintf(szBuffer, TEXT("Total Recognized words = %d"), nWordsCount);
      MessageBox(NULL, szBuffer, TEXT("Notice!"), MB_OK);

      for (L_INT i=0; i<nWordsCount; i++)
      {
         wsprintf(szBuffer, TEXT("Word = %s\nZone Index = %d\nArea {%d, %d, %d, %d}"),
                         pRecogWords[i].szWord,
                         pRecogWords[i].nZoneIndex,
                         pRecogWords[i].rcWordArea.left,
                         pRecogWords[i].rcWordArea.top,
                         pRecogWords[i].rcWordArea.right,
                         pRecogWords[i].rcWordArea.bottom);
         MessageBox(NULL, szBuffer, TEXT("Notice!"), MB_OK);
      }

      nRet = L_Doc2FreeRecognizedWords(hDoc, &pRecogWords);
      if(nRet != SUCCESS)
         return nRet;
   }
   else
      return nRet;
   return SUCCESS;
}
Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.