L_Doc2GetRecognizedWordsExt

#include "ltdoc2.h"

L_LTDOC2_API L_INT L_Doc2GetRecognizedWordsExt(hDoc, nDocId, nPageIndex, ppRecogWords, uStructSize, pnWordsCount)

Gets all recognized words for the specified recognized page.

Parameters

L_HDOC2 hDoc

Handle to the OCR document.

L_INT nDocId

Document ID created by calling L_Doc2CreateDocument.

L_INT nPageIndex

Zero-based index of the recognized page from which to get the recognized words.

pRECOGWORDS2 * ppRecogWords

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

L_UINT uStructSize

Size in bytes, of the structure pointed to by ppRecogWords. Set it to sizeof(RECOGWORDS2).

L_INT * pnWordsCount

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

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

Be sure to call L_Doc2Recognize / L_Doc2RecognizeExt successfully before calling L_Doc2GetRecognizedWordsExt.

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

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

L_Doc2GetRecognizedWordsExt 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 / L_Doc2SetRecognizedCharactersExt function. To save the updated recognized characters to a file, call the L_Doc2SaveResultsToFile / L_Doc2SaveResultsToFileExt function.

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

Required DLLs and Libraries

See Also

Functions

Topics

Example

L_INT Doc2GetRecognizedWordsExampleExt(L_HDOC2 hDoc, L_INT nDocId) 
{ 
   L_INT nRet; 
   pRECOGWORDS2 pRecogWords = NULL; 
   L_INT nWordsCount = 0; 
 
   nRet = L_Doc2GetRecognizedWordsExt(hDoc, nDocId, 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; 
} 
Help Version 20.0.2020.4.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS OCR Module - OmniPage Engine C API Help