Function Index
RegionLabel
RegionLabel[
img
]
labels the connected components of the binary image
img
.
RegionLabel[
img
,
neigh
]
labels the connected components of the binary image
img
using a custom connectivity definition via the list of offsets
neigh
.
The labeling operation sets all pixels belonging to the same connected component of the image to a specific integer value with each connected component receiving a unique integer label.
The default connectivity settings are
ConnectivityNumber
→8 for 2D arrays and
ConnectivityNumber
→26 for 3D arrays.
Custom connectivity settings may be defined using a list of offsets.
The argument
img
may be an array or
ImageData
expression.
See also User's Guide
6.5
.
New in Version 2.
Example
Here we load the package.
In[1]:=
Here is a 2D example binary-valued array.
In[2]:=
Out[3]//MatrixForm=
This finds the connected components using the default connectivity setting.
In[4]:=
Out[4]//MatrixForm=
The number of distinct regions may be different if the connectivity is changed.
In[5]:=
Out[5]//MatrixForm=
© 2009 Wolfram Research, Inc.
•
Terms of Use
•
Privacy Policy
Sign up for our newsletter: