| MIL 10 Reference
| Customize Help
| Save Settings

MblobSelectMoment



See also
Availability
Not available in MIL-Lite
Available in MIL

Available on Windows
Available on Linux

Available on Non-Matrox computer
Available on Matrox 4Sight-X
Available on Matrox 4Sight GP
Available on Matrox Supersight
function map Function map
Examples
None.
Next
Synopsis
Add specified moment to the feature list.
Syntax
void MblobSelectMoment(
MIL_ID FeatureListId, //in
MIL_INT64 MomType, //in
MIL_INT XMomOrder, //in
MIL_INT YMomOrder //in
)
Description

This function adds the specified general moment to the feature list. The general moment will be calculated by MblobCalculate(). Moment calculations other than those supported by MblobSelectFeature() must be specified with this function.

After calling MblobCalculate(), you can retrieve the results of the specified moment using MblobGetResult() or MblobGetResultSingle(), with M_GENERAL_MOMENT as the feature. Moments that you can add for calculation using MblobSelectFeature() (for example, M_MOMENT_X0_Y2) are calculated faster than if you selected them through MblobSelectMoment().

A call to this function overrides any previous values specified for M_GENERAL_MOMENT in the feature list.

Note that this function reference has not been updated for a MIL system added during a MIL update. Refer to the MIL system's release note to see if there is complementary information.
Parameters
This function is not supported on the selected boards.
Parameters
FeatureListId

Specifies the identifier of the feature list buffer.

MomType

Specifies the moment type. If the calculation is done on a binary image, only a binary version of the result is calculated. If you provide a grayscale image, both grayscale and binary versions are calculated.

This parameter must be set to one of the following values:

function map For specifying the moment type
CollapseValue Description
Collapse M_CENTRAL +

Specifies a central moment.

The central moment is defined as , where i and n are the lower and upper bounds of the summation respectively, pi = value of a pixel (always 1 for binary moments), xi = its X-coordinate, yi = its Y-coordinate, = the first order moment about xi divided by the sum of the pixel values (M_SUM_PIXEL for grayscale values) pi , = the first order ordinary moment about yi divided by the sum of the pixel values (M_SUM_PIXEL for grayscale values) pi , and (q + r) is the order of the moment.

Central moments use coordinates relative to each blob's center of gravity, and are therefore independent of a blob's position within an image.

(summarize)
Collapse M_ORDINARY +

Specifies an ordinary moment.

This ordinary moment is defined as , where i and n are the lower and upper bounds of the summation respectively, pi = value of a pixel (always 1 for binary moments), xi = its X-coordinate, yi = its Y-coordinate, and (q + r) is the order of the moment.

Ordinary moments are affected by the blob position because they use coordinates relative to the image origin (top-left corner).

(summarize)
Combination constants for any of the possible values of the MomType parameter.

You can add one of the following values to the above-mentioned values to set whether to use the binary or grayscale version of the selected feature.

If you provide a grayscale image, both grayscale and binary versions are calculated. The following limits the results to either binary or grayscale.

function map For specifying one version of the results
CollapseCombination value Description
Collapse M_BINARY

Calculates only the binary version of the image.

Collapse M_GRAYSCALE

Calculates only the grayscale version of the image.

Combination constants for any of the possible values of the MomType parameter.

You can add one of the following values to the above-mentioned values to set the general moment as a sorting key for the result retrieval.

function map For selecting a sorting key
CollapseCombination value Description
Collapse M_NO_SORT

Removes the specified sorting key.

Collapse M_SORTn_DOWN

Specifies the feature as the n th sorting key (in descending order), where n stands for an integer between 1 and 3.

Collapse M_SORTn_UP

Specifies the feature as the n th sorting key (in ascending order), where n stands for an integer between 1 and 3.

XMomOrder

Specifies the X-order of the moment. The X-order of the moment must be greater than or equal to 0.

YMomOrder

Specifies the Y-order of the moment. The Y-order of the moment must be greater than or equal to 0.

Compilation information
Header Include mil.h.
Library Use mil.lib; milblob.lib.
DLL Requires mil.dll; milblob.dll.
CENTRAL ORDINARY BINARY GRAYSCALE NO SORT SORTn DOWN SORTn UP