| MIL 10 Reference
| Customize Help
| Save Settings

MblobSelectFeature



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
Synopsis
Select feature(s) to be calculated.
Syntax
void MblobSelectFeature(
MIL_ID FeatureListId, //in
MIL_INT64 Feature //in
)
Description

This function selects the feature(s) to be calculated by MblobCalculate() when using the specified feature list.

Calculations for binary features are performed using the blob identifier image. Grayscale feature calculations are performed using both the blob identifier image and grayscale image. Features that have both binary and grayscale definitions are calculated using both the blob identifier image and the grayscale image (see MblobCalculate()).

You can get the feature results of a specific blob using MblobGetResultSingle(). To get the feature results of all blobs, use MblobGetResult(). The results of the features M_CHAIN_INDEX, M_CHAIN_X, M_CHAIN_Y, and M_CONVEX_HULL are only available with MblobGetResultSingle(). All other feature results are available with both MblobGetResultSingle() and MblobGetResult().

Note that you can change the number of Feret angles, for those features requiring them in calculations, using MblobControl().

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.

Feature

Specifies the feature to add to the feature list. To add several features, you can call this function for each feature you want to add to the list. Alternatively, you can use one of the values listed in the For selecting groups of features in a single call table below. This table contains values that allow you to select commonly used groups of features in a single call.

The following group of features do not use grayscale pixel values; they are calculated using only the blob identifier image. Note that, unless otherwise stated, features can be calculated in either pixel or calibrated units.

function map For specifying the feature to add
CollapseValue Description
Collapse M_ALL_FERETS +

Determines all Feret diameters of every blob in the image.

Collapse M_AREA +

Determines the number of foreground pixels in a blob (holes are not counted).

Collapse M_BLOB_TOUCHING_IMAGE_BORDERS +

Determines whether blobs touched the border of the blob identifier image.

Collapse M_BOX_AREA +

Determines the area covered by the bounding box of a blob.

Collapse M_BOX_ASPECT_RATIO +

Determines the ratio of the horizontal size to the vertical size of the bounding box of a blob.

Collapse M_BOX_FILL_RATIO +

Determines the ratio of the area of a blob to the area of the bounding box of the blob.

Collapse M_BOX_X_MAX +

Determines the extreme right coordinate of a blob.

Collapse M_BOX_X_MIN +

Determines the extreme left coordinate of a blob.

Collapse M_BOX_Y_MAX +

Determines the extreme bottom coordinate of a blob.

Collapse M_BOX_Y_MIN +

Determines the extreme top coordinate of a blob.

Collapse M_BREADTH +

Determines a measure of the true breadth of an object, with the same advantages and disadvantages as M_LENGTH.

Collapse M_CHAIN_INDEX +

Determines the indices which differentiate each chain's pixels within a specified blob. The index of the blob's outermost chain is 1. Chains that delimit holes in blobs are identified by subsequent indices for each chain.

(summarize)
Collapse M_CHAIN_X +

Determines the X-coordinate of each chained pixel in the specified blob, for all chains contained within the blob (both the pixels bordering a blob and those delimiting its holes). Chained pixels always form a closed chain. This implies that the starting pixel in the chain is also the closing one. If your blob has regions which are 1 pixel wide, these pixels are chained twice, once in the forward direction and then in the opposite direction.

Blobs with holes have multiple chains. To determine the chain to which this pixel's X-coordinate belongs, use M_CHAIN_INDEX.

(summarize)
Collapse M_CHAIN_Y +

Determines the Y-coordinate of each chained pixel in the specified blob, for all chains contained within the blob (both the pixels bordering a blob and those delimiting its holes). Chained pixels always form a closed chain. This implies that the starting pixel in the chain is also the closing one. If your blob has regions which are 1 pixel wide, these pixels are chained twice, once in the forward direction and then in the opposite direction.

Blobs with holes have multiple chains. To determine the chain to which this pixel's Y-coordinate belongs, use M_CHAIN_INDEX.

(summarize)
Collapse M_COMPACTNESS +

Determines the ratio between the area of a circle with the same perimeter as the blob in question, and the area of the blob itself. The minimum theoretical value of 1.0 is obtained if the blob is a perfect circle. In practice, the minimum obtainable value is slightly above 1. This is due to the effect of square pixel discretization. The more convoluted the shape, the greater the value.

The formula used is equal to where A is the area of the blob and p is the perimeter of the blob.

In the illusration above, the blobs have similar sizes but can be distinguised by their shapes. The compactness of the left blob is slightly above 1.0, while the compactness of the right blob is 1.24.

(summarize)
Collapse M_CONVEX_HULL_AREA +

Determines the area of the convex hull of a blob.

Collapse M_CONVEX_HULL_COG_X +

Determines the X-component of the center of gravity of the convex hull.

Collapse M_CONVEX_HULL_COG_Y +

Determines the Y-component of the center of gravity of the convex hull.

Collapse M_CONVEX_HULL_FILL_RATIO +

Determines the ratio between the area of a blob and the area of the blob's convex hull.

