0% found this document useful (0 votes)
616 views

Unit-4 Morphological Image Processing

Mathematical morphology is a collection of non-linear processes that can be applied to an image to remove details smaller than a certain reference shape called the structuring element. The basic morphological operations include dilation, erosion, opening and closing. Dilation enlarges objects in an image while erosion shrinks them. Opening can remove noise and closing can join broken parts of an object. The structuring element, which is usually much smaller than the image, defines the neighborhood over which the morphological operation is applied. Common shapes for structuring elements include squares, disks or lines. Morphological operations are useful for tasks like feature extraction, image filtering and segmentation.

Uploaded by

Anuj Sood
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
616 views

Unit-4 Morphological Image Processing

Mathematical morphology is a collection of non-linear processes that can be applied to an image to remove details smaller than a certain reference shape called the structuring element. The basic morphological operations include dilation, erosion, opening and closing. Dilation enlarges objects in an image while erosion shrinks them. Opening can remove noise and closing can join broken parts of an object. The structuring element, which is usually much smaller than the image, defines the neighborhood over which the morphological operation is applied. Common shapes for structuring elements include squares, disks or lines. Morphological operations are useful for tasks like feature extraction, image filtering and segmentation.

Uploaded by

Anuj Sood
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

Morphological Image Processing

Introduction
The word “morphology” comes from the Ancient Greek word morphé, which means “form”, and lógos, which
means “study, research”. The term Morphology has been used in biology that deals with the study of the form
and structure of organisms since the 17th century.
Morphology is the science of appearance, shape and organisation. Mathematical morphology is a collection of
non-linear processes which can be applied to an image to remove details smaller than a certain reference shape.
The operations of mathematical morphology were originally defined as set operations and shown to be useful
for processing sets of 2D points. The morphological operations can be used to extract the edges of an image,
filter an image, skelatonise an image, etc. The basic morphological operations, discussed in this chapter, include
dilation, erosion, opening and closing, followed by the properties of morphological operations. Even though
morphological operations can be performed on binary, grayscale and colour images, our focus in this chapter is
to apply different morphological operations to binary images. Binary images having only two gray levels
constitute an important subset of digital images. The end of image segmentation operation will be usually a
binary image.

Binarisation
Binarisation is the process of converting a grayscale image to a black-and-white image. A grayscale image
contains a pixel intensity range of 0 to 255 levels. Binarisation is done using global thresholding. Global
thresholding sets all pixels above a defined value to white, and the rest of the pixels to black in the image. It is
very important to decide the appropriate threshold value to binarise the image, though it is difficult to decide a
global value which is suitable for all images. A binary digital image is shown in Fig. 10.1. Each square in the
image represents a pixel. Each pixel has a value of either 0 or 1. The black pixel (digit 1) refers the foreground
of the image and the white pixel (digit 0) refers the background of the image.
Mathematical Morphology
Mathematical morphology is one of the most productive areas in image processing. Mathematical morphology
is a tool for extracting image components that are useful for representation and description. The technique was
originally developed by Matheron and Serra at the Ecole des Mines in Paris. The motivation comes from the
collection of structural information about the image domain. The content of mathematical morphology is
completely based on set theory. By using set operations, there are many useful operators defined in mathematical
morphology. Sets in mathematical morphology represent objects in an image.

