MIL_ID ContextDmrId, | //in |
MIL_ID TargetImageBufId, | //in |
MIL_ID ResultDmrId, | //in |
MIL_INT64 ControlFlag | //in |
This function uses a SureDotOCR context to read one or more dot-matrix strings from a target image. Results are stored in a SureDotOCR result buffer. To get the results, use MdmrGetResult().
Requirements for reading strings depend on the settings of the context, and the font and string models therein. To control these settings, use MdmrControl(), MdmrControlFont(), and MdmrControlStringModel(). MdmrRead() takes into account all settings.
Before performing a read operation, there must be at least one font, one character, and one string model in the context; it must also be in a preprocessed state (MdmrPreprocess()).
To read a string, it must not only meet the context's requirements, but it must also follow the basic rules of a string. It must, for example, be a linear sequence of characters.
Strings are read in the natural Latin-based reading order; that is, from left to right, and from top to bottom (with respect to the angle of the target). A string's position is the position of the center of the bounding box of its first character.
You can limit the read operation to a region of the target image buffer, using a rectangular ROI set with MbufSetRegion().
If the target image is not calibrated, results are calculated in the pixel coordinate system (pixel units). If the target image is calibrated, results are calculated in the world coordinate system (real-world units), but you can retrieve them in either world or pixel units. To specify this, call MdmrControl() with M_RESULT_OUTPUT_UNITS.
In the presence of distortion, some results are meaningless when converted from real-world to pixel units (such as angle and scale). For example, if a string appears warped in the target image, but the camera calibration context compensates for this, the resulting angle is meaningful in the real-world coordinate system, and meaningless in the pixel coordinate system. If complex distortions exist, correct the image before using it with SureDotOCR.
The read operation can occasionally take an unexpectedly long time to calculate. Use MdmrControl() with M_TIMEOUT to set a maximum read time.
Specifies the identifier of the SureDotOCR context to use for the read operation. The context must have been previously allocated on the required system using MdmrAlloc(), and preprocessed using MdmrPreprocess().
Specifies the identifier of the target image buffer which contains the dot-matrix strings to read. The target image buffer must be a 1-band, 8-bit unsigned buffer. Its maximum size is 65536x65536 pixels.
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 2D 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 identifier of the SureDotOCR result buffer in which to write the results of the read operation. The SureDotOCR result buffer must have been previously allocated on the required system using MdmrAllocResult().
Header | Include mil.h. |
Library | Use mil.lib; mildmr.lib. |
DLL | Requires mil.dll; mildmr.dll. |