In the example above, the left blob has a convex hull fill ratio of 1.0 whereas the middle and rightmost blobs have a convex hull fill ratio of 0.9.

(summarize)
Collapse M_CONVEX_HULL_PERIMETER +

Determines the perimeter of the convex hull of a blob. The perimeter is calculated by summing up the distance between every 2 consecutive points on the convex hull of a blob.

For a quicker result, you can select to calculate the approximation of this perimeter using M_CONVEX_PERIMETER.

(summarize)
Collapse M_CONVEX_HULL_X +

Determines the X-coordinate of each point on the convex perimeter of a blob. Convex perimeter pixels always form a closed figure. This implies that the starting pixel on the convex perimeter is also the closing one.

(summarize)
Collapse M_CONVEX_HULL_XY_PACKED +

Determines the X- and Y-coordinate of each point on the convex perimeter of a blob. Convex perimeter pixels always form a closed figure. This implies that the starting pixel on the convex perimeter is also the closing one.

(summarize)
Collapse M_CONVEX_HULL_Y +

Determines the Y-coordinate of each point on the convex perimeter of a blob. Convex perimeter pixels always form a closed figure. This implies that the starting pixel on the convex perimeter is also the closing one.

(summarize)
Collapse M_CONVEX_PERIMETER +

Determines the approximation of the perimeter of the convex hull of a blob. It is derived from several Feret diameters; so, a larger number of Ferets gives a more accurate result.

For a more accurate result, you can select to calculate M_CONVEX_HULL_PERIMETER.

(summarize)
Collapse M_ELONGATION +

Determines a value that is equal to M_LENGTH / M_BREADTH. It is similar to M_FERET_ELONGATION, except that it should be used for long thin objects.

(summarize)
Collapse M_EULER_NUMBER +

Determines the number of blobs - number of holes. This value is more useful for M_WHOLE_IMAGE than for M_INDIVIDUAL processing mode.

(summarize)
Collapse M_FERET_AT_PRINCIPAL_AXIS_ANGLE +

Determines the Feret diameter at the principal axis of a blob.

The principal axis is the axis at which the blob has the least moment of inertia. Also, if the blob is symmetrical, the principal axis is aligned with the blob's axis of symmetry.

(summarize)
Collapse M_FERET_AT_SECONDARY_AXIS_ANGLE +

Determines the Feret diameter at the secondary axis of a blob.

The secondary axis is perpendicular to the principal axis.

(summarize)
Collapse M_FERET_ELONGATION +

Determines the measure of the shape of a blob. It is equal to M_FERET_MAX_DIAMETER / M_FERET_MIN_DIAMETER.

It is accurate for reasonably compact objects, but becomes less accurate for very elongated objects (because M_FERET_MIN_DIAMETER becomes less accurate). For very elongated objects, M_ELONGATION should be used.

(summarize)
Collapse M_FERET_MAX_ANGLE +

Determines the angle at which the maximum Feret diameter is found. The value is in degrees, with positive values indicating a counter-clockwise displacement from the positive X-axis.

(summarize)
Collapse M_FERET_MAX_DIAMETER +

Determines the largest Feret diameter found after checking a certain number of angles. More angles will give a more accurate result, but will take longer to calculate. However, the maximum Feret diameter is not very sensitive to the number of angles, and 8 usually gives an accurate result.

(summarize)
Collapse M_FERET_MAX_DIAMETER_ELONGATION +

Determines the ratio of the maximum Feret diameter by its perpendicular Feret diameter.

Collapse M_FERET_MEAN_DIAMETER +

Determines the average Feret diameter at all the angles checked.

Collapse M_FERET_MIN_ANGLE +

Determines the angle at which the minimum Feret diameter is found. The value is in degrees, with positive values indicating a counter-clockwise displacement from the positive X-axis.

(summarize)
Collapse M_FERET_MIN_DIAMETER +

Determines the smallest Feret diameter found after checking a certain number of angles. More angles will give a more accurate result, but will take longer to calculate. Note that this feature will not be very accurate for long thin blobs. However, you can get an accurate measure of the breadth of long thin blobs more quickly using M_BREADTH.

(summarize)
Collapse M_FERET_MIN_DIAMETER_ELONGATION +

Determines the ratio of the minimum Feret diameter by its perpendicular Feret diameter.

Collapse M_FERET_PERPENDICULAR_TO_MAX_DIAMETER +

Determines the Feret diameter that is perpendicular to the maximum Feret diameter.

Collapse M_FERET_PERPENDICULAR_TO_MIN_DIAMETER +

Determines the Feret diameter that is perpendicular to the minimum Feret diameter.

Collapse M_FERET_PRINCIPAL_AXIS_ELONGATION +

Determines the ratio of the Feret diameter at the principal axis to the Feret diameter at the secondary axis. It is equal to M_FERET_AT_PRINCIPAL_AXIS_ANGLE / M_FERET_AT_SECONDARY_AXIS_ANGLE.

(summarize)
Collapse M_FERET_X +

