FUNCTION REFERENCE
bwareafilt
Keep binary objects by pixel count.
Keep binary objects by pixel count.
Syntax
BW2 = bwareafilt(BW, range, conn)Syntax
BW2 = bwareafilt(BW, n, keep, conn)BW must be logical. range is inclusive [low high]; n is a positive integer. keep is 'largest' (default) or 'smallest'. conn defaults to 8, or may be 4. Optional arguments may be omitted. Ties retain the first n objects, using column-major component discovery order.
Example
bwareafilt(logical([1 0 1 1; 0 0 1 1]),1)Differences from MATLAB: scalar 4/8 connectivity only.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.