| MIL 10 Reference
| Customize Help
| Save Settings

MimMorphic



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

Available on Windows
Available on Linux

Partially supported on:
Partially supported on Matrox GPU processing driver

Fully supported on:
Fully supported on Host system
Fully supported on Matrox CronosPlus
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 Solios eA/XA
Fully supported on Matrox Solios ecl/xcl/ev-cl
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
Perform a morphological transformation using a user-defined or predefined structuring element.
Syntax
void MimMorphic(
MIL_ID SrcImageBufId, //in
MIL_ID DstImageBufId, //in
MIL_ID StructElemBufId, //in
MIL_INT64 Operation, //in
MIL_INT NbIterationOrArea, //in
MIL_INT64 ProcMode //in
)
Description

This function performs one of several morphological transformations on the specified source image, using a user-defined or predefined structuring element.

If the source and destination are multi-band buffers, the same structuring element is applied to every band of the source 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 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
SrcImageBufId

Specifies the identifier of the source image buffer.

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.

[Matrox GPU processing driver]

The source image buffer must be unsigned monochrome 8- or 16-bit.

DstImageBufId

Specifies the identifier of the destination image buffer.

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.

[Matrox GPU processing driver]

The destination image buffer must be unsigned monochrome 8- or 16-bit.

StructElemBufId

Specifies the structuring element to use. For all operations except area opening and area closing operations, you must specify the identifier of the structuring element buffer which defines the required structuring element.

For M_AREA_OPEN or M_AREA_CLOSE operations, you must specify one of the following two predefined structuring elements. Note that these predefined structuring elements are not available for any other type of operation.

function map For area open or area close operations
CollapseValue Description
Collapse M_3X3_CROSS

Specifies a cross (+) structuring element whose neighborhood size is 3x3 pixels. In this case, there are 5 valid neighborhood pixels; the function ignores the pixels located at the four corners of the neighborhood.

(summarize)
Collapse M_3X3_RECT

Specifies a structuring element whose neighborhood size is 3x3 pixels. In this case, there are 9 valid neighborhood pixels.

(summarize)
Collapse MIL structuring element buffer identifier

Specifies a custom structuring element to use, allocated, using MbufAlloc...() with an M_STRUCT_ELEMENT attribute. This structuring element is to be loaded with structuring-element values, using MbufPut(). These values can be set to M_DONT_CARE to specify that the corresponding source image pixels should not be taken into account during the operation. You can set the overscan type and the center of the structuring element, using MbufControlNeighborhood().

For window leveling operations, the structuring element buffer must contain only 0 or M_DONT_CARE values. The center structuring element value must not be a M_DONT_CARE value.

(summarize)
Operation

Specifies the operation to perform. Supported operations are given in the table below.

function map For specifying the type of operation to perform
CollapseValue Description
MIL system-specific
tooltip (†)
Collapse M_AREA_CLOSE

Specifies an area close operation.

a b c e f g h i j k l m n o p q r s
Collapse M_AREA_OPEN

Specifies an area open operation.

a b c e f g h i j k l m n o p q r s
Collapse M_BOTTOM_HAT

Specifies a bottom-hat operation. This operation is the equivalent to a close operation (M_CLOSE), followed by a subtraction of the source image from the results.

(summarize)
a b c d e f g h i j k l m n o p q r s
Collapse M_CLOSE

Specifies a close operation. This operation is equivalent to a dilation followed by an erosion.

(summarize)
a b c d e f g h i j k l m n o p q r s
Collapse M_DILATE

Specifies a dilation operation.

When performing a binary dilation, if any of the structuring element values match the corresponding neighborhood values, the center pixel is set to the maximum value of the buffer (for example, 0xff for an 8-bit buffer); otherwise, it remains unchanged. In effect, binary dilation adds layers to the objects.

When performing a grayscale dilation, this operation adds each structuring element value to the corresponding pixel value in the neighborhood, and then replaces the center pixel of the neighborhood with the maximum value from the resulting neighborhood values.

The pixels that correspond to M_DONT_CARE in the structuring element are ignored.

(summarize)
a b c d e f g h i j k l m n o p q r s
Collapse M_ERODE

