Title: Euler Number Computation
1Euler Number Computation
- By
- Kishore Kulkarni
- (Under the Guidance of Dr. Longin Jan Latecki)
2Outline
- 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
3Connected Components Holes
- Connected Components 4, 6 and 8 Connectivity.
- Holes
4Euler Number
- The Euler Number (also called as the
connectivity factor) is defined as the difference
between connected components and holes. - Formally, Euler Number is given by ncomp
- E ncomp - ? nihole where
- i 1
- ncompgt number of foreground connected components
- nihole gt number of holes for ith connected
component
5Euler Number
E 5 11 -6
E 11 4 7
6Significance of Euler Number
- Euler Number is a topological parameter, which
describes 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 local neighbourhoods. - Although it is a local measure , it can be used
to obtain global properties. - For objects with no holes, it can be used to
calculate the number of connected components.
7Euler Number for Graphs
- If V, E, and F represent the set of vertices,
edges and faces respectively then for any graph
we have - V F E R
- where 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.
8Equivalence of Euler Number for graphs and Binary
images
- Any binary image can be represented as a graphs
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.
9Euler Number Contd
- Consider the following image.
- Euler Number E 2 0 2.
- For the corresponding graph,
- we have
- V 28, E 30, F 4
- R 28 30 4 2
10Convexities Concavities
- A region R is said to be convex iff, for every
x1, x2 in R, x1, x2 belongs to R. - A convex hull for a region R is defined as the
convex closure of region R. - Convexity (or the convex number) N2(X, a) is
defined as the number of first entries in the
object in a given direction a.
11Convexity concavity.
- Concavity (or the concave number) N2-(X, a) is
defined as the number of exits in a given
direction a. - In the following figure,
- N2(X, 90) 3
- N2-(X, 90) 2
12Convexities and Concavities
- For a binary image with 4-connectivity the
convexities and concavities can be represented by
the following 22 masks. - Convexities Three 0s and one 1.
- Concavities Three 1s and one 0.
13Euler 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)
14Algorithm 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(x1, y) p(x , y1) p(x1
, y1) 1 - concavities
- end
- Euler number convexities - concavities
15Euler Number for test images
- Image 1
- Number of Convexities
- 74
- Number of Concavities
- 74
- Euler Number 0
16Euler Number for test images
- Image 2
- Number of Convexities
- 86
- Number of Concavities
- 85
- Euler Number 1
17Euler Number for test images
- Image 3
- Number of Convexities
- 135
- Number of Concavities
- ?
- Euler Number ?
18Euler Number for test images
- Image 4
- Number of Convexities
- 74
- Number of Concavities
- 73
- Euler Number 1
19Euler Number for test images
- Image 5
- Number of Convexities
- 27
- Number of Concavities
- 16
- Euler Number 11
- Number of Objects
20Euler Number for test images
- Image 6
- Number of Convexities
- 51
- Number of Concavities
- 61
- Euler Number -10
- Number of Holes
- 1-(-10) 11
21Why 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 every
component. Then we prove the above equality for
one component to complete the proof.
22Proof - 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 1
- ncomp
- ncomp - ? nihole
- i 1
- Eimage
23Proof - 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 - be a Hole
- be a Background
- If (1) then we are done..
24Proof - Contd.
- If it is a background pixel then we have an
extra concavity count. Hence we need to prove
that there exists an equivalent convexity to
balanced the same. Now if it a background pixel,
then the two edges in the 22 mask (referring to
graphical representation of a binary image)
should not form a cycle with any of the
previously visited black pixels (otherwise we get
a hole). If this is the case there should be a
pixel with the mask . Hence we can prove
that number of concavities exceeding number of
holes and convexities exceeding 1 are equal by
similar argument. - Thus they cancel out. Hence the result.