HALCON Reference Manual 10.0.2
Table of Contents / XLD / Features ClassesClassesClasses | | | Operators

moments_xldmoments_xldmoments_xldMomentsXldMomentsXld (Operator)

Name

moments_xldmoments_xldmoments_xldMomentsXldMomentsXld — Geometric moments M20, M02, and M11 of contours or polygons.

Signature

moments_xld(XLD : : : M11, M20, M02)

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)

Herror moments_xld(Hobject XLD, double* M11, double* M20, double* M02)

Herror moments_xld(Hobject XLD, HTuple* M11, HTuple* M20, HTuple* M02)

double HXLD::MomentsXld(double* M20, double* M02) const

HTuple HXLDArray::MomentsXld(HTuple* M20, HTuple* M02) const

void HOperatorSetX.MomentsXld(
[in] IHUntypedObjectX* XLD, [out] VARIANT* M11, [out] VARIANT* M20, [out] VARIANT* M02)

VARIANT HXLDX.MomentsXld(
[out] VARIANT* M20, [out] VARIANT* M02)

VARIANT HXLDContX.MomentsXld(
[out] VARIANT* M20, [out] VARIANT* M02)

VARIANT HXLDPolyX.MomentsXld(
[out] VARIANT* M20, [out] VARIANT* M02)

VARIANT HXLDParaX.MomentsXld(
[out] VARIANT* M20, [out] VARIANT* M02)

VARIANT HXLDModParaX.MomentsXld(
[out] VARIANT* M20, [out] VARIANT* M02)

VARIANT HXLDExtParaX.MomentsXld(
[out] VARIANT* M20, [out] VARIANT* M02)

static void HOperatorSet.MomentsXld(HObject XLD, out HTuple m11, out HTuple m20, out HTuple m02)

HTuple HXLD.MomentsXld(out HTuple m20, out HTuple m02)

double HXLD.MomentsXld(out double m20, out double m02)

Description

moments_xldmoments_xldmoments_xldMomentsXldMomentsXld calculates the moments (M20M20M20M20m20, M02M02M02M02m02, and M11M11M11M11m11) of the region enclosed by the contours or polygons XLDXLDXLDXLDXLD. See moments_region_2ndmoments_region_2ndmoments_region_2ndMomentsRegion2ndMomentsRegion2nd 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. It is assumed that the contours or polygons are closed. If this is not the case moments_xldmoments_xldmoments_xldMomentsXldMomentsXld will artificially close the contours or polygons.

It should be noted that moments_xldmoments_xldmoments_xldMomentsXldMomentsXld 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_xldtest_self_intersection_xldTestSelfIntersectionXldTestSelfIntersectionXld can be used. If the contour or polygon intersects itself, useful values for the moments can be calculated with moments_points_xldmoments_points_xldmoments_points_xldMomentsPointsXldMomentsPointsXld.

If more than one contour or polygon is passed, the results are stored in tuples in the same order as the respective contours or polygons in XLDXLDXLDXLDXLD.

Parallelization

Parameters

XLDXLDXLDXLDXLD (input_object)  xld(-array) objectHXLDHXLDHXLDXHobject

Contours or polygons to be examined.

M11M11M11M11m11 (output_control)  real(-array) HTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double)

Mixed second order moment.

M20M20M20M20m20 (output_control)  real(-array) HTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double)

Second order moment along the row axis.

M02M02M02M02m02 (output_control)  real(-array) HTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double)

Second order moment along the column axis.

Complexity

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

Result

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

Possible Predecessors

gen_contours_skeleton_xldgen_contours_skeleton_xldgen_contours_skeleton_xldGenContoursSkeletonXldGenContoursSkeletonXld, smooth_contours_xldsmooth_contours_xldsmooth_contours_xldSmoothContoursXldSmoothContoursXld, gen_polygons_xldgen_polygons_xldgen_polygons_xldGenPolygonsXldGenPolygonsXld

Alternatives

moments_any_xldmoments_any_xldmoments_any_xldMomentsAnyXldMomentsAnyXld, moments_points_xldmoments_points_xldmoments_points_xldMomentsPointsXldMomentsPointsXld, moments_any_points_xldmoments_any_points_xldmoments_any_points_xldMomentsAnyPointsXldMomentsAnyPointsXld

See also

moments_any_xldmoments_any_xldmoments_any_xldMomentsAnyXldMomentsAnyXld, area_center_xldarea_center_xldarea_center_xldAreaCenterXldAreaCenterXld, moments_region_2ndmoments_region_2ndmoments_region_2ndMomentsRegion2ndMomentsRegion2nd, area_centerarea_centerarea_centerAreaCenterAreaCenter

Module

Foundation


Table of Contents / XLD / Features ClassesClassesClasses | | | Operators
HALCON Reference Manual 10.0.2 Copyright © 1996-2011 MVTec Software GmbH