Unit-4 Morphological Image Processing
Unit-4 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
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.
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:
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.
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:
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: 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.