Image Processing Toolbox User's Guide |
Suppress light structures connected to image border
Syntax
Description
IM2 = imclearborder(IM)
suppresses structures that are lighter than their surroundings and that are connected to the image border. IM
can be an intensity or binary image. The output image, IM2,
is intensity or binary, respectively. The default connectivity is 8 for two dimensions, 26 for three dimensions, and conndef(ndims(BW),'maximal')
for higher dimensions.
Note For intensity images, imclearborder tends to reduce the overall intensity level in addition to suppressing border structures. |
IM2 = imclearborder(IM,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
IM
can be a numeric or logical array of any dimension, and it must be nonsparse and real. IM2
has the same class as IM
.
Example
The following examples use this simple binary image to illustrate the effect of imclearborder
when you specify different connectivities.
BW = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 1 1 0 0 0 0 1 0 1 1 1 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Using a 4-connected neighborhood, the pixel at (5,2)
is not considered connected to the border pixel (4,1)
, so it is not cleared.
BWc1 = imclearborder(BW,4) BWc1 = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 1 0 1 1 1 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Using an 8-connected neighborhood, pixel (5,2)
is considered connected to pixel (4,1)
so both are cleared.
BWc2 = imclearborder(BW,8) BWc2 = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Algorithm
imclearborder
uses morphological reconstruction where
See Also
Reference
[1] Soille, P., Morphological Image Analysis: Principles and Applications, Springer, 1999, pp. 164-165.
imbothat | imclose |
© 1994-2005 The MathWorks, Inc.