Specifies an erosion operation.

When performing a binary erosion, if the structuring element does not match the corresponding neighborhood values exactly, the center pixel is set to zero; otherwise, it remains unchanged. In effect, binary erosion peels off layers of objects.

When performing a grayscale erosion, this operation subtracts each structuring element value from the corresponding pixel value in the neighborhood, and then replaces the center pixel of the neighborhood with the minimum value from the resulting neighborhood values.

The pixels that correspond to M_DONT_CARE in the structuring element are ignored.

(summarize)
a b c d e f g h i j k l m n o p q r s
Collapse M_HIT_OR_MISS

Specifies a hit or miss transformation.

(summarize)
a b c d e f g h i j k l m n o p q r s
MIL system specific

Supports only M_GRAYSCALE mode.

d
Collapse M_LEVEL

Specifies a window leveling operation on a pixel neighborhood basis.

This operation finds the minimum and maximum pixel values in a neighborhood, and then creates a linear mapping such that these map to the minimum and maximum possible values of the image buffer. It then replaces the center pixel of the neighborhood with its corresponding value in the mapping.

If the destination image buffer is a floating-point buffer, each pixel will be set to a value between 0 and 1.

The pixels that correspond to M_DONT_CARE in the structuring element are ignored.

(summarize)
a b c d e f g h i j k l m n o p q r s
Collapse M_MATCH

Specifies a matching operation.

(summarize)
a b c d e f g h i j k l m n o p q r s
MIL system specific

Supports only M_GRAYSCALE mode.

d
Collapse M_OPEN

Specifies an open operation. This operation is equivalent to an erosion, followed by a dilation.

(summarize)
a b c d e f g h i j k l m n o p q r s
Collapse M_THICK

Specifies a thickening operation.

(summarize)
a b c d e f g h i j k l m n o p q r s
MIL system specific

Supports only M_GRAYSCALE mode.

d
Collapse M_THIN

Specifies a thinning operation.

(summarize)
a b c d e f g h i j k l m n o p q r s
MIL system specific

Supports only M_GRAYSCALE mode.

d
Collapse M_TOP_HAT

Specifies a top-hat operation. This operation is the equivalent to an open operation (M_OPEN) followed by a subtraction of the results from the source image.

(summarize)
a b c d e f g h i j k l m n o p q r s
NbIterationOrArea

Specifies a value that is dependent on the morphological operation chosen.

For an area opening or area closing operation, this parameter specifies the minimum area, in pixels. For an M_HIT_OR_MISS, M_MATCH, or M_LEVEL operation, this parameter must be set to 1. For the other morphological operations, this parameter specifies the number of times to iterate the operation.

If the number of iterations is set to 0, and ProcMode is set to M_BINARY, the source image is binarized and the result is copied into the destination image buffer. If the number of iterations is set to 0, and ProcMode is set to M_GRAYSCALE, the source image is copied into the destination image buffer.

ProcMode

Specifies the processing mode to use. This parameter can be set to one of the following:

function map For specifying the processing mode
CollapseValue Description
MIL system-specific
tooltip (†)
Collapse M_BINARY

Treats non-zero pixels as ones (1) during processing.

(summarize)
a b c d e f g h i j k l m n o p q r s
MIL system specific

Both the source and destination buffers must be packed binary.

d
Collapse M_GRAYSCALE

Uses the source image's gray values for processing. The resulting pixels will be grayscale.

You must use this processing mode to perform an M_TOP_HAT, M_BOTTOM_HAT, or M_LEVEL operation.

This is the default value.

(summarize)
a b c d e f g h i j k l m n o p q r s
Compilation information
Header Include mil.h.
Library Use mil.lib; milim.lib.
DLL Requires mil.dll; milim.dll.
PROC NONE PROC NONE 3X3 CROSS 3X3 RECT AREA CLOSE AREA OPEN BOTTOM HAT CLOSE DILATE ERODE HIT OR MISS LEVEL MATCH OPEN THICK THIN TOP HAT BINARY GRAYSCALE HIT OR MISS MATCH LEVEL HIT OR MISS MATCH LEVEL