Table: | For specifying the context type and the type of its font |
+ combination: | For M_USER_DEFINED to specify the context type |
Table: | For specifying the width of the widest character in the font without its surrounding cell |
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. 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:
![]() |
|||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Description | ||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Specifies the default Host system of the current MIL application. |
||||||||||||||||||||||||||||||||||||||
![]() ![]() |
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:
![]() |
|||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Description | ||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Same as M_USER_DEFINED. |
||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Specifies a font respecting the SEMI M12-92 standard as the type of font. StringLength must be set to 12, the constraints (MocrSetConstraint()) for the target image are preset, and a checksum calculation is activated. (summarize)Specifies a font respecting the SEMI M12-92 standard as the type of font. (more details...) |
||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Specifies a font respecting the SEMI M13-88 standard as the type of font. StringLength must be set to 18, the constraints (MocrSetConstraint()) for the target image are preset, and a checksum calculation is activated. (summarize)Specifies a font respecting the SEMI M13-88 standard as the type of font. (more details...) |
||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Specifies a general, user-defined type of font. No maximum string length is set, the scale is set to 1.0, and the character spacing is the same as CharCellSizeX. No checksum is automatically associated with this OCR font context. You must specify a combination value from the following table: 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 12: Optical character recognition.
![]() |
|||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Description | ||||||||||||||||||||||||||||||||||||||
![]() ![]() |
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. Note that using either M_SEMI_M12_92 or M_SEMI_M13_88 automatically sets the OCR font context type to M_CONSTRAINED. This is the default value. (summarize)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...) |
||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Specifies an OCR font context that works well with clean target images. It requires less information about the target string, but provides a less robust search. If you are using clean target images but they are complex, have lighting variations, or require better binarization, you might consider trying the MIL String Reader module, which is more suitable for these cases. Note that under the correct conditions, OCR is typically faster. (summarize)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.
![]() |
|||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Description | ||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Specifies the maximum amount of characters that can be stored. At most 256 characters can be stored. (summarize)Specifies the maximum amount of characters that can be stored. (more details...) |
Specifies the width of the characters in the OCR font context, in pixels.
![]() |
|||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Description | ||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Specifies the width, in pixels. |
Specifies the height of the characters in the OCR font context, in pixels.
![]() |
|||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Description | ||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Specifies the height, in pixels. |
Specifies the distance between the edge of each character and their surrounding cell, along the X-axis, in pixels.
![]() |
|||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Description | ||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Specifies the horizontal distance, in pixels. Typically, this is set to the same value as the character thickness. Note that the minimum distance is 1 pixel. (summarize)Specifies the horizontal distance, in pixels. (more details...) |
Specifies the distance between the edge of each character and their surrounding cell, along the Y-axis, in pixels.
![]() |
|||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Description | ||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Specifies the vertical distance, in pixels. Note that the minimum distance is 1 pixel. (summarize)Specifies the vertical distance, in pixels. (more details...) |
Specifies the width of the widest character in the font without its surrounding cell, in pixels.
![]() |
|||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Description | ||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Specifies the width, in pixels. This should be equal to: CharCellSizeX - ( CharOffsetX *2). Note that, to be able to search for a string over a range of angles, the font context's character size must be greater than 16x16. (summarize)Specifies the width, in pixels. (more details...) |
Specifies the height of the tallest character in the font without its surrounding cell, in pixels.
![]() |
|||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Description | ||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Specifies the height, in pixels. This should be equal to: CharCellSizeY - ( CharOffsetY *2). Note that, to be able to search for a string over a range of angles, the font context's character size must be greater than 16x16. (summarize)Specifies the height, in pixels. (more details...) |
Specifies the maximum thickness (stroke width) of the characters in the OCR font context.
![]() |
|||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Description | ||||||||||||||||||||||||||||||||||||||
![]() ![]() |
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.
![]() |
|||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Description | ||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Specifies the maximum length of the string that can be read or verified, in characters. 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. (summarize)Specifies the maximum length of the string that can be read or verified, in characters. (more details...) |
Specifies whether the characters are brighter than the background. This parameter should be set to one of the following values:
![]() |
|||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Description | ||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Specifies that the characters to read or verify are darker than the background. |
||||||||||||||||||||||||||||||||||||||
![]() ![]() |
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. |