| MIL 10 Reference
| Customize Help
| Save Settings

MmodDraw



See also
Availability
Not available in MIL-Lite
Available in MIL

Available on Windows
Available on Linux

Partially supported on:
Partially supported on Matrox Solios eA/XA
Partially supported on Matrox Solios ecl/xcl/ev-cl

Fully supported on:
Fully supported on Host system
Fully supported on Matrox CronosPlus
Fully supported on Matrox GPU processing driver
Fully supported on Matrox GigE Vision driver
Fully supported on Matrox IEEE 1394 IIDC driver
Fully supported on Matrox Iris GT
Fully supported on Matrox Morphis
Fully supported on Matrox Morphis QxT
Fully supported on Matrox Orion HD
Fully supported on Matrox Radient eCL
Fully supported on Matrox Radient eV-CXP
Fully supported on Matrox USB3 Vision driver (requires Update 19)
Fully supported on Matrox Vio

For any information regarding a MIL system added during a MIL Update, see the MIL system’s release note

Available on Non-Matrox computer
Available on Matrox 4Sight-X
Available on Matrox 4Sight GP
Available on Matrox Supersight
function map Function map
Examples
Synopsis
Draw specific features of models or result occurrences an image buffer or 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 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 22: 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.

For M_GEOMETRIC or M_GEOMETRIC_CONTROLLED type of Model Finder contexts, or for Model Finder result buffers not allocated with M_SHAPE_CIRCLE, you can use MmodInquire() with the M_CHAIN_INDEX, M_CHAIN_X, and M_CHAIN_Y controls to inquire the active edges of the model.

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 graphics context to use when drawing. This parameter must be set to one of the following values:

function map For specifying the graphics context
CollapseValue Description
Collapse M_DEFAULT

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

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

(summarize)
Collapse MIL graphics context identifier

Specifies a valid 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 graphics context (ContextGraId). If it is not, an error will occur.

DstImageBufOrListGraId

Specifies the identifier of the destination image buffer or graphics list in which to draw. The buffer can be any valid MIL image buffer allocated using MbufAlloc...(). The graphics list must be previously allocated using MgraAllocList(). By drawing into a display's overlay buffer or associating the 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 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 graphics list.

function map For specifying an operation that can extract features from a model context only
CollapseValue Description
Collapse 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_CIRCLE type of Model Finder context.

(summarize)
Collapse M_DRAW_FLAT_REGIONS +

Draws the model's "flat regions".

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

(summarize)
Collapse M_DRAW_IMAGE +

Draws the model image.

Collapse M_DRAW_WEIGHT_REGIONS +

Draws the model's weighted region mask.

This operation is not supported for a model defined in an M_SHAPE_CIRCLE 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
CollapseValue Description
Collapse 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 cannot use M_DRAW_ACTIVE_EDGELS with a controlled geometric Model Finder context (MmodAlloc() with M_GEOMETRIC_CONTROLLED).

(summarize)
Combination constants that can be used alone or as combination constants 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
CollapseValue Description
Collapse 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)
Collapse 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)
Collapse 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 constants 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
CollapseCombination value Description
Collapse M_MODEL

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

This is the default value.

(summarize)
Collapse 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
CollapseValue Description
Collapse M_DEFAULT

Refers to index 0 for models and M_ALL for results.

Collapse M_ALL

Draws the specified feature of all models or all occurrences.

Collapse 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)
Collapse 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
CollapseValue Description
Collapse M_DEFAULT

Draws at the center of the top-left pixel of the destination image buffer; or, if drawing in a 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)
Collapse 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 GENERAL