ClassesClassesClassesClasses | | | | Operators

moments_any_xldmoments_any_xldMomentsAnyXldmoments_any_xldMomentsAnyXldMomentsAnyXld (Operator)

Name

moments_any_xldmoments_any_xldMomentsAnyXldmoments_any_xldMomentsAnyXldMomentsAnyXld — Arbitrary geometric moments of contours or polygons.

Signature

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

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

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

Herror moments_any_xld(Hobject XLD, const HTuple& Mode, const HTuple& PointOrder, const HTuple& Area, const HTuple& CenterRow, const HTuple& CenterCol, const HTuple& P, const HTuple& Q, double* M)

Herror moments_any_xld(Hobject XLD, const HTuple& Mode, const HTuple& PointOrder, const HTuple& Area, const HTuple& CenterRow, const HTuple& CenterCol, const HTuple& P, const HTuple& Q, HTuple* M)

double HXLD::MomentsAnyXld(const HTuple& Mode, const HTuple& PointOrder, const HTuple& Area, const HTuple& CenterRow, const HTuple& CenterCol, const HTuple& P, const HTuple& Q) const

HTuple HXLDArray::MomentsAnyXld(const HTuple& Mode, const HTuple& PointOrder, const HTuple& Area, const HTuple& CenterRow, const HTuple& CenterCol, const HTuple& P, const HTuple& Q) const

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

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

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

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

void HOperatorSetX.MomentsAnyXld(
[in] IHUntypedObjectX* XLD, [in] VARIANT Mode, [in] VARIANT PointOrder, [in] VARIANT Area, [in] VARIANT CenterRow, [in] VARIANT CenterCol, [in] VARIANT P, [in] VARIANT Q, [out] VARIANT* M)

VARIANT HXLDX.MomentsAnyXld(
[in] BSTR Mode, [in] VARIANT PointOrder, [in] VARIANT Area, [in] VARIANT CenterRow, [in] VARIANT CenterCol, [in] VARIANT P, [in] VARIANT Q)

VARIANT HXLDContX.MomentsAnyXld(
[in] BSTR Mode, [in] VARIANT PointOrder, [in] VARIANT Area, [in] VARIANT CenterRow, [in] VARIANT CenterCol, [in] VARIANT P, [in] VARIANT Q)

VARIANT HXLDPolyX.MomentsAnyXld(
[in] BSTR Mode, [in] VARIANT PointOrder, [in] VARIANT Area, [in] VARIANT CenterRow, [in] VARIANT CenterCol, [in] VARIANT P, [in] VARIANT Q)

VARIANT HXLDParaX.MomentsAnyXld(
[in] BSTR Mode, [in] VARIANT PointOrder, [in] VARIANT Area, [in] VARIANT CenterRow, [in] VARIANT CenterCol, [in] VARIANT P, [in] VARIANT Q)

VARIANT HXLDModParaX.MomentsAnyXld(
[in] BSTR Mode, [in] VARIANT PointOrder, [in] VARIANT Area, [in] VARIANT CenterRow, [in] VARIANT CenterCol, [in] VARIANT P, [in] VARIANT Q)

VARIANT HXLDExtParaX.MomentsAnyXld(
[in] BSTR Mode, [in] VARIANT PointOrder, [in] VARIANT Area, [in] VARIANT CenterRow, [in] VARIANT CenterCol, [in] VARIANT P, [in] VARIANT Q)

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

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

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

Description

moments_any_xldmoments_any_xldMomentsAnyXldmoments_any_xldMomentsAnyXldMomentsAnyXld calculates arbitrary moments MMMMMm of the regions enclosed by the contours or polygons XLDXLDXLDXLDXLDXLD. 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. It is assumed that the contours or polygons are closed. If this is not the case moments_any_xldmoments_any_xldMomentsAnyXldmoments_any_xldMomentsAnyXldMomentsAnyXld will artificially close the contours or polygons.

It should be noted that moments_any_xldmoments_any_xldMomentsAnyXldmoments_any_xldMomentsAnyXldMomentsAnyXld only returns useful results if the contour or polygon encloses a region in the plane. In particular, the contour or polygon must not intersect itself. This is particularly important if open contours or polygons are passed because they are closed automatically, which can produce a self-intersection. To test whether the contours or polygons intersect themselves, test_self_intersection_xldtest_self_intersection_xldTestSelfIntersectionXldtest_self_intersection_xldTestSelfIntersectionXldTestSelfIntersectionXld can be used. If the contour or polygon intersects itself, useful values for the moments can be calculated with moments_any_points_xldmoments_any_points_xldMomentsAnyPointsXldmoments_any_points_xldMomentsAnyPointsXldMomentsAnyPointsXld.

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

