DeleteBorderComponents

DeleteBorderComponents[image]
replaces connected components adjacent to the border in a binary image image with background pixels.

DeleteBorderComponents[m]
replaces components adjacent to the border in a label matrix m with .

Details and OptionsDetails and Options

  • DeleteBorderComponents by default treats all pixels surrounding a given pixel as adjacent. A given pixel has eight adjacent pixels in 2D and 26 adjacent pixels in 3D.
  • The option setting CornerNeighbors->False treats only the pixels in the coordinate directions as adjacent, which would include four pixels in 2D and six pixels in 3D.

ExamplesExamplesopen allclose all

Basic Examples (1)Basic Examples (1)

Deleting components connected to the image border in a binary image:

In[1]:=
Click for copyable input
Out[1]=
New in 8 | Last modified in 9
New to Mathematica? Find your learning path »
Have a question? Ask support »