Determines the dimension of the minimum bounding box of a blob in the horizontal direction; that is, M_BOX_X_MAX - M_BOX_X_MIN + 1.

Collapse M_FERET_Y +

Determines the dimension of the minimum bounding box of a blob in the vertical direction; that is, M_BOX_Y_MAX - M_BOX_Y_MIN + 1.

Collapse M_FIRST_POINT_X +

Determines (along with M_FIRST_POINT_Y) a unique point for each object, that is always on the perimeter of the object. The X-coordinate is that of the left-most pixel on the top-most line of the object.

(summarize)
Collapse M_FIRST_POINT_Y +

Determines (along with M_FIRST_POINT_X) a unique point for each object, that is always on the perimeter of the object. The Y-coordinate is that of the topmost line of the object.

(summarize)
Collapse M_GENERAL_FERET +

Determines the general Feret diameter at an angle specified using MblobSelectFeret(). If you don't call MblobSelectFeret() before performing a calculation, a MIL error will be generated.

(summarize)
Collapse M_INTERCEPT_0 +

Determines the number of times a transition from background to foreground (not vice versa) occurs in the horizontal direction for the entire blob. In other words, it is equal to the number of times the neighborhood configuration [ B, F ] occurs in a blob, where B is a background pixel and F is a foreground pixel.

(summarize)
Collapse M_INTERCEPT_45 +

Determines the number of times that the neighborhood configuration occurs in a blob, where F is a foreground pixel, B is a background pixel, and a dot can be any pixel value.

Collapse M_INTERCEPT_90 +

Determines the number of times that the neighborhood configuration occurs in a blob.

Collapse M_INTERCEPT_135 +

Determines the number of times that the neighborhood configuration occurs in a blob.

Collapse M_LABEL_VALUE +

Determines the label value for each blob in an image. This is a positive integer (>= 1) that is unique for each blob. This feature is always calculated; you do not need to select it.

(summarize)
Collapse M_LENGTH +

Determines the measure of the true length of an object, although it can only be applied to certain object types because it is derived from the perimeter (P) and area (A) assuming that P = 2(length + breadth) and A = length x breadth. It complements M_FERET_MAX_DIAMETER because it is accurate for different blob types (for example, long thin ones). Note, it is calculated much faster than the maximum Feret diameter.

(summarize)
Collapse M_MIN_AREA_BOX_ANGLE +

Determines the angle of the minimum-area bounding box of a blob. The angle is always measured from the X-axis to the side from which the width is measured.

(summarize)
Collapse M_MIN_AREA_BOX_AREA +

Determines the area of the minimum-area bounding box of a blob.

Collapse M_MIN_AREA_BOX_CENTER_X

Determines the X-coordinate of the center of the minimum-area bounding box of a blob.

Collapse M_MIN_AREA_BOX_CENTER_Y

Determines the Y-coordinate of the center of the minimum-area bounding box of a blob.

Collapse M_MIN_AREA_BOX_HEIGHT +

Determines the height of the minimum-area bounding box of a blob. The height is always taken as the shortest side of the box.

(summarize)
Collapse M_MIN_AREA_BOX_PERIMETER +

Determines the perimeter of the minimum-area bounding box of a blob.

Collapse M_MIN_AREA_BOX_WIDTH +

Determines the width of the minimum-area bounding box of a blob. The width is always taken as the longest side of the box.

(summarize)
Collapse M_MIN_AREA_BOX_Xn

Determines the X-coordinate of the n th vertex of the minimum-area bounding box of a blob, where n stands for an integer between 1 and 4.

Note that due to potential rotations of the bounding box, the labelling of the vertices might be inconsistent.

(summarize)
Collapse M_MIN_AREA_BOX_Yn

Determines the Y-coordinate of the n th vertex of the minimum-area bounding box of a blob, where n stands for an integer between 1 and 4.

Note that due to potential rotations of the bounding box, the labelling of the vertices might be inconsistent.

(summarize)
Collapse M_MIN_PERIMETER_BOX_ANGLE +

Determines the angle of the minimum-perimeter bounding box of a blob. The angle is always measured from the X-axis to the side from which the width is measured.

(summarize)
Collapse M_MIN_PERIMETER_BOX_AREA +

Determines the area of the minimum-perimeter bounding box of a blob.

Collapse M_MIN_PERIMETER_BOX_CENTER_X

Determines the X-coordinate of the center of the minimum-perimeter bounding box of a blob.

Collapse M_MIN_PERIMETER_BOX_CENTER_Y

Determines the Y-coordinate of the center of the minimum-perimeter bounding box of a blob.

Collapse M_MIN_PERIMETER_BOX_HEIGHT +

Determines the height of the minimum-perimeter bounding box of a blob. The height is always taken as the shortest side of the box.

(summarize)
Collapse M_MIN_PERIMETER_BOX_PERIMETER +

Determines the perimeter of the minimum-perimeter bounding box of a blob.

Collapse M_MIN_PERIMETER_BOX_WIDTH +

