computes the property "prop" for components of image indicated by the label matrix lmat.


computes the property "prop" for connected components of image.


only returns measurements for components that satisfy the criterion crit.


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 non-negative integers, in which each integer represents a component, and 0 represents the background.
  • ComponentMeasurements[,"prop"] returns an expression of the form {,i->vali,}, where vali is the value of "prop" computed for component i of the image.
  • ComponentMeasurements[,{"prop1","prop2",}] computes multiple properties for each component.
  • When using a criterion crit, arguments of crit can access property values using #j referring to "propj" 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 best-fit ellipse:
  • "Length"largest axis of the best-fit ellipse
    "Width"smallest axis of the best-fit ellipse
    "SemiAxes"lengths of the semiaxes of the best-fit ellipse
    "Orientation"angle between the largest axis and the horizontal axis
    "Elongation"elongation, computed as
    "Eccentricity"eccentricity of the best-fit ellipse
  • Shape measurements:
  • "Circularity"ratio of equivalent disk perimeter to the perimeter length
    "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"axes-oriented bounding box in the form {{xmin,ymin},{xmax,ymax}}
    "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 intensity-weighted centroid
  • Statistical measurements:
  • "Entropy"data entropy (base E)
    "Energy"data energy
  • Component-independent 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->{,valj,} (default)
    "ComponentAssociation"an association of i->{,valj,}
    "PropertyAssociation"an association of propj->{,vali,}
    "ComponentPropertyAssociation"an association of i-><|,propj->valj,|>
    "PropertyComponentAssociation"an association of propj-><|,i->vali,|>
    "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.


open all close all

Basic Examples  (3)

Measure a property for connected components in an image:

Click for copyable input

Measure a property only for larger components:

Click for copyable input

Measure properties in 3D:

Click for copyable input

Scope  (25)

Options  (2)

Applications  (5)

Properties & Relations  (8)

Possible Issues  (2)

Introduced in 2010
Updated in 2017