moments_xld moments_xld MomentsXld MomentsXld moments_xld (算子)
名称
moments_xld moments_xld MomentsXld MomentsXld moments_xld — Geometric moments
,
, and
of contours or polygons.
签名
Herror moments_xld (const Hobject XLD , double* M11 , double* M20 , double* M02 )
Herror T_moments_xld (const Hobject XLD , Htuple* M11 , Htuple* M20 , Htuple* M02 )
def moments_xld (xld : HObject) -> Tuple[Sequence[float], Sequence[float], Sequence[float]]
def moments_xld_s (xld : HObject) -> Tuple[float, float, float]
描述
moments_xld moments_xld MomentsXld MomentsXld MomentsXld moments_xld calculates the moments (M20 M20 M20 M20 m20 m20 ,
M02 M02 M02 M02 m02 m02 , and M11 M11 M11 M11 m11 m11 ) of the region enclosed by the
contours or polygons XLD XLD XLD XLD XLD xld . See moments_region_2nd moments_region_2nd MomentsRegion2nd MomentsRegion2nd MomentsRegion2nd moments_region_2nd
for the definition of these features. The moments are computed by
applying Green's theorem using only the points on the contour or
polygon, i.e., no region is generated explicitly for the purpose of
calculating the features.假设轮廓或多边形是闭合的。 If this is not the case moments_xld moments_xld MomentsXld MomentsXld MomentsXld moments_xld
will artificially close the contours or polygons.
需要注意的是,moments_xld moments_xld MomentsXld MomentsXld MomentsXld moments_xld 仅在轮廓或多边形在平面上包围区域时才会返回有效结果。特别需要注意的是,轮廓或多边形不得自相交。当传递开放轮廓或多边形时,这一点尤为重要,因为它们会被自动闭合,从而可能产生自相交的情况。可使用 test_self_intersection_xld test_self_intersection_xld TestSelfIntersectionXld TestSelfIntersectionXld TestSelfIntersectionXld test_self_intersection_xld 检测轮廓或多边形是否自相交。 If the contour or polygon intersects itself, useful values
for the moments can be calculated with moments_points_xld moments_points_xld MomentsPointsXld MomentsPointsXld MomentsPointsXld moments_points_xld 。
如果传递多个轮廓或多边形,结果将按其在 XLD XLD XLD XLD XLD xld 中的顺序存储为元组。
执行信息
多线程类型:可重入(与非独占算子并行运行)。
多线程作用域:全局(可从任何线程调用)。
在元组级别上自动并行化。
参数
XLD XLD XLD XLD XLD xld (输入对象) xld(-array) → object HXLD HObject HXLD Hobject
待检查的轮廓或多边形。
M11 M11 M11 M11 m11 m11 (输出控制) real(-array) → HTuple Sequence[float] HTuple Htuple (real) (double ) (double ) (double )
Mixed second order moment.
M20 M20 M20 M20 m20 m20 (输出控制) real(-array) → HTuple Sequence[float] HTuple Htuple (real) (double ) (double ) (double )
Second order moment along the row axis.
M02 M02 M02 M02 m02 m02 (输出控制) real(-array) → HTuple Sequence[float] HTuple Htuple (real) (double ) (double ) (double )
Second order moment along the column axis.
复杂度
设 n 为轮廓或多边形的点数。则运行时间为 O(n)。
结果
moments_xld moments_xld MomentsXld MomentsXld MomentsXld moments_xld 在输入不为空时返回 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>) 。如有必要,则抛出异常。
可能的前趋
gen_contours_skeleton_xld gen_contours_skeleton_xld GenContoursSkeletonXld GenContoursSkeletonXld GenContoursSkeletonXld gen_contours_skeleton_xld ,
smooth_contours_xld smooth_contours_xld SmoothContoursXld SmoothContoursXld SmoothContoursXld smooth_contours_xld ,
gen_polygons_xld gen_polygons_xld GenPolygonsXld GenPolygonsXld GenPolygonsXld gen_polygons_xld
替代
moments_any_xld moments_any_xld MomentsAnyXld MomentsAnyXld MomentsAnyXld moments_any_xld ,
moments_points_xld moments_points_xld MomentsPointsXld MomentsPointsXld MomentsPointsXld moments_points_xld ,
moments_any_points_xld moments_any_points_xld MomentsAnyPointsXld MomentsAnyPointsXld MomentsAnyPointsXld moments_any_points_xld
另见
moments_any_xld moments_any_xld MomentsAnyXld MomentsAnyXld MomentsAnyXld moments_any_xld ,
area_center_xld area_center_xld AreaCenterXld AreaCenterXld AreaCenterXld area_center_xld ,
moments_region_2nd moments_region_2nd MomentsRegion2nd MomentsRegion2nd MomentsRegion2nd moments_region_2nd ,
area_center area_center AreaCenter AreaCenter AreaCenter area_center
模块
基础