MocrGetResult()函数

Synopsis

Read results from an OCR result buffer.

Format

void MocrGetResult(OcrResultId, ResultToGet, ResultPtr)

MIL_ID OcrResultId; OCR result buffer identifier
long ResultToGet; Result type
void *ResultPtr; Storage location for OCR result buffer

Description

This function reads the specified results of a read or verify operation from an OCR result buffer.

The OcrResultId parameter specifies the identifier of the OCR result buffer to be read. This buffer typically contains results obtained by MocrReadString or MocrVerifyString.

The ResultToGet parameter specifies the type of result to read from the result buffer. It can be set to one of the following values:

M_STRING_VALID_FLAG Description
Read the flag that denotes the validity of the entire string. This flag is set depending on the user-specified acceptance score. To set the acceptance score value above which a string will be considered valid, call MocrControl with the M_STRING_ACCEPTANCE parameter. By default, all strings with a score greater or equal to 1 are valid.
Returned values
M_TRUE or M_FALSE
ResultPtr Type
Pointer to a double
M_STRING Description
Read the null-terminated string found during the read/verify operation. By default, any unrecognized character in the string will be replaced by its most-likely value, even if the confidence score for that value is lower than the user-specified character acceptance threshold (M_CHAR_ACCEPTANCE). If desired, the user can replace all unrecognized characters in the string with an invalid character marker by setting M_CHAR_INVALID to the appropriate value using MocrControl.
Returned Values
Null-terminated string of characters.
ResultPtr Type
Pointer to an array of char.
M_STRING_SCORE Description
Read the confidence score for the entire string calculated during the read/verify operation.
Returned Values
Returned values range numerically from 0 to 100%. The string score will probably never exactly reach 100%, and you should experiment to determine the range of scores corresponding to the desired level of confidence.
ResultPtr Type
Pointer to a double.
M_CHAR_VALID_FLAG Description
Read an array of flags listing the validity of individual string characters. Each flag is set depending on the user-specified acceptance score. To set the acceptance score value above which a character will be considered valid, call MocrControl with the M_CHAR_ACCEPTANCE parameter. By default, all characters with a score greater or equal to 1 are valid.
Returned Values
M_TRUE or M_FALSE.
ResultPtr Type
Pointer to an array of double.
M_CHAR_SCORE Description
Read an array of confidence scores for each individual string character.
Returned Values
Returned values range from 0% to 100%. The string score will probably never exactly reach 100%, and you should experiment to determine the range of scores corresponding to the desired level of confidence.
ResultPtr Type
Pointer to an array of double.
M_CHAR_POSITION_X Description
Read an array containing the X positions of each individual character.
Returned Values
0 to X size of image.
ResultPtr Type
Pointer to an array of double.
M_CHAR_POSITION_Y Description
Read an array containing the Y positions of each individual character.
Returned Values
0 to Y size of image.
ResultPtr Type
Pointer to an array of double.

To change the type of a returned value, the user can append one of the following suffixes to the ResultToGet value:

M_TYPE_ CHAR Returns data cast to char.
M_TYPE_SHORT Returns data cast to short.
M_TYPE_LONG Returns data cast to long.
M_TYPE_FLOAT Returns data cast to float.
M_TYPE_DOUBLE Returns data cast to double.

As an example: M_CHAR_POSITION_X is normally returned as an array of type double, but if you set ResultToGet to M_CHAR_POSITION_X + M_TYPE_LONG, the X coordinates of all string characters will be written to the array pointed to by ResultPtr as long values.

The ResultPtr parameter specifies the address of the location to which the results will be written. The type and size of the variable or array pointed to by ResultPtr must match the default result pointer type and size specified in the table above (unless the default has been overridden). If the variable is an array, its size must be equal to the number of characters read or verified, except for the M_STRING parameter which must have one extra entry since the string is null-terminated.

See also

MocrReadString, MocrVerifyString, MocrInquire, MocrControl

《MocrGetResult()函数》上有3条评论

评论已关闭。