Structuring Elements
In morphological operations, the structuring element is very important. The morphological operations are
controlled by a shape known as a structuring element. The structuring element consists of a pattern which is
specified in terms of coordinates of a number of discrete points relative to some origin. structuring element may
be either flat or non-flat. In processing with a flat structuring element, a binary valued neighborhood is used, in
which the true pixels are used in the morphological computation. A flat structuring element is actually a matrix
of 0’s and 1’s, generally much smaller than the image being processed. The center pixel of the structuring element
is called the origin and corresponds to the pixel being processed. The pixels in the structuring element containing
1’s define the neighborhood of the structuring element. Anon-flat structuring element is 3-dimensional; it uses
0’s and 1’s to define the extent of the structuring element in the x- and y-plane and the third dimension adds
height value. The structuring element has to be selected based on the application.
Mathematical morphology is a collection of non-linear processes which can be applied to an image to remove
details smaller than a certain reference shape, which is called structuring element. The structuring element in a
morphological operation plays an important role with its different shape and size. Shape and size are defined by
a number of 0s and 1s in the structuring elements. The circle shown in Fig. 10.2 is called the centre pixel, where
the resultant value is applied. This circle can be anywhere in the structuring element according to the user
perspective. The examples of structuring element reference are shown in Fig. 10.2.
Fig. 10.2 Some possibilities of 5 x 5 square structuring elements are shown. They are named as (a) N8 (8 –Neighbourhood centred)
(b) N4 (4 –Neighbourhood centred) (c) Flat plus (d ) Shifted version (e) 2 × 3 sized rectangular (f ) Reflected structuring element of
Fig. (e) (g) ‘L’ Shaped structuring element (h) Reflected version of structuring element Fig. (g) (i ) line-structuring element of 45°
( j) line-structuring element of 135° (k) Horizontal structuring element with size 1 × 3 (l) Vertical structuring element with size 3 × 1.
Input image Dilated image

Applications of Dilation Operation


1. Repairs Breaks (Bridging the gaps).
2. Repair Intrusions.
3. Enlarge the Object.
NUMERICALS ON DILATION SOLVED IN THEORY SESSION.
Erosion can be used to eliminate irrelevant details, below a certain size, in an image. A structuring element
eliminates detail in an image smaller than its own size. Erosion can be used to create a one-pixel wide outline of
the features in an image by subtracting the eroded image from the original image.
Erosion is the dual of dilation, i.e., eroding foreground pixels is equivalent to dilating background pixels.
However, erosion of an image, followed by dilation of the result, or vice versa, does not produce the original
image; isolated foreground pixels removed during erosion, for example, are not re-instated during dilation.

Input image Eroded image

Applications of Erosion Operation


1. Split apart joined object.
2. Strip away Intrusions.
3. Shrink the object.
NUMERICALS ON EROSION SOLVED IN THEORY SESSION.
Sources: Understanding DIP, Vipin Tyagi, CRC press.
DIP, S Jayaraman, TMH publication.

Sources: Digital Image Processing, S. Sridhar, Oxford University press.

The effect of opening on a binary image depends on the shape of the structuring element. Opening preserves
foreground regions that have a similar shape to the structuring element, or the structuring element completely
contained in the region, while it tends to eliminate foreground regions of dissimilar shapes. Thus, binary opening
can be used as a powerful shape detector for preserving certain shapes and eliminate others.

Input Image Opened Image

NUMERICALS ON OPENING SOLVED IN THEORY SESSION.

Closing can be used to eliminate the smaller holes in the image.


Opening and closing operations are frequently used to remove artefacts in a segmented image before proceeding
to further analysis. The choice of whether to use opening or closing, or a sequence of erosions and dilations,
depends on the individual processing requirement.
Similar to erosion and dilation, opening and closing are also duals of each other, i.e., opening the foreground
pixels with a particular structuring element is equivalent to closing the background pixels with the same
structuring element. Opening and closing operations are idempotent, i.e., repeated application of either of them
has no further effect on an image.

Input Image Closed Image


Sources: Understanding DIP, Vipin Tyagi, CRC press.
DIP, S Jayaraman, TMH publication.
NUMERICALS ON CLOSING SOLVED IN THEORY SESSION.

Hit-or-Miss Transform
The hit-or-miss transform is a basic tool that is used in mathematical morphology. The hit-or-miss transform
indicates the positions where a certain pattern (characterized by a structuring element B) occurs in the input
image. As such, it operates as a basic tool for shape detection.
The hit-or-miss transform uses a pair of structuring elements. This transformation is very useful in applications
related to the matching of isolated foreground pixels or endpoint pixels of line-segments. The hit-or-miss
transform is based on two erosions. In this transform, we search for points where B1 fits in an object, and B2 fits
in the background.
When the contents of structuring elements completely matches with the image contents (covered by structuring
elements), then it is Hit and use 1 for hit, for the pixel under process.

