MIL_ID SystemId, | //in |
MIL_INT64 FontType, | //in |
MIL_INT CharNumber, | //in |
MIL_INT CharCellSizeX, | //in |
MIL_INT CharCellSizeY, | //in |
MIL_INT CharOffsetX, | //in |
MIL_INT CharOffsetY, | //in |
MIL_INT CharSizeX, | //in |
MIL_INT CharSizeY, | //in |
MIL_INT CharThickness, | //in |
MIL_INT StringLength, | //in |
MIL_INT64 InitFlag, | //in |
MIL_ID *FontContextOcrIdPtr | //out |
This function allocates an OCR font context on the specified system. An OCR font context contains the OCR font, target image information, and processing controls. When the OCR font context is no longer required, you should release its memory, using MocrFree().
If the OCR font context already exists as an OCR font file that matches your constraints and character sizes, such as SEMI_M12-92.mfo (SEMI M12-92) or SEMI_M13-88.mfo (SEMI M13-88), restore it using MocrRestoreFont(). If you need a modified version of a SEMI font (changing its character size, offset, thickness, or the number of characters in the OCR font context) or need a user-defined font, you should allocate a new OCR font context. Note that using either M_SEMI_M12_92 or M_SEMI_M13_88 automatically sets the OCR font context type to M_CONSTRAINED.
A newly allocated OCR font context must have its grayscale character representations initialized using MocrImportFont() or MocrCopyFont(). Each part of the OCR font context can be changed using MocrControl() and MocrModifyFont(). Constraints are set using MocrSetConstraint().
When allocating an OCR font context, you must specify an OCR font context type. This can be modified later using MocrControl() with M_CONTEXT_CONVERT. If your target image has a visible threshold difference between the target characters and the background, uniform illumination, and unknown spacing between characters, and unknown string lengths, and if your font is proportional, start by allocating an M_GENERAL OCR font context. If your target image contains noisy, scratched, or low contrast characters, or if the illumination is not uniform, or if your font includes broken characters start by allocating an M_CONSTRAINED OCR font context.
You must calibrate the OCR font context when the cell, offset, size, or thickness of the characters in your target image differs from the OCR font. Calibration can be either automatic (using MocrCalibrateFont()) or manual (using MocrControl()). Note, to use MocrCalibrateFont(), you must use an M_CONSTRAINED OCR font context.
If you change any controls or constraints, use MocrPreprocess() to speed up any following read or verify operation.
If you intend to reuse a font that you modified, save it using MocrSaveFont(), and restore it using MocrRestoreFont() when you need it.
Specifies the system on which to allocate the OCR font context. This parameter should be set to one of the following values:
For specifying the system
identifier
|
|||||||||||||||||||||||||||||||||||||||
Value | Description
|
||||||||||||||||||||||||||||||||||||||
M_DEFAULT_HOST |
Specifies the default Host system of the current MIL application. |
||||||||||||||||||||||||||||||||||||||
MIL system identifier |
Specifies a valid system identifier, previously allocated using MsysAlloc(). |
Specifies the OCR font context type and the type of its font. This parameter should be set to one of the following values:
For specifying the context type and the
type of its font
|
|||||||||||||||||||||||||||||||||||||||
Value | Description
|
||||||||||||||||||||||||||||||||||||||
M_DEFAULT |
Same as M_USER_DEFINED. |
||||||||||||||||||||||||||||||||||||||
M_SEMI_M12_92 |
Specifies a font respecting the SEMI M12-92 standard as the type of font. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_SEMI_M13_88 |
Specifies a font respecting the SEMI M13-88 standard as the type of font. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_USER_DEFINED + |
Specifies a general, user-defined type of font. (more details...) |
You must add one of the following values to the above-mentioned value to set the OCR font context type.
For more information about which context type to use, see the Guidelines for choosing context types section of Chapter 10: Optical character recognition.
For M_USER_DEFINED to specify the context
type INQ
|
|||||||||||||||||||||||||||||||||||||||
Combination value | Description
|
||||||||||||||||||||||||||||||||||||||
M_CONSTRAINED |
Specifies an OCR font context that works well with degraded target images and requires more information about the target string, but provides a more robust search. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_GENERAL |
Specifies an OCR font context that works well with clean target images. (more details...) |
Specifies how many characters can be stored in the OCR font context. The maximum number of characters supported is 256.
Specifies the width of the characters in the OCR font context, in pixels.
For specifying the width of the
characters in the context
|
|||||||||||||||||||||||||||||||||||||||
Value | Description
|
||||||||||||||||||||||||||||||||||||||
6 <= Value <= 256 |
Specifies the width, in pixels. |
Specifies the height of the characters in the OCR font context, in pixels.
For specifying the height of the
characters in the context
|
|||||||||||||||||||||||||||||||||||||||
Value | Description
|
||||||||||||||||||||||||||||||||||||||
6 <= Value <= 256 |
Specifies the height, in pixels. |
Specifies the distance between the edge of each character and their surrounding cell, along the X-axis, in pixels. The minimum recommended value is 1.
Typically, this is set to the same value as the character thickness.
Specifies the distance between the edge of each character and their surrounding cell, along the Y-axis, in pixels. The minimum recommended value is 1.
Specifies the width of the widest character in the font without its surrounding cell, in pixels.
For specifying the width of the widest
character in the font without its surrounding cell
|
|||||||||||||||||||||||||||||||||||||||
Value | Description
|
||||||||||||||||||||||||||||||||||||||
6 <= Value <= 256 |
Specifies the width, in pixels. (more details...) |
Specifies the height of the tallest character in the font without its surrounding cell, in pixels.
For specifying the height of the tallest
character in the font without its surrounding cell
|
|||||||||||||||||||||||||||||||||||||||
Value | Description
|
||||||||||||||||||||||||||||||||||||||
6 <= Value <= 256 |
Specifies the height, in pixels. (more details...) |
Specifies the maximum thickness (stroke width) of the characters in the OCR font context, in pixels.
Specifies the maximum length of the string that can be read or verified using the OCR font context. Note that if M_SEMI_M12_92 is used, the string length must be 12. If M_SEMI_M13_88 is used, the string length must be 18. The maximum string length is 100 characters.
Specifies whether the characters are brighter than the background. This parameter should be set to one of the following values:
For specifying the character
brightness
|
|||||||||||||||||||||||||||||||||||||||
Value | Description
|
||||||||||||||||||||||||||||||||||||||
M_FOREGROUND_BLACK |
Specifies that the characters to read or verify are darker than the background. |
||||||||||||||||||||||||||||||||||||||
M_FOREGROUND_WHITE |
Specifies that the characters to read or verify are brighter than the background. |
Header | Include mil.h. |
Library | Use mil.lib; milocr.lib. |
DLL | Requires mil.dll; milocr.dll. |