Determines the width of the minimum-perimeter bounding box of a blob. The width is always taken as the longest side of the box.

(summarize)
Collapse M_MIN_PERIMETER_BOX_Xn

Determines the X-coordinate of the n th vertex of the minimum-perimeter bounding box of a blob, where n stands for an integer between 1 and 4.

Note that due to potential rotations of the bounding box, the labelling of the vertices might be inconsistent.

(summarize)
Collapse M_MIN_PERIMETER_BOX_Yn

Determines the Y-coordinate of the n th vertex of the minimum-perimeter bounding box of a blob, where n stands for an integer between 1 and 4.

Note that due to potential rotations of the bounding box, the labelling of the vertices might be inconsistent.

(summarize)
Collapse M_NUMBER_OF_CHAINED_PIXELS +

Determines the number of chained pixels for all blobs or a specified blob.

Collapse M_NUMBER_OF_CONVEX_HULL_POINTS +

Determines the number of points on the convex perimeter of a blob.

Collapse M_NUMBER_OF_HOLES +

Determines a value that is equal to the number of holes in a blob. Holes that intersect the edge of the image are not counted (they might not be holes). This value is equal to 1 - M_EULER_NUMBER and is therefore a true hole count only in M_INDIVIDUAL processing mode.

(summarize)
Collapse M_NUMBER_OF_RUNS +

Determines a value that is equal to the total number of runs in a blob. A run is defined as a horizontal string of consecutive foreground pixels.

(summarize)
Collapse M_PERIMETER +

Determines the total length of edges in a blob (including the edges of any holes), with an allowance made for the staircase effect that is produced when diagonal edges are digitized (inside corners are counted as 1.414, rather than 2.0). A single pixel blob (area = 1) has a perimeter of 4.0.

(summarize)
Collapse M_RECTANGULARITY +

Determines the degree to which a blob resembles a rectangle. To do this, MblobSelectFeature() calculates the ratio of the blob's area to the product of its minimum Feret diameter and the Feret diameter perpendicular to the minimum Feret diameter.

The three blobs above have the same minimum Feret diameter and the same Feret diameter perpendicular to the minimum Feret diameter. Only their shape and area differs. The rectangularity of the left blob is 1.0, indicating a perfect rectangle. The rectangularity of the middle blob is 0.8 and the rectangularity of the rightmost blob is 0.5.

(summarize)
Collapse M_ROUGHNESS +

Determines a measure of how rough a blob is and is equal to M_PERIMETER / M_CONVEX_PERIMETER. A smooth convex object will have the minimum roughness of 1.0.

In the example above, the left blob has a roughness of 1.0, the middle blob has a roughness of 1.1, and the right blob has a roughess of 1.5.

(summarize)
Collapse M_WORLD_BOX_X_MAX

Determines the extreme right X-coordinate of a blob, calculated in the relative coordinate system.

Collapse M_WORLD_BOX_X_MIN

Determines the extreme left X-coordinate of a blob, calculated in the relative coordinate system.

Collapse M_WORLD_BOX_Y_MAX

Determines the extreme bottom Y-coordinate of a blob, calculated in the relative coordinate system.

Collapse M_WORLD_BOX_Y_MIN

Determines the extreme top Y-coordinate of a blob, calculated in the relative coordinate system.

Collapse M_WORLD_FERET_X

Determines the dimension of the minimum bounding box of a blob in the horizontal direction, calculated in the relative coordinate system (that is, M_WORLD_BOX_X_MAX - M_WORLD_BOX_X_MIN + 1).

Collapse M_WORLD_FERET_Y

Determines the dimension of the minimum bounding box of a blob in the vertical direction, calculated in the relative coordinate system (that is, M_WORLD_BOX_Y_MAX - M_WORLD_BOX_Y_MIN + 1).

Collapse M_WORLD_X_AT_Y_MAX

Determines an X-coordinate that touches the maximum Y-coordinate of a blob, calculated in the relative coordinate system. In the case where more than one X-coordinate touches the maximum Y-coordinate of a blob, it cannot be specified which X-coordinate will be calculated and returned.

(summarize)
Collapse M_WORLD_X_AT_Y_MIN

Determines an X-coordinate that touches the minimum Y-coordinate of a blob, calculated in the relative coordinate system. In the case where more than one X-coordinate touches the minimum Y-coordinate of a blob, it cannot be specified which X-coordinate will be calculated and returned.

(summarize)
Collapse M_WORLD_Y_AT_X_MAX

Determines an Y-coordinate that touches the maximum X-coordinate of a blob, calculated in the relative coordinate system. In the case where more than one T-coordinate touches the maximum X-coordinate of a blob, it cannot be specified which Y-coordinate will be calculated and returned.

(summarize)
Collapse M_WORLD_Y_AT_X_MIN

Determines an Y-coordinate that touches the minimum X-coordinate of a blob, calculated in the relative coordinate system. In the case where more than one Y-coordinate touches the minimum X-coordinate of a blob, it cannot be specified which Y-coordinate will be calculated and returned.

