| MIL 10 Reference
| Customize Help
| Save Settings

MbeadDraw



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

Available on Windows
Available on Linux

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 a bead context or of a bead result.
Syntax
void MbeadDraw(
MIL_ID ContextGraId, //in
MIL_ID ContextOrResultBeadId, //in
MIL_ID DstImageBufOrListGraId, //in
MIL_INT64 DrawOperation, //in
MIL_INT64 DrawOption, //in
MIL_INT LabelOrIndex, //in
MIL_INT Index, //in
MIL_INT64 ControlFlag //in
)
Description

This function draws specific features of a selected bead context or bead result, in the specified destination image buffer or graphics list. Drawings are typically performed using either the template's vertices or trained points (when specifying a bead context), or using the trained points' corresponding measured point (when specifying a bead result). Drawing operations for trained points are only available after calling MbeadTrain(), while drawing operations for bead results are only available after calling MbeadVerify().

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 example, you can draw a zoomed section of the bead found in the target image at the top-left corner of the destination image. For more information, see the Drawing graphics with offset and zoom subsection of the Drawing graphics section of Chapter 22: Generating graphics.

All operations are available for drawing in either the specified destination image buffer or graphics list, unless otherwise specified.

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 if there is complementary information.
Parameters
This function is not supported on the selected boards.
Parameters
ContextGraId

Specifies the identifier of the graphics context to use. 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().

ContextOrResultBeadId

Specifies the identifier of the bead context or bead result buffer that this function will use to perform the drawing operation. The context or result buffer must have been previously allocated on the system using MbeadAlloc() or MbeadAllocResult(), respectively.

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 calling MbeadDraw() with a bead context (and using a calibrated training image) or with a bead result (and using a calibrated target image), the destination drawing buffer need not be calibrated to the same world. MIL draws according to the calibration context associated to either the training or verification image.

DrawOperation

Specifies the drawing operation to perform.

To perform drawing operations for a bead context or a bead result, this parameter can be set to one of the following values. These drawing operations are performed according to the points specified with the DrawOption parameter.

function map Drawing operations for a context or result
CollapseValue Description
Collapse M_DRAW_INDEX

Draws the index of the templates containing the points that fulfill the conditions of the DrawOption parameter. For example, if you set the DrawOption parameter to M_TRAINED, the index of all the successfully trained templates will be drawn.

(summarize)
Collapse M_DRAW_LABEL

Draws the label of the templates containing the points that fulfill the conditions of the DrawOption parameter. For example, if you set the DrawOption parameter to M_FAIL, the label of all the templates with at least one failed point will be drawn.

(summarize)
Collapse M_DRAW_POSITION

Draws a cross at the position of the point.

Collapse M_DRAW_POSITION_INDEX

Draws the index value of the point. If you specify M_USER, you can only perform this drawing operation for templates with a path that follows a polyline (MbeadControl() with M_TRAINING_PATH), otherwise you will get an error.

(summarize)
Collapse M_DRAW_POSITION_POLYLINE

Draws the polyline that connects the points. If the template's path follows a circle, MIL draws an actual circle (smooth curve).

(summarize)
Collapse M_DRAW_SEARCH_BOX

Draws the search box of the point.

Collapse M_DRAW_WIDTH

Draws an H-type line (|-|) indicating the width of the bead at that point.

This value is only supported for stripe-beads.

(summarize)

To draw the training image, this parameter must be set to the following value. To draw the training image, you must set the ContextOrResultBeadId parameter to a bead context, the DstImageBufOrListGraId parameter to a destination image, the DrawOption parameter to M_DEFAULT, the LabelOrIndex parameter to M_GENERAL, and the Index parameter to M_GENERAL.

function map Drawing the training image
CollapseValue Description
Collapse M_DRAW_TRAINING_IMAGE

Draws the training image. To draw the training image, you must have internally saved it with the bead context, by calling MbeadTrain() with M_SAVE_TRAINING_IMAGE. This operation cannot draw in a graphics list.

(summarize)
DrawOption

Specifies the type of points that this function will use to perform the drawing operation. If this information is not required for the specified drawing operation, set this parameter to M_DEFAULT.

When performing a drawing operation for a bead context or bead result, this parameter can be set to the following value.

function map For performing a drawing operation with a context or a result
CollapseValue Description
Collapse M_DEFAULT

Specifies the default value.

For a bead context, the default value is the same as M_TRAINED. For a bead result, the default value is the same as M_ALL. For an M_DRAW_TRAINING_IMAGE operation, the default indicates that this parameter's information is not required.

(summarize)

When performing a drawing operation for a bead context, this parameter can be set to one of the following values.

function map For performing a drawing operation with a context
CollapseValue Description
Collapse M_TRAINED

Specifies that MIL performs the drawing operation using the trained points indicated by both M_TRAINED_FAIL and M_TRAINED_PASS.

Collapse M_TRAINED_FAIL

Specifies that MIL performs the drawing operation using all the trained points that were expected but not found, during the training phase (MbeadTrain()). In this case, the drawing operation uses the expected position of the trained point.

(summarize)
Collapse M_TRAINED_PASS

Specifies that MIL performs the drawing operation using all the trained points that were established (found), during the training phase MbeadTrain().

Collapse M_USER

Specifies that MIL performs the drawing operation using the vertices of the template.

If the template's path follows a polyline (MbeadControl() with M_TRAINING_PATH), M_USER refers to the specified polyline points (MbeadTemplate()). If the template's path follows a circle or segment, M_USER refers to the minimum critical points that MIL internally calculates based on the specified settings of the path. For a path that follows a segment, MIL calculates three critical points, according to the specified start and end of the segment (MbeadControl() with M_TEMPLATE_SEGMENT_...). For a path that follows a circle, MIL calculates five critical points, according to the specified center and radius of the circle (M_TEMPLATE_CIRCLE_...).

You cannot specify M_USER for an M_DRAW_WIDTH operation; MIL considers width a trained aspect of the bead (as is the case, for example, when you are using a training image to establish the width).

(summarize)

When performing a drawing operation for a bead result, this parameter can be set to one of the following values.

function map For performing a drawing operation with a result
CollapseValue Description
Collapse M_ALL

Specifies that the drawing operation will be performed using all measured points, regardless of whether they have passed (M_PASS) or failed (M_FAIL). For measured points that were not found, the drawing operation uses their expected position.

(summarize)
Collapse M_FAIL

Specifies that the drawing operation will be performed using all measured points that were expected but did not pass verification. In this case, the drawing operation uses the expected position of the measured point.

(summarize)
Collapse M_FAIL_GAP_MAX

Specifies that the drawing operation will be performed using all measured points that have failed verification, and whose expected position falls within the maximum gap in the bead, as specified using MbeadControl() with M_GAP_MAX_LENGTH.

Collapse M_FAIL_INTENSITY_MAX

Specifies that the drawing operation will be performed using all measured points that have failed verification because their intensity is greater than the highest intensity allowed, as specified using MbeadControl() with M_INTENSITY_NOMINAL + M_INTENSITY_DELTA_POS.

This value is only supported for stripe-beads.

(summarize)
Collapse M_FAIL_INTENSITY_MIN

Specifies that the drawing operation will be performed using all measured points that have failed verification because their intensity is less than the lowest intensity allowed, as specified using MbeadControl() with M_INTENSITY_NOMINAL - M_INTENSITY_DELTA_NEG.

This value is only supported for stripe-beads.

(summarize)
Collapse M_FAIL_NOT_FOUND

Specifies that the drawing operation will be performed using all measured points that have failed verification because they were not found in the target image.

Collapse M_FAIL_OFFSET

Specifies that the drawing operation will be performed using all measured points that have failed verification because their position has surpassed the offset criterion, as specified using MbeadControl() with M_OFFSET_MAX.

Collapse M_FAIL_WIDTH_MAX

Specifies that the drawing operation will be performed using all measured points that have failed verification because the width of the measured bead at their position is greater than the maximum width criterion, as specified using MbeadControl() with M_TRAINING_WIDTH_NOMINAL + M_WIDTH_DELTA_POS.

This value is only supported for stripe-beads.

(summarize)
Collapse M_FAIL_WIDTH_MIN

Specifies that the drawing operation will be performed using all measured points that have failed verification because the width of the measured bead at their position is less than the minimum width criterion, as specified using MbeadControl() with M_TRAINING_WIDTH_NOMINAL - M_WIDTH_DELTA_NEG.

