Morphologically open image
J = imopen(I,SE)
J = imopen(I,nhood)
gpuarrayJ = imopen(gpuarrayI,___)
performs morphological opening on the grayscale or binary image
J = imopen(
I, returning the opened image,
SE is a single structuring element object returned by the
offsetstrel functions. The
morphological open operation is an erosion followed by a dilation, using the same
structuring element for both operations.
Read the image into the workspace and display it.
original = 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,);
Read an image.
original = imread('snowflakes.png');
Create a disk-shaped structuring element.
se = strel('disk',5);
Morphologically open the image on a GPU, using a
gpuArray object, and display the images.
afterOpening = imopen(gpuArray(original),se); figure, imshow(original), figure, imshow(afterOpening,)
I— Input image
Input image, specified as a grayscale image or binary image.
I can have any dimension, and must be real and
nhood— Structuring element neighborhood
Structuring element neighborhood, specified as a matrix of 0s and 1s.
[0 1 0; 1 1 1; 0 1 0]
gpuarrayI— Image to be opened on a GPU
Image to be opened on a GPU, specified as a
containing an image of type
logical. The structuring element
SE must be flat and two-dimensional.
J— Opened image
Opened image, returned as a grayscale image or binary image.
J has the same class as input image
gpuarrayJ— Opened image when run on a GPU
Opened image when run on a GPU, returned as a
gpuarrayJ has the same class as the input
Usage notes and limitations:
This function supports the generation of C code using MATLAB®
Note that if you choose the generic
MATLAB Host Computer target
platform, the function generates code that uses a precompiled, platform-specific
shared library. Use of a shared library preserves performance optimizations
but limits the target platforms for which code can be generated. For
more information, see Understand Code Generation with Image Processing Toolbox.
When generating code, the image input argument,
must be 2-D or 3-D and the structuring element input argument,
SE, must be a compile-time constant.