References and definitions of how everything is calculated are in the module help for the MeasureObjectSizeAndShape module; for your convenience I’ll reproduce them below but if you want the embedded links you’ll have to go to the module help to grab them yourself.
I’m not sure how much is the PNG conversion (though I suspect not much, because the Major and Minor axis lengths I’m getting are within ~0.2 pixels of yours), but there’s some blurring of the edges of your shapes that is leading to a) an imperfect segmentation but also b) the objects maybe not being the size you think they are- see here
Overall is here- the circle is closer to “right” than the rectangle but not perfect either.
The imperfect segmentation is going to lead to imperfect measurements.
The ratio of those 2 axis lengths is 5.53, so it’s certainly a reasonable approximation of the 5.55 ideal value you’ve calculated. I’m not certain why the ratio isn’t included in our measurements; possibly due to historical reasons, possibly just because it’s easy to derive from measurements we DO include, etc etc. If you think it’s important to add to our feature space, you’re welcome to contribute an RFC with the proposed changes to the code base.
That’s one measure of compactness but not the only one. The definition of ours is below.
See the Technical Notes below for an explanation of creating an ellipse with the same second-moments as an object region.
Area: The actual number of pixels in the region.
Perimeter: The total number of pixels around the boundary of each region in the image.
FormFactor: Calculated as 4*π*Area/Perimeter2. Equals 1 for a perfectly circular object.
Solidity: The proportion of the pixels in the convex hull that are also in the object, i.e. ObjectArea/ConvexHullArea. Equals 1 for a solid object (i.e., one with no holes or has a concave boundary), or <1 for an object with holes or possessing a convex/irregular boundary.
Extent: The proportion of the pixels in the bounding box that are also in the region. Computed as the Area divided by the area of the bounding box.
EulerNumber: The number of objects in the region minus the number of holes in those objects, assuming 8-connectivity.
Center_X, Center_Y: The x- and y-coordinates of the point farthest away from any object edge. Note that this is not the same as the Location-X and -Y measurements produced by the Identify modules.
Eccentricity: The eccentricity of the ellipse that has the same second-moments as the region. The eccentricity is the ratio of the distance between the foci of the ellipse and its major axis length. The value is between 0 and 1. (0 and 1 are degenerate cases; an ellipse whose eccentricity is 0 is actually a circle, while an ellipse whose eccentricity is 1 is a line segment.)
MajorAxisLength: The length (in pixels) of the major axis of the ellipse that has the same normalized second central moments as the region.
MinorAxisLength: The length (in pixels) of the minor axis of the ellipse that has the same normalized second central moments as the region.
Orientation: The angle (in degrees ranging from -90 to 90 degrees) between the x-axis and the major axis of the ellipse that has the same second-moments as the region.
Compactness: The mean squared distance of the object's pixels from the centroid divided by the area. A filled circle will have a compactness of 1, with irregular objects or objects with holes having a value greater than 1.
MaximumRadius: The maximum distance of any pixel in the object to the closest pixel outside of the object. For skinny objects, this is 1/2 of the maximum width of the object.
MedianRadius: The median distance of any pixel in the object to the closest pixel outside of the object.
MeanRadius: The mean distance of any pixel in the object to the closest pixel outside of the object.
MinFeretDiameter, MaxFeretDiameter: The Feret diameter is the distance between two parallel lines tangent on either side of the object (imagine taking a caliper and measuring the object at various angles). The minimum and maximum Feret diameters are the smallest and largest possible diameters, rotating the calipers along all possible angles.
Zernike shape features: Measure shape by describing a binary object (or more precisely, a patch with background and an object in the center) in a basis of Zernike polynomials, using the coefficients as features (Boland et al., 1998). Currently, Zernike polynomials from order 0 to order 9 are calculated, giving in total 30 measurements. While there is no limit to the order which can be calculated (and indeed users could add more by adjusting the code), the higher order polynomials carry less information.
A number of the object measurements are generated by creating an ellipse with the same second-moments as the original object region. This is essentially the best-fitting ellipse for a given object with the same statistical properties. Furthermore, they are not affected by the translation or uniform scaling of a region.
The Zernike features are computed within the minimum enclosing circle of the object, i.e., the circle of the smallest diameter that contains all of the object's pixels.
Rocha L, Velho L, Carvalho PCP, "Image moments-based structuring and tracking of objects", Proceedings from XV Brazilian Symposium on Computer Graphics and Image Processing, 2002. (pdf)
Principles of Digital Image Processing: Core Algorithms (Undergraduate Topics in Computer Science): Section 2.4.3 - Statistical shape properties
Chrystal P (1885), "On the problem to construct the minimum circle enclosing n given points in a plane", Proceedings of the Edinburgh Mathematical Society, vol 3, p. 30