Digital Image Processing Erosion & Dilation It is typically applied to binary image, but there are versions that work on gray scale image.
Oct 26, 2015
Digital Image Processing
Erosion & Dilation
It is typically applied to binary image, but there are versions that work on gray scale image.
Digital Image Processing
Structuring Element A structuring element is a matrix consisting of only 0's
and 1's that can have any arbitrary shape and size. The pixels with values of 1 define the neighborhood .
Example:Neighborhood 0 0 0 1 0 0 0 0 0 1 1 1 0 0 0 1 1 1 1 1 0 1 1 1 1 1 1 1 0 1 1 1 1 1 0 0 0 1 1 1 0 0 0 0 0 1 0 0 0
Digital Image Processing
Applications of dilationFor bridging gaps in an image
Effect of dilation using a 3×3 square structuring element
Digital Image Processing
Applications of erosion : Eliminating unwanted detail
Effect of erosion using a 3×3 square structuring element
Digital Image Processing
Opening & Closing
•The definition of a morphological opening of an image is :an erosion followed by a dilation,using the same structuring element for both operations.
•The related operation, morphological closing of an image, is the reverse: it consists of dilation followed by an erosion with the same structuring element.
Digital Image Processing
Example of opening
Effect of opening using a 3×3 square structuring element
Digital Image Processing
Example of closing
Effect of closing using a 3×3 square structuring element
Digital Image Processing
Skeletonization To reduce all objects in an image to lines,
without changing the essential structure of the image
Digital Image Processing
Example of Practical Applications of Morphology
Boundary Extraction
• The boundary of a set X is obtained by first eroding X by structuring element K and then taking the set difference of X and it’s erosion.
• The resultant image after subtracting the eroded image from the original image has the boundary of the objects extracted. The thickness of the boundary depends on the size of the structuring element.
Digital Image Processing
Morphological "top hat" operation Morphological "top hat" operation
returns the image minus the morphological opening of the image.
Example:
Input image Result
Digital Image Processing
Morphological "bottom hat" operation Morphological "bottom hat" operation
performs closing (dilation followed by erosion) and than subtracts the original image.
Example:
Input image Result
Digital Image Processing
Morphological Gradient Operator This morphological operator is a composition of
a dilation, an erosion of the input image by the same structuring
element and than the subtraction of these two results.
One important application of the morphologic gradient on binary images is the boundary extraction.
The same operator can be applied to gray level images.
Digital Image Processing
Morphological Gradient Operator
Dilation Erosion Subtraction
0 1 01 1 10 1 0
Structuring element used
Input image
Digital Image Processing
Morphological Gradient: An Example of a Grayscale Image
Input image
Negation of the morphological gradient.
Used structural element : 3x3 square
)()( bfbfg −−⊕=
Digital Image Processing (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Morphological Gradient: An Example of a Grayscale Image
Original image Morphological Gradient)()( bfbfg −−⊕=
Digital Image Processing
Hit-or-Miss operation The hit-or-miss operation is a basic tool for shape detection.
This operation requires two structuring elements. The neighborhoods of those structuring elements B1 andB2 should not have any overlapping elements.
The hit-or-miss operation preserves pixels whose neighborhoods match the shape of structuring element B1 and don't match the shape of B2
hit-or-miss is defined as the intersection of the erosion of A by the first structure element and the erosion of the complement of A by the second structure element: HitOrMiss = Intersect (Erosion (A, SE1), Erosion (~A,
SE2)).
Digital Image Processing
Example of the Hit-or-Miss Operation
Input image
Result imageStructuring elements:
Digital Image Processing
Morphological Reconstruction
Morphological reconstruction can be thought of conceptually as repeated dilations of an image, called the marker image, until the contour of the marker image fits under a second image, called the mask image.
In morphological reconstruction, the peaks in the marker image "spread out,"
Digital Image Processing
Morphological ReconstructionExamples
Examples of the image-preprocessing and segmentation.
a) Original, b) marker imagec) reconstructed image,
a) b) c)