This value is only supported for stripe-beads.

(summarize)
Collapse M_PASS

Specifies that the drawing operation will be performed using all the measured points that have passed verification.

LabelOrIndex

Specifies the templates (one or all) that this function will use to perform the drawing operation, or specifies that you are performing a general type of drawing operation. The specified template is either in a bead context or result buffer, depending on the ContextOrResultBeadId parameter setting. All LabelOrIndex parameter values can be used for any draw operation, unless otherwise specified.

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

function map For specifying the template
CollapseValue Description
Collapse

Specifies the index of a template for which to perform the drawing operation.

(summarize)
Parameters

Specifies the index. The index is from 0 (inclusive) to the number of templates minus 1.

Collapse

Specifies the label of a template, for which to perform the drawing operation.

(summarize)
Parameters

Specifies the label. The label must be greater than 0.

Collapse M_ALL

Specifies to perform the drawing operation for all templates.

Collapse M_GENERAL

Specifies that you are performing a general type of drawing operation. You can only use M_GENERAL with M_DRAW_TRAINING_IMAGE.

(summarize)
Index

Specifies the set of template points (one or all) for which to perform the drawing operation, or specifies that you are performing a general type of drawing operation. All Index parameter values can be used for any draw operation (except M_DRAW_TRAINING_IMAGE).

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

function map For specifying the index of the trained point
CollapseValue Description
Collapse M_ALL

Specifies to perform the drawing operation for all points in the specified templates.

Collapse M_GENERAL

Specifies that you are performing a general type of drawing operation. In this case, the entire template is either drawn or not, depending on whether it contains one or more points that meet the conditions of the drawing operation. You must specify M_GENERAL when using M_DRAW_TRAINING_IMAGE.

(summarize)
Collapse Value >= 0

Specifies the index of the point in the specified templates for which to perform the drawing operation. The index is from 0 (inclusive) to the total number of points in the template minus 1. To get the number of trained points in the template, use MbeadGetResult() with M_NUMBER.

(summarize)
ControlFlag

Specifies whether MIL performs drawings with fail-type points differently than drawings with other types of points.

function map For specifying whether MIL performs drawings with fail-type points differently
CollapseValue Description
Collapse M_DEFAULT

Specifies that MIL does not perform drawings with fail-type points differently.

Collapse M_ENHANCED

Specifies that MIL performs drawings with fail-type points differently than drawings with other types of points. That is, when possible, drawing operations (M_DRAW_...) with M_..._FAIL or M_FAIL_... points, such as M_TRAINED_FAIL and M_FAIL_NOT_FOUND, will be visually distinguishable from drawing operations with other types of points, such as M_USER, M_TRAINED_PASS, and M_PASS.

This can be useful when drawing both fail-type and pass-type points, either by calling MbeadDraw() multiple times, or by performing the drawing operation on all points (M_TRAINED and M_ALL). For example, if you specify M_DRAW_POSITION_INDEX and M_ALL, the index of each trained point is drawn, if its associated measured point has been found (pass); for measured points that were expected but not found (fail), the index of their associated trained point is drawn with a horizontal line above it.

You cannot use M_ENHANCED when drawing the training image (M_DRAW_TRAINING_IMAGE).

(summarize)
Compilation information
Header Include mil.h.
Library Use mil.lib; milbead.lib.
DLL Requires mil.dll; milbead.dll.
DEFAULT PROC NONE DRAW INDEX DRAW LABEL DRAW POSITION DRAW POSITION INDEX DRAW POSITION POLYLINE DRAW SEARCH BOX DRAW WIDTH DRAW TRAINING IMAGE DEFAULT TRAINED TRAINED FAIL TRAINED PASS USER ALL FAIL FAIL GAP MAX FAIL INTENSITY MAX FAIL INTENSITY MIN FAIL NOT FOUND FAIL OFFSET FAIL WIDTH MAX FAIL WIDTH MIN PASS NUMBER OF TEMPLATES ALL GENERAL ALL GENERAL DEFAULT ENHANCED DEFAULT GENERAL GENERAL ENHANCED BEAD STRIPE