Skip to content

convexityConvexityConvexityconvexityconvexity🔗

Short description🔗

convexityConvexityConvexityconvexityconvexity — Shape factor for the convexity of a region.

Signature🔗

convexity( region Regions, out real Convexity )void Convexity( const HObject& Regions, HTuple* Convexity )static void HOperatorSet.Convexity( HObject regions, out HTuple convexity )def convexity( regions: HObject ) -> Sequence[float]

def convexity_s( regions: HObject ) -> floatHerror convexity( const Hobject Regions, double* Convexity )

Herror T_convexity( const Hobject Regions, Htuple* Convexity )

HTuple HRegion::Convexity( ) const

HTuple HRegion.Convexity( )

Description🔗

The operator convexityConvexity calculates the convexity of each input region of Regionsregionsregions.

  • Calculation: If \(F_{c}\) is the area of the convex hull and \(F_{o}\) the original area of the region the shape factor C is defined as:

    \[\begin{eqnarray*}C = \frac{F_{o}}{F_{c}}\end{eqnarray*}\]

The shape factor C is 1 if the region is convex (e.g., rectangle, circle etc.). If there are indentations or holes C is smaller than 1.

In the documentation of this chapter (Regions / Features), you can find an image illustrating regions which vary in their convexity.

In case of an empty region the operator convexityConvexity returns the value 0 (if no other behavior was set (see set_systemSetSystem)). If more than one region is passed the numerical values of the contour length are stored in a tuple, the position of a value in the tuple corresponding to the position of the region in the input tuple.

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🔗

Regionsregionsregions (input_object) region(-array) → objectHObjectHRegionHObjectHobject

Region(s) to be examined.

Convexityconvexityconvexity (output_control) real(-array) → (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Convexity of the input region(s).

Assertion: Convexity <= 1

Result🔗

The operator convexityConvexity returns the value 2 (H_MSG_TRUE) if the input is not empty. The behavior in case of empty input (no input regions available) is set via the operator set_system('no_object_result',<Result>). The behavior in case of empty region (the region is the empty set) is set via set_system('empty_region_result',<Result>). If necessary an exception is raised.

Combinations with other operators🔗

Combinations

Possible predecessors

thresholdThreshold, regiongrowingRegiongrowing, connectionConnection

See also

select_shapeSelectShape, area_centerAreaCenter, shape_transShapeTrans

Module🔗

Foundation