bwboundaries
Trace object boundaries in binary image
Syntax
Description
traces the
exterior boundaries of objects, as well as boundaries of
holes inside these objects, in the binary image
B = bwboundaries(BW)BW.
bwboundaries also traces the
exterior and hole boundaries of children objects completely
enclosed by parent objects. The function returns
B, a cell array of boundary
pixel locations.
The figure illustrates these components.

specifies the trace style and the order of returned vertex
coordinates using name-value
arguments (since R2023a).B = bwboundaries(___,Name=Value)
Examples
Input Arguments
Name-Value Arguments
Output Arguments
Algorithms
The bwboundaries function implements the Moore-Neighbor tracing algorithm
modified by Jacob's stopping criteria. This function is based on the
boundaries function presented in the
first edition of Digital Image Processing Using
MATLAB
[1].
References
[1] Gonzalez, R. C., R. E. Woods, and S. L. Eddins, Digital Image Processing Using MATLAB, New Jersey, Pearson Prentice Hall, 2004.






