Boxed Recognition
retrieves boxed recognition results on a box-by-box basis. The function fills
an array of
BOXRESULTS structures with the results and alternatives for a set of boxed character
positions in the recognized text. Each of the
BOXRESULTS structure in the array contains one or more recognition guesses for a single
box.
For example, consider the case in which the user has written a seven-letter
word before requesting recognition
say, by tapping an OK button. The application can retrieve results
individually for each box by calling
GetBoxResultsHRC in a loop, or provide an array of at least seven
BOXRESULTS structures and receive all seven recognition results with a single call to
GetBoxResultsHRC.
The following example code retrieves recognition results two boxes at a time.
It requests only the first alternative for each box, which represents the
recognizer's best guess about the character in the box:
#define NBOX 2 // Number of boxes to get
#define NALT 1 // Only one alternative per box
BOXRESULTS box[NBOX]; // Array of BOXRESULTS structures
UINT iSyv = 0; // Index of symbol values
int cBox; // Number of results returned
.
.
.
do {
cBox = GetBoxResultsHRC( hrc1, NALT, iSyv, NBOX,
(LPBOXRESULTS)&box, FALSE );
. // Do error checking
. // Read results from
. // box[] array
iSyv += (UINT) cBox; // Increment index
} while (cBox == NBOX) // Loop for next boxes
By requesting only a single alternative for a small number of boxes, the
preceding example can allocate the array on the stack. However, the
BOXRESULTS structure contains a variable-length array of type
SYV for additional alternative characters. For a value of NALT greater than 1, the application must allocate extra space for the
alternatives in each
BOXRESULTS, as the following line demonstrates:
HGLOBAL hMem = GlobalAlloc( GHND,
NBOX*( sizeof(BOXRESULTS) + (NALT-1)*sizeof(SYV)) );
The example provided in the
GetBoxResultsHRC reference section in Chapter 10 further illustrates how to use this function.
When
GetBoxResultsHRC returns, the application can walk the
BOXRESULTS array and display the information appropriately. The boxed edit control
described in the "The bedit Control" section in Chapter 3 uses
GetBoxResultsHRC to perform recognition and to generate alternative results.
Boxed writing does not constrain an application to call
GetBoxResultsHRC for recognition results. An application can also call
GetResultsHRC, described next, even if the
HRC is configured for box guides.
- Software for developers
-
Delphi Components
.Net Components
Software for Android Developers
- More information resources
-
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
- Databases for Amazon shops developers
-
Amazon Categories Database
Browse Nodes Database