vision.MorphologicalOpen System object

Package: vision

Perform morphological opening on an image

Description

The MorphologicalOpen object performs morphological opening on an image. The MorphologicalOpen System object performs an erosion operation followed by a dilation operation using a predefined neighborhood or structuring element. This System object uses flat structuring elements only. For more information about structuring elements, see the strel function reference page in the Image Processing Toolbox™ documentation.

Construction

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

H = vision.MorphologicalOpen(Name,Value) returns a morphological opening 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 applies when you set the NeighborhoodSource property 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('disk',5).

Methods

cloneCreate morphological open 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 opening on input image

Examples

Perform opening on an image

 img = im2single(imread('blobs.png'));
 hopening = vision.MorphologicalOpen;
 hopening.Neighborhood = strel('disk', 5);
 opened = step(hopening, img);
 figure;

 subplot(1,2,1),imshow(img); title('Original image');
 subplot(1,2,2),imshow(opened); title('Opened image');

Algorithms

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

Was this topic helpful?