Closing

Closing[image, ker]
gives the morphological closing of image with respect to the structuring element ker.

Closing[image, r]
gives the closing with respect to a range-r square.

Closing[data, ...]
applies closing to an array of data.

DetailsDetails

  • Closing works with binary, grayscale, and other images.
  • Closing works with 3D as well as 2D images, and also with data arrays of any rank.
  • The structuring element ker is a matrix containing s and s.
  • Closing automatically pads structuring elements to have odd dimensions.
  • Closing[image, r] is equivalent to Closing[image, BoxMatrix[r]].
  • If multiple image channels are present, Closing operates on each of them separately.

ExamplesExamplesopen allclose all

Basic Examples (5)Basic Examples (5)

Remove thin, dark features by morphological closing:

In[1]:=
Click for copyable input
In[2]:=
Click for copyable input

Use morphological closing to remove pepper noise from a color photo:

In[1]:=
Click for copyable input
Out[1]=

Closing removes holes that are smaller than the structuring elements:

In[1]:=
Click for copyable input
Out[1]=

Remove small holes in foreground objects:

In[1]:=
Click for copyable input
Out[1]=

Specify an explicit structuring element:

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