| MIL 10 Reference
| Customize Help
| Save Settings

MimDraw



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 the settings of an image processing context or the results of an image processing operation.
Syntax
void MimDraw(
MIL_ID ContextGraId, //in
MIL_ID Src1MilId, //in
MIL_ID Src2MilId, //in
MIL_ID DstImageBufOrListGraId, //in
MIL_INT64 Operation, //in
MIL_DOUBLE Param1, //in
MIL_DOUBLE Param2, //in
MIL_INT64 ControlFlag //in
)
Description

The function draws the settings of an image processing context or the results of a MIL image processing operation, into a destination image buffer.

You can also use MimDraw() to draw the internal copy of a source image that was passed to MimControl() or an image processing function and saved in an image processing context or result buffer. Note that the drawn image might differ from the original source image (for example, in bit depth). This is because, for greater optimization, an image processing context or result buffer might store its internal image data in a different format than the original source image buffer.

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:

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

Src1MilId

Specifies the identifier of the primary source image buffer, result buffer, or image processing context from which to extract the results to draw. The buffer must have been previously allocated on the required system, using MbufAlloc...(), MimAllocResult(), or MimAlloc(), respectively.

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

See the Parameter associations section for possible values that can be specified.

Src2MilId

Specifies the identifier of the secondary source image buffer for the drawing operation. The buffer must have been previously allocated on the required system using MbufAlloc...().

If this parameter is not required for the draw operation, it must be set to M_NULL.

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

See the Parameter associations section for possible values that can be specified.

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...(). However, when the source buffers are image buffers, the destination image buffer should be greater than or equal in size and bit depth to the source image buffers. If the destination image buffer is smaller than the source image buffers, the excess will not be part of the destination image.

If drawing an internal image contained in an image processing context or result buffer, the same destination buffer rule applies. In this case, you can use MimInquire() to find the size, depth, and other attributes of the internal image to correctly set the destination buffer.

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.

An operation can draw in a graphics list only if it is specified in the operation's description. If you specify a graphics list, the graphics list must have been previously allocated using MgraAllocList(). You cannot use a graphics list when drawing with wavelet transformations.

Operation

Specifies the type of operation to perform.

See the Parameter associations section for possible values that can be specified.

Param1

Specifies an attribute of the operation to perform.

If this parameter is not required for the draw operation, it must be set to 0.

See the Parameter associations section for possible values that can be specified.

Param2

Specifies an attribute of the operation to perform.

If this parameter is not required for the draw operation, it must be set to 0.

See the Parameter associations section for possible values that can be specified.

ControlFlag

Specifies drawing constraints. You must set this parameter to M_DEFAULT unless you are drawing MimLocatePeak1d() or MimWaveletTransform() results.

To specify the default drawing behavior, set this parameter to the following:

function map For specifying the default drawing behavior
CollapseValue Description
Collapse M_DEFAULT

Specifies the default behavior. Except when drawing MimLocatePeak1d() or MimWaveletTransform() results, MIL ignores this parameter.

When drawing MimLocatePeak1d() results, the default is M_FIXED_POINT + n, where n = 0.

When drawing MimWaveletTransform() results, the default is M_AUTO_SCALE.

(summarize)

To specify the number of fractional bits in the source values when using MimLocatePeak1d() results, set this parameter to the following:

function map For specifying the number of fractional bits when using MimLocatePeak1d results
CollapseValue Description
Collapse M_FIXED_POINT + n

Specifies the number of fractional bits in the source values, when they are in a fixed-point format. Set n to an integer between 0 and 7, inclusive.

(summarize)

To specify how to manage the range of pixel values when using MimWaveletTransform() results, set this parameter to one of the following:

function map For specifying how to manage the range of pixel values when using MimWaveletTransform results
CollapseValue Description
Collapse M_AUTO_SCALE

Remaps pixel values (Src1MilId) according to the range of pixel values allowed in the destination (DstImageBufOrListGraId).

Collapse M_SATURATION

Clips pixel values (Src1MilId) that are outside the range of pixel values allowed in the destination (DstImageBufOrListGraId).

In the following table, Src1MilId specifies an image processing context and Operation specifies the operation to perform with the specified image processing context. Src2MilId, Param1, and Param2 are not required, and must be set to M_NULL, 0, and 0, respectively.

function map For specifying to perform the draw operation with the specified image processing context
CollapseSrc1MilId Description
Operation
Src2MilId
Param1
Param2
Collapse Dead pixel correction image processing
context ID

