rectangularityrectangularityRectangularityRectangularityrectangularity(算子)

名称

rectangularityrectangularityRectangularityRectangularityrectangularity — 区域矩形的形状系数。

签名

rectangularity(Regions : : : Rectangularity)

Herror rectangularity(const Hobject Regions, double* Rectangularity)

Herror T_rectangularity(const Hobject Regions, Htuple* Rectangularity)

void Rectangularity(const HObject& Regions, HTuple* Rectangularity)

HTuple HRegion::Rectangularity() const

static void HOperatorSet.Rectangularity(HObject regions, out HTuple rectangularity)

HTuple HRegion.Rectangularity()

def rectangularity(regions: HObject) -> Sequence[float]

def rectangularity_s(regions: HObject) -> float

描述

算子 rectangularityrectangularityRectangularityRectangularityRectangularityrectangularity calculates the rectangularity of the input regions.

To determine the rectangularity, first a rectangle is computed that has the same first and second order moments as the input region. The computation of the rectangularity measure is finally based on the area of the difference between the computed rectangle and the input region normalized with respect to the area of the rectangle.

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

For rectangles rectangularityrectangularityRectangularityRectangularityRectangularityrectangularity returns the value 1. The more the input region deviates from a perfect rectangle, the less the returned value for RectangularityRectangularityRectangularityRectangularityrectangularityrectangularity will be.

In case of an empty region the operator rectangularityrectangularityRectangularityRectangularityRectangularityrectangularity 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 rectangularity are stored in a tuple, the position of a value in the tuple corresponding to the position of the region in the input tuple.

注意

For input regions which orientation cannot be computed by using second order moments (as it is the case for square regions, for example), the returned RectangularityRectangularityRectangularityRectangularityrectangularityrectangularity is underestimated by up to 10% depending on the orientation of the input region.

执行信息

参数

RegionsRegionsRegionsRegionsregionsregions (输入对象)  region(-array) objectHRegionHObjectHRegionHobject

待检查的区域。

RectangularityRectangularityRectangularityRectangularityrectangularityrectangularity (输出控制)  real(-array) HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)

Rectangularity of the input region(s).

Assertion: 0 <= Rectangularity && Rectangularity <= 1.0

结果

算子 rectangularityrectangularityRectangularityRectangularityRectangularityrectangularity 在输入不为空时返回值 2 ( H_MSG_TRUE )。当输入为空(无可用输入区域)时,可设置行为通过算子 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>)。空区域(区域是空集)的情况下的可设置行为通过 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>)。如有必要,则抛出异常。

可能的前趋

thresholdthresholdThresholdThresholdThresholdthreshold, regiongrowingregiongrowingRegiongrowingRegiongrowingRegiongrowingregiongrowing, connectionconnectionConnectionConnectionConnectionconnection

替代

circularitycircularityCircularityCircularityCircularitycircularity, compactnesscompactnessCompactnessCompactnessCompactnesscompactness, convexityconvexityConvexityConvexityConvexityconvexity, eccentricityeccentricityEccentricityEccentricityEccentricityeccentricity

另见

contlengthcontlengthContlengthContlengthContlengthcontlength, area_centerarea_centerAreaCenterAreaCenterAreaCenterarea_center, select_shapeselect_shapeSelectShapeSelectShapeSelectShapeselect_shape

参考文献

P. L. Rosin: “Measuring rectangularity”; Machine Vision and Applications; vol. 11; pp. 191-196; Springer-Verlag, 1999.

模块

基础