Skip to main content

MmodDraw

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

Draw specific features of models or result occurrences in an image buffer or 2D graphics list.

Syntax

void MmodDraw(
AIL_ID ContextGraId, //in
AIL_ID ContextOrResultModId, //in
AIL_ID DstImageBufOrListGraId, //out
AIL_INT64 Operation, //in
AIL_INT Index, //in
AIL_INT64 ControlFlag //in
)

Description

This function draws specific features of models or result occurrences in the destination image buffer or 2D graphics list.

You can draw results and settings, obtained relative to an offset, at the top-left corner of the destination image, using MgraControl with M_DRAW_OFFSET_X and M_DRAW_OFFSET_Y and zoom them using MgraControl withM_DRAW_ZOOM_X and M_DRAW_ZOOM_Y. For more information, see Drawing with an offset and scale.

[Image: MmodDrawZooming.png]

When zooming, MmodDraw will draw into the destination image buffer even if the buffer is not large enough to contain all of the zoomed image. The image will be truncated.

Note that if you try to draw a model's edges and its Model Finder context has not been preprocessed, a preliminary edge extraction operation will be performed for the model.

Parameters

ContextGraId (in, AIL_ID)

Specifies the identifier of the 2D graphics context to use when drawing. This parameter must be set to one of the following values:

For specifying the 2D graphics context

ValueDescription
M_DEFAULTSpecifies that the default 2D graphics context of the current Aurora Imaging Library application is used.

Note: Note that there is a different default 2D graphics context for each thread. | | 2D graphics context identifier | Specifies a valid 2D graphics context identifier, which you have allocated using MgraAlloc. |

ContextOrResultModId (in, AIL_ID)

Specifies the Model Finder context or result buffer from which to extract the features to draw. The Model Finder context or result buffer must have been previously allocated using MmodAlloc or MmodAllocResult, respectively.

DstImageBufOrListGraId (out, AIL_ID)

Specifies the identifier of the destination image buffer or 2D graphics list in which to draw. The buffer can be any valid 1- or 3-band image buffer allocated using MbufAlloc.... The 2D graphics list must be previously allocated using MgraAllocList. By drawing into a display's overlay buffer or associating the 2D graphics list with the display, you can also annotate an image non-destructively.

Operation (in, AIL_INT64)

Specifies the type of operation to perform. Operations can be added together to draw multiple features at a time. For example, to draw both the result occurrence's position and active edges, you would set the Operation parameter to M_DRAW_POSITION+M_DRAW_EDGES. The Operation parameter can be set to a combination of the following values:

For specifying an operation that can extract features from a model context only

ValueDescription
M_DRAW_DONT_CAREDraws the model's "don't care" pixels.
M_DRAW_FLAT_REGIONSDraws the model's "flat regions".
M_DRAW_IMAGEDraws the model image.
M_DRAW_WEIGHT_REGIONSDraws the model's weighted region mask.

For specifying an operation that can extract features from a result buffer

ValueDescription
M_DRAW_ACTIVE_EDGELSDraws the active edgels of the target. To set the degree by which Aurora Imaging Library considers edgels in the target active, use MmodControl with M_ACTIVE_EDGELS.

When using M_DRAW_ACTIVE_EDGELS, you must set the Index parameter to M_GENERAL; also, the find operation must have been performed with M_SAVE_TARGET_EDGES set to M_ENABLE.

For each model, Aurora Imaging Library establishes one set of active edgels in the target. For multi-model contexts, M_DRAW_ACTIVE_EDGELS draws all the edgels that have contributed to at least one model.

You can only use M_DRAW_ACTIVE_EDGELS with a Model Finder result buffer whose results were generated using a geometric Model Finder context (MmodAlloc with M_GEOMETRIC). |

For specifying an operation that can extract features to draw from both a model context and a result buffer

ValueDescription
M_DRAW_BOXDraws the model box, or a bounding box around the occurrence. Note that when drawing an occurrence, the bounding box is drawn maintaining the angle and scale of the occurrence.
M_DRAW_EDGESDraws the edges related to the model or result.

When working with a model context, Aurora Imaging Library draws the active edges of the model (not masked out).

When working with result occurrences, the drawing depends on whether you are adding M_MODEL or M_TARGET to M_DRAW_EDGES. | | M_DRAW_POSITION | Draws a cross-like symbol at the model's reference axis origin or occurrence position. The cross is drawn maintaining the angle of the model's reference axis or the occurrence. |

For

ValueDescription
M_MODEL (default)Draws the active edges of the model transformed at the occurrence position.
M_TARGETDraws the edges of the target in the region of the occurrence. If the Index parameter is set to M_GENERAL, then all the edges of the target are drawn. To draw the edges of the target, the find operation must have been performed with M_SAVE_TARGET_EDGES set to M_ENABLE.

Index (in, AIL_INT)

Specifies the index of the model in the specified Model Finder context, or of the result occurrence. User labels cannot be used as indices; to retrieve the index of a model from its user label, use MmodInquire with M_INDEX_FROM_LABEL.

For specifying the index of the model or of the result occurrence

ValueDescription
M_DEFAULTRefers to index 0 for models and M_ALL for results.
M_ALLDraws the specified feature of all models or all occurrences.
M_GENERALDraws the specified feature of the entire target. M_GENERAL can only be specified when using M_DRAW_EDGES + M_TARGET or M_DRAW_ACTIVE_EDGELS.
Value >= 0Specifies the model index or the result occurrence.

ControlFlag (in, AIL_INT64)

Specifies where in the destination image buffer to draw.

For specifying where to draw

ValueDescription
M_DEFAULTDraws at the center of the top-left pixel of the destination image buffer; or, if drawing in a 2D graphics list, from the center of the top-left pixel of the image used at the time of annotation.

When drawing features of a result occurrence, this parameter must be set to M_DEFAULT. | | M_ORIGINAL | Draws at the offsets used to define the model region in the model source. If M_ORIGINAL is selected, the drawing is done at the original position of the model.

M_ORIGINAL is only supported for image-type or Edge Finder-type models. |

This operation is not supported for a model defined in an M_SHAPE_... type of Model Finder context.

Copyright © 2026 Zebra Technologies.