Opening[image, ker]
gives the morphological opening of image with respect to the structuring element ker.

Opening[image, r]
gives the opening with respect to a range-r square.

Opening[data, ...]
applies opening to an array of data.


  • Opening works with binary, grayscale, and other images.
  • Opening 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.
  • Opening automatically pads structuring elements to have odd dimensions.
  • Opening[image, r] is equivalent to Opening[image, BoxMatrix[r]].
  • If multiple image channels are present, Opening operates on each of them separately.

ExamplesExamplesopen allclose all

Basic Examples (2)Basic Examples (2)

Use morphological opening to extract objects larger than the structuring element:

Click for copyable input

Opening of a color photo with a diamond-shaped structuring element:

Click for copyable input
New in 7 | Last modified in 9
New to Mathematica? Find your learning path »
Have a question? Ask support »