| MIL 10 Reference
| Customize Help
| Save Settings

MocrReadString



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
Read an unknown string from a target image.
Syntax
void MocrReadString(
MIL_ID ImageBufId, //in
MIL_ID FontContextOcrId, //in
MIL_ID OcrResultId //in
)
Description

This function reads an unknown string from the specified target image using the specified OCR font context. All existing font controls and constraints (which can be set with MocrControl() and MocrSetConstraint() respectively) are taken into account, and results are stored in the specified result buffer. Results can be read from the result buffer using the MocrGetResult() function.

This function assumes that the string to be read has the same length as specified in the font, and that the target string characters have the same type, size, and spacing as the characters in OCR font context used for calibration (either automatically with MocrCalibrateFont() or manually with MocrControl()). This is particularly important when using an M_CONSTRAINED OCR font context.

For best results, the angle of the string(s) to be read should be as close to 0 as possible.

You can limit the operation to a region of the image buffer, using a rectangular region of interest (ROI) set using MbufSetRegion().

When reading multiple strings, performing a search at an angle or using the M_GENERAL OCR font context, the target image should have a clearly-defined threshold between the characters and their background. Note that the threshold must preserve the shape of the characters. Broken and/or touching characters can degrade the results.

Note that before performing a read operation, the OCR font context must be preprocessed (MocrPreprocess()).

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
ImageBufId

Specifies the identifier of the image which contains the string to be read.

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.

FontContextOcrId

Specifies the identifier of the OCR font context to use to read the string from the target image.

OcrResultId

Specifies the OCR result buffer in which to place results of the read operation.

Compilation information
Header Include mil.h.
Library Use mil.lib; milocr.lib.
DLL Requires mil.dll; milocr.dll.
PROC RASTER