The following steps provide a basic methodology for using the MIL SureDotOCR module:
Allocate a SureDotOCR context, using MdmrAlloc().
Allocate a SureDotOCR result buffer to hold the results of the read operation, using MdmrAllocResult().
Import one or more fonts to the context, using MdmrImportFont(). Typically, you should interactively create your fonts using the console-based font utilities with the predefined SureDotOCR font files that MIL installs.
You can also add an empty font to the context, using MdmrControl(), and you can add characters to a font by defining their representation in an array, using MdmrControlFont().
Add one or more string models to the context, using MdmrControl().
Set the diameter of the dots that make up the characters in the strings to read, using MdmrControl().
Set the dimensions of the rectangular region in which to read strings, using MdmrControl().
Set the maximum and minimum number of characters in the string model, using MdmrControlStringModel().
If necessary, modify context settings, using MdmrControl(). For example, you can modify the foreground with which to read strings.
If necessary, add or replace characters in a font, using MdmrImportFont() or MdmrControlFont(). MdmrControlFont() provides additional functionality, such as allowing you to delete characters, or rename them.
If necessary, modify string model settings, using MdmrControlStringModel(). For example, you can apply grammar-like constraints, such as specifying that a position in a string must contain a specific character from a specific font.
Preprocess the SureDotOCR context, using MdmrPreprocess().
Perform the read operation in the specified target image, using MdmrRead().
Retrieve the required results from the SureDotOCR result buffer, using MdmrGetResult().
If necessary, draw the results, using MdmrDraw(). For example, you can specify M_DRAW_STRING_BOX to draw a bounding box around the string; then, specify M_DRAW_MIL_FONT_STRING to draw an annotation of the string under the bounding box. For more information on annotation, see the Annotations subsection of the Results and annotations section later in this chapter.
If necessary, save your SureDotOCR context, using MdmrSave() or MdmrStream().
Free all your allocated objects, using MdmrFree().