Download as pdf or txt
Download as pdf or txt
You are on page 1of 24

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 0 0 1 0 1 1 1 1 1 0 1 1 0 0 1 0 0 0

1 1 1 1 1 1 1

Digital Image Processing

0 1 1 1 1 1 0

0 0 1 1 1 0 0

0 0 0 1 0 0 0

Example of dilation on a binary image

Digital Image Processing

Example of dilation on a grayscale image

Digital Image Processing

Applications of dilation For bridging gaps in an image

Effect of dilation using a 33 square structuring element


Digital Image Processing

Applications of erosion : Eliminating unwanted detail

Effect of erosion using a 33 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 33 square structuring element


Digital Image Processing

Example of an Opening

Remove small objects


Digital Image Processing

Example of closing

Effect of closing using a 33 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 its 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

Boundary Extraction example

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
Digital Image Processing

Result

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

Input image

Dilation

Erosion

Subtraction

010 1 1 1 Structuring element used 010

Digital Image Processing

Morphological Gradient: An Example of a Grayscale Image


g = ( f b) ( f b)
Input image

Negation of the morphological gradient. Used structural element : 3x3 square


Digital Image Processing

Morphological Gradient: An Example of a Grayscale Image

Original image

g = ( f b) ( f b)

Morphological Gradient
Digital Image Processing
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

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 image

Structuring 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 Reconstruction Examples


Examples of the imagepreprocessing and segmentation. a) Original, b) marker image c) reconstructed image,

a)

b)

c)

Digital Image Processing

The Watershed Transformation


Principle: Any greytone image can be considered as a topographic surface. The watershed algorithm is an image processing segmentation algorithm that splits an image into areas, based on the topology of the image.

Digital Image Processing

You might also like