Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Morphological structuring element

A `strel`

object represents a flat morphological
*structuring element*, which is an essential part of
morphological dilation and erosion operations.

A flat structuring element is a binary valued neighborhood, either 2-D or
multidimensional, in which the `true`

pixels are included in the
morphological computation, and the `false`

pixels are not. The center
pixel of the structuring element, called the *origin*, identifies the
pixel in the image being processed. Use the `strel`

function (described
below) to create a flat structuring element. You can use flat structuring elements with
both binary and grayscale images. The following figure illustrates a flat structuring
element.

To create a nonflat structuring element, use `offsetstrel`

.

`SE = strel(nhood)`

`SE = strel('arbitrary',nhood)`

`SE = strel('diamond',r)`

`SE = strel('disk',r,n)`

`SE = strel('octagon',r)`

`SE = strel('line',len,deg)`

`SE = strel('rectangle',[m n])`

`SE = strel('square',w)`

`SE = strel('cube',w)`

`SE = strel('cuboid',[m n p])`

`SE = strel('sphere',r)`

`SE = strel('diamond',`

creates
a diamond-shaped structuring element, where `r`

)`r`

specifies
the distance from the structuring element origin to the points of the
diamond.

`SE = strel('disk',`

creates a disk-shaped structuring element, where `r`

,`n`

)`r`

specifies the radius and `n`

specifies the number of line
structuring elements used to approximate the disk shape. Morphological
operations using disk approximations run much faster when the structuring
element uses approximations.

`SE = strel('octagon',`

creates
a octagonal structuring element, where `r`

)`r`

specifies the
distance from the structuring element origin to the sides of the octagon, as
measured along the horizontal and vertical axes. `r`

must
be a nonnegative multiple of 3.

`SE = strel('rectangle',`

creates a rectangular structuring element of size `[m n]`

)```
[m
n]
```

.

`SE = strel('cube',`

creates a
3-D cubic structuring element whose width is `w`

)`w`

pixels.

`SE = strel('cuboid',`

creates a 3-D cuboidal structuring element of size `[m n p]`

)```
[m n
p]
```

.

The following syntaxes still work, but `offsetstrel`

is the preferred way
to create these nonflat structuring element shapes:

`SE = strel('arbitrary',nhood,h)`

`SE = strel('ball',r,h,n)`

The following syntaxes still work, but are not recommended for use:

`SE = strel('pair',offset)`

`SE = strel('periodicline',p,v)`

Structuring elements that do not use approximations (

`n`

= 0) are not suitable for computing granulometries.

For all shapes except `'arbitrary'`

, structuring elements are
constructed using a family of techniques known collectively as *structuring
element decomposition*. The principle is that dilation by some large
structuring elements can be computed faster by dilation with a sequence of smaller
structuring elements. For example, dilation by an 11-by-11 square structuring element
can be accomplished by dilating first with a 1-by-11 structuring element and then with
an 11-by-1 structuring element. This results in a theoretical performance improvement of
a factor of 5.5, although in practice the actual performance improvement is somewhat
less. Structuring element decompositions used for the `'disk'`

shape is
an approximations—all other decompositions are exact.

[1] van den Boomgard, R, and R. van Balen, "Methods for Fast Morphological Image
Transforms Using Bitmapped Images," *Computer Vision, Graphics, and Image
Processing: Graphical Models and Image Processing*, Vol. 54, Number 3,
pp. 252–254, May 1992.

[2] Adams, R., "Radial Decomposition of Discs and Spheres," *Computer
Vision, Graphics, and Image Processing: Graphical Models and Image
Processing*, Vol. 55, Number 5, pp. 325–332, September 1993.

[3] Jones, R., and P. Soille, "Periodic lines: Definition, cascades, and
application to granulometrie," *Pattern Recognition Letters*, Vol.
17, pp. 1057–1063, 1996.