Image Processing Toolbox User's Guide Previous page   Next Page
imclearborder

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.

IM2 = imclearborder(IM,CONN) specifies the desired connectivity. CONN can have any of the following scalar values.

Value
Meaning
Two-dimensional connectivities
4
4-connected neighborhood
8
8-connected neighborhood
Three-dimensional connectivities
6
6-connected neighborhood
18
18-connected neighborhood
26
26-connected neighborhood

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.

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.

Using an 8-connected neighborhood, pixel (5,2) is considered connected to pixel (4,1) so both are cleared.

Algorithm

imclearborder uses morphological reconstruction where

See Also

conndef

Reference

[1]  Soille, P., Morphological Image Analysis: Principles and Applications, Springer, 1999, pp. 164-165.


Previous page  imbothat imclose Next page

© 1994-2005 The MathWorks, Inc.