Specifies a dead pixel correction image processing context used in MimDeadPixelCorrection() operations, allocated using MimAlloc() with M_DEAD_PIXEL_CONTEXT.

(summarize)
Collapse M_DRAW_DEAD_PIXELS

Draws the dead pixels image from the dead pixel correction image processing context.

(summarize)
Collapse Flat-field image processing context ID

Specifies an image processing context used in MimFlatField() operations, allocated using MimAlloc() with M_FLAT_FIELD_CONTEXT.

(summarize)
Collapse M_DRAW_DARK_IMAGE

Draws the dark image from the flat-field image processing context. The dark image represents the thermal agitation of the camera's CCD.

(summarize)
Collapse M_DRAW_FLAT_IMAGE

Draws the flat image from the flat-field context. The flat image represents the variation in sensitivity of each element of the camera's CCD.

(summarize)
Collapse M_DRAW_OFFSET_IMAGE

Draws the offset image from the flat-field context. The offset image represents the electrical bias of the camera's CCD.

(summarize)
Collapse Match image processing context ID

Specifies an image processing context used in MimMatch() operations, allocated using MimAlloc() with M_MATCH_CONTEXT.

(summarize)
Collapse M_DRAW_MASK

Draws the mask image from the match image processing context. All non-zero values in the image are considered mask pixels; these pixels will mask out corresponding pixels in the model image when MimMatch() performs the match.

(summarize)
Collapse M_DRAW_MODEL

Draws the model image from the match context. MimMatch() compares its source image against this model image.

(summarize)

In the following table, Src1MilId specifies a result buffer and Operation specifies the operation to perform with the specified result buffer. Src2MilId is not required and must be set to M_NULL. Set Param1 and Param2 to 0, unless otherwise specified.

function map For specifying a draw operation that uses image processing results
CollapseSrc1MilId Description
Operation
Src2MilId
Param1
Param2
Collapse Find orientation result buffer ID

Specifies a find orientation image processing result buffer identifier, allocated using MimAllocResult() with M_FIND_ORIENTATION_LIST.

The result buffer must contain the dominant orientations (angle values found using MimFindOrientation()) of the image and the orientation scores (between 0 and 100).

(summarize)
Collapse M_DRAW_IMAGE_ORIENTATION

Draws arrows to represent the found image orientations (viewing angles) calculated by MimFindOrientation(). The center of each arrow will be at the center of the destination image buffer. The arrow's length is proportional to its score and the available space in the destination buffer (DstImageBufOrListGraId). With multiple calls to MimDraw(), you can set each arrow to have a different color, dictated by the graphics context specified (ContextGraId). Depending on your requirements, you would either change the foreground color associated with the graphics context or allocate multiple graphics context each with a different foreground color. This can be useful for debugging your application.

(summarize)
Collapse Param1

Specifies the index of the first orientation to draw from the result buffer. The first orientation in the result buffer is at index 0 and will have a score of 100%.

(summarize)
Collapse Param2

Specifies the number of orientations to draw from the result buffer. The number of orientations cannot exceed the number of entries allocated using MimAllocResult() with NbEntries.

(summarize)
Collapse Wavelet transformation result buffer ID

Specifies a result buffer used to store MimWaveletTransform() results, allocated using MimAllocResult() with M_WAVELET_TRANSFORM_RESULT.

The DstImageBufOrListGraId parameter must specify an image buffer that can be processed (MbufAlloc...() with M_IMAGE + M_PROC). It must have the same number of bands and be the same type as the source used with MimWaveletTransform().

For dyadic modes (MimControl() with M_TRANSFORMATION_MODE set to M_DYADIC), drawings are in the top-right (vertical coefficient), bottom-right (diagonal coefficient), and bottom-left (horizontal coefficient) corners of the display. This drawing pattern repeats for each level calculated (MimGetResult() with M_NUMBER_OF_LEVELS). Since dyadic transformations sample wavelet coefficients by a factor of 2 per level, drawings are resized at each level. MIL also draws the approximation (the low frequency rendition) of the wavelet transformation at the last level, in the top-left corner of the display.

For undecimated modes (M_UNDECIMATED), drawings are in one row, per level. Each row is split into three columns, representing the horizontal (left column), diagonal (middle column), and vertical (right column) wavelet coefficients for that level. Since undecimated transformations are not sampled, drawings are all the same size, regardless of level. MIL also draws the approximation (the low frequency rendition) of the wavelet transformation at the last level, in the first column of the first row. The middle and right columns in this row are blank.

