7/30/2019 Kishoe Euler
1/24
1
Euler Number Computation
ByKishore Kulkarni
(Under the Guidance of Dr. Longin Jan Latecki)
7/30/2019 Kishoe Euler
2/24
2
Outline
Connected Components & Holes
Euler Number & its significance
For Binary Images For Graphs Analogy between Euler number for graphs & binary
images
Concavities and Convexities Relation between Euler Number, Concavities & Convexities
Euler Number computation for test images.
Justification of correctness of algorithm used for computing
Euler Number
7/30/2019 Kishoe Euler
3/24
7/30/2019 Kishoe Euler
4/24
4
Euler Number
The Euler Number (also called as the connectivityfactor) is defined as the difference between
connected components and holes.Formally, Euler Number is given by
ncomp
E = ncomp
- nihole
where
i = 1
ncomp=> number of foreground connected components
nihole => number of holes for ith connected component
7/30/2019 Kishoe Euler
5/24
5
Euler Number
E = 5 11 = -6E = 11 4 = 7
7/30/2019 Kishoe Euler
6/24
6
Significance of Euler Number
Euler Number is a topological parameter, whichdescribes the structure of an object, regardless of its
specific geometric shape. Euler number (for discrete case) is a local measure
and is obtained as the sum of measures in the localneighbourhoods.
Although it is a local measure , it can be used toobtain global properties.
For objects with no holes, it can be used to calculatethe number of connected components.
7/30/2019 Kishoe Euler
7/24 7
Euler Number for Graphs
IfV, E, and F represent the set of vertices, edges and faces
respectively then for any graph we have
|V| + |F| = |E|+ Rwhere R is the Euler Number for graphs
|V| = 7, |F| = 3(or 4), |E| = 9
Euler Number ,
R = 7 + 3(or 4) 9 = 1(or 2)
depending upon whether or
not we treat the area outside the
graph as a face.
7/30/2019 Kishoe Euler
8/24 8
Equivalence of Euler Number for
graphs and Binary images
Any binary image can be represented as agraphs where Every black pixel (1) is represents the vertex of
the graph Two neighbouring black pixels (vertices of the
graphs) are joined to form an edge The Euler Number for the binary image and
its corresponding graph is the same.
7/30/2019 Kishoe Euler
9/24 9
Euler Number Contd
Consider the following image.
Euler Number E = 2 0 = 2.
For the corresponding graph,
we have
|V
| = 28, |E| = 30, |F| = 4R = 28 30 + 4 = 2
7/30/2019 Kishoe Euler
10/24 10
Convexities & Concavities
A region Ris said to be convex iff, for every
x1, x2 inR,
[x1, x2] belongs toR.
A convex hull for a region Ris defined as
the convex closure of region R.
Convexity (or the convex number) N2+
(X, )is defined as the number of first entries in the
object in a given direction .
7/30/2019 Kishoe Euler
11/24 11
Convexity & concavity.
Concavity (or the concave number) N2-(X, ) is
defined as the number of exits in a given direction .
In the following figure,
N2+(X, 90) = 3
N2
-(X, 90) = 2
7/30/2019 Kishoe Euler
12/24 12
Convexities and Concavities
For a binary image with 4-connectivity the convexities and
concavities can be represented by the following 2*2 masks.
Convexities Three 0s and one 1. Concavities Three 1s and one 0.
7/30/2019 Kishoe Euler
13/24 13
Euler Number in terms of
convexity and concavity The relationship between Euler Number,
Convexities and concavities is given by
N2(X) = N2+(X) - N2-(X)
So now we have the following relation
E = c h = v e + f = N2+(X) - N2-(X) The upstream convexity [ ] -------- (1)
The upstream concavity [ ] ----------(2)
10
00
11
10
7/30/2019 Kishoe Euler
14/24 14
Algorithm for computing Euler Number(for 4-connectivity)
For every pixel (x, y) of the image,
Do
if p(x,y) = 1 and p(x-1, y) = p(x , y-1) = p(x-1 , y-1) = 0
convexities ++
if p(x,y) = 0 & p(x+1, y) = p(x , y+1) = p(x+1 , y+1) =1
concavities ++end
Euler number = convexities - concavities
7/30/2019 Kishoe Euler
15/24 15
Euler Number for test images
Image 1:
Number of Convexities
= 74
Number of Concavities
= 74
Euler Number = 0
7/30/2019 Kishoe Euler
16/24 16
Euler Number for test images
Image 2:
Number of Convexities
= 86
Number of Concavities
= 85
Euler Number = 1
7/30/2019 Kishoe Euler
17/24 17
Euler Number for test images
Image 3:
Number of Convexities
= 135
Number of Concavities
= ?
Euler Number = ?
7/30/2019 Kishoe Euler
18/24 18
Euler Number for test images
Image 4:
Number of Convexities
= 74
Number of Concavities
= 73
Euler Number = 1
7/30/2019 Kishoe Euler
19/24
19
Euler Number for test images
Image 5:
Number of Convexities
= 27
Number of Concavities
= 16
Euler Number = 11
= Number of Objects
7/30/2019 Kishoe Euler
20/24
20
Euler Number for test images
Image 6:
Number of Convexities
= 51
Number of Concavities
= 61
Euler Number = -10Number of Holes
= 1-(-10) = 11
7/30/2019 Kishoe Euler
21/24
21
Why does this approach always
returns Euler Number ?
To prove:
Euler Number for an image = Number of upstream
convexities - Number of upstream concavities
Proof:
First we prove that Euler Number for the whole
image is the sum of Euler numbers for everycomponent. Then we prove the above equality for
one component to complete the proof.
7/30/2019 Kishoe Euler
22/24
22
Proof - Contd.
Euler number for component is given by
Ei= 1 nihole
where nihole is the number of holes in component i
Consider ncomp ncomp
Ei = (1 - nihole)
i = 1 i = 1ncomp
= ncomp - nihole
i = 1
= Eimage
7/30/2019 Kishoe Euler
23/24
23
Proof - Contd.
The upstream convexity [ ] -------- (1)
The upstream concavity [ ] ----------(2)
The first pixel with value 1 in the image
should be of type (1). Hence this convexity
refers to the connected component. Now any
pixel with the mask [ ] can(4) be a Hole
(5) be a Background
If (1) then we are done..
10
00
11
10
11
10
7/30/2019 Kishoe Euler
24/24
24
Proof - Contd.
If it is a background pixel then we have an extra concavitycount. Hence we need to prove that there exists an equivalentconvexity to balanced the same. Now if it a background pixel,then the two edges in the 2*2 mask (referring to graphicalrepresentation of a binary image) should not form a cyclewith any of the previously visited black pixels (otherwise weget a hole). If this is the case there should be a pixel with the
mask [ ]. Hence we can prove that number of concavitiesexceeding number of holes and convexities exceeding 1 areequal by similar argument.
Thus they cancel out. Hence the result.
10
00