'unnormalized':

No normalization.

'unnormalized_central':

Shift the region by its centroid

'normalized':

Normalization by the area A = AreaAreaAreaAreaAreaarea of the enclosed image region

'central':

Normalization by the area A = AreaAreaAreaAreaAreaarea of the enclosed image region and a shift of the region by it's centroid

For the normalization of the moments three specific moments are used: The area AreaAreaAreaAreaAreaarea of the enclosed image region and the coordinates CenterRowCenterRowCenterRowCenterRowCenterRowcenterRow,CenterColCenterColCenterColCenterColCenterColcenterCol of it's centroid (this values can be calculated with area_center_xldarea_center_xldAreaCenterXldarea_center_xldAreaCenterXldAreaCenterXld). In addition to that moments_any_xldmoments_any_xldMomentsAnyXldmoments_any_xldMomentsAnyXldMomentsAnyXld expects information about the point order of the input contours/polygons in PointOrderPointOrderPointOrderPointOrderPointOrderpointOrder, see area_center_xldarea_center_xldAreaCenterXldarea_center_xldAreaCenterXldAreaCenterXld again.

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

Parallelization

Parameters

XLDXLDXLDXLDXLDXLD (input_object)  xld(-array) objectHXLDHXLDHXLDHXLDXHobject

Contours or polygons to be examined.

ModeModeModeModeModemode (input_control)  string HTupleHTupleHTupleVARIANTHtuple (string) (string) (HString) (char*) (BSTR) (char*)

Computation mode.

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

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

PointOrderPointOrderPointOrderPointOrderPointOrderpointOrder (input_control)  string(-array) HTupleHTupleHTupleVARIANTHtuple (string) (string) (HString) (char*) (BSTR) (char*)

Point order along the boundary.

Default value: 'positive' "positive" "positive" "positive" "positive" "positive"

Suggested values: 'positive'"positive""positive""positive""positive""positive", 'negative'"negative""negative""negative""negative""negative"

AreaAreaAreaAreaAreaarea (input_control)  real(-array) HTupleHTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double) (double)

Area enclosed by the contour or polygon.

CenterRowCenterRowCenterRowCenterRowCenterRowcenterRow (input_control)  point.y(-array) HTupleHTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double) (double)

Row coordinate of the centroid.

CenterColCenterColCenterColCenterColCenterColcenterCol (input_control)  point.x(-array) HTupleHTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double) (double)

Column coordinate of the centroid.

PPPPPp (input_control)  point.x(-array) HTupleHTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong) (Hlong)

First index of the desired moments .

Default value: 1

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

QQQQQq (input_control)  point.x(-array) HTupleHTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong) (Hlong)

Second index of the desired moments .

Default value: 1

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

MMMMMm (output_control)  real(-array) HTupleHTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double) (double)

The computed moments.

Complexity

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

Result

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

Possible Predecessors

area_center_xldarea_center_xldAreaCenterXldarea_center_xldAreaCenterXldAreaCenterXld, gen_contours_skeleton_xldgen_contours_skeleton_xldGenContoursSkeletonXldgen_contours_skeleton_xldGenContoursSkeletonXldGenContoursSkeletonXld, smooth_contours_xldsmooth_contours_xldSmoothContoursXldsmooth_contours_xldSmoothContoursXldSmoothContoursXld, gen_polygons_xldgen_polygons_xldGenPolygonsXldgen_polygons_xldGenPolygonsXldGenPolygonsXld

Alternatives

moments_xldmoments_xldMomentsXldmoments_xldMomentsXldMomentsXld, moments_any_points_xldmoments_any_points_xldMomentsAnyPointsXldmoments_any_points_xldMomentsAnyPointsXldMomentsAnyPointsXld

See also

moments_xldmoments_xldMomentsXldmoments_xldMomentsXldMomentsXld, area_center_xldarea_center_xldAreaCenterXldarea_center_xldAreaCenterXldAreaCenterXld, moments_region_2ndmoments_region_2ndMomentsRegion2ndmoments_region_2ndMomentsRegion2ndMomentsRegion2nd, area_centerarea_centerAreaCenterarea_centerAreaCenterAreaCenter

Module

Foundation


ClassesClassesClassesClasses | | | | Operators