Image Processing Toolbox User's Guide |
Find perimeter pixels in binary image
Syntax
Description
BW2 = bwperim(BW1)
returns a binary image containing only the perimeter pixels of objects in the input image BW1
. A pixel is part of the perimeter if it is nonzero and it is connected to at least one zero-valued pixel. The default connectivity is 4 for two dimensions, 6 for three dimensions, and conndef(ndims(BW), 'minimal')
for higher dimensions.
BW2 = bwperim(BW1,CONN)
specifies the desired connectivity. CONN
can have any of the following scalar values.
Connectivity can also be defined in a more general way for any dimension by using for CONN
a 3-by-3-by-...-by-3 matrix of 0
's and 1
's. The 1
-valued elements define neighborhood locations relative to the center element of CONN
. Note that CONN
must be symmetric about its center element.
Class Support
BW1
must be logical or numeric, and it must be nonsparse. BW2
is of class logical
.
Example
See Also
bwarea
, bweuler
, conndef
, imfill
bwpack | bwselect |
© 1994-2005 The MathWorks, Inc.