Function File: imclearborder (im)
Function File: imclearborder (im, conn)

Clear borders of objects or ligher structures.

On the simplest case of binary images, this function removes objects that touch the image borders. In the case of grayscale images, lighter regions (higher intensity values) that touch the image border get removed.

To be more exact, this is equivalent to use imreconstruct using the im borders as marker, and setting all unchanged elements to a background value.

Element connectivity conn, to define the size of objects, can be specified with a numeric scalar (number of elements in the neighborhood):

4 or 8

for 2 dimensional matrices;

6, 18 or 26

for 3 dimensional matrices;

or with a binary matrix representing a connectivity array. Defaults to conndef (ndims (bw), "maximal") which is equivalent to conn of 8 and 26 for 2 and 3 dimensional matrices respectively.

See also: imreconstruct.

Package: image