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

moments_region_2ndmoments_region_2ndmoments_region_2ndMomentsRegion2ndMomentsRegion2nd (Operator)

Name

moments_region_2ndmoments_region_2ndmoments_region_2ndMomentsRegion2ndMomentsRegion2nd — Geometric moments of regions.

Signature

moments_region_2nd(Regions : : : M11, M20, M02, Ia, Ib)

Herror moments_region_2nd(const Hobject Regions, double* M11, double* M20, double* M02, double* Ia, double* Ib)

Herror T_moments_region_2nd(const Hobject Regions, Htuple* M11, Htuple* M20, Htuple* M02, Htuple* Ia, Htuple* Ib)

Herror moments_region_2nd(Hobject Regions, double* M11, double* M20, double* M02, double* Ia, double* Ib)

Herror moments_region_2nd(Hobject Regions, HTuple* M11, HTuple* M20, HTuple* M02, HTuple* Ia, HTuple* Ib)

double HRegion::MomentsRegion2nd(double* M20, double* M02, double* Ia, double* Ib) const

HTuple HRegionArray::MomentsRegion2nd(HTuple* M20, HTuple* M02, HTuple* Ia, HTuple* Ib) const

void HOperatorSetX.MomentsRegion2nd(
[in] IHUntypedObjectX* Regions, [out] VARIANT* M11, [out] VARIANT* M20, [out] VARIANT* M02, [out] VARIANT* Ia, [out] VARIANT* Ib)

VARIANT HRegionX.MomentsRegion2nd(
[out] VARIANT* M20, [out] VARIANT* M02, [out] VARIANT* Ia, [out] VARIANT* Ib)

static void HOperatorSet.MomentsRegion2nd(HObject regions, out HTuple m11, out HTuple m20, out HTuple m02, out HTuple ia, out HTuple ib)

HTuple HRegion.MomentsRegion2nd(out HTuple m20, out HTuple m02, out HTuple ia, out HTuple ib)

double HRegion.MomentsRegion2nd(out double m20, out double m02, out double ia, out double ib)

Description

The operator moments_region_2ndmoments_region_2ndmoments_region_2ndMomentsRegion2ndMomentsRegion2nd calculates the moments (M20M20M20M20m20, M02M02M02M02m02) and the product of inertia of the axes through the center parallel to the coordinate axes (M11M11M11M11m11). Furthermore the main axes of inertia (IaIaIaIaia, IbIbIbIbib) are calculated.

Calculation:

Z0 and S0 are the coordinates of the center of a region R with the area F. Then the moments Mij are defined by:

Mij = SUM ( (Z0 - Z)^i (S0 - S)^j )

wherein Z and S run through all pixels of the region R.

Furthermore,

h = (M20 + M02) / 2.

then IaIaIaIaia and IbIbIbIbib are defined by:

IaIaIaIaia = h + sqrt ( h^2 - M20 x M02 + M11^2)

IbIbIbIbib = h - sqrt ( h^2 - M20 x M02 + M11^2)

If more than one region is passed the results are stored in tuples, the index of a value in the tuple corresponding to the index of a region in the input.

In case of empty region all parameters have the value 0.0 if no other behavior was set (see set_systemset_systemset_systemSetSystemSetSystem).

Parallelization

Parameters

RegionsRegionsRegionsRegionsregions (input_object)  region(-array) objectHRegionHRegionHRegionXHobject

Regions to be examined.

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

Product of inertia of the axes through the center parallel to the coordinate axes.

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

Moment of 2nd order (line-dependent).

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

Moment of 2nd order (column-dependent).

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

The one main axis of inertia.

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

The other main axis of inertia.

Complexity

If F is the area of the region the mean runtime complexity is O(sqrt(F)).

Result

The operator moments_region_2ndmoments_region_2ndmoments_region_2ndMomentsRegion2ndMomentsRegion2nd returns the value 2 (H_MSG_TRUE) if the input is not empty. The behavior in case of empty input (no input regions available) is set via the operator 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>). The behavior in case of empty region (region is the empty set) is set via set_system('empty_region_result',<Result>)set_system("empty_region_result",<Result>)set_system("empty_region_result",<Result>)SetSystem("empty_region_result",<Result>)SetSystem("empty_region_result",<Result>). If necessary an exception is raised.

Possible Predecessors

thresholdthresholdthresholdThresholdThreshold, regiongrowingregiongrowingregiongrowingRegiongrowingRegiongrowing, connectionconnectionconnectionConnectionConnection

Alternatives

moments_region_2nd_invarmoments_region_2nd_invarmoments_region_2nd_invarMomentsRegion2ndInvarMomentsRegion2ndInvar

See also

elliptic_axiselliptic_axiselliptic_axisEllipticAxisEllipticAxis

Module

Foundation


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