Besides the area and perimeter, you might need to determine the dimension of the blobs. Since blobs are not typically rectangular in shape, you will probably have to take the length (or diameter) of the blobs at various angles from the horizontal axis. This is actually one of the many definitions of the blob length, called the Feret diameter. Several Feret diameters are illustrated below. Note, the angle at which the Feret diameter is taken (relative to the horizontal axis) is specified as a subscript to the F.
With MIL, you can calculate the Feret diameter at a specified angle (M_GENERAL_FERET) by adding it to the feature list, using MblobSelectFeature() with M_GENERAL_FERET and then using MblobSelectFeret() to specify the angle; if you don't call MblobSelectFeature() first, MblobSelectFeret() will automatically add it to the feature list. To add the Feret diameter at 0° (horizontal Feret diameter) and 90° (vertical Feret diameter) to the feature list, you can also use MblobSelectFeature() (M_FERET_X and M_FERET_Y, respectively).
You can automatically determine the minimum, maximum, and average Feret diameters of the blob by adding the M_FERET_MIN_DIAMETER, M_FERET_MAX_DIAMETER, and M_FERET_MEAN_DIAMETER features, respectively, to the feature list, using MblobSelectFeature(). These diameters will be determined by testing the diameter of the blobs at several angles. Alternatively, you can set the range over which to calculate the Feret diameters (or other Feret-based features) using MblobControl() with M_FERET_ANGLE_SEARCH_START and M_FERET_ANGLE_SEARCH_END.
You can use MblobControl() with M_NUMBER_OF_FERETS to change the default number of angles; these angles will start at 0° and increase in increments of 180°/n , where n is the number of Feret diameters. Increasing the number of angles that are tested increases the accuracy of the results, but also increases processing time.
Note that, since memory usage increases with the number of Feret diameters, using a large number of Feret diameters in an image with many blobs might result in memory allocation errors.
When the Feret is computed at 0° or 90°, the Feret diameter is equal to the exact length of the blob in that direction. However, when the Feret is computed at another angle, the Feret diameter is always smaller than the width of the blob in that direction. This is because pixels are considered circular. The approximation is at its worse at 45°. The relative difference between the Feret approximation and the exact length decreases as the blobs get bigger. The difference between the approximation and the exact length is shown in the image below.
The maximum Feret diameter is not very sensitive to the number of angles; using 8 angles usually produces an accurate result. The minimum diameter, however, can be inaccurate for long thin blobs unless many angles are used.
The angles at which the minimum and maximum Feret diameter were found can be determined by adding the M_FERET_MIN_ANGLE and M_FERET_MAX_ANGLE to the feature list, using MblobSelectFeature().
You can determine the ratio of the maximum to minimum Feret diameter by adding M_FERET_ELONGATION feature to the feature list, using the above function.
Although the Feret diameters provide a good approximation of the blob size, these features are not very good for long, thin blobs. For these, the following features, available with MblobSelectFeature(), might provide better results:
M_LENGTH: an extraction of the true length of a blob.
M_BREADTH: an extraction of the true breadth of a blob.
M_ELONGATION: the ratio of the length to the breadth.
These features are derived from the area and perimeter, using the assumption that the blob area is equal to the [length x breadth] and the perimeter is equal to [2(length + breadth)]. These relations only hold if the length and breadth are constant throughout a blob. However, long, thin blobs generally satisfy this assumption, even if they are not straight.
Note, since these features use only the area and perimeter, they are faster to calculate than Feret features.