(summarize)
Collapse M_DRAW_WAVELET +

Draws the resulting image of the wavelet transformation.

During the wavelet transformation, calculations can require MIL to internally add padding data to the image's boarder. M_DRAW_WAVELET does not draw this padding with the resulting image.

To retrieve the image size required to perform this operation, use MimGetResult() with M_WAVELET_DRAW_SIZE_X and M_WAVELET_DRAW_SIZE_Y.

(summarize)
Collapse M_DRAW_WAVELET_WITH_PADDING +

Draws the resulting image of the wavelet transformation, with padding.

During the wavelet transformation, calculations can require MIL to internally add padding data to the image's boarder. M_DRAW_WAVELET_WITH_PADDING draws the resulting image with this padding.

To retrieve the image size required to perform this operation, use MimGetResult() with M_WAVELET_DRAW_SIZE_X_WITH_PADDING and M_WAVELET_DRAW_SIZE_Y_WITH_PADDING.

(summarize)
Combination constants for M_DRAW_WAVELET (when Src1MilId=Wavelet transformation result buffer ID); M_DRAW_WAVELET_WITH_PADDING (when Src1MilId=Wavelet transformation result buffer ID).

You can add one of the following values to the above-mentioned values to specify whether the drawing operation uses the real or imaginary numbers in the wavelet result.

function map For specifying whether to draw using the real or imaginary numbers in the wavelet result
CollapseCombination value Description
Collapse M_IMAGINARY_PART

Draws using the imaginary part of the values in the wavelet result. Only available for complex wavelet transformations (MimGetResult() with M_TRANSFORMATION_DOMAIN must return M_COMPLEX).

(summarize)
Collapse M_REAL_PART

Draws using only the real numbers in the result. Available for any type of wavelet transformation.

This is the default value.

(summarize)

In the following table, Src1MilId specifies a result buffer and Operation specifies the operation to perform with the specified result buffer. Src2MilId and Param2 are not required, and must be set to M_NULL and 0, respectively.

function map For specifying to perform the draw operation with the result buffer used to store MimStatMultiple() results
CollapseSrc1MilId Description
Operation
Src2MilId
Param1
Param2
Collapse Multiple statistics result buffer ID

Specifies a result buffer used to store MimStatMultiple() results, allocated using MimAllocResult() with M_STAT_MULTIPLE_RESULT.

(summarize)
Collapse M_DRAW_STAT_RESULT

Draws the specified statistical results of the multiple statistic image processing result buffer. Note that the results are saturated to the maximum possible value for the specified destination buffer of the draw operation.

(summarize)
Collapse Param1

Specifies the type of statistical operation's result to draw.

(summarize)
Collapse M_MAX

Draws the results of the maximum pixel operation.

Collapse M_MAX_ABS

Draws the results of the maximum absolute pixel operation.

Collapse M_MEAN

Draws the results of the mean value of the pixels operation.

Collapse M_MIN

Draws the results of the minimum pixel operation.

Collapse M_MIN_ABS

Draws the results of the minimum absolute pixel operation.

Collapse M_STANDARD_DEVIATION

Draws the results of the standard deviation operation.

Collapse M_SUM

Draws the results of the sum of the pixel operation.

Collapse M_SUM_ABS

Draws the results of the sum of the absolute pixel operation.

Collapse M_SUM_OF_SQUARES

Draws the results of the sum of the squared pixel operation.

In the following table, Src1MilId, and optionally Src2MilId, specify image buffer(s) and Operation specifies the operation to perform with the specified image buffer(s).

function map For specifying to perform the draw operation with the image buffer(s) used in MimLocatePeak1d()
CollapseSrc1MilId Description
Operation
Src2MilId
Param1
Param2
Collapse Locate 1D peak position image buffer ID

Specifies the position destination image buffer used in MimLocatePeak1d() operations.

(summarize)
Collapse M_DRAW_PEAKS +

Draws the peaks at the position at which they were found in the original source image. It draws each peak using the peak's calculated intensity value or using the foreground color of the specified graphics context.

This operation cannot be rendered in world units (MgraControl() with M_INPUT_UNITS cannot be set to M_WORLD) when drawing in either an image buffer or a graphics list. Additionally, this operation cannot be drawn with offset or zoom values (MgraControl() with M_DRAW_OFFSET_X or M_DRAW_OFFSET_Y set to values other than 0.0, and M_DRAW_ZOOM_X or M_DRAW_ZOOM_Y set to values other than 1.0).