(summarize)
Collapse M_X_MAX_AT_Y_MAX

Determines the maximum X-coordinate at the maximum Y-coordinate of a blob, calculated in the pixel coordinate system. Together with M_BOX_Y_MAX, this determines one of the contact points on the convex perimeter of the blob.

(summarize)
Collapse M_X_MAX_AT_Y_MIN

Determines the maximum X-coordinate at the minimum Y-coordinate of a blob, calculated in the pixel coordinate system. Together with M_BOX_Y_MIN, this determines one of the contact points on the convex perimeter of the blob.

(summarize)
Collapse M_X_MIN_AT_Y_MAX

Determines the minimum X-coordinate at the maximum Y-coordinate of a blob, calculated in the pixel coordinate system. Together with M_BOX_Y_MAX, this determines one of the contact points on the convex perimeter of the blob.

(summarize)
Collapse M_X_MIN_AT_Y_MIN

Determines the minimum X-coordinate at the minimum Y-coordinate of a blob, calculated in the pixel coordinate system. Together with M_BOX_Y_MIN, this determines one of the contact points on the convex perimeter of the blob.

(summarize)
Collapse M_Y_MAX_AT_X_MAX

Determines the maximum Y-coordinate at the maximum X-coordinate of a blob, calculated in the pixel coordinate system. Together with M_BOX_X_MAX, this determines one of the contact points on the convex perimeter of the blob.

(summarize)
Collapse M_Y_MAX_AT_X_MIN

Determines the maximum Y-coordinate at the minimum X-coordinate of a blob, calculated in the pixel coordinate system. Together with M_BOX_X_MIN, this determines one of the contact points on the convex perimeter of the blob.

(summarize)
Collapse M_Y_MIN_AT_X_MAX

Determines the minimum Y-coordinate at the maximum X-coordinate of a blob, calculated in the pixel coordinate system. Together with M_BOX_X_MAX, this determines one of the contact points on the convex perimeter of the blob.

(summarize)
Collapse M_Y_MIN_AT_X_MIN

Determines the minimum Y-coordinate at the minimum X-coordinate of a blob, calculated in the pixel coordinate system. Together with M_BOX_X_MIN, this determines one of the contact points on the convex perimeter of the blob.

(summarize)
Combination constants for M_ALL_FERETS; M_AREA; M_BLOB_TOUCHING_IMAGE_BORDERS; M_BOX_AREA; M_BOX_ASPECT_RATIO; M_BOX_FILL_RATIO; M_BOX_X_MAX; M_BOX_X_MIN; M_BOX_Y_MAX; M_BOX_Y_MIN; M_BREADTH; M_CHAIN_INDEX; M_CHAIN_X; M_CHAIN_Y; M_COMPACTNESS; M_CONVEX_HULL_AREA; M_CONVEX_HULL_COG_X; M_CONVEX_HULL_COG_Y; M_CONVEX_HULL_FILL_RATIO; M_CONVEX_HULL_PERIMETER; M_CONVEX_HULL_X; M_CONVEX_HULL_XY_PACKED; M_CONVEX_HULL_Y; M_CONVEX_PERIMETER; M_ELONGATION; M_EULER_NUMBER; M_FERET_AT_PRINCIPAL_AXIS_ANGLE; M_FERET_AT_SECONDARY_AXIS_ANGLE; M_FERET_ELONGATION; M_FERET_MAX_ANGLE; M_FERET_MAX_DIAMETER; M_FERET_MAX_DIAMETER_ELONGATION; M_FERET_MEAN_DIAMETER; M_FERET_MIN_ANGLE; M_FERET_MIN_DIAMETER; M_FERET_MIN_DIAMETER_ELONGATION; M_FERET_PERPENDICULAR_TO_MAX_DIAMETER; M_FERET_PERPENDICULAR_TO_MIN_DIAMETER; M_FERET_PRINCIPAL_AXIS_ELONGATION; M_FERET_X; M_FERET_Y; M_FIRST_POINT_X; M_FIRST_POINT_Y; M_GENERAL_FERET; M_INTERCEPT_0; M_INTERCEPT_45; M_INTERCEPT_90; M_INTERCEPT_135; M_LABEL_VALUE; M_LENGTH; M_MIN_AREA_BOX_ANGLE; M_MIN_AREA_BOX_AREA; M_MIN_AREA_BOX_HEIGHT; M_MIN_AREA_BOX_PERIMETER; M_MIN_AREA_BOX_WIDTH; M_MIN_PERIMETER_BOX_ANGLE; M_MIN_PERIMETER_BOX_AREA; M_MIN_PERIMETER_BOX_HEIGHT; M_MIN_PERIMETER_BOX_PERIMETER; M_MIN_PERIMETER_BOX_WIDTH; M_NUMBER_OF_CHAINED_PIXELS; M_NUMBER_OF_CONVEX_HULL_POINTS; M_NUMBER_OF_HOLES; M_NUMBER_OF_RUNS; M_PERIMETER; M_RECTANGULARITY; M_ROUGHNESS.

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

