24
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 Lecture

Embed Size (px)

DESCRIPTION

Morphological Processing Recap &Extend lecture Digital Image Processing

Citation preview

Page 1: Digital Image Processing Lecture

Digital Image Processing

Erosion & Dilation

It is typically applied to binary image, but there are versions that work on gray scale image.

Page 2: Digital Image Processing Lecture

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

Page 3: Digital Image Processing Lecture

Digital Image Processing

Example of dilationon a binary image

Page 4: Digital Image Processing Lecture

Digital Image Processing

Example of dilationon a grayscale image

Page 5: Digital Image Processing Lecture

Digital Image Processing

Applications of dilationFor bridging gaps in an image

Effect of dilation using a 3×3 square structuring element

Page 6: Digital Image Processing Lecture

Digital Image Processing

Applications of erosion : Eliminating unwanted detail

Effect of erosion using a 3×3 square structuring element

Page 7: Digital Image Processing Lecture

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.

Page 8: Digital Image Processing Lecture

Digital Image Processing

Example of opening

Effect of opening using a 3×3 square structuring element

Page 9: Digital Image Processing Lecture

Digital Image Processing

Remove small objects

Example of an Opening

Page 10: Digital Image Processing Lecture

Digital Image Processing

Example of closing

Effect of closing using a 3×3 square structuring element

Page 11: Digital Image Processing Lecture

Digital Image Processing

Skeletonization To reduce all objects in an image to lines,

without changing the essential structure of the image

Page 12: Digital Image Processing Lecture

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.

Page 13: Digital Image Processing Lecture

Digital Image Processing

Boundary Extractionexample

Page 14: Digital Image Processing Lecture

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

Page 15: Digital Image Processing Lecture

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

Page 16: Digital Image Processing Lecture

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.

Page 17: Digital Image Processing Lecture

Digital Image Processing

Morphological Gradient Operator

Dilation Erosion Subtraction

0 1 01 1 10 1 0

Structuring element used

Input image

Page 18: Digital Image Processing Lecture

Digital Image Processing

Morphological Gradient: An Example of a Grayscale Image

Input image

Negation of the morphological gradient.

Used structural element : 3x3 square

)()( bfbfg −−⊕=

Page 19: Digital Image Processing Lecture

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 −−⊕=

Page 20: Digital Image Processing Lecture

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)).

Page 21: Digital Image Processing Lecture

Digital Image Processing

Example of the Hit-or-Miss Operation

Input image

Result imageStructuring elements:

Page 22: Digital Image Processing Lecture

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,"

Page 23: Digital Image Processing Lecture

Digital Image Processing

Morphological ReconstructionExamples

Examples of the image-preprocessing and segmentation.

a) Original, b) marker imagec) reconstructed image,

a) b) c)

Page 24: Digital Image Processing Lecture

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.