ComponentMeasurements

ComponentMeasurements[m, "prop"]
computes the values of property prop for each component of a label matrix m that consists of identical elements.

ComponentMeasurements[image, "prop"]
uses the connectivity of nonzero pixels in image to compute the label matrix.

ComponentMeasurements[{m, image}, "prop"]
uses pixel values of image to compute property prop.

ComponentMeasurements[..., "prop", crit]
only returns measurements that satisfy a criterion crit.

Details and OptionsDetails and Options

  • ComponentMeasurements[m, "prop"] returns an expression of the form , where the are the values of computed for segment i.
  • ComponentMeasurements[m, {"prop1", "prop2", ...}] computes multiple properties.
  • ComponentMeasurements[m, "Properties"] gives the names of all available properties as a list of strings.
  • ComponentMeasurements by default treats all eight pixels surrounding a given pixel as adjacent.
  • The option setting CornerNeighbors->False treats only the four pixels in the coordinate directions as adjacent.
  • With a setting "BorderComponents"->False, ComponentMeasurements will ignore components that are connected to the border.
  • Position, area, and length measurements are taken in the standard image coordinate system where position corresponds to the bottom-left corner, runs from to width, and runs from to height.
  • The following properties can be computed for arbitrary label matrices:
  • 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:
  • "PerimeterCount"number of elements on the perimeter
    "PerimeterLength"total length of outer pixel sides
    "OuterPerimeterCount"number of elements adjacent to the component
    "PolygonalLength"total length of the polygon formed by the centers of the perimeter elements
    "MaxPerimeterDistance"largest distance of an inner element to the perimeter
    "AuthalicRadius"radius of a circle that has the same polygonal perimeter length
  • 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 box properties:
  • "BoundingBox"axes-oriented bounding box in the form
    "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"
  • 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
  • Pixel value measurements can be computed if the original image is specified in the form ComponentMeasurements[{labelmatrix, image}, ...].
  • For images of type or , ComponentMeasurements always normalizes values to lie between 0 and 1.
  • The following properties are available:
  • Basic pixel value measurements:
  • "Data"image data given as a flat list of channel vectors
    "IntensityData"list of image intensity values
  • 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
New in 8
New to Mathematica? Find your learning path »
Have a question? Ask support »