Find perimeter of objects in binary image
BW2 = bwperim(BW)
BW2 = bwperim(BW,conn)
a binary image that contains only the perimeter pixels of objects
in the input image
BW2 = bwperim(
BW. 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
conndef(ndims(BW), 'minimal') for
higher dimensions. If you do not specify a return value,
the result in a figure window.
BW— Input binary imagelogical or numeric matrix that must be 2-D, real, and nonsparse
Input binary image, specified as a logical or numeric matrix that must be 2-D, real, and nonsparse.
BW = imread('circles.png'); BW2 = bwperim(BW);
4for 2-D (default) |
26| 3-by-3-by-...-by-3 array of zeroes and ones
Connectivity, specified as one of the values in this table or
a 3-by-3-by-...-by-3 array of
1-valued elements define neighborhood locations
relative to the center element of
conn. Note that
be symmetric around its center element.
BW2 = bwperim(BW,8);
This function supports the generation of C code using MATLAB® Coder™.
Note that if you choose the generic
MATLAB Host Computer target
platform, the function generates code that uses a precompiled, platform-specific
shared library. Use of a shared library preserves performance optimizations
but limits the target platforms for which code can be generated. For
more information, see Understanding Code Generation with Image Processing Toolbox.
When generating code, note the following:
bwperim supports only 2-D images.
bwperim does not support a no-output-argument
The connectivity matrix input argument,
must be a constant
You can use this function in the MATLAB Function Block in Simulink.