Digital Image Processing
MORPHOLOGICAL
Hamid R. Rabiee Fall 2015 Image Analysis 2
Morphological Image Processing
Edge Detection
Keypoint Detection
Image Feature Extraction
Texture Image Analysis
Shape Analysis
Color Image Processing
Template Matching
Image Segmentation Image Analysis 3
Figure 9.1 of Jain book Image Analysis 4
Ultimate aim of image processing applications:
Automatic description, interpretation, or understanding the scene
For example, an image understanding system should be able to send the report:
The field of view contains a dirt road surrounded by grass. Image Analysis 5
Table 9.1 of Jain book Image Analysis 6
original binary
Morphological Analysis Edge Detection Keypoint Detection 7
Morphological Image Processing (MIP) Outline 8
Preview
Preliminaries
Dilation
Erosion
Opening
Closing
Hit-or-miss transformation Outline (cont.) 9
Morphological algorithms
Boundary Extraction
Hole filling
Extraction of connected components
Convex hall
Thinning
Thickening
Skeleton Outline (cont.) 10
Gray-scale morphology
Dilation and erosion
Opening and closing
Rank filter, median filter, and majority filter Preview 11
a tool for extracting image components that are useful in the representation and description of region shape, such as boundaries, skeletons, and convex hull
Can be used to extract attributes and “meaning” from images, unlike pervious image processing tools which their input and output were images.
Morphological techniques such as morphological filtering, thinning, and pruning can be used for pre- or post-processing
All the concepts are introduced on binary images. Some extensions to gray- scale images are discussed later. Preliminaries 12
The language of mathematical morphology is set theory:
In binary images, the sets in question are members of the 2-D integer space 풁ퟐ, where each element of a set is a 2-D vector whose coordinates are the (x, y) coordinates of a white pixel (by convention) in the image
White pixels of the image represent foreground (1 pixels) binary images Black pixels of the image are background (0 pixels)
background
foreground Preliminaries 13
In addition to basic set operations including union, intersection, complement, and difference, we will need:
Translation:
Reflection: Preliminaries 14
Operations in morphological image processing are shift-invariant
Each operation needs a structuring element (SE)
SE is a binary image, which it’s origin must be specified
Some examples are cross, square, and circle SEs
cross square circle Dilation 15
The dilation of set A by structuring element B, is defined as
Figure 9.6 of Gonzalez book Dilation 16
Expands the size of foreground objects
Smooths object boundaries
Closes holes and gaps
Original image Dilation with 3 * 3 cross SE Dilation with 7 * 7 cross SE
Original image is taken from MIT course slides Dilation 17
Using dilation to fix a text image with broken characters
Original image Dilation with 3 * 3 cross SE Dilation with 5 * 5 cross SE
Original image is taken from figure 9.7 of Gonzalez book Dilation 18
Dilation is commutative
Dilation is associative
Note: can be decomposed to structuring elements and
This decomposition can cause speed-up Erosion 19
The erosion of set A by structuring element B, is defined as
Figure 9.4 of Gonzalez book Erosion 20
Shrinks the size of foreground objects
Smooths object boundaries
Removes peninsulas, fingers and small objects
Original image Erosion with 3 * 3 cross SE Erosion with 7 * 7 cross SE
Original image is taken from MIT course slides Erosion 21
Using erosion to clear the thin wires in an image
Original image Erosion with a disk of radius 10 Erosion with a disk of radius 5 Erosion with a disk of radius 20
Original image is taken from figure 9.5 of Gonzalez book Relationship between dilation and erosion 22
Duality: Dilation and erosion are duals of each other with respect to set complementation and reflection
and
Proof Opening 23
The opening of set A by structuring element B, is defined as
The geometric interpretation of opening
Figure 9.8 of Gonzalez book Closing 24
The closing of set A by structuring element B, is defined as
The geometric interpretation of closing is based on opening using duality property
Figure 9.9 of Gonzalez book Relationship between opening and closing 25
Duality: Opening and closing are duals of each other with respect to set complementation and reflection
and
Proof: homework Open filter & close filter 26
Original image
Result of opening
Result of opening followed by closing
: 3 * 3 square SE
Figure 9.11 of Gonzalez book Hit-or-miss transformation 27
The hit-or-miss transformation of by ,where is a structuring element pair is defined as
Suppose that is enclosed by a small window . The local background of with respect to is defined as the set difference – , and the structuring element B2 is as follows example Hit-or-miss transformation 28
Original image
( to be more visible) Structuring Structuring element B1 element B2 Morphological algorithms 29
Boundary Extraction
Hole filling
Extraction of connected components
Convex hall
Thinning
Thickening
Skeleton
Pruning Boundary extraction 30
The boundary of set can be obtained using erosion
Also the we can use dilation to obtain boundary
The difference between dilation and erosion results thicker boundary Boundary extraction 31
Original image
Original image is taken from MIT course slides Hole filling 32
Hole: background region surrounded by a connected border of foreground pixels
Assumption: a point inside each hole region is given, , and is symmetric
In each iteration
Termination is at iteration step if
The set union of and contains all filled holes and their boundaries
Figure is taken from Gonzalez book Extraction of connected components 33
Connected component: refer to definition!
Assumption: a point on one of the connected components of set is given and .
The objective is to find all the elements of this connected component.
In each iteration:
Termination is at iteration step if
is the set containing all the elements of the connected component.
Figure is taken from Gonzalez book Convex hall 34
The convex hall of an arbitrary set is the smallest convex set containing .. .
Assumption: represent four structuring elements.
In each iteration: : hit-or-miss transformation
Termination is at iteration step if and we define
Then convex hall of is
Limiting growth of convex hall algorithm along the vertical and horizontal directions Convex hall 35
Limiting growth of convex hall algorithm
Figure is taken from Gonzalez book Thinning 36
The thinning of a set by a structuring element is defined in terms of hit-or- miss transformation
To thin symmetrically a sequence of structuring elements is used
Where is a rotated version of
Definition of thinning by a set of structuring elements Thinning 37
Figure is taken from Gonzalez book Thickening 38
Thickening is the morphological dual of thinning and is defined as
Definition of thickening by a set of structuring elements
Usual procedure in practice
Thin the background of a set in question and then complement the result. Afterwards remove the resulting disconnected points.
The thinned background forms a boundary for the thickening process which is one of the principal reasons for using this procedure. Thickening 39
Result of Thinning of Remove disconnected points
Final result of Thickening of
Figure is taken from Gonzalez book Skeleton 40
First we define
The skeleton of set A is
can be reconstructed using
The resulting set may be disconnected
Other algorithms are needed if the skeleton must be maximally thin, connected and minimally eroded Skeleton 41
Original set
Reconstructed set
Morphological skeleton Figure is taken from Gonzalez book Gray-scale morphology 42
The basic operations introduced for binary images are extendable to gray- scale images
In this case f(x, y) is a gray-scale image and b(x, y) is a structuring element
Structuring elements in gray-scale morphology belong to one of two categories: non-flat and flat
Gray-scale SEs are used infrequently in practice Dilation and erosion 43
The dilation with flat structuring element is defined as
The erosion with flat structuring element is defined as
The dilation with non-flat structuring element is defined as
The erosion with non-flat structuring element is defined as Dilation and erosion 44
Example:
Flat SE
Original image Dilation with 5 * 5 square SE Erosion with 5 * 5square SE
Width of lines is not preserved Dilation and erosion 45
As in the binary case, dilation and erosion are duals with respect to function complementation and reflection
Where and
Simplifying the notation
Similarly Opening and closing 46
The expressions for Opening and closing gray-scale images have the same form as their binary counterparts.
Opening
Closing
Duality of opening and closing
and Opening and closing 47
Example 1:
2-D image
Original image Opening with 5 * 5 square SE Closing with 5 * 5 square SE
Width of lines is preserved Opening and closing 48
Example 2: Original 1-D signal 1-D signal
Flat SE, pushed up underneath the signal
Opening
Flat SE, pushed down along the top of the signal
Closing
Figure 9.36 of Gonzalez book Rank filter 49
Generalization of flat dilation/erosion: instead of using min or max value in window, use the p-th ranked value example
Increases robustness against noise
Best-known example: median filter for noise reduction
Concept useful for both gray-level and binary images
All rank filters are commutative with thresholding
Concepts are taken from MIT course slides Median filter and majority filter 50
Gray-level images example
Median filter: instead of using min or max value in window, use median value
Binary images example
Majority filter: instead of using min or max value in window, use majority value
Concepts are taken from MIT course slides References 51
Gonzalez book:
Rafael C. Gonzalez, and Richard E. Woods. Digital image processing, Prentice Hall, Inc., 2007
MIT course slides:
web.stanford.edu/class/ee368/Handouts/Lectures/2015_Autumn/7- Morphological_16x9.pdf End of Lecture 10
Thank You!