({{, (RefLink[ImageMeasurements, paclet:ref/ImageMeasurements])[image,"prop"] 
returns the value of property "prop" for the entire image.}, {, (RefLink[ImageMeasurements, paclet:ref/ImageMeasurements])[image,"prop",format] 
returns the values in the specified output format.}, {, (RefLink[ImageMeasurements, paclet:ref/ImageMeasurements])[{(Subscript[image, 1]), (Subscript[image, 2]), …},…] 
returns measurements for all (Subscript[image, i]).}})

OpenersNotesSection(Spacer1)Details and Options

(RefLink[ImageMeasurements, paclet:ref/ImageMeasurements]) works with arbitrary 2D and 3D images.

(RefLink[ImageMeasurements, paclet:ref/ImageMeasurements])[image,{"(Subscript[prop, 1])","(Subscript[prop, 2])",…}] computes multiple properties.

(RefLink[ImageMeasurements, paclet:ref/ImageMeasurements])[image,"Properties"] gives names of all available properties as a list of strings.

Position, area, and length measurements are computed in the standard image coordinate system.

For images of type "Byte" and "Bit16", (RefLink[ImageMeasurements, paclet:ref/ImageMeasurements]) always normalizes values to lie between 0 and 1.

The following properties can be computed on images:

Global image properties:

Basic histogram properties, measured for each channel individually:

Basic image intensity properties:

Contour properties:

Spatial intensity measurements:

Statistical measurements:

The following format specifications can be used:

(RefLink[ImageMeasurements, paclet:ref/ImageMeasurements]) takes a (RefLink[Masking, paclet:ref/Masking]) option. The default setting is (RefLink[Masking, paclet:ref/Masking])->(RefLink[All, paclet:ref/All]). The (RefLink[Masking, paclet:ref/Masking]) option is ignored when returning global image properties.

OpenersPrimaryExamplesSection(Spacer1)Examples  (17)

OpenersExampleSection0(Spacer1)Basic Examples  (2)

Extract mean color value:

image=;

ImageMeasurements[image,"Mean"]

Mean pixel intensity:

ImageMeasurements[image,"MeanIntensity"]

Global image entropy:

ImageMeasurements[image,"Entropy"]//N

Standard deviation of pixel intensity in a 3D image:

ImageMeasurements[, "StandardDeviation"]

OpenersExampleSection1(Spacer1)Scope  (8)

OpenersExampleSubsection0(Spacer1)Basic Uses  (5)

Test an image to see if it has an alpha channel:

ImageMeasurements[,"Transparency"]

Compute multiple properties of an image:

ImageMeasurements[,{"DataType","DataRange"}]

Compute a property of multiple images:

ImageMeasurements[{,},"DataType"]

Compute multiple properties of multiple images:

ImageMeasurements[{,},{"DataType","DataRange"}]

Extract pixel value ranges for each channel:

Transpose@ImageMeasurements[,{"Min","Max"}]

OpenersExampleSubsection1(Spacer1)Output Format  (3)

Format the properties as an (RefLink[Association, paclet:ref/Association]):

ImageMeasurements[,{"Min","Max","Mean"},"Association"]

Return a list of rules:

ImageMeasurements[,{"Min","Max","Mean"},"RuleList"]

Return a (RefLink[Dataset, paclet:ref/Dataset]):

ImageMeasurements[,{"Min","Max","Mean"},"Dataset"]

OpenersExampleSection2(Spacer1)Options  (2)

OpenersExampleSubsection2(Spacer1)Masking  (1)

Compute the mean pixel value for a specified region of interest:

ImageMeasurements[,"Mean",Masking->]

OpenersExampleSubsection3(Spacer1)ConrnerNeighbors  (1)

By default, (RefLink[ImageMeasurements, paclet:ref/ImageMeasurements]) assumes 8-connectivity:

i=;

c8=ImageMeasurements[i,"PerimeterPositions"];

