moments_any_points_xldmoments_any_points_xldMomentsAnyPointsXldMomentsAnyPointsXld (Operator)


moments_any_points_xldmoments_any_points_xldMomentsAnyPointsXldMomentsAnyPointsXld — Arbitrary geometric moments of contours or polygons treated as point clouds.


moments_any_points_xld(XLD : : Mode, Area, CenterRow, CenterCol, P, Q : M)

Herror moments_any_points_xld(const Hobject XLD, const char* Mode, double Area, double CenterRow, double CenterCol, const Hlong P, const Hlong Q, double* M)

Herror T_moments_any_points_xld(const Hobject XLD, const Htuple Mode, const Htuple Area, const Htuple CenterRow, const Htuple CenterCol, const Htuple P, const Htuple Q, Htuple* M)

void MomentsAnyPointsXld(const HObject& XLD, const HTuple& Mode, const HTuple& Area, const HTuple& CenterRow, const HTuple& CenterCol, const HTuple& P, const HTuple& Q, HTuple* M)

HTuple HXLD::MomentsAnyPointsXld(const HString& Mode, const HTuple& Area, const HTuple& CenterRow, const HTuple& CenterCol, const HTuple& P, const HTuple& Q) const

double HXLD::MomentsAnyPointsXld(const HString& Mode, double Area, double CenterRow, double CenterCol, Hlong P, Hlong Q) const

double HXLD::MomentsAnyPointsXld(const char* Mode, double Area, double CenterRow, double CenterCol, Hlong P, Hlong Q) const

double HXLD::MomentsAnyPointsXld(const wchar_t* Mode, double Area, double CenterRow, double CenterCol, Hlong P, Hlong Q) const   (Windows only)

static void HOperatorSet.MomentsAnyPointsXld(HObject XLD, HTuple mode, HTuple area, HTuple centerRow, HTuple centerCol, HTuple p, HTuple q, out HTuple m)

HTuple HXLD.MomentsAnyPointsXld(string mode, HTuple area, HTuple centerRow, HTuple centerCol, HTuple p, HTuple q)

double HXLD.MomentsAnyPointsXld(string mode, double area, double centerRow, double centerCol, int p, int q)


moments_any_points_xldmoments_any_points_xldMomentsAnyPointsXldMomentsAnyPointsXldMomentsAnyPointsXld calculates arbitrary moments MMMMm of the point clouds given by the contours or polygons XLDXLDXLDXLDXLD (i.e., the order of the points in the contour or polygon is not taken into account).

The computed moments are normalized depending on the desired mode ModeModeModeModemode:


No normalization.


Shift the contour points by their centroid


Normalization by the area A = AreaAreaAreaAreaarea


Normalization by the area A = AreaAreaAreaAreaarea and a shift of the contour points by their centroid

For the normalization of the moments three specific values are used: The area AreaAreaAreaAreaarea and the coordinates CenterRowCenterRowCenterRowCenterRowcenterRow,CenterColCenterColCenterColCenterColcenterCol of it's centroid (this values can be computed with area_center_points_xldarea_center_points_xldAreaCenterPointsXldAreaCenterPointsXldAreaCenterPointsXld).

If the contour or polygon is closed (end point = start point), the end point of the contour or polygon is not taken into account to avoid that it receives twice the weight of the other points.

moments_any_xldmoments_any_xldMomentsAnyXldMomentsAnyXldMomentsAnyXld should be used if the contour XLDXLDXLDXLDXLD intersects itself or if it is not possible to close the contour using a line from end to start point without self-intersection, because in this case moments_any_xldmoments_any_xldMomentsAnyXldMomentsAnyXldMomentsAnyXld does not produce useful results. To test whether the contours or polygons intersect themselves, test_self_intersection_xldtest_self_intersection_xldTestSelfIntersectionXldTestSelfIntersectionXldTestSelfIntersectionXld can be used.

If more than one contour or polygon is passed, MMMMm contains all desired moments of the first contour/polygon followed by all the moments of the second contour/polygon and so forth.

Execution Information


XLDXLDXLDXLDXLD (input_object)  xld(-array) objectHXLDHXLDHobject

Contours or polygons to be examined.

ModeModeModeModemode (input_control)  string HTupleHTupleHtuple (string) (string) (HString) (char*)

Computation mode.

Default value: 'unnormalized' "unnormalized" "unnormalized" "unnormalized" "unnormalized"

Suggested values: 'unnormalized'"unnormalized""unnormalized""unnormalized""unnormalized", 'unnormalized_central'"unnormalized_central""unnormalized_central""unnormalized_central""unnormalized_central", 'normalized'"normalized""normalized""normalized""normalized", 'central'"central""central""central""central"

AreaAreaAreaAreaarea (input_control)  real(-array) HTupleHTupleHtuple (real) (double) (double) (double)

Area enclosed by the contour or polygon.

CenterRowCenterRowCenterRowCenterRowcenterRow (input_control)  point.y(-array) HTupleHTupleHtuple (real) (double) (double) (double)

Row coordinate of the centroid.

CenterColCenterColCenterColCenterColcenterCol (input_control)  point.x(-array) HTupleHTupleHtuple (real) (double) (double) (double)

Column coordinate of the centroid.

PPPPp (input_control)  point.x(-array) HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

First index of the desired moments .

Default value: 1

Suggested values: 0, 1, 2, 3, 4

QQQQq (input_control)  point.x(-array) HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Second index of the desired moments .

Default value: 1

Suggested values: 0, 1, 2, 3, 4

MMMMm (output_control)  real(-array) HTupleHTupleHtuple (real) (double) (double) (double)

The computed moments.


Let n be the number of points of the contour or polygon. Then the run time is O(n).


moments_any_points_xldmoments_any_points_xldMomentsAnyPointsXldMomentsAnyPointsXldMomentsAnyPointsXld returns 2 (H_MSG_TRUE) if the input is not empty. If the input is empty the behavior can be set via 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>). If necessary, an exception is raised.

Possible Predecessors

area_center_points_xldarea_center_points_xldAreaCenterPointsXldAreaCenterPointsXldAreaCenterPointsXld, gen_contours_skeleton_xldgen_contours_skeleton_xldGenContoursSkeletonXldGenContoursSkeletonXldGenContoursSkeletonXld, smooth_contours_xldsmooth_contours_xldSmoothContoursXldSmoothContoursXldSmoothContoursXld, gen_polygons_xldgen_polygons_xldGenPolygonsXldGenPolygonsXldGenPolygonsXld


moments_points_xldmoments_points_xldMomentsPointsXldMomentsPointsXldMomentsPointsXld, moments_any_xldmoments_any_xldMomentsAnyXldMomentsAnyXldMomentsAnyXld

See also

moments_points_xldmoments_points_xldMomentsPointsXldMomentsPointsXldMomentsPointsXld, area_center_points_xldarea_center_points_xldAreaCenterPointsXldAreaCenterPointsXldAreaCenterPointsXld, moments_region_2ndmoments_region_2ndMomentsRegion2ndMomentsRegion2ndMomentsRegion2nd, area_centerarea_centerAreaCenterAreaCenterAreaCenter