| Customize Help
| Save Settings

MedgeDraw



Function Map
Synopsis
Draw specific edge results in the destination image buffer or 2D graphics list.
Syntax
void MedgeDraw(
MIL_ID ContextGraId, //in
MIL_ID ResultEdgeId, //in
MIL_ID DstImageBufOrListGraId, //in
MIL_INT64 Operation, //in
MIL_INT IndexOrLabel, //in
MIL_INT64 ControlFlag //in
)
Description

This function draws specific edge results in the destination image buffer or 2D graphics list.

To draw edge results, the required information must be available for the specified edge or group of edges, in the Edge Finder result buffer. To verify availability, call MedgeGetResult() with the required edge result combined with M_AVAILABLE.

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 edge map 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 24: Generating graphics.

Note that if the edges are calculated using a calibrated source image, Edge Finder takes the camera calibration into account; that is, drawings might be distorted, according to the camera calibration. For example, a straight line (in the world) might be drawn as a curve.

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().

ResultEdgeId

Specifies the identifier of the Edge Finder result buffer from which to extract the results to draw. The Edge Finder result buffer must have been previously allocated on the required system using MedgeAllocResult().

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

The Edge Finder result buffer (ResultEdgeId) must be allocated on the same system as the 2D graphics context buffer (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 MedgeDraw() to draw results extracted from a calibrated source image, the destination drawing buffer need not be calibrated to the same world. MedgeDraw() draws all the requested results according to the calibrated source image.

Operation

Specifies the type of operation to perform. The possible Operation parameter values in the table below can be added together to draw multiple feature results at once.

The following operations can draw in a destination image buffer or 2D graphics list.

function map For specifying the type of operation to perform
Click to summarizeValue Description
Click to summarize M_DRAW_BOX +

Draws a bounding box around each edge.

Note that to perform this operation, the M_BOX feature in MedgeControl() must be calculated.

(summarize)
Click to summarize M_DRAW_CENTER_OF_GRAVITY +

Draws a cross at the center of gravity of each edge.

You can modify the cross size by setting MedgeControl() with M_DRAW_CROSS_SIZE to an appropriate value.

Note that to perform this operation, the M_CENTER_OF_GRAVITY feature in MedgeControl() must be calculated.

(summarize)
Click to summarize M_DRAW_CIRCLE_FIT +

Draws the circle fit of each edge.

Note that to perform this operation, the M_CIRCLE_FIT feature in MedgeControl() must be calculated.

(summarize)
Click to summarize M_DRAW_EDGE +

Draws each edge.

Click to summarize M_DRAW_EDGELS +

Draws a cross at each edgel.

You can modify the cross size by setting MedgeControl() with M_DRAW_CROSS_SIZE to an appropriate value.

(summarize)
Click to summarize M_DRAW_ELLIPSE_FIT +

Draws the ellipse fit of each edge.

Note that to perform this operation, the M_ELLIPSE_FIT feature in MedgeControl() must be calculated.

(summarize)
Click to summarize M_DRAW_FERET_GENERAL +

Draws the edges' general Feret, using an H-type line (|-|). This line is drawn on contact with the edge's two extrema edgels, at the general Feret diameter's angle.

Note that to perform this operation, the M_FERET_GENERAL feature in MedgeControl() must be calculated.

(summarize)
Click to summarize M_DRAW_FERET_MAX +

Draws the edges' maximum Feret, using an H-type line (|-|). This line is drawn on contact with the edge's two extrema edgels, at the maximum Feret diameter's angle.

Note that to perform this operation, the M_FERET_MAX_DIAMETER and M_FERET_MAX_ANGLE features in MedgeControl() must be calculated.

(summarize)
Click to summarize M_DRAW_FERET_MIN +

Draws the edges' minimum Feret, using an H-type line (|-|). This line is drawn on contact with the edge's two extrema edgels, at the minimum Feret diameter's angle.

Note that to perform this operation, the M_FERET_MIN_DIAMETER and M_FERET_MIN_ANGLE features in MedgeControl() must be calculated.

(summarize)
Click to summarize M_DRAW_INDEX +

Draws each edge's index value.

Click to summarize M_DRAW_LABEL +

Draws each edge's label value.

Note that to perform this operation, the M_LABEL_VALUE feature in MedgeControl() must be calculated.

(summarize)
Click to summarize M_DRAW_LINE_FIT +

Draws the line fit of each edge.

Note that to perform this operation, the M_LINE_FIT feature in MedgeControl() must be calculated.

(summarize)
Click to summarize M_DRAW_POSITION +

Draws a cross at the center of each edge.

You can modify the cross size by setting MedgeControl() with M_DRAW_CROSS_SIZE to an appropriate value.

Note that to perform this operation, the M_POSITION feature in MedgeControl() must be calculated.

(summarize)
Click to summarize M_DRAW_SEGMENTS +

Draws the segments of the edge approximation.

Note that to perform this operation, edge approximations must have been previously calculated by setting MedgeControl() with M_CHAIN_APPROXIMATION to M_LINE.

(summarize)
Click to summarize M_DRAW_VERTICES +

Draws the segment intersections (or vertices) of the edge approximation.

Note that to perform this operation, edge approximations must have been previously calculated by setting MedgeControl() with M_CHAIN_APPROXIMATION to M_LINE.

(summarize)

You can add the following value to the above-mentioned values to specify that the operation's numeric value is drawn.

function map For M_DRAW_CENTER_OF_GRAVITY, M_DRAW_POSITION, M_DRAW_FERET_MIN, M_DRAW_FERET_MAX, and M_DRAW_FERET_GENERAL
Click to summarizeCombination value Description
Click to summarize M_DRAW_VALUE +

Specifies that the operation's numerical value is drawn. For example, if you add M_DRAW_VALUE to M_DRAW_CENTER_OF_GRAVITY, the center of gravity's coordinates are drawn within parenthesis, and centered above the drawing cross.

(summarize)
Combination values that can be used alone or as combination values for the values listed in For specifying the type of operation to perform; the values listed in For M_DRAW_CENTER_OF_GRAVITY, M_DRAW_POSITION, M_DRAW_FERET_MIN, M_DRAW_FERET_MAX, and M_DRAW_FERET_GENERAL.

You can use one of the following values on its own, or add it to the above-mentioned values, to specify an operation that cannot use a 2D graphics list as a destination.

The following operations can only draw in an image buffer.

function map For specifying operations that cannot use a 2D graphics list as a destination
Click to summarizeValue Description
Click to summarize M_DRAW_ANGLE

Draws the internal angle buffer.

Note that to perform this operation, the angle buffer must have been previously saved in the result buffer by enabling M_SAVE_ANGLE in MedgeControl().

(summarize)
Click to summarize M_DRAW_CROSS_DERIVATIVE

Draws the internal cross-derivative buffer of the source image.

M_DRAW_CROSS_DERIVATIVE is only relevant for M_CREST Edge Finder contexts.

Note that to perform this operation, the derivatives must have been previously saved in the result buffer by enabling M_SAVE_DERIVATIVES in MedgeControl().

(summarize)
Click to summarize M_DRAW_FIRST_DERIVATIVE_X

Draws the internal first derivative buffer of the source image, in the X-direction.

M_DRAW_FIRST_DERIVATIVE_X is only relevant for M_CONTOUR Edge Finder contexts.

Note that to perform this operation, the derivatives must have been previously saved in the result buffer by enabling M_SAVE_DERIVATIVES in MedgeControl().

(summarize)
Click to summarize M_DRAW_FIRST_DERIVATIVE_Y

Draws the internal first derivative buffer of the source image, in the Y-direction.

M_DRAW_FIRST_DERIVATIVE_Y is only relevant for M_CONTOUR Edge Finder contexts.

Note that to perform this operation, the derivatives must have been previously saved in the result buffer by enabling M_SAVE_DERIVATIVES in MedgeControl().

(summarize)
Click to summarize M_DRAW_IMAGE

Draws the source image.

Note that to perform this operation, the source image must have been previously saved in the result buffer by enabling M_SAVE_IMAGE in MedgeControl().

(summarize)
Click to summarize M_DRAW_MAGNITUDE

Draws the internal magnitude buffer.

Note that to perform this operation, the magnitude buffer must have been previously saved in the result buffer by enabling M_SAVE_MAGNITUDE in MedgeControl().

(summarize)
Click to summarize M_DRAW_MASK

Draws the mask buffer.

Note that to perform this operation, the mask buffer must have been previously saved in the result buffer by enabling M_SAVE_MASK in MedgeControl().

(summarize)
Click to summarize M_DRAW_SECOND_DERIVATIVE_X

Draws the internal second derivative buffer of the source image, in the X-direction.

M_DRAW_SECOND_DERIVATIVE_X can only be used with M_CREST Edge Finder contexts.

Note that to perform this operation, the derivatives must have been previously saved in the result buffer by enabling M_SAVE_DERIVATIVES in MedgeControl().

(summarize)
Click to summarize M_DRAW_SECOND_DERIVATIVE_Y

Draws the internal second derivative buffer of the source image, in the Y-direction.

M_DRAW_SECOND_DERIVATIVE_Y can only be used with M_CREST Edge Finder contexts.

Note that to perform this operation, the derivatives must have been previously saved in the result buffer by enabling M_SAVE_DERIVATIVES in MedgeControl().

(summarize)
IndexOrLabel

Specifies the edge(s) to draw. This parameter must be set to one of the values below.

function map For specifying the edge(s) to draw
Click to summarizeValue Description
Click to summarize M_DEFAULT

Same as M_INCLUDED_EDGES.

Click to summarize M_ALL_EDGES +

Specifies all edges.

Click to summarize M_EXCLUDED_EDGES +

Specifies all currently excluded edges.

Click to summarize M_INCLUDED_EDGES +

Specifies all currently included edges.

Click to summarize Value +

Specifies either the edge's index or label. For more information, see combination values below.

Valid index values must fall within the following range: 0 to the number of included edges in the Edge Finder result buffer - 1. You can retrieve valid label values using MedgeGetResult() with M_LABEL_VALUE.

(summarize)
Combination values for any of the possible values of the IndexOrLabel parameter.

You can add one of the following values to the above-mentioned values to specify whether you are providing an index or a label value.

function map For an index or a label value
Click to summarizeCombination value Description
Click to summarize M_TYPE_INDEX

Specifies an edge using its index value.

Note that only included edges (M_INCLUDED_EDGES) can be drawn.

This is the default value.

(summarize)
Click to summarize M_TYPE_LABEL

Specifies an edge using its label value.

ControlFlag

Reserved for future expansion and must be set to M_DEFAULT.

Compilation information
Header Include mil.h.
Library Use mil.lib; miledge.lib.
DLL Requires mil.dll; miledge.dll.
DEFAULT PROC NONE DRAW BOX DRAW CENTER OF GRAVITY DRAW CIRCLE FIT DRAW EDGE DRAW EDGELS DRAW ELLIPSE FIT DRAW FERET GENERAL DRAW FERET MAX DRAW FERET MIN DRAW INDEX DRAW LABEL DRAW LINE FIT DRAW POSITION DRAW SEGMENTS DRAW VERTICES DRAW VALUE DRAW ANGLE DRAW CROSS DERIVATIVE DRAW FIRST DERIVATIVE X DRAW FIRST DERIVATIVE Y DRAW IMAGE DRAW MAGNITUDE DRAW MASK DRAW SECOND DERIVATIVE X DRAW SECOND DERIVATIVE Y DEFAULT ALL EDGES EXCLUDED EDGES INCLUDED EDGES TYPE INDEX TYPE LABEL