MocrCalibrateFont()函数

Synopsis

Calibrate font character size to match a sample image.

Format

void MocrCalibrateFont(ImageBufId, FontId, String, TargetCharSizeXMin, TargetCharSizeXMax, TargetCharSizeXStep, TargetCharSizeYMin, TargetCharSizeYMax, TargetCharSizeYStep, Operation)

MIL_ID ImageBufId; Sample calibration image identifier
MIL_ID FontId; Font buffer identifier
char *String; Character string in sample image
double TargetCharSizeXMin; Minimum width of the target character
double TargetCharSizeXMax; Maximum width of the target character
double TargetCharSizeXStep; Width increment
double TargetCharSizeYMin; Minimum height of the target character
double TargetCharSizeYMax; Maximum height of the target character
double TargetCharSizeYStep; Height increment
long Operation; Operation flag

Description

This function automatically calibrates the X and Y size and spacing of the font characters to match that of the string in the sample calibration image. The sample image must contain the string specified in the String parameter, and its size and spacing must be representative of the images to be read or verified with the calibrated font. The cleaner the sample image, the better the calibration results. If a string cannot be located in the image, an error message will be issued.

MocrCalibrateFont should be called with new fonts or when the character size in the target images changes. This function, which can take several seconds to execute, determines the size and spacing of the characters in the target image.

Note that the target character size and spacing can be set manually by calling MocrControl with the M_TARGET_CHAR_SIZE_X, M_TARGET_CHAR_SIZE_Y, and M_TARGET_CHAR_SPACING parameters.

The ImageBufId parameter specifies the buffer identifier of the sample calibration image. 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/verified using the calibrated font.

The FontId parameter specifies the buffer identifier of the font to be calibrated.

The String parameter specifies the character string present in the sample calibration image. This string must be null-terminated.

The TargetCharSizeXMin, TargetCharSizeXMax, TargetCharSizeYMin and TargetCharSizeYMax together determine the range in which the character size may vary in the sample image. The increments specified by TargetCharSizeXStep and TargetCharSizeYStep specify the precision of the calibration.

Note that if the range is too wide or the step too low, the function may take up to several minutes to execute. In general, a range of +/- 1 pixel with a step of 0.125 pixel provides good results in a reasonable amount of time.

The Operation parameter specifies the operation to be performed. It should be set to M_DEFAULT.

See also

MocrControl, MocrReadString, MocrVerifyString

《MocrCalibrateFont()函数》上有1条评论

评论已关闭。