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.
|Binary hit-miss operation|
|Morphological operations on binary images|
|Morphological operations on binary volume|
|Reduce all objects to lines in 2-D binary image or 3-D binary volume|
|Remove small objects from binary image|
|Suppress light structures connected to image border|
|Morphologically close image|
|Fill image regions and holes|
|Morphologically open image|
|Create connectivity array|
|Check validity of connectivity argument|
Dilation adds pixels to boundary of an object. Dilation makes objects more visible and fills in small holes in the object.
Erosion removes pixels from the boundary of an object. Erosion removes islands and small objects so that only substantive objects remain.
Combine dilation and erosion to remove small objects from an image and smooth the border of large objects.
Dilation adds pixels to the boundary of objects in an image. Erosion removes pixels from object boundaries.
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.
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.
Morphological reconstruction is useful to extract marked objects from an image without changing the object size or shape.
The process of skeletonization reduces all objects in an image to lines, without changing the essential structure of the image.
The perimeter, or boundary, of objects in a binary image consists of all pixels at the interface of the object and the background.
imfill function performs a
flood-fill operation on binary and grayscale images.
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.
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.