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

Morphological Operators Pv8

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Morphological Operators Pv8

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 37

Morphological operations

Reference : Digital Image processing – Rafael


Gonzalez, Richard E. Woods
Morphological operations

 Morphology deals with structure

 Morphological image processing is used to extract image


components for representation and description of region
shape, such as boundaries, skeletons, and the convex hull

 Collection of non-linear operations related to the shape or


morphological feature of the image

 Used for removing imperfections


Reflection & translation
Reflection and translation

Courtesy: Gonzalez and woods, DIP


Structuring elements

 Probes an image with the small mask called “structuring


element” (SE)
 Structuring element is placed in all possible pixels of the
image and compared with the corresponding
neighbourhood of pixels.
 Operations are based on whether the structuring element
“fits” or “hits” (intersects) the neighbourhood.
Structuring elements
Hits and fits

Neither hits nor fits

HITS

FITS (completely contained or overlapped


Structuring element

 Is a small binary image


 Matrix dimension suggests the size of the structuring
element
 Pattern of ones zeros specifies the shape of structuring
element

0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 1 0 0 0 0 0 0 1 0 0 0
0 0 1 1 1 0 0 0 0 0 1 0 0 0
0 1 1 1 1 1 0 0 1 1 1 1 1 0
0 0 1 1 1 0 0 0 0 0 1 0 0 0
0 0 0 1 0 0 0 0 0 0 1 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0
Erosion

With A and B as sets in Z 2 , the erosion of A by B, denoted A - B,


defined
A - B  z | ( B ) Z  A

The set of all points z such that B, translated by z , is contained by A.


Erosion

 B is the structuring element


 Structuring element contained in set A – the elements A
and B completely overlap
 Erosion has a shrinking effect or is a thinning operation
 Origin of B visits every element in the set A
 For each location of the origin if B is completely contained
in A the location is a member of a new set otherwise not.
Courtesy: Gonzalez and woods, DIP
Erosion examples
Erosion Example
Original Image Processed Image With Eroded Pixels

Structuring Element
Erosion Example
Original Image Processed Image

Structuring Element
Dilation

2
With A and B as sets in Z , the dilation of A by B,
denoted A  B, is defined as

 
  A 
A  B= z | B
z

Dilation example (Gonzalez)
Dilation Example
Original Image Processed Image

Structuring Element
Dilation Example
Original Image Processed Image With Dilated Pixels

Structuring Element
Dilation
 Growing or thickening effect on the objects of a binary image
 The extent of thickening is a function of shape of the
structuring element used
 superimpose the structuring element on top of the input image
so that the origin of the structuring element coincides with the
input pixel position.
 If at least one pixel in the structuring element coincides with a
foreground pixel in the image underneath, then the input pixel
is set to the foreground value.
 If all the corresponding pixels in the image are background,
however, the input pixel is left at the background value.
Opening and closing (compound
operations)

 Opening: generally smoothens the contour of an object and


breaks narrow isthmuses and eliminates thin protrusions

 Closing: also smoothens the sections of contours but as


opposed to opening it generally
 fuses narrow breaks and long thin gulfs and
 eliminates small holes and fills the gaps in the contour
Opening and closing

- +

+ -
Morphological processing - example
Hit or miss transformation

 The hit-and-miss transform is a general binary


morphological operation that can be used to look for
particular patterns of foreground and background pixels in
an image.

 As with other binary morphological operators it takes as


input a binary image and a structuring element, and
produces another binary image as output.
Hit or miss transform

 Both the structuring element and the image will have both
foreground and background pixels

 In erosion and dilation the ‘0’ pixel considered to be don’t


cares or simply fillers

 Foreground pixels are 1’s and background pixels are 0’s


Hit or miss

 Translate the origin of the structuring element to all points


in the image
 Compare the elements in the structuring element and the
image
 If the foreground and background elements of structuring
element exactly coincide with the foreground and
background pixels of the image then the pixel underneath
the origin should be replaced by foreground pixel value
 If it doesn’t match replace it by background pixel value.
Example (hit or miss)
Morphological algortihms

 Background extraction
 Hole filling
 Extraction of connected components
 Convex hull
 Thinning
 Pruning
 Thickening
 skeletons
Boundary extraction

-
Boundary extraction example
Hole filling
Hole filling example (Gonzalez)
Extraction of connected components

 A be a set containing one or more connected components,

 Form an array X0 (of the same size as the array containing


A) whose elements are 0s, except at each location known to
correspond to a point in each connected component in A,
which is set to 1.
X k ( X k  1  B )  A
B : structuring element

until X k  X k -1
Extraction of connected components

You might also like