Dip 13 50

You might also like

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 50

Morphology

(in Biology)

Deals with the form & structure


of animals & plants
Mathematical
Morphology
Tool for extracting image components
Useful in the representation &
description of region shape

2
Mathematical
Morphology

Relatively separate part of image analysis

Based on the algebra of non-linear operators


operating on object shape.

In many aspects supersedes the linear algebraic


system of convolution.

3
Mathematical morphology is increasingly
becoming a popular tool for image
processing & analysis.

Unlike traditional image processing


techniques, the morphological techniques
treat an image as an ensemble of sets.

The operations are defined as an interaction


between two sets: an object and a
constructing element, and the language is
that of set theory.

4
Z : set of integers
Z2 : coordinate space (x,y)
A : a set in Z2
w = (x, y) is an element of A
w Є A
B = {w | condition }
◦ B is a set of pixel coordinates satisfying condition
AC : complement of A

5
a = (a1, a2)
Complement of set A (a is a point)
AC = { w | w A}

Difference of set A & B


A - B = { w | w є A, w B}
= A ∩ BC

Reflection of set B

Translation of set A by point z = (z1, z2)

6
7
Binary Images
Binary image
bi-valued function of x and y
morphological theory views
◦ binary image as a set of its
foreground (1-valued) pixels
◦ elements of Z2 1
1 1
1 1
1 1
8
 Set operations can be applied directly to
binary image sets.
 For example if A and B are binary
images then
C = AUB is also a binary image.
 In terms of function C is given by
1 if either A( x,y ) or B( x,y ) is 1, or both are 1
C ( x, y )  
0 otherwise

Using the set notation

C  ( x, y ) | ( x, y )  A or ( x, y )  B or ( x, y )  ( A and B )

9
Logic operations
Involving
Binary Images

Note: Here

Black represents
binary 1s

White represents
binary 0s

10
The sets of black & white pixels constitute a
description of a binary image.
Assumption: only black pixels are considered &
the others are treated as background.

The primary morphological operations are


dilation & erosion.
From these two, more complex morphological
operations are constituted.
E.g. opening, closing etc.
11
 Dilation is an operation that grows or
thickens objects in a binary image.
 The specific manner of this thickening is
controlled by a shape referred to as a
structuring element.
 The structuring element is translated
throughout the domain of the image to see
where it overlaps with 1-valued pixels. The
output image is 1 at each location of the
origin s.t. the structuring element overlaps at
least one 1-valued pixel in the input image.
12
Basic Components in Morphology
Every Operation has two elements.
1) Input Image
2) Structuring element
The results of the operation mainly
depends upon the structuring element
chosen. Origin is not a
member of the
structuring
element

Typical Structuring elements


13
X denotes the origin of the structuring element
Dilation combines two sets using
vector addition
(a, b) + (c, d) = (a+c, b+d)

14
Let,
A = {(1,0), (1,1), (1,2), (2,2), (0,3), (0,4)}
B = {(0,0), (1,0)}

Image B
Image A Structuring Dilation 15
element
Dilation
(Another way of defining it)

Theoretical way of generation:


Obtain the reflection of B about its origin
Shift this reflection by z
The dilation of A by B then is set of all
displacements z, such that B^ and A overlap by at
least one element
16
17
18
Structuring Element Decomposition
 Suppose that a structring element B can be
represented as a dilation of two structring
elements B1 and B2:
B  B1  B2
then
A  B  A  ( B1  B2 )  ( A  B1 )  B2

 That is, dilating A with B is the same as first


dilating A with B1 and then dilating the result
with B2.
 It is said that B can be decomposed into the
structring elements B1 and B2. 19
1 1 1 1
1 1 1  1 1 1 1
  
1 1 1 1

20
Dilation when the representative point is not a
member of the structuring element

Image B
Image A Structuring Dilation
element
21
Properties of Dilation
Dilation is commutative

Dilation is associative

Dilation is invariant to translation

Dilation may be expressed as a union of shifted


point sets

22
Application of Dilation
Used for bridging
gaps

B = [0 1 0; 1 1 1; 0 1 0];
23
 Shrinks or thins objects in a binary
image
 Controlled by structuring element
 Translate structuring element, check
if it entirely fits within foreground of
image

 The mathematical defination is

24
Let,
A = {(1,0), (1,1), (1,2), (0,3), (1,3), (2,3), (3,3), (1,4)}
B = {(0,0), (1,0)}

Image A Image B
Structuring
element Erosion 25
Dilation & Erosion are duals of each
other wrt set complementation &
reflection

Proof:

If (B)z is contained in set A, then

26
But the complement of the set of z’s that satisfy

is the set of z’s that satisfy

Thus,

Remember???

27
Application of Erosion
Used for eliminating
irrelevant details
It might decompose complicated
objects into several simpler ones.

28
29
30
31
Combining Dilation and Erosion
In practical applications, dilation and
erosion are used most often in various
combinations.
Three of the most common
combinations of dilation and erosion are
 Opening
 Closing
 Hit-or-miss transformation

32
If an image is eroded & then dilated (or vice-
versa), the original image is not re-obtained

33
Opening
Erosion followed by dilation
The morphological opening of A by structuring
element B is given as

Opening
Generally smoothes the contours of an object
Breaks narrow isthmuses
Eliminates thin protrusions
It is less destructive than the Erosion
34
erode then dilate
union of all translations of B that fit
entirely within A
not union of the "origins" which would
be erosion
removes small objects and restores
shape

35
Closing
Dilation followed by Erosion
The morphological closing of A by structuring
element B is given as

Closing
Also tends to smooth sections of the contours
Generally fuses narrow breaks & long thin gulfs
Eliminates small holes & fills gaps in the contour
36
If an image A is unchanged by opening with the
structuring element B, then it is called
open with respect to B
If an image A is unchanged by closing with the
structuring element B, then it is called
closed with respect to B

Opening & closing with an isotropic


structuring element is used to eliminate
specific image details smaller than the
structuring element – the global shape of the
image is not distorted

37
Geometric interpretation of Opening operation

Opening can be thought of as a fitting process


38
Geometric interpretation of Closing operation

39
40
41
Properties of
Opening Operation

is a subset (subimage) of A

If C is a subset of D, then is a subset of

The opening operation is idempotent, i.e.

42
Properties of
Closing Operation

A is a subset (subimage) of

If C is a subset of D, then is a subset of

The opening operation is idempotent, i.e.

43
The Hit-or-Miss
Transformation

A basic tool for


shape detection

It is a morphological operator for finding local


patterns of pixels
(local means the shape of the structuring
element)
44
Hit or Miss Transform
Goal
◦To find the locations in set A,
where the object X fits exactly.
◦identify isolated foreground
pixels (say, shape (subset) X) or
◦end points of line segments

W is the local background of X; it is a small window


enclosing X.

45
Erosion of A by X is the set of locations of
origin of X, such that X is completely
contained in A.

Therefore,
may be viewed geometrically as the set of all
locations of origin of X at which X found a
match (hit) in A.

46
This notion can be generalized by letting
B = (B1, B2) where

B1 is the set formed from elements of B


associated with an object (X in this case)

B2 is the set of elements of B associated with


the corresponding background (W – X).

47
The set
Contains all the (origin) points at which,
simultaneously, B1 found a match (hit) in A
and B2 found a match in Ac.

Using the definition of set difference & the dual


relationship between erosion & dilation, the
above equation can be written as:

Note: A - B = A ∩ BC
48
49
Hit: matches all 1's in B1
Erode to detect pixels with

Miss: none of 1s in B2
Erode to remove pixels with

50

You might also like