This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Morphological Operations

Dilate, erode, reconstruct, and perform other morphological operations

Morphology is a broad set of image processing operations that process images based on shapes. In a morphological operation, each pixel in the image is adjusted based on the value of other pixels in its neighborhood. By choosing the size and shape of the neighborhood, you can construct a morphological operation that is sensitive to specific shapes in the input image.

The most basic morphological operations are dilation and erosion. Dilation adds pixels to the boundaries of objects in an image, while erosion removes pixels on object boundaries. Dilation and erosion are often used in combination for specific image preprocessing applications, such as filling holes or removing small objects.

Functions

bwhitmissBinary hit-miss operation
bwmorphMorphological operations on binary images
bwmorph3Morphological operations on binary volume
bwskelReduce all objects to lines in 2-D binary image or 3-D binary volume
bwulterodeUltimate erosion
bwareaopenRemove small objects from binary image
imbothatBottom-hat filtering
imclearborderSuppress light structures connected to image border
imcloseMorphologically close image
imdilateDilate image
imerodeErode image
imextendedmaxExtended-maxima transform
imextendedminExtended-minima transform
imfillFill image regions and holes
imhmaxH-maxima transform
imhminH-minima transform
imimposeminImpose minima
imopenMorphologically open image
imreconstructMorphological reconstruction
imregionalmaxRegional maxima
imregionalminRegional minima
imtophatTop-hat filtering
watershedWatershed transform
conndefCreate connectivity array
iptcheckconnCheck validity of connectivity argument
applylutNeighborhood operations on binary images using lookup tables
bwlookup Nonlinear filtering using lookup tables
makelutCreate lookup table for use with bwlookup

Objects

strelMorphological structuring element
offsetstrelMorphological offset structuring element

Examples and How To

Dilate an Image to Enlarge a Shape

Dilation adds pixels to boundary of an object. Dilation makes objects more visible and fills in small holes in the object.

Erode an Image To Remove Thin Lines

Erosion removes pixels from the boundary of an object. Erosion removes islands and small objects so that only substantive objects remain.

Operations That Combine Dilation and Erosion

Combine dilation and erosion to remove small objects from an image and smooth the border of large objects.

Concepts

Morphological Dilation and Erosion

Dilation adds pixels to the boundary of objects in an image. Erosion removes pixels from object boundaries.

Structuring Elements

A structuring element defines the neighborhood used to process each pixel. It influences the size and shape of objects you want to process in the image.

Pixel Connectivity

Morphological processing starts at the peaks in the marker image and spreads throughout the rest of the image based on the connectivity of the pixels.

Understanding Morphological Reconstruction

Morphological reconstruction is useful to extract marked objects from an image without changing the object size or shape.

Skeletonization

The process of skeletonization reduces all objects in an image to lines, without changing the essential structure of the image.

Find Object Perimeters

The perimeter, or boundary, of objects in a binary image consists of all pixels at the interface of the object and the background.

Flood-Fill Operations

The imfill function performs a flood-fill operation on binary and grayscale images.

Correct Nonuniform Illumination and Analyze Foreground Objects

This example shows how to perform image preprocessing such as morphological opening and contrast adjustment. Then, create a binary image and compute statistics of image foreground objects.

Lookup Table Operations

A lookup table is a vector in which each element represents the different permutations of pixels in a neighborhood. Lookup tables are useful for custom erosion and dilation operations.

Featured Examples