For features that have both grayscale and binary definitions, the grayscale version of the feature is used as the sorting key by default. To use the binary version, add M_BINARY to the feature selected as a sorting key. Only one feature can be selected as the first, second, or third sorting key.

function map For specifying 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.

You can add one of the following values to the above-mentioned values to specify to calculate a contact point(s) of the Feret.

function map For specifying the use of Feret contact points
CollapseCombination value Description
Collapse M_FERET_CONTACT_POINTS

Determines the contact points of a Feret.

Collapse M_FERET_CONTACT_POINTS_X1

Determines the X-coordinate for the first contact point of the Feret diameter.

Collapse M_FERET_CONTACT_POINTS_X2

Determines the X-coordinate for the second contact point of the Feret diameter.

Collapse M_FERET_CONTACT_POINTS_Y1

Determines the Y-coordinate for the first contact point of the Feret diameter.

Collapse M_FERET_CONTACT_POINTS_Y2

Determines the Y-coordinate for the second contact point of the Feret diameter.

The following features require grayscale pixel values, and can only be calculated if you provide a grayscale image.

function map For features with grayscale pixel values
CollapseValue Description
Collapse M_BLOB_CONTRAST

Determines the difference between the maximum and minimum pixel values of a blob. It is equal to M_MAX_PIXEL - M_MIN_PIXEL.

(summarize)
Collapse M_MAX_PIXEL

Determines the maximum pixel value found in a blob.

Collapse M_MEAN_PIXEL

Determines the mean pixel value in a blob. It is equal to M_SUM_PIXEL / M_AREA.

(summarize)
Collapse M_MIN_PIXEL

Determines the minimum pixel value found in a blob.

Collapse M_SIGMA_PIXEL

Determines the standard deviation of pixel values in a blob. It is equal to , where N = number of pixels and p = pixel value.

(summarize)
Collapse M_SUM_PIXEL

Determines the sum of all pixel values in a blob.

Collapse M_SUM_PIXEL_SQUARED

Determines the sum of the squares of each pixel value in a blob.

The following features have two different definitions: a binary definition, where all pixels are considered equal, and a grayscale, where pixels are weighted by their value in the gray image (the grayscale version is much slower to calculate). If you do not provide a grayscale image, only the binary version can be calculated. If you do provide a grayscale image, both versions are calculated.

function map For features with two definitions
CollapseValue Description
Collapse M_AXIS_PRINCIPAL_ANGLE +

Determines the angle at which a blob has the least moment of inertia. For elongated blobs, it is aligned with the longest axis. The result is always between -90° and +90°, measured in a counter-clockwise direction from the positive X-axis. It is calculated as:

When the blob identifier image is calibrated this feature is calculated in calibrated units; otherwise they are calculated in pixel units. (summarize)
Collapse M_AXIS_SECONDARY_ANGLE +

Determines the angle perpendicular to M_AXIS_PRINCIPAL_ANGLE. It is always between -90° and +90°.

(summarize)
Collapse M_CENTER_OF_GRAVITY_X +

Determines the X-position of the center of gravity of a blob. The grayscale version is M_MOMENT_X1_Y0 / M_SUM_PIXEL. The binary version uses M_AREA instead of M_SUM_PIXEL.

(summarize)
Collapse M_CENTER_OF_GRAVITY_Y +

Determines the Y-position of the center of gravity of a blob. The grayscale version is M_MOMENT_X0_Y1 / M_SUM_PIXEL. The binary version uses M_AREA instead of M_SUM_PIXEL.

(summarize)
Collapse M_MOMENT_CENTRAL_X0_Y2 +

Determines the necessary calculation of the central moment where the order of X equals 0 and the order of Y equals 2.

This 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), yi = its Y-coordinate, = the first order ordinary moment about Y divided by the sum of the pixel values (M_SUM_PIXEL for grayscale values) pi .

For central moments, coordinates are relative to each blob's center of gravity, as opposed to ordinary moments, which use coordinates that are relative to the image origin (top-left corner). Calculate higher moments by calling MblobSelectMoment().

(summarize)
Collapse M_MOMENT_CENTRAL_X1_Y1 +

Determines the necessary calculation of the central moment where the order of X equals 1 and the order of Y equals 1.

This 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 and, yi = its Y-coordinate, = the first ordinary order moment about Xi divided by the sum of the pixel values (M_SUM_PIXEL for grayscale values) pi , and = the first order ordinary moment about Yi divided by the sum of the pixel values (M_SUM_PIXEL for grayscale values) pi .

For central moments, coordinates are relative to each blob's center of gravity, as opposed to ordinary moments, which use coordinates that are relative to the image origin (top-left corner). Calculate higher moments by calling MblobSelectMoment().

(summarize)
Collapse M_MOMENT_CENTRAL_X2_Y0 +

Determines the necessary calculation of the central moment where the order of X equals 2 and the order of Y equals 0.

This 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, = the first order ordinary moment about xi divided by the sum of the pixel values (M_SUM_PIXEL for grayscale values) pi .

