You are on page 1of 38

Binary and Gray level

Mathematical Morphology
K.Narasimhan
APIII/ECE
Morphology: a branch of biology that deals with
the form and structure of animals and plants

used to extract image components that are useful in the
representation and description of region shape, such as
boundaries extraction
skeletons
convex hull
morphological filtering
thinning
pruning
Mathematical Morphology
mathematical framework used for:
pre-processing
noise filtering, shape simplification, ...
enhancing object structure
Skeletonization, convex hull...
Segmentation
watershed,
quantitative description
area, perimeter, ...
} , | {

B for b b w w B e e =
} , | { ) ( A for a z a c c A
z
e + e =
Reflection and Translation
6
Example
Does the structuring element hit the set?
dilation of a set A by structuring element B: all z
in A such that B hits A when origin of B=z


grow the object
}

{ A ) B z|( B A
z
= =
Dilation
Does the structuring element fit the set?
erosion of a set A by structuring element B: all z
in A such that B is in A when origin of B=z


shrink the object
} { A z|(B) B A
z
_ =
Erosion
erosion
removal of structures of certain shape and size,
given by SE
Dilation
filling of holes of certain shape and size, given by SE
useful
Erosion and Dilation Example
(a) images of squares of size 1,3,5,7,9,15 pixels on the side.
(b) erosion of (a) witha structuring element of 1s,13 pixels on the side.
(c) Dilation of (b) with the same structuring element.
Skeletonization:
To reduce all objects in an image to lines, without changing the essential
structure of the image, use the bwmorph function. This process is known
as skeletonization.
BW1 = imread('circbw.tif');
BW2 = bwmorph(BW1,'skel',Inf);
imshow(BW1); figure, imshow(BW2)




Circbw.tif Before and After

Skeletonization


erosion followed by dilation, denoted


eliminates protrusions
breaks necks
smoothes contour
B B A B A = ) (
Opening
dilation followed by erosion, denoted


smooth contour
fuse narrow breaks and long thin gulfs
eliminate small holes
fill gaps in the contour
B B A B A = - ) (
Closing
Properties of Opening & Closing

Opening

AB is a subset (subimage) of A
If C is a subset of D, then CB is a subset of DB
(A B) B = A B

Closing

A is a subset (subimage) of A B
If C is a subset of D, then C B is a subset of D B
(A B) B = A B
Note that multiple openings or closings have no effect
after the operator has been applied once
Duality
Opening and closing are dual with respect to
complementation and reflection
)

( ) ( B A B A
c c
= -
Smoothing, gradient, top-hat
Smoothing:
s = (f o b) - b
Top-hat:
h = f-(f o b)
Gradient:
g = (f b) -(f O b)
In mathematical morphology and digital image processing, top-hat transform is an
operation that extracts small elements and details from given images.

There exist two types of top-hat transform: The white top-hat transform is defined as
the difference between the input image and its opening by some structuring element;

The black top-hat transform is defined dually as the difference between the closing and
the input image.

Top-hat transforms are used for various image processing tasks, such as feature
extraction, background equalization, image enhancement, and others.
) ( ) ( B A A A = |
Boundary Extraction
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

It is actually the basic operation of binary morphology since almost all the other
binary morphological operators can be derived from it.

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-and-miss Transform, Hit-or-miss Transform
Hit-or-Miss Transformation

In general, let B=(B1, B2)

B1 is the set associated with an object and

B2 is the set associated with the corresponding background

You might also like