When the contents of structuring elements NOT matches with the image contents (covered by structuring
elements), then it is Miss and use 0 for miss, for the pixel under process.

Hit-or-miss transformation of an image A by structuring element pair B = (B1, B2) can be defined as:

The hit-or-miss transform is a transformation which is used for template matching. It is also used to find specific
configuration of pixel(s) in an image. It is used to find specific shape (represented by group of pixels) within an
image. An example of use of the hit-or-miss transform is in finding the corners in a binary image.
NUMERICALS ON HIT-OR-MISS TRANSFORM SOLVED IN THEORY SESSION.
Boundary Detection
Morphological operations are very effective in the detection of boundaries in a binary image X. The following
boundary detectors are widely used:

For Internal Boundary

For External Boundary

where Y is the boundary image, operator ‘Θ’ denotes erosion and operator ‘⊕’ denotes dilation. ‘-’ denotes the
set theoretical subtraction.
The internal boundary consists of those pixels in A that are at its edge; the external boundary consists of pixels
outside A and which are just next to it.
The external boundaries are larger than the internal boundaries. This is because the internal boundaries show the
outer edge of the image components whereas the external boundaries show the pixels just outside the
components.

Thinning and Thickening


In some applications, the user may be interested not simply in whether or not an object is a single connected
component, but in properties such as the number of branches and holes. Such properties are referred to as the
topology of the object. Operations which preserves the topology of an object are called homeomorphisms. These
operations are known as thinning operations and thickening operations.
Thinning is a morphological operation that repeatedly erodes away foreground pixels from the boundary of
binary images while preserving the end points of line segments. Thickening is the dual of thinning, i.e.,
thickening the foreground is equivalent to thinning the background.
Thinning
This operation thins the objet to line. This operation is applied to binary images.
Thinning is a morphological operator used to remove irrelevant foreground pixels present in binary image. The
performance of thinning algorithm depends upon the nature of structuring element.
Thinning (A,B) = A – Hit-or-Miss transform (A,B)

The thinning process is split into two types.


(i) It removes boundary pixels of a connected component that are neither essential for preserving the connectivity
of image nor represent any significant geometrical features of an image. The process converges when the
connected skeleton does not change or vanishes even if the iteration process continues.
(ii) It encodes distance information for every pixel of the pattern by a label representing the distance of the pixel
to the boundary. The set of pixels with local minimum distance labels is used to derive the resulting skeleton.

Structuring elements of thinning operation


Thinning is similar to erosion, but it does not cause disappearance of object components. It intends to reduce objects to the thickness
of 1 pixel, generating a minimally connected axis that is equidistant from the object edges. Thinning is a fundamental early
processing step in representing the structural shape of a pattern as a graph. It can be applied in industrial part inspection, fingerprint
recognition, optical character recognition, and biomedical diagnosis.
The thinning of a binary image set can be represented in terms of hit-or-miss operation as

This can be thought of as a search-and-delete process. The operation locates all occurrences of B in A, and the set subtraction
removes those pixels that have been located from A.
For thinning A symmetrically, we use a sequence of eight structuring elements:

Therefore, thinning a sequence of eight structuring elements is represented as


The thinning process removes pixels from the outside edges of an object. The structuring elements are designed to find those edge
pixels whose removal will not change the object’s connectivity. After thinning for the first pass with these eight structuring elements
is completed, the entire process for the second pass is repeated until no further changes occur.

Input Image Thinned Image


Sources: IP & PR, Frank Y Shih, IEEE_Wiley press.
DIP, S Jayaraman, TMH publication.
NUMERICALS ON THINNING SOLVED IN THEORY SESSION.
The thickening process is the dual of thinning, that is, thinning the foreground is equivalent to thickening the
background. This process is normally applied repeatedly until it causes no further changes in the image.

