B = bwtraceboundary(BW, p)
B = bwtraceboundary(BW, p, fstep, conn)
B = bwtraceboundary(BW, p, fstep, conn, m)
| Parameter | Description |
|---|---|
| BW | Input binary image. Nonzero values are treated as true. |
| p | Boundary start point [row column]. |
| fstep | First search direction. |
| conn | Connectivity, either 4 or 8. |
| m | Maximum number of boundary points to return. |
| Parameter | Description |
|---|---|
| B | Boundary coordinates as an N-by-2 [row column] matrix. |
Trace boundary pixels of the binary object containing the start point p = [row column]. Supported connectivities are 4 and 8. The first search direction can be N, NE, E, SE, S, SW, W, or NW for 8-connectivity, and N, E, S, or W for 4-connectivity.
BW=false(64,64); BW(16:48,16:48)=true;
B=bwtraceboundary(BW, [16 16], 'E', 8);
figure; imagesc(BW); hold on; plot(B(:,2), B(:,1), 'r.'); title('Traced boundary');
| Version | Description |
|---|---|
| 2.0.0 | initial version |