rectangularity_xldrectangularity_xldRectangularityXldRectangularityXldrectangularity_xld (算子)

名称

rectangularity_xldrectangularity_xldRectangularityXldRectangularityXldrectangularity_xld — 轮廓或多边形矩形的形状系数。

签名

rectangularity_xld(XLD : : : Rectangularity)

Herror rectangularity_xld(const Hobject XLD, double* Rectangularity)

Herror T_rectangularity_xld(const Hobject XLD, Htuple* Rectangularity)

void RectangularityXld(const HObject& XLD, HTuple* Rectangularity)

HTuple HXLD::RectangularityXld() const

static void HOperatorSet.RectangularityXld(HObject XLD, out HTuple rectangularity)

HTuple HXLD.RectangularityXld()

def rectangularity_xld(xld: HObject) -> Sequence[float]

def rectangularity_xld_s(xld: HObject) -> float

描述

算子 rectangularity_xldrectangularity_xldRectangularityXldRectangularityXldRectangularityXldrectangularity_xld calculates the rectangularity of each input contour or polygon in XLDXLDXLDXLDXLDxld. The input contour or polygon must not intersect itself, otherwise the resulting parameter is not meaningful (Whether the input contour or polygon intersects itself or not can be determined with test_self_intersection_xldtest_self_intersection_xldTestSelfIntersectionXldTestSelfIntersectionXldTestSelfIntersectionXldtest_self_intersection_xld). If the input contour or polygon is not closed it will be closed automatically.

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

For rectangles rectangularity_xldrectangularity_xldRectangularityXldRectangularityXldRectangularityXldrectangularity_xld returns the value 1. The more the input contour or polygon deviates from a perfect rectangle, the less the returned value for RectangularityRectangularityRectangularityRectangularityrectangularityrectangularity will be. 如果传递多个轮廓或多边形,结果将按其在 XLDXLDXLDXLDXLDxld 中的顺序存储为元组。

注意

For input contours or polygons which orientation cannot be computed by using second order moments (as it is the case for squares, for example), the returned RectangularityRectangularityRectangularityRectangularityrectangularityrectangularity is underestimated by up to 10% depending on the orientation of the input contour or polygon.

执行信息

参数

XLDXLDXLDXLDXLDxld (输入对象)  xld(-array) objectHXLDHObjectHXLDHobject

待检查的轮廓或多边形。

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

Rectangularity of the input contours or polygons.

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

结果

算子 rectangularity_xldrectangularity_xldRectangularityXldRectangularityXldRectangularityXldrectangularity_xld 在输入不为空时返回值 2 ( H_MSG_TRUE )。The behavior in case of empty input (no input contours or polygons 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>)。如有必要,则抛出异常。

可能的前趋

gen_contours_skeleton_xldgen_contours_skeleton_xldGenContoursSkeletonXldGenContoursSkeletonXldGenContoursSkeletonXldgen_contours_skeleton_xld, edges_sub_pixedges_sub_pixEdgesSubPixEdgesSubPixEdgesSubPixedges_sub_pix, threshold_sub_pixthreshold_sub_pixThresholdSubPixThresholdSubPixThresholdSubPixthreshold_sub_pix, gen_contour_polygon_xldgen_contour_polygon_xldGenContourPolygonXldGenContourPolygonXldGenContourPolygonXldgen_contour_polygon_xld, test_self_intersection_xldtest_self_intersection_xldTestSelfIntersectionXldTestSelfIntersectionXldTestSelfIntersectionXldtest_self_intersection_xld

替代

circularity_xldcircularity_xldCircularityXldCircularityXldCircularityXldcircularity_xld, convexity_xldconvexity_xldConvexityXldConvexityXldConvexityXldconvexity_xld, compactness_xldcompactness_xldCompactnessXldCompactnessXldCompactnessXldcompactness_xld, eccentricity_xldeccentricity_xldEccentricityXldEccentricityXldEccentricityXldeccentricity_xld

另见

area_center_xldarea_center_xldAreaCenterXldAreaCenterXldAreaCenterXldarea_center_xld, select_shape_xldselect_shape_xldSelectShapeXldSelectShapeXldSelectShapeXldselect_shape_xld

参考文献

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

模块

基础