Back to Aurora Vision Library website

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

CloseRegion


Header: AVL.h
Namespace: avl
Module: FoundationBasic

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

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

Syntax

C++
C#
 
void avl::CloseRegion
(
	const avl::Region& inRegion,
	avl::KernelShape::Type inKernel,
	int inRadiusX,
	atl::Optional<int> inRadiusY,
	avl::Region& outRegion
)

Parameters

Name Type Range Default Description
Input value inRegion const Region& Input region
Input value inKernel KernelShape::Type Kernel shape (predefined)
Input value inRadiusX int 0 - 1 Nearly half of the kernel's width (2*R+1)
Input value inRadiusY Optional<int> 0 - NIL 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 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.

Hints

  • 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).

Examples

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

Errors

List of possible exceptions:

Error type Description
DomainError Unsupported kernel in CloseRegion.

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.