MIL_ID ImageBufId, | //in |
MIL_ID FontContextOcrId, | //in |
MIL_CONST_TEXT_PTR String, | //in |
MIL_DOUBLE TargetCharSizeXMin, | //in |
MIL_DOUBLE TargetCharSizeXMax, | //in |
MIL_DOUBLE TargetCharSizeXStep, | //in |
MIL_DOUBLE TargetCharSizeYMin, | //in |
MIL_DOUBLE TargetCharSizeYMax, | //in |
MIL_DOUBLE TargetCharSizeYStep, | //in |
MIL_INT64 Operation | //in |
This function automatically calibrates the X and Y size and spacing of the font of a specified OCR font context to match that of a string in the sample target image. Note that these values can also be set manually with MocrControl() with M_TARGET_CHAR_SPACING, M_TARGET_CHAR_SIZE_X, and M_TARGET_CHAR_SIZE_Y. This function can only calibrate an M_CONSTRAINED OCR font context. You can change the type of context using MocrControl() with M_CONTEXT_CONVERT.
The sample image must contain the string specified in the String parameter, and both the size and spacing must be representative of the images to be read or verified with the calibrated OCR font context. This function might not return the expected results if the sample image contains more or fewer characters than the specified target string length (MocrControl() with M_STRING_SIZE).
The better the sample image, the better the calibration results. If a string cannot be located in the sample image, an error will be generated. Use MappGetError() to learn the error code and related information.
You can limit the operation to a region of the image buffer, using a rectangular region of interest (ROI) set using MbufSetRegion().
MocrCalibrateFont() should be called after defining a new OCR font context or when the character size in the target images changes.
The resulting target values are the best match between the minimum and the maximum target character sizes specified in the parameters of this function. Calibration will increment the minimum target character size by a step value until it reaches the maximum target character size. You can inquire the target character sizes and spacing with MocrInquire(). For best results, use a range of +/- 1 pixel with, for example, a step of between 0.1 and 0.2 pixels. Note that the greater the number of steps between the minimum and the maximum target character sizes, the longer this operation will take.
Specifies the identifier of the sample target image buffer. The characters of the string in this sample image must be of the same type and size as that in the images to be read or verified using the OCR font context.
This image buffer can only have a rectangular region of interest (ROI) defined using MbufSetRegion() (with or without rotation). In addition, the region must be defined in vector format from a graphics list (M_VECTOR or M_VECTOR_AND_RASTER). An error will be generated if the ROI is only in raster format (M_RASTER) or a non-rectangular shape.
Specifies the character string present in the sample target image. This string must be null-terminated.
For specifying the character
string
|
|||||||||||||||||||||||||||||||||||||||
Value | Description
|
||||||||||||||||||||||||||||||||||||||
MIL_TEXT("String") 1 |
Specifies the character string that is present in the sample target image. (more details...) |
1 If you are passing the value in a variable, don't enclose it in MIL_TEXT().
Specifies the minimum width of the characters in the sample target image, in pixels.
For specifying the minimum width of the
characters
|
|||||||||||||||||||||||||||||||||||||||
Value | Description
|
||||||||||||||||||||||||||||||||||||||
6 <= Value <= 256 |
Sets the minimum width, in pixels. (more details...) |
Specifies the maximum width of the characters in the sample target image, in pixels.
For specifying the maximum width of the
characters
|
|||||||||||||||||||||||||||||||||||||||
Value | Description
|
||||||||||||||||||||||||||||||||||||||
6 <= Value <= 256 |
Sets the maximum width, in pixels. (more details...) |
Specifies the increment to use when searching for the character width between TargetCharSizeXMin and TargetCharSizeXMax. Note that very small step sizes should only be used within small ranges, otherwise application performance can be adversely affected.
Specifies the minimum height of the characters in the sample target image, in pixels.
For specifying the minimum height of the
characters
|
|||||||||||||||||||||||||||||||||||||||
Value | Description
|
||||||||||||||||||||||||||||||||||||||
6 <= Value <= 256 |
Sets the minimum height, in pixels. (more details...) |
Specifies the maximum height of the characters in the sample target image, in pixels.
For specifying the maximum height of the
characters
|
|||||||||||||||||||||||||||||||||||||||
Value | Description
|
||||||||||||||||||||||||||||||||||||||
6 <= Value <= 256 |
Sets the maximum height, in pixels. (more details...) |
Specifies the increment to use when searching for the character height between TargetCharSizeYMin and TargetCharSizeYMax. Note that very small step sizes should only be used within small ranges, otherwise application performance can be adversely affected.
Header | Include mil.h. |
Library | Use mil.lib; milocr.lib. |
DLL | Requires mil.dll; milocr.dll. |