Documentation

imopen

Morphologically open image

Description

example

J= imopen(I,SE)performs morphological opening on the grayscale or binary imageI, returning the opened image,J.SEis a single structuring element object returned by thestrel或者offsetstrelfunctions. The morphological open operation is an erosion followed by a dilation, using the same structuring element for both operations.

You optionally can perform the openingusing a GPU (requires Parallel Computing Toolbox™).

J= imopen(I,nhood)打开图像I, wherenhoodis a matrix of0s and1s that specifies the structuring element neighborhood. Theimopenfunction determines the center element of the neighborhood byfloor((size(nhood)+1)/2).

这个语法is equivalent toimopen(I,strel(nhood)).

Examples

collapse all

Read the image into the workspace and display it.

或者iginal = imread('Snowflakes.png'); imshow(original);

Create a disk-shaped structuring element with a radius of 5 pixels.

se = strel('disk',5);

Remove snowflakes having a radius less than 5 pixels by opening it with the disk-shaped structuring element.

afterOpening = imopen(original,se); figure imshow(afterOpening,[]);

Input Arguments

collapse all

Input image, specified as a grayscale image or binary image of any dimension.

Data Types:single|double|int8|int16|int32|uint8|uint16|uint32|logical

Structuring element, specified as a singlestrelobject oroffsetstrel目的。如果图像Iis data typelogical, the structuring element must be flat.

Structuring element neighborhood, specified as a matrix of0s and1s.

Example:[0 1 0; 1 1 1; 0 1 0]

Output Arguments

collapse all

打开的图像,作为灰度图像或二进制图像返回。Jhas the same class as input imageI.

Extended Capabilities

See Also

Functions

Objects

Introduced before R2006a