Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Trace region boundaries in binary image

`B = bwboundaries(BW)`

`B = bwboundaries(BW,conn)`

`B = bwboundaries(BW,conn,options)`

`[B,L]= bwboundaries(___)`

```
[B,L,n,A]
= bwboundaries(___)
```

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
descends into the outermost objects (parents) and traces their children
(objects completely enclosed by the parents). Returns `B`

,
a cell array of boundary pixel locations.

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*, by Gonzalez, R. C., R. E. Woods, and S.
L. Eddins, New Jersey, Pearson Prentice Hall, 2004.

[1] Gonzalez, R. C., R. E. Woods, and S. L. Eddins, *Digital
Image Processing Using MATLAB*, New Jersey, Pearson Prentice
Hall, 2004.