Morphological Transformations

Function

Perocess an image using morphological operations.

../../../../../_images/functional_description13.png

Sample Scenario

This Step is usually used for image pre-processing when the quality of images is not ideal and further adjustment is needed.

Apply operations such as dilation, erosion, and opening and closing to denoise, fill, etc. based on actual requirements.

Input and Output

When ClosingOperator is selected, the input and output are as shown in the figure below.

../../../../../_images/input_output_07.png

Parameter Descriptions

Parameter

Description

Morphological Transformations

DilateOperator

Dilation. It is mainly used to increase the object area and join broken parts of an object.

ErodeOperator

Erosion. It is mainly used to remove small noises and detach two connected objects.

OpeningOperator

Opening is another name of erosion followed by dilation. It is useful in removing noise.

ClosingOperator

Closing is reverse of Opening, i.e., dilation followed by erosion. It is useful in closing small holes inside the foreground objects, or small black points on the object.

Skeleton

Extract the contour of the object.

Kernel Size

The size of the kernel, i.e., the structuring element.

Kernel Shape

MORPH_RECT

Use a rectangular kernel.

MORPH_CROSS

Use a crossing kernel.

MORPH_ELLIPSE

Use an elliptical kernel.

Parameter Tuning

Morphological Transformations

Default setting: DilateOperator

Options: ClosingOperator, DilateOperator, ErodeOperator, OpeningOperator, Skeleton

Descriptions:

  1. ClosingOperator: Closing is reverse of Opening, Dilation followed by Erosion. It is useful in closing small holes inside the foreground objects, or small black points on the object.

    Kernel Size
    Default setting: 21 pixel
    Instruction: The size of the kernel should be set according to the measurement requirements. The figure below shows the effect when the kernel size is set differently (smallest on the left and largest on the right).
    ../../../../../_images/contrast_effects_of_closing_operator1.png
    Kernel Shape
    Default setting: Rectangle (MORPH_RECT)
    Options: Rectangle (MORPH_RECT), Cross shape (MORPH_CROSS), Ellipse (MORPH_ELLIPSE)
    Instruction:

    Performance on image detail restoration: MORPH_RECT < MORPH_CROSS < MORPH_ELLIPSE

    Time required for operation: MORPH_RECT < MORPH_CROSS < MORPH_ELLIPSE

    Hint

    It is recommended to keep the default setting. However, you may configure the setting according to specific requirements.

  2. DilateOperator: Dilation. It is mainly used to increase the object area and join broken parts of an object.

    Kernel Size
    Default setting: 3 pixel
    Instruction: The size of the kernel should be set according to the measurement requirements. The larger the kernel size, the more dilated the object area. The figure below shows the effect when the kernel size is set differently (smallest on the left and largest on the right).
    ../../../../../_images/contrast_effects_of_dilate_operator1.png
    Kernel Shape
    Default setting: Rectangle (MORPH_RECT)
    Options: Rectangle (MORPH_RECT), Cross shape (MORPH_CROSS), Ellipse (MORPH_ELLIPSE)
    Instruction:

    Performance on image detail restoration: MORPH_RECT < MORPH_CROSS < MORPH_ELLIPSE

    Time required for operation: MORPH_RECT < MORPH_CROSS < MORPH_ELLIPSE

    Hint

    It is recommended to keep the default setting. However, you may configure the setting according to specific requirements.

  3. ErodeOperator: Erosion. It is mainly used to remove small noises and detach two connected objects.

    Kernel Size
    Default setting: 3 pixel
    Instruction: The size of the kernel should be set according to the measurement requirements. The larger the kernel size, the greater the erosion of the object area. The figure below shows the effect when the kernel size is set differently (smallest on the left and largest on the right).
    ../../../../../_images/contrast_effects_of_erode_operator1.png
    Kernel Shape
    Default setting: Rectangle (MORPH_RECT)
    Options: Rectangle (MORPH_RECT), Cross shape (MORPH_CROSS), Ellipse (MORPH_ELLIPSE)
    Instruction:

    Performance on image detail restoration: MORPH_RECT < MORPH_CROSS < MORPH_ELLIPSE

    Time required for operation: MORPH_RECT < MORPH_CROSS < MORPH_ELLIPSE

    Hint

    It is recommended to keep the default setting. However, you may configure the setting according to specific requirements.

  4. OpeningOperator: Opening is another name of erosion followed by dilation. It is useful in removing noise.

    Kernel Size
    Default setting: 21 pixel
    Instruction: The size of the kernel should be set according to the measurement requirements. The figure below shows the effect when the kernel size is set differently (smallest on the left and largest on the right).
    ../../../../../_images/contrast_effects_of_opening_operator1.png
    Kernel Shape
    Default setting: Rectangle (MORPH_RECT)
    Options: Rectangle (MORPH_RECT), Cross shape (MORPH_CROSS), Ellipse (MORPH_ELLIPSE)
    Instruction:

    Performance on image detail restoration: MORPH_RECT < MORPH_CROSS < MORPH_ELLIPSE

    Time required for operation: MORPH_RECT < MORPH_CROSS < MORPH_ELLIPSE

    Hint

    It is recommended to keep the default setting. However, you may configure the setting according to specific requirements.

  5. Skeleton: Extract the contour of the object.

    The figure below shows the effect before and after the operation.

    ../../../../../_images/contrast_effects_of_skeleton1.png