Operator Reference

Region

List of Operators ↓

This chapter describes operators of region morphology.

Concept of Region Morphology

Region morphology provides a set of morphological operators that allow to modify or describe the shape of a region. The morphological operators can be used, for example, to connect or disconnect adjacent regions or to smooth the boundary of a region. In the following, we will take a closer look at the morphological operators.

Dilation and Erosion

To dilate or erode an input region, a structuring element is applied to the input region. This structuring element is scanned over the image line-by-line. During dilation the reference point of the structuring element is added to the resulting region whenever the structuring element and the input region have at least one pixel in common. This results in an enlarged region, as shown in the image below. Erosion reduces the area of the input region because the reference point is only added to the resulting region if the structuring element lies completely within the input region. As a result, erosion can alternatively be used to find objects.

( 1) ( 2) ( 3) ( 4)
(1) Image with input region, (2) structuring element with reference point in the origin, (3) result of dilating the input region, (4) result of eroding the input region.

These operators can be used to dilate or erode a region:

Morphological Operators Structuring Element Reference Point
dilation1dilation1Dilation1Dilation1dilation1 erosion1erosion1Erosion1Erosion1erosion1 arbitrary origin
minkowski_add1minkowski_add1MinkowskiAdd1MinkowskiAdd1minkowski_add1 minkowski_sub1minkowski_sub1MinkowskiSub1MinkowskiSub1minkowski_sub1 arbitrary, transposed origin
dilation2dilation2Dilation2Dilation2dilation2 erosion2erosion2Erosion2Erosion2erosion2 arbitrary arbitrary
minkowski_add2minkowski_add2MinkowskiAdd2MinkowskiAdd2minkowski_add2 minkowski_sub2minkowski_sub2MinkowskiSub2MinkowskiSub2minkowski_sub2 arbitrary, transposed arbitrary
dilation_circledilation_circleDilationCircleDilationCircledilation_circle erosion_circleerosion_circleErosionCircleErosionCircleerosion_circle circular origin
dilation_rectangle1dilation_rectangle1DilationRectangle1DilationRectangle1dilation_rectangle1 erosion_rectangle1erosion_rectangle1ErosionRectangle1ErosionRectangle1erosion_rectangle1 rectangular origin

Note that Minkowski addition and dilation are identical if the structuring element is symmetric. The same applies to Minkowski subtraction and erosion. Erosion can be used to separate objects that are attached to each other. In the following, the steps that are required to separate objects are described briefly.

First, the objects of the image must be segmented, for example by using the operator thresholdthresholdThresholdThresholdthreshold. Next, the operator connectionconnectionConnectionConnectionconnection is used to get multiple regions instead of a single region. As you can see in the image (3) below, the result of the connection is unsatisfactory because several objects are merged.

( 1) ( 2) ( 3)
(1) Image with globular objects, (2) segmented regions, (3) connected components.

This problem can be solved using erosion. As mentioned above, erosion reduces the area of the input region. Thus, if erosion is applied prior to the operator connectionconnectionConnectionConnectionconnection, the regions are separated as desired. Lastly, dilation is applied on the separated regions to approximately get the original shape back.

( 1) ( 2) ( 3)
(1) Segmented regions after erosion, (2) connected components, (3) connected components after dilation.

Opening and Closing

Both operations generate the resulting region by combining dilation and erosion operations. Opening is an erosion followed by a dilation. It is useful to eliminate small unwanted structures. Closing is the opposite of opening, i.e., a dilation followed by an erosion. The closing operator is able to close small gaps, as shown below.

( 1) ( 2) ( 3) ( 4)
(1) Image with input region, (2) structuring element with reference point, (3) result of applying an opening to the input region, (4) result of applying a closing.

These operators can be used to open or close a region:

Further Operators

In addition to the operators mentioned above, you can use top_hattop_hatTopHatTopHattop_hat to get the difference between the input region and the result of the opening, or bottom_hatbottom_hatBottomHatBottomHatbottom_hat to get the difference between the result of the closing and the input region. Furthermore, you can calculate the boundary of a region with the operator boundaryboundaryBoundaryBoundaryboundary.

( 1) ( 2) ( 3)
(1) Top hat, (2) bottom hat, (3) boundary.

The operator hit_or_misshit_or_missHitOrMissHitOrMisshit_or_miss can be used to find objects, taking the foreground and the background of the image into account. To remove unwanted branches from a skeleton, pruningpruningPruningPruningpruning is a suitable operator.

Glossary

In the following list, the most important terms that are used in the context of Morphology are described.

input region

Region which is modified by morphological operators.

structuring element

Region which is used to scan the input region.


List of Operators

bottom_hatBottomHatbottom_hatBottomHatbottom_hat
Compute the bottom hat of regions.
boundaryBoundaryboundaryBoundaryboundary
Reduce a region to its boundary.
closingClosingclosingClosingclosing
Close a region.
closing_circleClosingCircleclosing_circleClosingCircleclosing_circle
Close a region with a circular structuring element.
closing_rectangle1ClosingRectangle1closing_rectangle1ClosingRectangle1closing_rectangle1
Close a region with a rectangular structuring element.
dilation1Dilation1dilation1Dilation1dilation1
Dilate a region.
dilation2Dilation2dilation2Dilation2dilation2
Dilate a region (using a reference point).
dilation_circleDilationCircledilation_circleDilationCircledilation_circle
Dilate a region with a circular structuring element.
dilation_rectangle1DilationRectangle1dilation_rectangle1DilationRectangle1dilation_rectangle1
Dilate a region with a rectangular structuring element.
erosion1Erosion1erosion1Erosion1erosion1
Erode a region.
erosion2Erosion2erosion2Erosion2erosion2
Erode a region (using a reference point).
erosion_circleErosionCircleerosion_circleErosionCircleerosion_circle
Erode a region with a circular structuring element.
erosion_rectangle1ErosionRectangle1erosion_rectangle1ErosionRectangle1erosion_rectangle1
Erode a region with a rectangular structuring element.
hit_or_missHitOrMisshit_or_missHitOrMisshit_or_miss
Hit-or-miss operation for regions.
minkowski_add1MinkowskiAdd1minkowski_add1MinkowskiAdd1minkowski_add1
Perform a Minkowski addition on a region.
minkowski_add2MinkowskiAdd2minkowski_add2MinkowskiAdd2minkowski_add2
Dilate a region (using a reference point).
minkowski_sub1MinkowskiSub1minkowski_sub1MinkowskiSub1minkowski_sub1
Erode a region.
minkowski_sub2MinkowskiSub2minkowski_sub2MinkowskiSub2minkowski_sub2
Erode a region (using a reference point).
openingOpeningopeningOpeningopening
Open a region.
opening_circleOpeningCircleopening_circleOpeningCircleopening_circle
Open a region with a circular structuring element.
opening_rectangle1OpeningRectangle1opening_rectangle1OpeningRectangle1opening_rectangle1
Open a region with a rectangular structuring element.
pruningPruningpruningPruningpruning
Prune the branches of a region.
top_hatTopHattop_hatTopHattop_hat
Compute the top hat of regions.