Function File: bwpropfilt (bw, attrib)
Function File: bwpropfilt (bw, I, attrib)
Function File: bwpropfilt (…, range)
Function File: bwpropfilt (…, n)
Function File: bwpropfilt (…, n, keep)
Function File: bwpropfilt (…, …, conn)

Filter objects from image based on their properties.

Returns a logical matrix with the objects of bw filtered based on the specific property attrib. The possible values for attrib are all the properties from regionprops that return a scalar value, e.g., Area, Extent, and MaxIntensity, but not PixelValues, basic, and BoundingBox. For certain attributes, such as MaxIntensity and WeightedCentroid, the grayscale image I must also be specified.

To filter objects with a value on a specific interval, range must be a two-element vector with the interval [low high] (values are inclusive).

Alternatively, a scalar n will select the objects with the N highest values. The keep option defaults to "largest" but can also be set to "smallest" to select the N objects with lower values.

The last optional argument, conn, can be a connectivity matrix, or the number of elements connected to the center (see conndef).

See also: bwareaopen, bwareafilt, bwlabel, bwlabeln, bwconncomp, regionprops.

Package: image