Back to Adaptive Vision Studio website

You are here: Start » Filter Reference » Region Morphology » CloseRegion


Performs a morphological closing on a region using selected predefined kernel.

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


Filling-in small gaps in a region without making it thicker.


The operation performs a morphological closing, which is a tool used for filling gaps in a region. The operation is a convolution of two basic morphological operations:

  • Firstly, the input region is dilated using DilateRegion operation.
  • Then, the resulting region is eroded using ErodeRegion operation.

During the dilation gaps that are small enough are actually closed, while further erosion assures that the width of region limbs is preserved.

Both of the component operations are conducted using the same inKernel, inRadiusX and inRadiusY parameters.


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


Description of usage of this filter can be found in examples and tutorial: Capsules, Molybdenum Foil, Rubber Ring, Rubber Ring (Simple), User Filter Example - Database.

CloseRegion run with inKernel = Ellipse of dimensions inRadiusX = 5, inRadiusY = 5.


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 CloseRegion.

Complexity Level

This filter is available on Basic Complexity Level.

Filter Group

This filter is member of CloseRegion filter group.

See Also

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