compactnesscompactnessCompactnessCompactnesscompactness (算子名称)

名称

compactnesscompactnessCompactnessCompactnesscompactness — Shape factor for the compactness of a region.

参数签名

compactness(区域 : : : Compactness)

Herror compactness(const Hobject 区域, double* Compactness)

Herror T_compactness(const Hobject 区域, Htuple* Compactness)

void Compactness(const HObject& 区域, HTuple* Compactness)

HTuple HRegion::Compactness() const

static void HOperatorSet.Compactness(HObject 区域, out HTuple compactness)

HTuple HRegion.Compactness()

def compactness(区域: HObject) -> Sequence[float]

def compactness_s(区域: HObject) -> float

描述

The operator compactnesscompactnessCompactnessCompactnessCompactnesscompactness calculates the compactness of the input regions.

Calculation:

If L is the length of the contour (see contlengthcontlengthContlengthContlengthContlengthcontlength) and F the area of the region the shape factor C is defined as:

C = max(1,C')

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

The shape factor C of a circle is 1. If the region is long or has holes C is larger than 1. The operator compactnesscompactnessCompactnessCompactnessCompactnesscompactness responds to the course of the contour (roughness) and to holes. The value of C is clipped to 1.0, because the pixel area of a region can only be an approximation of a real circle's area. This approximation error is bigger for small regions than for large regions.

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

运行信息

参数表

区域区域区域区域区域区域 (input_object)  region(-array) objectHRegionHObjectHRegionHobject

Region(s) to be examined.

CompactnessCompactnessCompactnessCompactnesscompactnesscompactness (output_control)  real(-array) HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)

Compactness of the input region(s).

Assertion: Compactness >= 1.0 || Compactness == 0

结果

The operator compactnesscompactnessCompactnessCompactnessCompactnesscompactness 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>)set_system("no_object_result",<Result>)SetSystem("no_object_result",<Result>)SetSystem("no_object_result",<Result>)SetSystem("no_object_result",<Result>)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>)set_system("empty_region_result",<Result>)SetSystem("empty_region_result",<Result>)SetSystem("empty_region_result",<Result>)SetSystem("empty_region_result",<Result>)set_system("empty_region_result",<Result>). If necessary an exception is raised.

可能的前置算子

thresholdthresholdThresholdThresholdThresholdthreshold, regiongrowingregiongrowingRegiongrowingRegiongrowingRegiongrowingregiongrowing, connectionconnectionConnectionConnectionConnectionconnection

可替代算子

convexityconvexityConvexityConvexityConvexityconvexity, eccentricityeccentricityEccentricityEccentricityEccentricityeccentricity

参考其它

contlengthcontlengthContlengthContlengthContlengthcontlength, area_centerarea_centerAreaCenterAreaCenterAreaCenterarea_center, select_shapeselect_shapeSelectShapeSelectShapeSelectShapeselect_shape

模块

Foundation