Function File: bwareafilt (bw, range)
Function File: bwareafilt (bw, n)
Function File: bwareafilt (bw, n, keep)
Function File: bwareafilt (…, conn)

Filter objects from image based on their sizes.

Returns a logical matrix with the objects of bw filtered based on their area (defined by thei number of pixels). This function is equivalent to bwpropfilt (bw, "Area", …).

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, bwlabel, bwlabeln, bwconncomp, bwpropfilt, regionprops.

Package: image