Table: | For specifying where to draw |
MIL_ID ContextGraId, | //in |
MIL_ID ContextOrResultModId, | //in |
MIL_ID DstImageBufOrListGraId, | //in |
MIL_INT64 Operation, | //in |
MIL_INT Index, | //in |
MIL_INT64 ControlFlag | //in |
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.
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
|
|||||||||||||||||||||||||||||||||||||||
Value | Description | ||||||||||||||||||||||||||||||||||||||
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)Specifies that the default 2D graphics context of the current MIL application is used. (more details...) |
||||||||||||||||||||||||||||||||||||||
MIL 2D graphics context identifier |
Specifies a valid 2D graphics context identifier, which you have allocated using MgraAlloc(). |
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.
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.
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.
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.
For specifying an operation that can extract features
from a model context only
|
|||||||||||||||||||||||||||||||||||||||
Value | Description | ||||||||||||||||||||||||||||||||||||||
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)Draws the model's "don't care" pixels. (more details...) |
||||||||||||||||||||||||||||||||||||||
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)Draws the model's "flat regions". (more details...) |
||||||||||||||||||||||||||||||||||||||
M_DRAW_IMAGE + |
Draws the model image. |
||||||||||||||||||||||||||||||||||||||
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)Draws the model's weighted region mask. (more details...) |
The following operation can extract the features to draw from a result buffer.
For specifying an operation that can extract features
from a result buffer
|
|||||||||||||||||||||||||||||||||||||||
Value | Description | ||||||||||||||||||||||||||||||||||||||
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)Draws the active edgels of the target. (more details...) |
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.
For specifying an operation that can extract features
to draw from both a model context and a result buffer
|
|||||||||||||||||||||||||||||||||||||||
|
Description | ||||||||||||||||||||||||||||||||||||||
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)Draws the model box, or a bounding box around the occurrence. (more details...) |
||||||||||||||||||||||||||||||||||||||
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)Draws the edges related to the model or result. (more details...) |
||||||||||||||||||||||||||||||||||||||
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)Draws a cross-like symbol at the model's reference axis origin or occurrence position. (more details...) |
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.
For M_DRAW_EDGES when working with result
occurrences
|
|||||||||||||||||||||||||||||||||||||||
|
Description | ||||||||||||||||||||||||||||||||||||||
M_MODEL |
Draws the active edges of the model transformed at the occurrence position. This is the default value. (summarize)Draws the active edges of the model transformed at the occurrence position. (more details...) |
||||||||||||||||||||||||||||||||||||||
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)Draws the edges of the target in the region of the occurrence. (more details...) |
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:
For specifying the indes of the model or of the
result occurrence
|
|||||||||||||||||||||||||||||||||||||||
Value | Description | ||||||||||||||||||||||||||||||||||||||
M_DEFAULT |
Refers to index 0 for models and M_ALL for results. |
||||||||||||||||||||||||||||||||||||||
M_ALL |
Draws the specified feature of all models or all occurrences. |
||||||||||||||||||||||||||||||||||||||
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)Draws the specified feature of the entire target. (more details...) |
||||||||||||||||||||||||||||||||||||||
Value >= 0 |
Specifies the model index or the result occurrence. |
Specifies where in the destination image buffer to draw.
For specifying where to draw
|
|||||||||||||||||||||||||||||||||||||||
Value | Description | ||||||||||||||||||||||||||||||||||||||
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)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. (more details...) |
||||||||||||||||||||||||||||||||||||||
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)Draws at the offsets used to define the model region in the model source. (more details...) |
Header | Include mil.h. |
Library | Use mil.lib; milmod.lib. |
DLL | Requires mil.dll; milmod.dll. |