This operation can draw in a graphics list if no intensity buffer is specified (Src2MilId set to M_NULL).


You must specify a combination value from each of the following tables:
(summarize)
Collapse Src2MilId

Specifies whether the intensity results will be used when drawing the peaks.

(summarize)
Collapse M_NULL

Specifies to draw the peaks in the foreground color of the graphics context specified using ContextGraId.

Collapse Locate 1D peak intensity image buffer ID

Specifies the intensity destination image buffer used in MimLocatePeak1d() operations. When this buffer is specified, the peaks are drawn using their corresponding intensity value.

If you supply an intensity buffer, the intensity buffer defines the drawing color when drawing each position, regardless of the setting of ContextGraId.

(summarize)
Collapse Param1

Specifies the row in the source image buffers from which to read the results.

Collapse Param2

Specifies the size of the drawn representation of valid peaks. When drawing the peaks as dots (M_DOTS), this parameter specifies the diameter of the dots that are drawn at valid positions; when connecting the peaks using lines (M_LINES), this parameter specifies the width of the line segments that connect valid positions.

(summarize)
Combination constants for M_DRAW_PEAKS (when Src1MilId=Locate 1D peak position image buffer ID).

You must add one of the following values to the above-mentioned value to specify the direction in which the peak detection was performed.

function map For specifying the direction in which the peak detection was performed
CollapseCombination value Description
Collapse M_HORIZONTAL

Specifies that the peaks detection was performed in the horizontal direction.

Collapse M_VERTICAL

Specifies that the peaks detection was performed in the vertical direction.

This is the default value.

(summarize)
Combination constants for M_DRAW_PEAKS (when Src1MilId=Locate 1D peak position image buffer ID).

You must add one of the following values to the above-mentioned value to specify the style in which to draw.

function map For specifying the style in which to draw
CollapseCombination value Description
Collapse M_DOTS

Specifies to draw the valid result positions as dots in the destination buffer.

When M_DOTS is specified, only valid positions are drawn; if a peak was not found for a row/column, nothing will be drawn for that row/column.

(summarize)
Collapse M_LINES

Specifies to draw line segments between valid positions in the destination buffer.

This is the default value.

(summarize)

In the following table, Src1MilId specifies the result buffer and Operation specifies the operation to perform with the specified result buffer.

function map For specifying to perform the draw operation with the result buffer(s) used in MimLocatePeak1d()
CollapseSrc1MilId Description
Operation
Src2MilId
Param1
Param2
Collapse Locate peak 1D result buffer ID

Specifies a result buffer allocated using MimAllocResult() with M_LOCATE_PEAK_1D_RESULT and used in MimLocatePeak1d() operations.

(summarize)
Collapse M_DRAW_DEPTH_MAP_ROW

Specifies to write the position values of the specified result buffer into a single row of the specified image buffer.

(summarize)
Collapse Param1

Specifies the row of the specified image buffer in which to write the position values. In the case of multiple peaks, the first peak is used, as defined by MimControl() with M_SORT_CRITERION.

(summarize)
Collapse M_DRAW_INTENSITY_MAP_ROW

Specifies to write the intensity values of the specified result buffer into a single row of the specified image buffer.

(summarize)
Collapse Param1

Specifies the row of the specified image buffer in which to write the intensity values. In the case of multiple peaks, the first peak is used, as defined by MimControl() with M_SORT_CRITERION.

(summarize)
Compilation information
Header Include mil.h.
Library Use mil.lib; milim.lib.
DLL Requires mil.dll; milim.dll.
DEFAULT PROC NONE PROC NONE PROC NONE DEFAULT FIXED POINT n AUTO SCALE SATURATION DEAD PIXEL CONTEXT DRAW DEAD PIXELS FLAT FIELD CONTEXT DRAW DARK IMAGE DRAW FLAT IMAGE DRAW OFFSET IMAGE MATCH CONTEXT DRAW MASK DRAW MODEL DRAW IMAGE ORIENTATION DRAW WAVELET DRAW WAVELET WITH PADDING IMAGINARY PART REAL PART DRAW STAT RESULT MAX MAX ABS MEAN MIN MIN ABS STANDARD DEVIATION SUM SUM ABS SUM OF SQUARES PROC DRAW PEAKS NULL PROC HORIZONTAL VERTICAL DOTS LINES DRAW DEPTH MAP ROW DRAW INTENSITY MAP ROW NULL NULL NULL