Q21Digital Image Processing
Question
Describe morphological image processing. Explain dilation, erosion, opening, and closing operations with suitable examples.
Answer
Morphological processing uses set-theoretic operations with a structuring element; dilation and erosion are the primitives, combined into opening and closing for shape refinement.
Morphological image processing is a collection of non-linear operations related to the shape or morphology of features in a binary (or grayscale) image, based on set theory. It relies on the ordering of pixels and uses a structuring element (SE), a small shape (e.g., a square or cross) that probes the image.
Dilation and Erosion
Dilation, , adds pixels to the boundaries of objects: the SE is translated across the image, and if it overlaps any foreground pixel, the anchor position is set to foreground. This grows objects, fills small holes, and connects nearby components. Erosion, , removes pixels on object boundaries: a pixel remains foreground only if the SE, when centered there, is entirely contained within the object. This shrinks objects and eliminates small protrusions and noise specks.
Opening and Closing
Opening (, erosion followed by dilation) smooths the contour of an object, breaks narrow isthmuses (thin connecting bridges between larger regions), and eliminates thin protrusions and small isolated noise objects, while approximately preserving the size of large objects. Closing (, dilation followed by erosion) smooths sections of contours, fuses narrow breaks and long thin gulfs, eliminates small holes, and fills small gaps in the contour, again with minimal change to overall object size.
Worked Example
Consider a binary object shaped like a rectangle with a single-pixel-wide spur protruding from one side, probed with a square SE. Erosion removes the entire spur (since the SE cannot fit inside a 1-pixel-wide feature) and shrinks the rectangle boundary by one pixel on all sides; the subsequent dilation in opening restores the rectangle to nearly its original size but the spur, having been deleted, does not reappear. Conversely, if the same rectangle has a 1-pixel-wide notch cut into its edge, dilation first fills the notch, and the subsequent erosion in closing restores the boundary elsewhere while leaving the notch filled. This illustrates why opening removes small protrusions and closing fills small intrusions, both while preserving the overall object geometry, which is why the two operations are used as a sequential pair for noise cleanup in binary image preprocessing prior to feature extraction.
Related Morphological Algorithms
Building on dilation and erosion, several higher-level algorithms are commonly derived: boundary extraction computes , subtracting the eroded set from the original to leave only the outer shell of pixels; the hit-or-miss transform uses a pair of disjoint structuring elements to detect specific shapes or configurations, forming the basis of algorithms like thinning and thickening; and morphological skeletonization repeatedly erodes an object down to a minimal connected line representation that preserves its topology, useful for shape analysis in optical character recognition and fingerprint processing. All of these algorithms are constructed purely from the two primitive operations of dilation and erosion, which is what makes morphological processing such a compact and composable framework compared to convolution-based spatial filtering.