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('diamond',r)`

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

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

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

`SE = strel('rectangle',mn)`

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

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

`SE = strel('cuboid',xyz)`

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

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

`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. `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('line',`

creates a linear structuring element that is symmetric with respect to the
neighborhood center. `len`

,`deg`

)`deg`

specifies the angle (in
degrees) of the line as measured in a counterclockwise direction from the
horizontal axis. `len`

is approximately the distance
between the centers of the structuring element members at opposite ends of
the line.

`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, where `mn`

)`mn`

specifies the size.

`SE = strel('cube',`

creates a
cubic structuring element whose width is `w`

)`w`

pixels.
`w`

must be a nonnegative integer scalar.

`SE = strel('cuboid',`

creates
a cuboidal structuring element of size `xyz`

)`xyz`

.

`SE = strel('arbitrary',`

creates a structuring element, where `nhood`

)`nhood`

is a matrix
of 1s and 0s that specifies the neighborhood. You can omit
`'arbitrary'`

and specify
`strel(nhood)`

.

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.