Skip to main content

MdlocrControlStringModel

BoardSupported
Host SystemYes
V4L2Yes
Clarity UHDYes
Concord PoENo
GenTLYes
GevIQYes
GigE VisionYes
IndioNo
Iris GTXYes
Radient eV-CLYes
Rapixo CLYes
Rapixo CoFYes
Rapixo CXPYes
USB3 VisionYes

Control a global setting of a Deep Learning OCR string model.

Syntax

void MdlocrControlStringModel(
AIL_ID ContextDlocrId, //out
AIL_INT64 StringModelLabelOrIndex, //in
AIL_INT64 ControlType, //in
AIL_DOUBLE ControlValue //in
)

Description

This function allows you to control a global setting of a Deep Learning OCR string model. String models represent the strings to read from a target image. Initially, any character from any font can be read.

String models are held in a Deep Learning OCR context. To add string models to a context based on a previous call to MdlocrRead, use MdlocrDefineModelFromResult; to add a string model without relying on a previous MdlocrRead operation, use MdlocrDefineModel. To inquire about global settings of string models, use MdlocrInquireStringModel.

You must preprocess the Deep Learning OCR context after you have finished modifying its string models and before calling MdlocrRead. To know if a context needs to be preprocessed, call MdlocrInquire with M_PREPROCESSED.

Parameters

ContextDlocrId (out, AIL_ID)

Specifies the identifier of the Deep Learning OCR context that contains the string model to control. The context must have been previously allocated on the system using MdlocrAlloc.

StringModelLabelOrIndex (in, AIL_INT64)

Specifies the string model (one or all) to control. Set this parameter to one of the values below:

For specifying the string model

ValueDescription
M_STRING_INDEXSpecifies to control the string model by indicating its index.
M_STRING_LABELSpecifies to control the string model by indicating its label.
M_ALLSpecifies to control all string models.

ControlType (in, AIL_INT64)

Specifies the type of setting to control.

ControlValue (in, AIL_DOUBLE)

Specifies the required value for the setting.

Parameter Associations

For general string model settings

To control a global setting of a string model, set the ControlType parameter to one of the values below. Unless otherwise specified, set the StringModelLabelOrIndex parameter to the label or index of a string model.


M_CHAR_HEIGHT_MAX

Sets the maximum height of an uppercase character in the string model. Note this value must be less than or equal to the value set using MdlocrControl with M_DETECTION_CHAR_HEIGHT_MAX.

ValueDescription
M_DEFAULT
M_SAME_AS_CONTEXT (default)Specifies to use the maximum character height specified using MdlocrControl with M_DETECTION_CHAR_HEIGHT_MAX.
Value >= M_CHAR_HEIGHT_MINSpecifies the maximum character height, in pixels.

M_CHAR_HEIGHT_MIN

Sets the minimum height of an uppercase character in the string model. Note, this value must be greater than or equal to the value set using MdlocrControl with M_DETECTION_CHAR_HEIGHT_MIN.

ValueDescription
M_DEFAULT
M_SAME_AS_CONTEXT (default)Specifies to use the minimum character height specified using MdlocrControl with M_DETECTION_CHAR_HEIGHT_MIN.
0.0 <= Value <= M_CHAR_HEIGHT_MAXSpecifies the minimum height in pixels.

M_MAX_NUMBER_OF_OCCURRENCES

Sets the maximum number of occurrences of the specified string model.

ValueDescription
M_DEFAULT
M_INFINITE (default)Specifies that there is no maximum number of occurrences.
Value >= M_MIN_NUMBER_OF_OCCURRENCESSpecifies the maximum number of occurrences.

M_MIN_NUMBER_OF_OCCURRENCES

Sets the minimum number of occurrences of the specified string model.

ValueDescription
M_DEFAULT
0 <= Value <= M_MAX_NUMBER_OF_OCCURRENCES (default)Specifies the minimum number of occurrences.

M_STRING_LABEL_VALUE

Sets the label of the specified string model. You must set the StringModelLabelOrIndex parameter to the index of the string model.

ValueDescription
0 < Value < 2097152Specifies the label of the string model to control.

M_STRING_SIZE_MAX

Sets the maximum number of characters in a string.

ValueDescription
M_STRING_SIZE_MIN <= Value <= 256Specifies the maximum number of characters.

M_STRING_SIZE_MIN

Sets the minimum number of characters in a string. > Note: Note, when setting M_STRING_SIZE_MIN less than M_STRING_SIZE_MAX, MdlocrRead operations with M_MODEL_BASED will be allowed to skip model positions where M_IS_OPTIONAL is set to M_TRUE. MdlocrPreprocessexpects the number of positions with M_IS_OPTIONAL set to M_TRUE to be greater than or equal to the difference between M_STRING_SIZE_MAX and M_STRING_SIZE_MIN.

ValueDescription
1 <= Value <= M_STRING_SIZE_MAXSpecifies the minimum number of characters.

M_TEXT_ANCHOR_MODE

Sets the text anchoring mode. If a text anchor is used, it will not be included in the string result.

ValueDescription
M_DEFAULT
M_DISABLE (default)Specifies that no anchoring is used.
M_TEXT_PREFIXSpecifies that the string is prefixed by a known substring. Specify the substring usingM_TEXT_ANCHOR_VALUE.
M_TEXT_SUFFIXSpecifies that the string is suffixed by a known substring. Specify the substring usingM_TEXT_ANCHOR_VALUE.

M_TEXT_ANCHOR_VALUE

Sets the text to be used as a textual anchor.

ValueDescription
"String" (default)Specifies the text used as an anchor. An empty string indicates that any string that fits the string model can be read.
Copyright © 2026 Zebra Technologies.