For central moments, coordinates are relative to each blob's center of gravity, as opposed to ordinary moments, which use coordinates that are relative to the image origin (top-left corner). Calculate higher moments by calling MblobSelectMoment().

(summarize)
Collapse M_MOMENT_X0_Y1 +

Determines the necessary calculation of the ordinary moment where the order of X equals 0 and the order of Y equals 1.

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) and yi = its Y-coordinate.

In order to calculate the weighted arithmetic mean about Y, take the result returned by the calculation of this feature and divide it by the M_SUM_PIXEL feature (for grayscale values).

For ordinary moments, coordinates are relative to the image origin (top-left corner), as opposed to central moments, which use coordinates that are relative to each blob's center of gravity. Calculate higher moments by calling MblobSelectMoment().

(summarize)
Collapse M_MOMENT_X0_Y2 +

Determines the necessary calculation of the ordinary moment where the order of X equals 0 and the order of Y equals 2.

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) and yi = its Y-coordinate.

For ordinary moments, coordinates are relative to the image origin (top-left corner), as opposed to central moments, which use coordinates that are relative to each blob's center of gravity. Calculate higher moments by calling MblobSelectMoment().

(summarize)
Collapse M_MOMENT_X1_Y0 +

Determines the necessary calculation of the ordinary moment where the order of X equals 1 and the order of Y equals 0.

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) and xi = its X-coordinate.

In order to calculate the weighted arithmetic mean about X, take the result returned by the calculation of this feature and divide it by the M_SUM_PIXEL feature (for grayscale values).

For ordinary moments, coordinates are relative to the image origin (top-left corner), as opposed to central moments, which use coordinates that are relative to each blob's center of gravity. Calculate higher moments by calling MblobSelectMoment().

(summarize)
Collapse M_MOMENT_X1_Y1 +

Determines the necessary calculation of the ordinary moment where the order of X equals 1 and the order of Y equals 1.

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 and yi = its Y-coordinate.

For ordinary moments, coordinates are relative to the image origin (top-left corner), as opposed to central moments, which use coordinates that are relative to each blob's center of gravity. Calculate higher moments by calling MblobSelectMoment().

(summarize)
Collapse M_MOMENT_X2_Y0 +

Determines the necessary calculation of the ordinary moment where the order of X equals 2 and the order of Y equals 0.

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) and xi = its X-coordinate.

For ordinary moments, coordinates are relative to the image origin (top-left corner), as opposed to central moments, which use coordinates that are relative to each blob's center of gravity. Calculate higher moments by calling MblobSelectMoment().

(summarize)

The following values allow you to select groups of features in a single call.

function map For selecting groups of features in a single call
CollapseValue Description
Collapse M_ALL_FEATURES

Adds all features (except general Feret and general movement).

Collapse M_BOX

Adds all 4 bounding box features plus X- and Y-Ferets.

Collapse M_CENTER_OF_GRAVITY +

Adds both X- and Y-coordinates of the center of gravity.

Collapse M_CHAINS

Adds all 4 chain features. Note that the chain code is computed depending on the lattice and foreground values set with MblobControl().

(summarize)
Collapse M_CONTACT_POINTS

Adds first point and other contact features (M_X_MIN_AT_Y_MIN, M_X_MAX_AT_Y_MIN, M_X_MAX_AT_Y_MAX, M_X_MIN_AT_Y_MAX, M_Y_MIN_AT_X_MAX, M_Y_MAX_AT_X_MAX, M_Y_MAX_AT_X_MIN, and M_Y_MIN_AT_X_MIN).

Collapse M_CONVEX_HULL

Adds all convex hull features (M_CONVEX_HULL_AREA, M_CONVEX_HULL_FILL_RATIO, M_CONVEX_HULL_X, M_CONVEX_HULL_XY_PACKED M_CONVEX_HULL_Y, and M_NUMBER_OF_CONVEX_HULL_POINTS).

Collapse M_MIN_AREA_BOX

Adds all the minimum-area bounding box features (M_MIN_AREA_BOX_AREA, M_MIN_AREA_BOX_ANGLE, M_MIN_AREA_BOX_CENTER_X, M_MIN_AREA_BOX_CENTER_Y, M_MIN_AREA_BOX_HEIGHT, M_MIN_AREA_BOX_PERIMETER, M_MIN_AREA_BOX_WIDTH, M_MIN_AREA_BOX_Xn, M_MIN_AREA_BOX_Yn).

Collapse M_MIN_PERIMETER_BOX

Adds all the minimum-perimeter bounding box features (M_MIN_PERIMETER_BOX_AREA, M_MIN_PERIMETER_BOX_ANGLE, M_MIN_PERIMETER_BOX_CENTER_X, M_MIN_PERIMETER_BOX_CENTER_Y, M_MIN_PERIMETER_BOX_HEIGHT, M_MIN_PERIMETER_BOX_PERIMETER, M_MIN_PERIMETER_BOX_WIDTH, M_MIN_PERIMETER_BOX_Xn, M_MIN_PERIMETER_BOX_Yn).

