| Customize Help
| Save Settings

MimMorphic



Function Map
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.

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.

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 either an M_3X3_CROSS or an M_3X3_RECT structuring element. Note that these predefined structuring elements are not available for any other type of operation.

function map For specifying the structuring element
Click to summarizeValue Description
Click to summarize 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)
Click to summarize M_3X3_RECT

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

(summarize)
Click to summarize 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 MbufControl().

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
Click to summarizeValue Description MIL system-specific
tooltip (‡)
Click to summarize M_AREA_CLOSE

Specifies an area close operation.

a c
M10
g h i j k
M10
l m o p r
U27
t
U28
u
U36
v y
U75
aa
Click to summarize M_AREA_OPEN

Specifies an area open operation.

a c
M10
g h i j k
M10
l m o p r
U27
t
U28
u
U36
v y
U75
aa
Click to summarize 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 c
M10
g h i j k
M10
l m o p r
U27
t
U28
u
U36
v y
U75
aa
Click to summarize M_CLOSE

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

(summarize)
a c
M10
g h i j k
M10
l m o p r
U27
t
U28
u
U36
v y
U75
aa
Click to summarize 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 c
M10
g h i j k
M10
l m o p r
U27
t
U28
u
U36
v y
U75
aa
Click to summarize 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 c
M10
g h i j k
M10
l m o p r
U27
t
U28
u
U36
v y
U75
aa
Click to summarize M_HIT_OR_MISS

Specifies a hit or miss transformation.

a c
M10
g h i j k
M10
l m o p r
U27
t
U28
u
U36
v y
U75
aa
Click to summarize 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 c
M10
g h i j k
M10
l m o p r
U27
t
U28
u
U36
v y
U75
aa
Click to summarize M_MATCH

Specifies a matching operation.

a c
M10
g h i j k
M10
l m o p r
U27
t
U28
u
U36
v y
U75
aa
Click to summarize M_OPEN

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

(summarize)
a c
M10
g h i j k
M10
l m o p r
U27
t
U28
u
U36
v y
U75
aa
Click to summarize M_THICK

Specifies a thickening operation.

a c
M10
g h i j k
M10
l m o p r
U27
t
U28
u
U36
v y
U75
aa
Click to summarize M_THIN

Specifies a thinning operation.

a c
M10
g h i j k
M10
l m o p r
U27
t
U28
u
U36
v y
U75
aa
Click to summarize 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 c
M10
g h i j k
M10
l m o p r
U27
t
U28
u
U36
v y
U75
aa
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
Click to summarizeValue Description
Click to summarize M_BINARY

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

Click to summarize 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.

(summarize)
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 AREA CLOSE AREA OPEN AREA CLOSE AREA OPEN