Products & Services Solutions Academia Support User Community Company

Learn more about Image Processing Toolbox   

imclose - Morphologically close image

Syntax

IM2 = imclose(IM,SE)
IM2 = imclose(IM,NHOOD)

Description

IM2 = imclose(IM,SE) performs morphological closing on the grayscale or binary image IM, returning the closed image, IM2. The structuring element, SE, must be a single structuring element object, as opposed to an array of objects. The morphological close operation is a dilation followed by an erosion, using the same structuring element for both operations.

IM2 = imclose(IM,NHOOD) performs closing with the structuring element strel(NHOOD), where NHOOD is an array of 0's and 1's that specifies the structuring element neighborhood.

Class Support

IM can be any numeric or logical class and any dimension, and must be nonsparse. If IM is logical, then SE must be flat. IM2 has the same class as IM.

Examples

Use imclose to join the circles in the image together by filling in the gaps between them and by smoothing their outer edges.

  1. Read the image into the MATLAB workspace and view it.

    originalBW = imread('circles.png');
    imshow(originalBW);

  2. Create a disk-shaped structuring element. Use a disk structuring element to preserve the circular nature of the object. Specify a radius of 10 pixels so that the largest gap gets filled.

    se = strel('disk',10);
  3. Perform a morphological close operation on the image.

    closeBW = imclose(originalBW,se);
    figure, imshow(closeBW)

See Also

imdilate, imerode, imopen, strel

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS