| Image Processing Toolbox | ![]() |
Determine the perimeter of the objects in a binary image
Syntax
BW2 = bwperim(BW1,n)
Description
BW2 = bwperim(BW1,n) returns a binary image containing only the perimeter pixels of objects in the input image BW1. A pixel is part of the perimeter if its value is 1 and there is at least one zero-valued pixel in its neighborhood. n can have a value of either 4 or 8, where 4 specifies 4-connected neighborhoods and 8 specifies 8-connected neighborhoods; if the argument is omitted, it defaults to 4.
Class Support
The input image BW1 can be of class double or uint8. The output image BW2 is of class uint8.
Example
BW1 = imread('circbw.tif');
BW2 = bwperim(BW1,8);
imshow(BW1)
figure, imshow(BW2)
See Also
| bwmorph | bwselect | ![]() |