Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

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 with grayscale images. The matrix is of type double.

To create a flat structuring element, use strel.

Creation

Syntax

SE = offsetstrel('ball',r,h)
SE = offsetstrel('ball',r,h,n)
SE = offsetstrel(offset)

Description

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.

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

Input Arguments

expand all

Radius of the ball-shaped structuring element in the x-y plane, specified as a nonnegative 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 nonnegative integer.

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

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

Properties

expand all

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

Data Types: logical

Dimensions of structuring element, specified as a nonnegative scalar.

Data Types: double

Object Functions

decomposeReturn sequence of decomposed structuring elements
reflectReflect structuring element
translateTranslate structuring element

Examples

expand 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 = 

  Columns 1 through 7

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

  Columns 8 through 11

    0.7498         0      -Inf      -Inf
    2.2494    1.4996    0.7498      -Inf
    2.9992    2.2494    1.4996         0
    3.7491    2.9992    2.2494    0.7498
    4.4989    3.7491    2.9992    1.4996
    4.4989    3.7491    2.9992    2.2494
    4.4989    3.7491    2.9992    1.4996
    3.7491    2.9992    2.2494    0.7498
    2.9992    2.2494    1.4996         0
    2.2494    1.4996    0.7498      -Inf

Extended Capabilities

Introduced before R2006a

Was this topic helpful?