vision.MorphologicalErode System object

Package: vision

Perform morphological erosion on an image

Description

The MorphologicalErode object performs morphological erosion on an image using a neighborhood specified by a square structuring element of width 4.

Construction

H = vision.MorphologicalErode returns a System object, H, that performs morphological erosion on an intensity or binary image.

H = vision.MorphologicalErode(Name,Value) returns a morphological erosion System object, H, with each specified property set to the specified value. You can specify additional name-value pair arguments in any order as (Name1, Value1,...,NameN,ValueN).

Code Generation Support
Supports MATLAB® Function block: Yes
System Objects in MATLAB Code Generation.
Code Generation Support, Usage Notes, and Limitations.

Properties

NeighborhoodSource

Source of neighborhood values

Specify how to enter neighborhood or structuring element values as Property or Input port. If set to Property, use the Neighborhood property to specify the neighborhood or structuring element values. Otherwise, specify the neighborhood using an input to the step method. Note that structuring elements can only be specified using Neighborhood property and they cannot be used as input to the step method. The default is Property.

Neighborhood

Neighborhood or structuring element values

This property is applicable when the NeighborhoodSource property is set to Property. If you are specifying a neighborhood, this property must be a matrix or vector of 1s and 0s. If you are specifying a structuring element, use the strel function. The default is strel('square',4).

Methods

cloneCreate morphological erode object with same property values
getNumInputsNumber of expected inputs to step method
getNumOutputsNumber of outputs from step method
isLockedLocked status for input attributes and non-tunable properties
release Allow property value and input characteristics changes
stepPerform morphological erosion on input

Examples

Erode an input image.

 x = imread('peppers.png');
 hcsc = vision.ColorSpaceConverter;
 hcsc.Conversion = 'RGB to intensity';
 hautothresh = vision.Autothresholder;
 herode = vision.MorphologicalErode('Neighborhood', ones(5,5));
 x1 = step(hcsc, x); % convert input to intensity
 x2 = step(hautothresh, x1); % convert input to binary
 y = step(herode, x2); % Perform erosion on input
 figure;

 subplot(3,1,1),imshow(x); title('Original image');
 subplot(3,1,2),imshow(x2); title('Thresholded Image');
 subplot(3,1,3),imshow(y); title('Eroded Image');

Algorithms

This object implements the algorithm, inputs, and outputs described on the Erosion block reference page. The object properties correspond to the block parameters.

Was this topic helpful?