| MIL 10 Reference
| Customize Help
| Save Settings

MocrSetConstraint



See also
Availability
Not available in MIL-Lite
Available in MIL

Available on Windows
Available on Linux

Available on Non-Matrox computer
Available on Matrox 4Sight-X
Available on Matrox 4Sight GP
Available on Matrox Supersight
function map Function map
Examples
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 if there is complementary information.
Parameters
This function is not supported on the selected boards.
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
CollapseValue Description
Collapse M_DEFAULT

Same as M_ANY.

Collapse M_ANY

Specifies that all characters present in the font are valid.

Collapse M_DIGIT

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

Collapse 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 constants 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
CollapseCombination value Description
Collapse M_LOWERCASE

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

Collapse 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
CollapseValue Description
Collapse M_NULL

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

Collapse 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