Start » Filter Reference » Region » Region Morphology » ErodeRegion

ErodeRegion


Module: FoundationBasic

Performs a morphological erosion on a region using a predefined kernel.

Applications

Making the region thinner or removing small parts.
Name Type Range Description
Input value
inRegion Region Input region
Input value
inKernel KernelShape Kernel shape (predefined)
Input value
inRadiusX Integer 0 - Nearly half of the kernel's width (2*R+1)
Input value
inRadiusY Integer* 0 - Nearly half of the kernel's height (2*R+1), or same as inRadiusX
Output value
outRegion Region Output region

Description

The operation performs a morphological erosion, which is a basic tool used for region shrinking. Similarly to other region morphology operations, erosion is conducted using a shape called kernel (or structuring element). The kernel is repeatedly centered at each location within the dimensions of the input region. Then, pixel location L is added to the resulting region if and only if all of the input region pixels lies inside the kernel centered at this (L) location.

The input parameter inKernel allows to choose the shape of a kernel, while parameters inRadiusX, inRadiusY allow to determine its dimensions. For instance:

  • inKernel = Ellipse together with inRadiusX = inRadiusY results in shrinking performed equally in all directions.
  • Setting inRadiusX to higher value than inRadiusY results in shrinking performed more significantly along horizontal axis.

Hints

  • Increase inRadiusX to make the output region thinner.
  • Change inKernel to Ellipse to make the filter work equally strongly in each direction (execution will be slower).

Examples

Description of usage of this filter can be found in examples and tutorial: Chocolate Cookies Inspection 3D, Waffles.

ErodeRegion run with inKernel = Ellipse of dimensions inRadiusX = 3, inRadiusY = 3.

Errors

This filter can throw an exception to report error. Read how to deal with errors in Error Handling.

List of possible exceptions:

Error type Description
DomainError Unsupported kernel in ErodeRegion.

Complexity Level

This filter is available on Advanced Complexity Level.

Filter Group

This filter is member of ErodeRegion filter group.

See Also

  • OpenRegion – Performs a morphological opening on a region using a predefined kernel.
  • DilateRegion – Performs a morphological dilation on a region using a predefined kernel.