| Customize Help
| Save Settings

MocrSetConstraint



Function Map
Synopsis
Set character position constraints.
Syntax
void MocrSetConstraint(
MIL_ID FontContextOcrId, //in
MIL_INT CharPos, //in
MIL_INT64 CharPosType, //in
MIL_CONST_TEXT_PTR CharValidString //in
)
Description

This function specifies which character value constraints to apply to each position of the strings in the target image, when using the specified OCR font context. This function specifies which characters can appear at given positions in the string to be read, and associates these constraints with the OCR font context. Using this function increases both speed and reliability as long as the strings in the target image have a known format and obey certain grammatical rules.

Note that constraints are set in regards to the character's position in the string. When dealing with multiple strings, the same constraints are applied to each string.

If you change any constraints, use MocrPreprocess() to speed up any following read or verify operation.

Note that this function reference has not been updated for a MIL system added during a MIL update. Refer to the MIL system's release note to see which MIL system’s documentation you should use in its place and any possible differences.
Parameters
This function is not supported on the selected boards.
This function reference has not been updated for the selected MIL system. To show the content of this page, choose a second MIL system; refer to the MIL system's release note to see which MIL system’s documentation to choose and any possible differences.
Parameters
FontContextOcrId

Specifies the OCR font context identifier with which to associate the constraints.

CharPos

Specifies the character position in the string for which a constraint is being set. Valid values range from zero to the length of the string -1.

CharPosType INQ

Specifies the type of character that can appear at the specified string position.

This parameter should be set to one of the following values:

function map For specifying the type of character that is accepted
Click to summarizeValue Description
Click to summarize M_DEFAULT

Same as M_ANY.

Click to summarize M_ANY

Specifies that all characters present in the font are valid.

Click to summarize M_DIGIT

Specifies that only characters "0" to "9" (ASCII codes 48 to 57) are valid.

Click to summarize M_LETTER +

Specifies that only characters "A" to "Z" and "a" to "z" (ASCII codes 65 to 90 and 97 to 122) are valid.

Combination values for M_LETTER.

You can add one of the following values to the above-mentioned value to specify the letter case of the characters accepted.

function map For M_LETTER to specify which characters are accepted
Click to summarizeCombination value Description
Click to summarize M_LOWERCASE

Specifies that only characters "a" to "z" (ASCII codes 97 to 122) are valid.

Click to summarize M_UPPERCASE

Specifies that only characters "A" to "Z" (ASCII codes 65 to 90) are valid.

CharValidString INQ

Specifies that any character matching the given CharPosType will be accepted as valid, or explicitly lists valid characters for the specified position.

function map For specifying whether all characters matching the CharPosType will be accepted
Click to summarizeValue Description
Click to summarize M_NULL

Sets all font characters matching the CharPosType parameter value as valid.

Click to summarize MIL_TEXT("StringOfCharacters") 1

Specifies an explicit list of valid characters for the specified position. This string must be null-terminated. The accepted characters must match the CharPosType parameter definition and must exist in the font.

(summarize)

1 If you are passing the value in a variable, don't enclose it in MIL_TEXT().

Compilation information
Header Include mil.h.
Library Use mil.lib; milocr.lib.
DLL Requires mil.dll; milocr.dll.
DEFAULT ANY DIGIT LETTER LOWERCASE UPPERCASE NULL