| Customize Help
| Save Settings

MmodDraw



Function Map
Synopsis
Draw specific features of models or result occurrences an image buffer or 2D graphics list.
Syntax
void MmodDraw(
MIL_ID ContextGraId, //in
MIL_ID ContextOrResultModId, //in
MIL_ID DstImageBufOrListGraId, //in
MIL_INT64 Operation, //in
MIL_INT Index, //in
MIL_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() with M_DRAW_ZOOM_X and M_DRAW_ZOOM_Y. For more information, see the Drawing graphics with offset and zoom subsection of the Drawing graphics section of Chapter 24: Generating graphics.

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.

Note that this function reference has not been updated for a MIL system added during a MIL update. Refer to the MIL system's release note to see which MIL system’s documentation you should use in its place and any possible differences.
Parameters
This function is not supported on the selected boards.
This function reference has not been updated for the selected MIL system. To show the content of this page, choose a second MIL system; refer to the MIL system's release note to see which MIL system’s documentation to choose and any possible differences.
Parameters
ContextGraId

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

function map For specifying the 2D graphics context
Click to summarizeValue Description
Click to summarize M_DEFAULT

Specifies that the default 2D graphics context of the current MIL application is used.

Note that there is a different default 2D graphics context for each thread.

(summarize)
Click to summarize MIL 2D graphics context identifier

Specifies a valid 2D graphics context identifier, which you have allocated using MgraAlloc().

ContextOrResultModId

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.

[Matrox Solios eA/XA; Matrox Solios ecl/xcl/ev-cl]

The Model Finder context or result buffer must be allocated on the same system as the 2D graphics context (ContextGraId). If it is not, an error will occur.

DstImageBufOrListGraId

Specifies the identifier of the destination image buffer or 2D graphics list in which to draw. The buffer can be any valid MIL 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.

If specifying an image buffer, it must not have a region of interest (ROI) associated with it. Using an image buffer with an ROI will cause an error.

When using MmodDraw() to draw features extracted from models or targets that are associated with a camera calibration context, the destination drawing buffer must also be calibrated to the same world coordinate system. MmodDraw() draws all the requested features according to whether the destination image buffer is physically corrected or not.

When drawing a model, the destination image must be at least the size of the model. Use MmodInquire() with the M_ALLOC_SIZE... inquire types to get the correct size.

When drawing a synthetic model, the destination image must have a size that matches the size of the model box scaled by M_PIXEL_SCALE.

Operation

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:

The following operations can extract the features to draw from a model context only and cannot draw in a 2D graphics list.

function map For specifying an operation that can extract features from a model context only
Click to summarizeValue Description
Click to summarize M_DRAW_DONT_CARE +

Draws the model's "don't care" pixels.

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

(summarize)
Click to summarize M_DRAW_FLAT_REGIONS +

Draws the model's "flat regions".

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

(summarize)
Click to summarize M_DRAW_IMAGE +

Draws the model image.

Click to summarize M_DRAW_WEIGHT_REGIONS +

Draws the model's weighted region mask.

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

(summarize)

The following operation can extract the features to draw from a result buffer.

function map For specifying an operation that can extract features from a result buffer
Click to summarizeValue Description
Click to summarize M_DRAW_ACTIVE_EDGELS +

Draws the active edgels of the target. To set the degree by which MIL 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, MIL 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).

(summarize)
Combination values that can be used alone or as combination values for the values listed in For specifying an operation that can extract features from a model context only; the values listed in For specifying an operation that can extract features from a result buffer.

You can use one or more of the following values in combination with each other or with the above-mentioned values, to specify an operation that can extract features to draw from both a model context and a result buffer.

function map For specifying an operation that can extract features to draw from both a model context and a result buffer
Click to summarize
Value
Description
Click to summarize M_DRAW_BOX

Draws 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.

(summarize)
Click to summarize M_DRAW_EDGES +

Draws the edges related to the model or result.

When working with a model context, MIL 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.

(summarize)
Click to summarize 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.

(summarize)
Combination values for M_DRAW_EDGES.

You can add one of the following values to the above-mentioned value to specify whether to draw the active edges of the model transformed at the occurrence position or to draw the edges of the target in the region of the occurrence.

function map For M_DRAW_EDGES when working with result occurrences
Click to summarize
Combination value
Description
Click to summarize M_MODEL

Draws the active edges of the model transformed at the occurrence position.

This is the default value.

(summarize)
Click to summarize M_TARGET

Draws 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.

(summarize)
Index

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.

This parameter should be set to one of the following values:

function map For specifying the indes of the model or of the result occurrence
Click to summarizeValue Description
Click to summarize M_DEFAULT

Refers to index 0 for models and M_ALL for results.

Click to summarize M_ALL

Draws the specified feature of all models or all occurrences.

Click to summarize M_GENERAL

Draws 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.

(summarize)
Click to summarize Value >= 0

Specifies the model index or the result occurrence.

ControlFlag

Specifies where in the destination image buffer to draw.

function map For specifying where to draw
Click to summarizeValue Description
Click to summarize M_DEFAULT

Draws 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.

(summarize)
Click to summarize 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.

(summarize)
Compilation information
Header Include mil.h.
Library Use mil.lib; milmod.lib.
DLL Requires mil.dll; milmod.dll.
DEFAULT PROC NONE DRAW DONT CARE DRAW FLAT REGIONS DRAW IMAGE DRAW WEIGHT REGIONS DRAW ACTIVE EDGELS DRAW BOX DRAW EDGES DRAW POSITION MODEL TARGET DEFAULT ALL GENERAL DEFAULT ORIGINAL GEOMETRIC GENERAL