FUNCTION REFERENCE
regionprops
Measure properties of image regions.
Measure properties of image regions.
Syntax
stats = regionprops(BW, properties...)Syntax
stats = regionprops(L, properties...)Syntax
stats = regionprops(CC, properties...)Syntax
stats = regionprops(L, I, properties...)Returns an n-by-1 struct array with one element per region and one field per property, in the order requested. Regions are the 8-connected objects of a logical image BW, the pixels of each value k = 1..max(L(:)) of a label matrix L (empty labels give zero-area regions), or the objects of a bwconncomp struct CC. Properties are names (any case) or a cell array of names; the default and 'basic' are Area, Centroid and BoundingBox; 'all' lists every supported property. Coordinates: x is the column, y the row, pixel centres at integers. Area: number of pixels. Centroid: [x y] mean. BoundingBox: [ulx uly width height] with half-pixel corners. PixelIdxList: linear indices (column, ascending). PixelList: [x y] of each pixel in that order. Extent: Area over the bounding-box area. EquivDiameter: sqrt(4*Area/pi). FilledArea: pixels after filling the holes of the region. MajorAxisLength, MinorAxisLength, Eccentricity and Orientation describe the ellipse with the same normalised second central moments as the region: uxx = mean((x-mx)^2) + 1/12, uyy = mean((y-my)^2) + 1/12 (with y pointing up), uxy = mean((x-mx)(y-my)); the axes are 2*sqrt(2)*sqrt(uxx + uyy +- sqrt((uxx-uyy)^2 + 4*uxy^2)) and Orientation (degrees, -90 to 90, counterclockwise from the x axis) the direction of the major axis. Perimeter: the distance between each adjoining pair of pixels around the outer border (1 for edge neighbours, sqrt(2) for diagonal ones) on the 8-connected boundary traced from the region's first pixel; a single pixel has perimeter 0. With an intensity image I of the same size: MeanIntensity (double), MaxIntensity and MinIntensity (class of I; NaN only when the whole region is NaN) and WeightedCentroid ([x y] weighted by I).
Example
s = regionprops(logical([1 1 0 0; 1 1 0 1])); [s.Area] % [4 1]Example
s = regionprops([1 1 0; 0 0 2], 'Centroid', 'BoundingBox'); s(2).BoundingBox % [2.5 1.5 1 1]Example
s = regionprops(true(2, 4), 'MajorAxisLength', 'Orientation', 'Perimeter') % Perimeter 8Differences from MATLAB: no table output ('table'), and 'ConvexHull', 'ConvexImage', 'ConvexArea', 'Solidity', 'Circularity', 'EulerNumber', 'Extrema', 'Image', 'FilledImage', 'SubarrayIdx', 'PixelValues' and the Feret properties are not supported yet; bwboundaries is not available. The perimeter is the plain boundary chain length the documentation describes; GNU Octave uses a corner-corrected estimate (Vossepoel and Smeulders) and scikit-image a weighted pixel count, so both give other values.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.