L_DocGetRecognizedWords
#include "ltdoc.h"
L_LTDOC_API L_INT L_DocGetRecognizedWords (hDoc, nPageIndex, ppRecogWords, uStructSize, pnWordsCount)
L_HDOC hDoc; |
/* handle to the OCR document.*/ |
L_INT nPageIndex; |
/* page index */ |
pRECOGWORDS * ppRecogWords; |
/* address of a pointer to a RECOGWORDS 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 |
Specifies the index of the recognized page from which to get the recognized words. This index is zero-based. |
ppRecogWords |
Address of a pointer to a RECOGWORDS structure into which an array of RECOGWORDS structures will be allocated and updated. |
uStructSize |
Specifies the size of the structure pointed to by ppRecogWords. Should be set to sizeof(RECOGWORDS). |
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 L_DocFreeRecognizedWords.
This function should only be called after successfully starting a recognition process by calling L_DocRecognize.
L_DocGetRecognizedWords 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 L_DocSetRecognizedCharacters. To save the updated recognized characters to a file, call L_DocSaveResultsToFile To save the results into memory, call L_DocSaveResultsToMemory.
Required DLLs and Libraries
LTDOC 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
Example
L_INT DocGetRecognizedWordsExample(L_HDOC hDoc) { L_INT nRet; pRECOGWORDS pRecogWords = NULL; L_INT nWordsCount = 0; nRet = L_DocGetRecognizedWords(hDoc, 0, &pRecogWords, sizeof(RECOGWORDS), &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_DocFreeRecognizedWords(hDoc, &pRecogWords); if(nRet != SUCCESS) return nRet; } else return nRet; return SUCCESS; }