Collapse M_NO_FEATURES

Removes all features (except label value).

Collapse M_WORLD_BOX

Adds all of the positional and dimension features that are calculated in the relative coordinate system (M_WORLD_FERET_X, M_WORLD_FERET_Y, M_WORLD_BOX_X_MIN, M_WORLD_BOX_Y_MIN, M_WORLD_BOX_X_MAX, M_WORLD_BOX_Y_MAX, M_WORLD_X_AT_Y_MAX, M_WORLD_X_AT_Y_MIN, M_WORLD_Y_AT_X_MAX, and M_WORLD_Y_AT_X_MIN).

Combination constants for the values listed in For features with two definitions; and for the following value: M_CENTER_OF_GRAVITY.

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.

function map For specifying whether to use the binary or grayscale version of the selected feature
CollapseCombination value Description
Collapse M_BINARY

Calculates the selected feature in the binary version only.

Collapse M_GRAYSCALE

Calculates the selected feature in the grayscale version only.

Compilation information
Header Include mil.h.
Library Use mil.lib; milblob.lib.
DLL Requires mil.dll; milblob.dll.
ALL FERETS AREA BLOB TOUCHING IMAGE BORDERS BOX AREA BOX ASPECT RATIO BOX FILL RATIO BOX X MAX BOX X MIN BOX Y MAX BOX Y MIN BREADTH CHAIN INDEX CHAIN X CHAIN Y COMPACTNESS CONVEX HULL AREA CONVEX HULL COG X CONVEX HULL COG Y CONVEX HULL FILL RATIO CONVEX HULL PERIMETER CONVEX HULL X CONVEX HULL XY PACKED CONVEX HULL Y CONVEX PERIMETER ELONGATION EULER NUMBER FERET AT PRINCIPAL AXIS ANGLE FERET AT SECONDARY AXIS ANGLE FERET ELONGATION FERET MAX ANGLE FERET MAX DIAMETER FERET MAX DIAMETER ELONGATION FERET MEAN DIAMETER FERET MIN ANGLE FERET MIN DIAMETER FERET MIN DIAMETER ELONGATION FERET PERPENDICULAR TO MAX DIAMETER FERET PERPENDICULAR TO MIN DIAMETER FERET PRINCIPAL AXIS ELONGATION FERET X FERET Y FIRST POINT X FIRST POINT Y GENERAL FERET INTERCEPT 0 INTERCEPT 45 INTERCEPT 90 INTERCEPT 135 LABEL VALUE LENGTH MIN AREA BOX ANGLE MIN AREA BOX AREA MIN AREA BOX CENTER X MIN AREA BOX CENTER Y MIN AREA BOX HEIGHT MIN AREA BOX PERIMETER MIN AREA BOX WIDTH MIN AREA BOX Xn MIN AREA BOX Yn MIN PERIMETER BOX ANGLE MIN PERIMETER BOX AREA MIN PERIMETER BOX CENTER X MIN PERIMETER BOX CENTER Y MIN PERIMETER BOX HEIGHT MIN PERIMETER BOX PERIMETER MIN PERIMETER BOX WIDTH MIN PERIMETER BOX Xn MIN PERIMETER BOX Yn NUMBER OF CHAINED PIXELS NUMBER OF CONVEX HULL POINTS NUMBER OF HOLES NUMBER OF RUNS PERIMETER RECTANGULARITY ROUGHNESS WORLD BOX X MAX WORLD BOX X MIN WORLD BOX Y MAX WORLD BOX Y MIN WORLD FERET X WORLD FERET Y WORLD X AT Y MAX WORLD X AT Y MIN WORLD Y AT X MAX WORLD Y AT X MIN X MAX AT Y MAX X MAX AT Y MIN X MIN AT Y MAX X MIN AT Y MIN Y MAX AT X MAX Y MAX AT X MIN Y MIN AT X MAX Y MIN AT X MIN NO SORT SORTn DOWN SORTn UP FERET CONTACT POINTS FERET CONTACT POINTS X1 FERET CONTACT POINTS X2 FERET CONTACT POINTS Y1 FERET CONTACT POINTS Y2 BLOB CONTRAST MAX PIXEL MEAN PIXEL MIN PIXEL SIGMA PIXEL SUM PIXEL SUM PIXEL SQUARED AXIS PRINCIPAL ANGLE AXIS SECONDARY ANGLE CENTER OF GRAVITY X CENTER OF GRAVITY Y MOMENT CENTRAL X0 Y2 MOMENT CENTRAL X1 Y1 MOMENT CENTRAL X2 Y0 MOMENT X0 Y1 MOMENT X0 Y2 MOMENT X1 Y0 MOMENT X1 Y1 MOMENT X2 Y0 ALL FEATURES BOX CENTER OF GRAVITY CHAINS CONTACT POINTS CONVEX HULL MIN AREA BOX MIN PERIMETER BOX NO FEATURES WORLD BOX BINARY GRAYSCALE