HighlightImage[i,{RandomColor[],#}&/@c8,ImageSize->Small]

Use (RefLink[CornerNeighbors, paclet:ref/CornerNeighbors])->(RefLink[False, paclet:ref/False]) to assume 4-connectivity:

c4=ImageMeasurements[i,"PerimeterPositions",CornerNeighbors->False];

HighlightImage[i,{RandomColor[],#}&/@c4,ImageSize->Small]

OpenersExampleSection3(Spacer1)Applications  (5)

Multiply the gradient magnitude of an image by its maximum value, so that the pixels with the largest values are white:

mag=GradientFilter[,1]

max=ImageMeasurements[mag,"Max"];
ImageMultiply[mag,1/max]

Detect whether an image has constant pixel values:

constantQ[img_]:=And@@(SameQ@@@Transpose[ImageMeasurements[img,{"Min","Max"}]]);
constantQ/@{,,}

Ordinal measurement descriptor of an image:

ordinalMeasurementDescriptor[img_,n_]:=Ordering@Map[ImageMeasurements[#,"MeanIntensity"]&,Flatten@ImagePartition[img,{Scaled[1/n]}][[;;n,;;n]]];

ordinalMeasurementDescriptor[,8]

Compute the centroid distance function for the shapes present in an image:

i=;

Extract the list of shapes from the image:

shapes=Values@ComponentMeasurements[i,"Shape"]

Define a function that parametrizes the distance from the contour centroid:

centroidDistanceFunc[i_Image]:=
Module[{cont,centroid,d},
cont=First@ImageMeasurements[i,"PerimeterPositions"];
centroid=N@Mean[cont];
d=N@EuclideanDistance[#,centroid]&/@cont;
Interpolation[Transpose[{Subdivide[Length[cont]-1],d}]]
]

Plot the centroid distance function for some of the shapes:

sample=RandomSample[shapes,3];
labels=Image[ColorNegate[sample],ImageSize->15];
ListLinePlot[centroidDistanceFunc/@sample,
PlotLabels->labels,ImageSize->Medium
]

Define a feature vector sampling the centroid distance:

features=centroidDistanceFunc[#][Range[0,1,1/50]]&/@shapes;

Use the feature vectors to cluster the shapes:

FindClusters[features->shapes,Method->"GaussianMixture"]

Compute the Fourier descriptors of a shape:

i=;

Extract the contour coordinates and compute the Fourier transform of their complex representation:

c=ImageMeasurements[i,"Contours"][[1,1]];

contourFourierDescriptors[contour_,n_]:=
Module[{z},
z=Fourier[Complex@@@contour];
z[[Ceiling[n/2];;-Ceiling[n/2]]]=0;
z
]

contourFourierDescriptors[c,10]//Short

The original shape can be reconstructed using only a portion of the descriptors:

reconstructContour[descriptors_]:=ReIm[InverseFourier[descriptors]]

Graphics[Line[reconstructContour[contourFourierDescriptors[c,100]]]]

Control the contour smoothness by interactively setting the number of descriptors:

Manipulate[HighlightImage[i,Line@reconstructContour[contourFourierDescriptors[c,n]]],
{{n,50},5,500,5},
SaveDefinitions->True
]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[Image, paclet:ref/Image])  ▪  (RefLink[Image3D, paclet:ref/Image3D])  ▪  (RefLink[ImageData, paclet:ref/ImageData])  ▪  (RefLink[ComponentMeasurements, paclet:ref/ComponentMeasurements])  ▪  (RefLink[ImageHistogram, paclet:ref/ImageHistogram])  ▪  (RefLink[Image3DProjection, paclet:ref/Image3DProjection])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Image Processing & Analysis, paclet:guide/ImageProcessing])}, {▪(RefLinkPlain[Image Representation, paclet:guide/ImageRepresentation])}, {▪(RefLinkPlain[Image Computation for Microscopy, paclet:guide/ImageComputationForMicroscopy])}})}})