Main Content

offsetstrel

Morphological offset structuring element

Description

An offsetstrel object represents a nonflat morphological structuring element, which is an essential part of morphological dilation and erosion operations.

A nonflat structuring element is a matrix that identifies the pixel in the image being processed and defines the neighborhood used in the processing of that pixel. A nonflat structuring element contains finite values used as additive offsets in the morphological computation. The center pixel of the matrix, called the origin, identifies the pixel in the image that is being processed. Pixels in the neighborhood with the value -Inf are not used in the computation.

You can only use offsetstrel objects for morphological operations on grayscale images.

To create a flat structuring element, use strel.

Creation

Description

SE = offsetstrel(offset) creates a nonflat structuring element with the additive offset specified in the matrix offset.

example

SE = offsetstrel('ball',r,h) creates a nonflat, ball-shaped structuring element whose radius in the x-y plane is r and whose maximum offset height is h. For improved performance, offsetstrel approximates this shape by a sequence of eight nonflat line-shaped structuring elements.

SE = offsetstrel('ball',r,h,n) creates a nonflat ball-shaped structuring element, where n specifies the number of nonflat, line-shaped structuring elements that offsetstrel uses to approximate the shape. Morphological operations using ball approximations run much faster when you specify a value for n greater than 0.

Input Arguments

expand all

Values to be added to each pixel location in the neighborhood when performing the morphological operation, specified as a numeric matrix. Values that are -Inf are not considered in the computation.

Data Types: double

Radius of the ball-shaped structuring element in the x-y plane, specified as a positive integer.

Data Types: double

Maximum offset height, specified as a real scalar.

Data Types: double

Number of nonflat line-shaped structuring elements used to approximate the shape, specified as a positive even number or 0.

Value of nBehavior
n > 0offsetstrel uses a sequence of n nonflat, line-shaped structuring elements to approximate the shape. n must be an even number.
n = 0offsetstrel does not use any approximation. The structuring element members comprise all pixels whose centers are no greater than r away from the origin. The corresponding height values are determined from the formula of the ellipsoid specified by r and h.

Data Types: double

Properties

expand all

Structuring element neighborhood with offsets, specified as a numeric matrix.

Data Types: double

Dimensions of structuring element, specified as a nonnegative scalar.

Data Types: double

Object Functions

imdilateDilate image
imerodeErode image
imcloseMorphologically close image
imopenMorphologically open image
imbothatBottom-hat filtering
imtophatTop-hat filtering
decomposeReturn sequence of decomposed structuring elements
reflectReflect structuring element
translateTranslate structuring element

Examples

collapse all

Create a ball-shaped structuring element.

SE = offsetstrel('ball',5, 6)
SE = 
offsetstrel is a ball shaped offset structuring element with properties:

            Offset: [11x11 double]
    Dimensionality: 2

View the structuring element.

SE.Offset
ans = 11×11

      -Inf      -Inf         0    0.7498    1.4996    2.2494    1.4996    0.7498         0      -Inf      -Inf
      -Inf    0.7498    1.4996    2.2494    2.9992    2.9992    2.9992    2.2494    1.4996    0.7498      -Inf
         0    1.4996    2.2494    2.9992    3.7491    3.7491    3.7491    2.9992    2.2494    1.4996         0
    0.7498    2.2494    2.9992    3.7491    4.4989    4.4989    4.4989    3.7491    2.9992    2.2494    0.7498
    1.4996    2.9992    3.7491    4.4989    5.2487    5.2487    5.2487    4.4989    3.7491    2.9992    1.4996
    2.2494    2.9992    3.7491    4.4989    5.2487    5.9985    5.2487    4.4989    3.7491    2.9992    2.2494
    1.4996    2.9992    3.7491    4.4989    5.2487    5.2487    5.2487    4.4989    3.7491    2.9992    1.4996
    0.7498    2.2494    2.9992    3.7491    4.4989    4.4989    4.4989    3.7491    2.9992    2.2494    0.7498
         0    1.4996    2.2494    2.9992    3.7491    3.7491    3.7491    2.9992    2.2494    1.4996         0
      -Inf    0.7498    1.4996    2.2494    2.9992    2.9992    2.9992    2.2494    1.4996    0.7498      -Inf
      ⋮

Extended Capabilities

Version History

Introduced before R2006a