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.

vision.MorphologicalClose System object

Package: vision

Perform morphological closing on image


    Note:   The vision.MorphologicalClose System object will be removed in a future release. Use the imclose function with equivalent functionality instead.

The MorphologicalClose object performs morphological closing on an intensity or binary image. The MorphologicalClose System object performs a dilation operation followed by an erosion operation using a predefined neighborhood or structuring element. This System object uses flat structuring elements only.

    Note:   Starting in R2016b, instead of using the step method to perform the operation defined by the System object™, you can call the object with arguments, as if it were a function. For example, y = step(obj,x) and y = obj(x) perform equivalent operations.


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

H = vision.MorphologicalClose(Name,Value) returns a morphological closing 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.



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 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('line',5,45).


cloneCreate morphological close 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 closing on input image


Perform morphological closing on an image.

 img = im2single(imread('blobs.png'));
 hclosing = vision.MorphologicalClose;
 hclosing.Neighborhood = strel('disk', 10);
 closed = step(hclosing, img);

 subplot(1,2,1),imshow(img); title('Original image');
 subplot(1,2,2),imshow(closed); title('Closed image');


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

Introduced in R2012a

Was this topic helpful?