Different structuring elements of thickening process


Thickening is similar to dilation, but it does not cause merging of disconnected objects. Thickening is the morphological dual to
thinning. It is used to grow some concavities in an object and can be represented in terms of hit-or-miss operation and union as

The thickened image contains the original set plus some filled-in pixels determined by the hit-or-miss operation. The sequence of
structuring elements used in thickening is the same as that in thinning. The sequence of thickening operations can be represented as

Sources: IP & PR, Frank Y Shih, IEEE_Wiley press.


DIP, S Jayaraman, TMH publication.

NUMERICALS ON THICEKING SOLVED IN THEORY SESSION.


Skeletonization
Skeletons represents the structural shape of a region in the form of a graph. The skeleton of an object can be
obtained by the iterations of thinning process. Skeletonization is similar to thinning, but it explores more structure
information of an object. The skeleton emphasizes certain properties of images; for instance, curvatures of the
contour correspond to topological properties of the skeleton.
Skeleton, medial axis, or symmetrical axis has been extensively used for characterizing objects satisfactorily
using the structures that are composed of line or arc patterns. This has the advantages of reducing the memory
space required for storage of the essential structural information and simplifying the data structure required in
pattern analysis.
The skeleton of a binary object is a representation of the basic form of that object which has been reduced down
to its minimal level (i.e. a ‘bare bones’ representation). A very useful conceptualization of the morphological
skeleton is provided by the prairie-fire analogy: the boundary of an object is set on fire and spreads with uniform
velocity in all directions inwards; the skeleton of the object will be defined by the points at which the fire fronts
meet and quench (i.e. stop) each other.
Consider an arbitrary, binary object A. A point p within this binary object belongs to the skeleton of A if and
only if the two following conditions hold:
(1) A disk Dz may be constructed, with p at its centre, that lies entirely within A and touches the boundary of
A at two or more places.
(2) No other larger disk exists that lies entirely within A and yet contains Dz. An equivalent geometric
construction for producing the skeleton is to:
(1) Start at an arbitrary point on the boundary and consider the maximum possible size of disk which can touch
the boundary at this point and at least one other point on the boundary and yet remain within the object.
(2) Mark the centre of the disk.
(3) Repeat this process at all points along the entire boundary (moving in infinitesimal steps) until you return to
the original starting point. The trace or locus of all the disk centre points is the skeleton of the object.
The skeleton is a useful representation of the object morphology, as it provides both topological information and
numerical metrics which can be used for comparison and categorization. The topology is essentially encapsulated
in the number of nodes (where branches meet) and number of end points and the metric information is provided
by the lengths of the branches and the angles between them.
A weakness of the skeleton as a representation of a shape is that it is sensitive (sometimes highly) to small
changes in the morphology. Slight irregularities in a boundary can lead to spurious ‘spurs’ in the skeleton which
can interfere with recognition processes based on the topological properties of the skeleton. So-called pruning
can be carried out to remove spurs of less than a certain length, but this is not always effective as small
perturbations in the boundary of an image can sometimes lead to large spurs in the skeleton.
Applications include the representation and recognition of handwritten characters, fingerprint ridge patterns,
biological cell structures, circuit diagrams, engineering drawings, robot path planning, and the like. Note that the
original shape can be reconstructed using the skeleton points and their distances to shape boundary. On the
contrary, one cannot reconstruct the original shape from a thinned image obtained by a thinning algorithm.

(a) input image (b) skeleton of (a)

Some shapes and their corresponding morphological skeletons

Sources: Image Processing & Pattern recognition: Fundamentals & Techniques, Frank Y Shih, Wiley- IEEE Press.
Fundamentals of DIP: A practical approach with examples in MATLAB, Chris Solomon, page number-222. Wiley-Blackwell
Publication.

NUMERICALS ON SKELETONIZATION SOLVED IN THEORY SESSION.

You might also like