| Customize Help

Code context initialization modes

A code context is a MIL object that stores code models and operation settings. Some of these settings can be initialized to predetermined values that change based on the selected code context initialization mode. When allocating your code context (using McodeAlloc()), you can chose between 2 types of initialization modes:

  • M_TYPICAL_RECOGNITION. This configures the context for a faster but less robust McodeRead() or McodeGrade() operation by making assumptions about the code to read and/or grade (such as, that the foreground color is black). This is the default value.

  • M_IMPROVED_RECOGNITION. This configures the context for a more robust McodeRead(), McodeGrade(), or McodeTrain() operation by not making many assumptions about the code to read and grade (such as, that the foreground color could be black or white). This initialization mode is recommended if your target images lack similarity (for example, some but not all include complex or noisy backgrounds), contain distorted codes, or contain codes that are at an angle or even flipped. It is also recommended when searching for 2D matrix codes that are composed of dots. Note that this initialization mode is not recommended with M_PHARMACODE.

    Note that when selecting this mode, the default of the affected code context and code model settings might change between MIL releases to improve robustness, given new features or standard recommendations.

The initialization mode can be changed after allocation, using McodeControl() with M_INITIALIZATION_MODE. When you change the initialization mode, control types that have already been set to some value (other than default) are not changed. Instead, the initialization mode changes those control types that are set to their default value (M_DEFAULT).