Skip to content

erosion_rectangle1ErosionRectangle1ErosionRectangle1erosion_rectangle1erosion_rectangle1🔗

Short description🔗

erosion_rectangle1ErosionRectangle1ErosionRectangle1erosion_rectangle1erosion_rectangle1 — Erode a region with a rectangular structuring element.

Signature🔗

erosion_rectangle1( region Region, out region RegionErosion, extent.x Width, extent.y Height )void ErosionRectangle1( const HObject& Region, HObject* RegionErosion, const HTuple& Width, const HTuple& Height )static void HOperatorSet.ErosionRectangle1( HObject region, out HObject regionErosion, HTuple width, HTuple height )def erosion_rectangle1( region: HObject, width: int, height: int ) -> HObject

Herror erosion_rectangle1( const Hobject Region, Hobject* RegionErosion, const Hlong Width, const Hlong Height )

Herror T_erosion_rectangle1( const Hobject Region, Hobject* RegionErosion, const Htuple Width, const Htuple Height )

HRegion HRegion::ErosionRectangle1( Hlong Width, Hlong Height ) const

HRegion HRegion.ErosionRectangle1( int width, int height )

Description🔗

erosion_rectangle1ErosionRectangle1 applies an erosion with a rectangular structuring element to the input regions Regionregionregion. The size of the structuring rectangle is Widthwidthwidth x Heightheightheight. The operator results in reduced regions, and the areas smaller than the rectangular mask are eliminated.

erosion_rectangle1ErosionRectangle1 is a very fast operation because the height of the rectangle enters only logarithmically into the runtime complexity, while the width does not enter at all. This leads to excellent runtime efficiency, even in the case of very large rectangles (edge length \(>\) 100).

Regions containing small connecting strips between large areas are separated only seemingly. They remain logically one region.

Attention🔗

To reduce a region by the same amount in all directions, Widthwidthwidth and Heightheightheight must be odd. If this is not the case, the region is eroded by a smaller amount at the right or at the bottom, respectively, than at the left or at the top.

Execution information🔗

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

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

  • Automatically parallelized on tuple level.

Parameters🔗

Regionregionregion (input_object) region(-array) → objectHObjectHRegionHObjectHobject

Regions to be eroded.

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

Eroded regions.

Widthwidthwidth (input_control) extent.x → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Width of the structuring rectangle.

Default: 1111
Suggested values: 1, 2, 3, 4, 5, 11, 15, 21, 31, 51, 71, 101, 151, 2011, 2, 3, 4, 5, 11, 15, 21, 31, 51, 71, 101, 151, 201
Value range: 1 ≤ Width ≤ 511 (lin)
Minimum increment: 1
Recommended increment: 1

Heightheightheight (input_control) extent.y → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Height of the structuring rectangle.

Default: 1111
Suggested values: 1, 2, 3, 4, 5, 11, 15, 21, 31, 51, 71, 101, 151, 2011, 2, 3, 4, 5, 11, 15, 21, 31, 51, 71, 101, 151, 201
Value range: 1 ≤ Height ≤ 511 (lin)
Minimum increment: 1
Recommended increment: 1

Complexity🔗

Let \(F1\) be the area of an input region and \(H\) be the height of the rectangle. Then the runtime complexity for one region is:

\[\begin{eqnarray*} O(\sqrt{F1} \cdot ld(H)) \enspace . \end{eqnarray*}\]

Result🔗

erosion_rectangle1ErosionRectangle1 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

Possible successors

reduce_domainReduceDomain, select_shapeSelectShape, area_centerAreaCenter, connectionConnection

Alternatives

erosion1Erosion1, minkowski_sub1MinkowskiSub1

See also

gen_rectangle1GenRectangle1

Module🔗

Foundation