FUNCTION REFERENCE

bwareaopen

Remove small objects from a binary image.

Remove small objects from a binary image.

Syntax

BW2 = bwareaopen(BW, P)

Syntax

BW2 = bwareaopen(BW, P, conn)

Removes the connected components (conn 8 by default, or 4) with fewer than P pixels. BW is 2-D (nonzero = foreground); BW2 is logical.

Example

bwareaopen(logical([1 0 1 1; 0 0 1 1]), 2)   % [0 0 1 1; 0 0 1 1]

Differences from MATLAB: 2-D only.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.