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

DilateRegion
Header: | FIL.h |
---|---|
Namespace: | fil |
Module: | FoundationBasic |
Performs a morphological dilation on a region using a predefined kernel.
Applications: Making the region thicker or filling-in small holes within it.
Syntax
void fil::DilateRegion ( const fil::Region& inRegion, fil::KernelShape::Type inKernel, int inRadiusX, ftl::Optional<int> inRadiusY, fil::Region& outRegion )
Parameters
Name | Type | Range | Default | Description | |
---|---|---|---|---|---|
![]() |
inRegion | const Region& | Input region | ||
![]() |
inKernel | KernelShape::Type | Kernel shape (predefined) | ||
![]() |
inRadiusX | int | 0 - ![]() |
1 | Nearly half of the kernel's width (2*R+1) |
![]() |
inRadiusY | Optional<int> | 0 - ![]() |
NIL | Nearly half of the kernel's height (2*R+1), or same as inRadiusX |
![]() |
outRegion | Region& | Output region |
Description
The operation performs a morphological dilation, which is a basic tool used for region expansion. Similarly to other region morphology operations, dilation 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 at least one 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 expansion performed equally in all directions.
- Setting inRadiusX to higher value than inRadiusY results in expansion performed more significantly along horizontal axis.
Hints
- Increase inRadiusX to make the output region thicker.
- Change inKernel to Ellipse to make the filter work equally strongly in each direction (execution will be slower).
Examples
![]() |
![]() |
DilateRegion run with inKernel = Ellipse of dimensions inRadiusX = 5, inRadiusY = 5.
Errors
List of possible exceptions:
Error type | Description |
---|---|
DomainError | Unsupported kernel in DilateRegion. |
See Also
- CloseRegion – Performs a morphological closing on a region using selected predefined kernel.
- DilateRegion_AnyKernel – Performs a morphological dilation on a region using an arbitrary kernel.
- ErodeRegion – Performs a morphological erosion on a region using a predefined kernel.