ComponentMeasurements
ComponentMeasurements[{image,lmat},"prop"]
computes the property "prop" for components of image indicated by the label matrix lmat.
ComponentMeasurements[image,"prop"]
computes the property "prop" for connected components of image.
ComponentMeasurements[…,"prop",crit]
only returns measurements for components that satisfy the criterion crit.
ComponentMeasurements[…,"prop",crit,format]
formats the result according to the output specification format.
Details and Options
 ComponentMeasurements can be used to compute different properties for all or some of the components in an image.
 ComponentMeasurements works with 2D or 3D images and label matrices.
 A label matrix lmat is an array of nonnegative integers, in which each integer represents a component, and 0 represents the background.
 ComponentMeasurements[…,"prop"] returns an expression of the form {…,i>val_{i},…}, where val_{i} is the value of "prop" computed for component i of the image.
 ComponentMeasurements[…,{"prop_{1}","prop_{2}",…}] computes multiple properties for each component.
 When using a criterion crit, arguments of crit can access property values using #j referring to "prop_{j}" given in the list of properties. A component is selected if crit returns True.
 The criterion crit can also access other component properties using #propname.
 ComponentMeasurements[…,"Properties"] gives the names of supported properties for the given input as a list of strings. All properties are not supported for all inputs.
 Properties related to area measurements:

"Count" number of elements "Area" approximate area, where each pixel area is weighted by its neighborhood configuration "FilledCount" number of elements after filling holes "EquivalentDiskRadius" radius of a disk that has the same area "AreaRadiusCoverage" fraction of pixels within the equivalent disk radius  Perimeter properties:

"AuthalicRadius" radius of a circle with the same polygonal perimeter length "MaxPerimeterDistance" largest distance of an inner element to the perimeter "OuterPerimeterCount" number of elements adjacent to the component "PerimeterCount" number of elements on the perimeter "PerimeterLength" total length of outer pixel sides "PerimeterPositions" sorted positions of the perimeter elements "PolygonalLength" total length of the polygon formed by the centers of the perimeter elements  Position, area, and length measurements are taken in the standard image coordinate system.
 Centroid properties:

"Centroid" center of mass coordinates "Medoid" coordinate of the closest element to the centroid "MeanCentroidDistance" mean distance of all elements from the centroid "MaxCentroidDistance" maximum distance of all elements from the centroid "MinCentroidDistance" minimum distance of all elements from the centroid  Parameters of the oriented bestfit ellipse:

"Length" largest axis of the bestfit ellipse "Width" smallest axis of the bestfit ellipse "SemiAxes" lengths of the semiaxes of the bestfit ellipse "Orientation" angle between the largest axis and the horizontal axis "Elongation" elongation, computed as "Eccentricity" eccentricity of the bestfit ellipse  Shape measurements:

"Circularity" , with polygonal length and equivalent disk radius "FilledCircularity" circularity after filling holes "Rectangularity" fraction of pixels within the minimal bounding box  Bounding contour properties:

"Contours" lines describing the component boundary "ContourHierarchy" topological nesting of the contours  Bounding box properties:

"BoundingBox" axesoriented bounding box in the form {{x_{min},y_{min}},{x_{max},y_{max}}} "BoundingBoxArea" area enclosed by the bounding box "MinimalBoundingBox" smallest possible oriented bounding box defined by the four corner vertices  Bounding disk properties:

"BoundingDiskCenter" bounding disk center coordinates "BoundingDiskRadius" bounding disk radius "BoundingDiskCoverage" coverage of bounding disk area by the component area  Convex hull properties:

"ConvexCount" number of elements included in the convex hull "ConvexVertices" corner elements of the convex hull "ConvexArea" area of the convex hull polygon "ConvexPerimeterLength" length of the convex hull polygon "ConvexCoverage" fraction of elements occupied in the convex hull "CaliperLength" largest diameter of the convex hull (Feret diameter) "CaliperWidth" smallest diameter of the convex hull "MeanCaliperDiameter" mean of all possible caliper diameters "CaliperElongation" 1 – (caliper width/caliper height)  Neighborhood properties:

"Neighbors" direct neighbors, given as a set of labels "NeighborCount" number of direct neighbors "ExteriorNeighbors" labels of exterior neighbors "ExteriorNeighborCount" number of exterior neighbors "InteriorNeighbors" labels of interior neighbors "InteriorNeighborCount" number of interior neighbors "AdjacentBorders" list of adjacent image borders "AdjacentBorderCount" number of adjacent image borders  Basic topological properties:

"Fragmentation" number of connected components minus one "Holes" number of holes in each component "Complexity" total number of components and holes minus one "EulerNumber" number of components minus the number of holes  Relational topological properties:

"EmbeddedComponents" embedded components, given as a list of labels "EmbeddedComponentCount" number of embedded components "EnclosingComponents" enclosing components, given as a list of labels "EnclosingComponentCount" number of enclosing components (nesting level)  General properties:

"Label" label of the component "Mask" binary mask given as an array "Shape" shape of the component given as a binary image  Pixel value measurements can be computed only if input is of the form image or {m,image}.
 If both image and m are present, they should be commensurate.
 The following pixel value measurements are available.
 Basic pixel value measurements:

"Data" image data given as a flat list of channel vectors "IntensityData" list of image intensity values  Subimage extractions:

"Image" content of the image for each component bounding box "MaskedImage" subimage masked by the component shape  Basic histogram properties, measured for each channel individually, in each component:

"Min" minimum value "Max" maximum value "Mean" average value "Median" median value "StandardDeviation" standard deviation "Total" total of all values  Basic image intensity properties:

"MinIntensity" minimum intensity "MaxIntensity" maximum intensity "MeanIntensity" average intensity "MedianIntensity" median intensity "StandardDeviationIntensity" standard deviation of the intensity distribution "TotalIntensity" total intensity  Spatial intensity measurements:

"Skew" asymmetry in intensity distribution "IntensityCentroid" coordinates of the intensityweighted centroid  Statistical measurements:

"Entropy" data entropy (base E) "Energy" data energy  Componentindependent global properties:

"LabelCount" total number of labels "Dimensions" dimensions of the entire input  The following format specifications can be used:

"ComponentList" a list of i>{…,val_{j},…} (default) "ComponentAssociation" an association of i>{…,val_{j},…} "PropertyAssociation" an association of prop_{j}>{…,val_{i},…} "ComponentPropertyAssociation" an association of i><…,prop_{j}>val_{j},… > "PropertyComponentAssociation" an association of prop_{j}><…,i>val_{i},… > "Dataset" a Dataset of component property association  ComponentMeasurements takes a CornerNeighbors option. The default setting is CornerNeighbors>True.
 For images of type "Byte" or "Bit16", data values are normalized to lie between 0 and 1 when computing pixel value properties.
Examples
open allclose allBasic Examples (3)
Scope (25)
Data (8)
Measurements of a 2D integer label matrix:
Measurements of a 2D image component based on connectivity of its nonzero pixels:
Pixel value measurements of a 2D image:
Pixel value measurements of a 2D color image:
Pixel value measurement of a 2D color image and its corresponding label matrix:
Measurements of a 3D integer label matrix:
Properties (7)
Criteria (5)
Output Format (5)
Format the output as an association of components and componentproperty values:
Format the output as an association of properties and componentproperty values:
Format the output as a nested association of components and componentproperty values:
Format the output as a nested association of properties and componentproperty values:
Format the output as a dataset of components and componentproperty values:
Options (2)
Applications (5)
Compute the mean color value for each component:
Select complete and nonoverlapping cells:
Binarize the image to get the foreground:
Compute centroids and equivalent disk radius of imageenclosed large components:
Highlight selected components:
Replace each pixel with a property of a component to which it belongs:
Compute an image segmentation:
Replace each segment with its mean color:
Properties & Relations (8)
Compute measurements for large components only:
Use DeleteSmallComponents to delete small components first:
Notice that labels are normalized:
Compute measurements for components not touching the image borders:
Use DeleteBorderComponents to delete border components first:
Compute for components with one hole, not touching the image borders:
Use SelectComponents to delete components that either do not have holes or touch borders:
Extract the complete list of properties supported for 2D images:
Extract the complete list of properties supported for 3D images:
List of 2D shape properties, when no image is specified: