Skip to content

erosion1Erosion1Erosion1erosion1erosion1🔗

Short description🔗

erosion1Erosion1Erosion1erosion1erosion1 — Erode a region.

Signature🔗

erosion1( region Region, region StructElement, out region RegionErosion, integer Iterations )void Erosion1( const HObject& Region, const HObject& StructElement, HObject* RegionErosion, const HTuple& Iterations )static void HOperatorSet.Erosion1( HObject region, HObject structElement, out HObject regionErosion, HTuple iterations )def erosion1( region: HObject, struct_element: HObject, iterations: int ) -> HObject

Herror erosion1( const Hobject Region, const Hobject StructElement, Hobject* RegionErosion, const Hlong Iterations )

Herror T_erosion1( const Hobject Region, const Hobject StructElement, Hobject* RegionErosion, const Htuple Iterations )

HRegion HRegion::Erosion1( const HRegion& StructElement, Hlong Iterations ) const

HRegion HRegion.Erosion1( HRegion structElement, int iterations )

Description🔗

erosion1Erosion1 erodes the input regions with a structuring element. By applying erosion1Erosion1 to a region, its boundary gets smoothed. In the process, the area of the region is reduced. Furthermore, connected regions may be split. Such regions, however, remain logically one region. The erosion is a set-theoretic region operation. It uses the intersection operation.

Let \(M\) (StructElementstructElementstruct_element) and \(R\) (Regionregionregion) be two regions, where \(M\) is the structuring element and \(R\) is the region to be processed. Furthermore, let \(m\) be a point in \(M\). Then the displacement vector \({{\vec{v}}_{m}} = (dx,dy)\) is defined as the difference of the center of gravity of \(M\) and the vector \(\vec{m}\). Let \(t_{\vec{v}_{m}}(R)\) denote the translation of a region \(R\) by a vector \(\vec{v}\). Then

\[\begin{eqnarray*} \textrm{erosion1}(R,M) := \bigcap_{m \in M}{t_{{-\vec{v}}_{m}} (R)}. \end{eqnarray*}\]

For each point \(m\) in \(M\) a translation of the region \(R\) is performed. The intersection of all these translations is the erosion of \(R\) with \(M\). erosion1Erosion1 is similar to the operator minkowski_sub1MinkowskiSub1, the difference is that in erosion1Erosion1 the structuring element is mirrored at the origin. The position of StructElementstructElementstruct_element is meaningless, since the displacement vectors are determined with respect to the center of gravity of \(M\).

The parameter Iterationsiterationsiterations determines the number of iterations which are to be performed with the structuring element. The result of iteration \(n-1\) is used as input for iteration \(n\). From the above definition it follows that the maximum region is generated in case of an empty structuring element.

Structuring elements (StructElementstructElementstruct_element) can be generated with operators such as gen_circleGenCircle, gen_rectangle1GenRectangle1, gen_rectangle2GenRectangle2, gen_ellipseGenEllipse, draw_regionDrawRegion, gen_region_polygonGenRegionPolygon, gen_region_pointsGenRegionPoints, etc.

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

Parameters🔗

Regionregionregion (input_object) region(-array) → objectHObjectHRegionHObjectHobject

Regions to be eroded.

StructElementstructElementstruct_element (input_object) region → objectHObjectHRegionHObjectHobject

Structuring element.

RegionErosionregionErosionregion_erosion (output_object) region(-array) → objectHObjectHRegionHObjectHobject *

Eroded regions.

Iterationsiterationsiterations (input_control) integer → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Number of iterations.

Default: 11
Suggested values: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 15, 17, 20, 30, 40, 501, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 15, 17, 20, 30, 40, 50
Value range: 1 ≤ Iterations (lin)
Minimum increment: 1
Recommended increment: 1

Complexity🔗

Let \(F1\) be the area of the input region, and \(F2\) be the area of the structuring element. Then the runtime complexity for one region is:

\[\begin{eqnarray*} O(\sqrt{F1} \cdot \sqrt{F2} \cdot \textrm{Iterations}) \enspace . \end{eqnarray*}\]

Result🔗

erosion1Erosion1 returns 2 (H_MSG_TRUE) if all parameters are correct. The behavior in case of empty or no input region can be set via:

  • no region: set_system('no_object_result',<RegionResult>)

  • empty region: set_system('empty_region_result',<RegionResult>)

Otherwise, an exception is raised.

Combinations with other operators🔗

Combinations

Possible predecessors

thresholdThreshold, regiongrowingRegiongrowing, watershedsWatersheds, class_ndim_normClassNdimNorm, gen_circleGenCircle, gen_ellipseGenEllipse, gen_rectangle1GenRectangle1, gen_rectangle2GenRectangle2, draw_regionDrawRegion, gen_region_pointsGenRegionPoints, gen_region_polygon_filledGenRegionPolygonFilled

Possible successors

connectionConnection, reduce_domainReduceDomain, select_shapeSelectShape, area_centerAreaCenter

Alternatives

minkowski_sub1MinkowskiSub1, minkowski_sub2MinkowskiSub2, erosion2Erosion2

See also

transpose_regionTransposeRegion

Module🔗

Foundation