B = bwboundaries(BW)
B = bwboundaries(BW, conn)
[B, L, n] = bwboundaries(BW, conn, option)
| Parameter | Description |
|---|---|
| BW | Input binary image. Nonzero values are treated as true. |
| conn | Connectivity, either 4 or 8. |
| option | Boundary option: 'holes' or 'noholes'. |
| Parameter | Description |
|---|---|
| B | Cell array of boundary coordinate matrices. |
| L | Label matrix for foreground components. |
| n | Number of foreground components. |
Find perimeter coordinates of connected binary regions. Supported connectivities are 4 and 8. The option 'holes' appends boundaries of filled holes.
BW=false(64,64); BW(10:28,10:30)=true; BW(36:54,38:56)=true;
B=bwboundaries(BW);
figure; imagesc(BW); hold on;
for k=1:length(B), plot(B{k}(:,2), B{k}(:,1), 'r.'); end
title('Boundaries');
| Version | Description |
|---|---|
| 2.0.0 | initial version |