20
International Journal of Contemporary Mathematical Sciences Vol. 11, 2016, no. 2, 65 - 84 HIKARI Ltd, www.m-hikari.com http://dx.doi.org/10.12988/ijcms.2016.5839 A Contour-Oriented Approach to Shape Analysis via the Slope Chain Code Ernesto Bribiesca Department of Computer Science Instituto de Investigaciones en Matem´ aticas Aplicadas y en Sistemas Universidad Nacional Aut´onoma de M´ exico Apdo. Postal 20-726, M´ exico, D.F., 01000, M´ exico Copyright c 2015 Ernesto Bribiesca. This article is distributed under the Creative Com- mons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited. Abstract We present a noncircularity measure for 2D (two-dimensional) shapes and an approach to the computation of the Euler number based on the Slope Chain Code (SCC). The SCC was developed for representing and analyzing open and closed curves in the 2D domain. Now, in this pa- per we describe more properties of the SCC, such as: the independence of scaling and starting point for simple closed curves, arithmetic op- erations among convex shapes, the minimum and maximum values of the proposed noncircularity measure, the computation of the number of holes in a picture, and the computation of the Euler number. Finally, in order to illustrate the capabilities of the proposed method, we present the computation of topological properties of an example of a picture of the real world. Keywords: Slope chain code, Euler number, simple closed curves, noncir- cularity measure, pictures, chain coding, tortuosity 1 Introduction Shape analysis is an important topic in pattern recognition, digital image pro- cessing [17], and computer vision. Two fundamental properties of shapes are

A Contour-Oriented Approach to Shape Analysis via the ... · A Contour-Oriented Approach to Shape Analysis ... i.e. the alphabet of the string (the chain) is nite ... The slope change

Embed Size (px)

Citation preview

Page 1: A Contour-Oriented Approach to Shape Analysis via the ... · A Contour-Oriented Approach to Shape Analysis ... i.e. the alphabet of the string (the chain) is nite ... The slope change

International Journal of Contemporary Mathematical SciencesVol. 11, 2016, no. 2, 65 - 84

HIKARI Ltd, www.m-hikari.comhttp://dx.doi.org/10.12988/ijcms.2016.5839

A Contour-Oriented Approach to Shape Analysis

via the Slope Chain Code

Ernesto Bribiesca

Department of Computer ScienceInstituto de Investigaciones en Matematicas Aplicadas y en Sistemas

Universidad Nacional Autonoma de MexicoApdo. Postal 20-726, Mexico, D.F., 01000, Mexico

Copyright c© 2015 Ernesto Bribiesca. This article is distributed under the Creative Com-

mons Attribution License, which permits unrestricted use, distribution, and reproduction in

any medium, provided the original work is properly cited.

Abstract

We present a noncircularity measure for 2D (two-dimensional) shapesand an approach to the computation of the Euler number based on theSlope Chain Code (SCC). The SCC was developed for representing andanalyzing open and closed curves in the 2D domain. Now, in this pa-per we describe more properties of the SCC, such as: the independenceof scaling and starting point for simple closed curves, arithmetic op-erations among convex shapes, the minimum and maximum values ofthe proposed noncircularity measure, the computation of the number ofholes in a picture, and the computation of the Euler number. Finally, inorder to illustrate the capabilities of the proposed method, we presentthe computation of topological properties of an example of a picture ofthe real world.

Keywords: Slope chain code, Euler number, simple closed curves, noncir-cularity measure, pictures, chain coding, tortuosity

1 Introduction

Shape analysis is an important topic in pattern recognition, digital image pro-cessing [17], and computer vision. Two fundamental properties of shapes are

Page 2: A Contour-Oriented Approach to Shape Analysis via the ... · A Contour-Oriented Approach to Shape Analysis ... i.e. the alphabet of the string (the chain) is nite ... The slope change

66 Ernesto Bribiesca

their circularity and genus, this work deals with these above-mentioned prop-erties. We proposed a measure of noncircularity and a method to compute theEuler number, both techniques are based on the Slope Chain Code (SCC) defi-nition [6, 7]. Using the SCC notation of any shape, geometrical and topologicalproperties of the shape are preserved. The SCC is similar to other chain codes[16, 4, 8] since it uses numerical sequences, but has some important differencesfrom them. The SCC of a curve is obtained by placing constant straight-linesegments around the curve (the endpoints of the straight-line segments alwaystouching the curve, so a better description of the curve is obtained), and cal-culating the slope changes between contiguous straight-line segments scaledto a continuous range from −1 to 1. The main properties of the SCC are: 1)invariant under translation; 2) independent of rotation; 3) optionally, invariantunder scaling; 4) it does not use a grid; 5) the straight-line segment size (l) isalways the same for the whole shape; 6) the range of slope changes is unlimited(goes continuously from −1 to 1); 7) the chain elements produces sequence ofdiscrete elements (a chain), i.e. the alphabet of the string (the chain) is finite.Thus, grammatical techniques [21, 30, 1] may be used for shape classification.In the content of this work, we use some of the concepts of the SCC for defin-ing our proposed measure of noncircularity and the computation of the EulerNumber.

There are many shape descriptors, such as: linearity [31], convexity [25],elongation [32], rectilinearity [37], sigmoidality [27], compactness [9], circular-ity [26, 18, 35, 28, 38, 20], and others. This work proposed a measure of non-circularity based on the SCC. Other important shape descriptor correspondsto the Euler number or genus. The Euler number is a fundamental topologicalproperty of shapes. The Euler number is a basic feature in many applications:in the recognition of industrial parts [34],in character recognition, in the com-putation of porosity of objects, in biological imaging, in graph theory, and soforth. Many authors have proposed different methods to compute the Eulernumber, for example in refs. [34, 5, 13, 24, 15, 2, 12, 11, 3, 36, 14, 10].

Some authors have used chain-code techniques to compute the Euler num-ber. For example, Using the Vertex Chain Code [8]: Wulandhari and Haron[33] proposed an interesting method to calculate the genus by means of thechain elements. They analyzed shapes with only one hole, so obtained twoVertex-Chain-Code chains of the outer and inner boundaries of the analyzedshape. Next, they add all chain elements and compare with the number ofelements of both chains multiplied by two. Liying and Xuejun [23] gave analgorithm for calculating the Euler number of image on the basis of VertexChain Code and tree structures of contours. Sossa-Azuela et. al. [29] pre-sented an interesting approach to compute the Euler number by means of theVertex Chain Code. Now, in this paper we proposed a method to compute theEuler number based on the SCC.

Page 3: A Contour-Oriented Approach to Shape Analysis via the ... · A Contour-Oriented Approach to Shape Analysis ... i.e. the alphabet of the string (the chain) is nite ... The slope change

A contour-oriented approach to shape analysis 67

In the content of this paper, definitions 2, 4, 6, and 9, propositions 7 and15 are based on refs. [6, 7]. On the other hand, definitions 1, 3, 5, 8, 10, 14,16, and 18, propositions 12, 13, and 17, theorems 19 and 20, and corollary 11are the contribution of this paper.

This paper is organized as follows. In Section 2 we describe some conceptsand definitions. Section 3 presents a summary of the SCC. Section 4 gives theproposed measure of noncircularity. In Section 5, we describe the computationof the Euler number using the SCC. Section 6 presents some results of thecomputation of topological features of an object of the real world. Finally, inSection 7 we give some conclusions.

2 Concepts and definitions

In order to introduce the proposed noncircularity measure and our approachto the computation of the Euler number using the SCC, a number of conceptsand definitions are presented below:

• Shape is referred to as shape-of-object, and an object is considered to bea geometric entity [19].

• A simple closed curve is a curve which does not cross itself.

An important assumption in this section is that an entity has been isolatedfrom the picture plane. This entity is called the curve, and is the result of aprevious process.

DEFINITION 1. A chain a is an ordered sequence of n elements, and isrepresented by

a = a1a2 . . . an = {ai : 1 ≤ i ≤ n}. (1)

DEFINITION 2. An element ai of a chain indicates the slope change of thecontiguous straight-line segments of the curve in that element position. Therange of the slope changes goes continuously from −1 to 1.

DEFINITION 3. The slope change between contiguous straight-line segmentsis ordinarily counted as positive if counterclockwise, negative if clockwise [22].

3 The Slope Chain Code

In order to have a self contained paper, this section summarizes the SCC,which was presented in refs. [6, 7] and presents new concepts which are the

Page 4: A Contour-Oriented Approach to Shape Analysis via the ... · A Contour-Oriented Approach to Shape Analysis ... i.e. the alphabet of the string (the chain) is nite ... The slope change

68 Ernesto Bribiesca

contribution of this paper. The SCC of a curve is obtained by placing constantstraight-line segments around the curve (the endpoints of the straight-linesegments always touching the curve, so a better description of the curve isobtained), and calculating the slope changes between contiguous straight-linesegments scaled to a continuous range from −1 to 1. The SCC of a curve isindependent of translation, rotation, and optionally, of scaling, which is animportant advantage in pattern recognition.

DEFINITION 4. The independence of scaling of a curve is obtaining by nor-malizing the length of its perimeter P to a fixed number m of straight-linesegments around it.

The SCC may be computed for open and simple closed curves [7]. However,in the content of this paper we only focus on simple closed curves. In orderto obtain the SCC of a continuous closed curve, first, we calculate its perime-ter P and define the number m of straight-line segments. For instance, Fig.1(a) illustrates an example of a simple closed curve. Next, we define a fixednumber m of straight-line segments to represent it. In this example, m = 20.Furthermore, we select an origin, this origin correspond to the point of maxi-mum inflection of the whole curve. In some cases, may be exist one or morepoints of maximum inflection (this is common in symmetrical curves). Thus,in order to select the appropriate origin, additional criteria must be included.

Once this length is known, i.e. l = Pm

see Fig. 1(a). The origin of the curveis represented by a point and an endpoint of one of the straight line-segmentsis set to coincide with this origin. The opposite endpoint is set over the curve,determining the starting point of the next segment, and so on. Graphically,this process amounts to superimposing a sequence of circles traversing thecurve, where the intersections of the curve and circles determine the points ofthe discrete shape (Fig. 1(a)). The radius of each circle corresponds to thelength of the previous defined segment l.

Then, the slope changes between contiguous-straight line segments are com-puted. Positive and zero slope changes are scaled to lie within the interval[0, 1); negative slope changes are scaled to lie within the interval (−1, 0] (therange of slope changes are shown in Fig. 1(b)). The sequence of slope changesis the chain which defines the discrete shape of the continuous closed curve, seeFig. 1(c). Thus, the chain of the simple closed curve shown in Fig. 1(c) is asfollows: -.2 -.2 .3 .2 .2 .3 -.2 -.2 .3 .2 .2 .3 -.2 -.2 .3 .2 .1 .1 .2 .3. Note that thechain elements in Fig. 1(c) have a predetermined accuracy (10−1) in the slopechanges; this may, of course, be changed. This accuracy generates a finitealphabet composed of 19 symbols. For instance, a predetermined accuracyequal to (10−2) produces a finite alphabet composed of 199 symbols. The dig-italization of the slope changes at different resolutions produces a sequence ofdiscrete elements (a chain), i.e. the alphabet of the string (the chain) is finite.

Page 5: A Contour-Oriented Approach to Shape Analysis via the ... · A Contour-Oriented Approach to Shape Analysis ... i.e. the alphabet of the string (the chain) is nite ... The slope change

A contour-oriented approach to shape analysis 69

Thus, grammatical techniques [21, 30, 1] may be used for shape classification.In this manner, it is possible to manipulate the advantages and disadvantagesof the continuous and discrete domains depending on the required study.

Figure 1: How to obtain the SCC of a simple closed curve: (a) a continuouscurve with a selected origin and a previous defined straight-line segment ,traversing the curve using circles (the radius of each circle is equal to thestraight-line segment length) to determine slope changes; (b) the range ofslope changes [0, 1) and (−1, 0]; (c) the discrete curve and its ordered sequenceof slope changes.

3.1 Independence of starting point for simple closedcurves

The closed curves described via the SCC may be invariant under starting point.Generally speaking, the point of maximum inflection of all the simple closedcurve corresponds to the unique starting point. However, when the above-mentioned curve is digitalized and represented by the SCC depending on theresolution may be this changed. Therefore, in order to have a unique starting

Page 6: A Contour-Oriented Approach to Shape Analysis via the ... · A Contour-Oriented Approach to Shape Analysis ... i.e. the alphabet of the string (the chain) is nite ... The slope change

70 Ernesto Bribiesca

point of any curve already represented by chain elements (see Fig. 2(a)), wedefine the following:

DEFINITION 5. A simple closed curve is invariant under starting point bychoosing the starting point so that the resulting sequence of elements forms achain of values of minimum magnitude.

Thus, in order to make a curve invariant under starting point, we have torotate the chain elements until the chain is minimum as follows:

01) -.2 -.2 .3 .2 .2 .3 -.2 -.2 .3 .2 .2 .3 -.2 -.2 .3 .2 .1 .1 .2 .302) -.2 .3 .2 .2 .3 -.2 -.2 .3 .2 .2 .3 -.2 -.2 .3 .2 .1 .1 .2 .3 -.203) .3 .2 .2 .3 -.2 -.2 .3 .2 .2 .3 -.2 -.2 .3 .2 .1 .1 .2 .3 -.2 -.204) .2 .2 .3 -.2 -.2 .3 .2 .2 .3 -.2 -.2 .3 .2 .1 .1 .2 .3 -.2 -.2 .305) .2 .3 -.2 -.2 .3 .2 .2 .3 -.2 -.2 .3 .2 .1 .1 .2 .3 -.2 -.2 .3 .206) .3 -.2 -.2 .3 .2 .2 .3 -.2 -.2 .3 .2 .1 .1 .2 .3 -.2 -.2 .3 .2 .207) -.2 -.2 .3 .2 .2 .3 -.2 -.2 .3 .2 .1 .1 .2 .3 -.2 -.2 .3 .2 .2 .308) -.2 .3 .2 .2 .3 -.2 -.2 .3 .2 .1 .1 .2 .3 -.2 -.2 .3 .2 .2 .3 -.209) .3 .2 .2 .3 -.2 -.2 .3 .2 .1 .1 .2 .3 -.2 -.2 .3 .2 .2 .3 -.2 -.210) .2 .2 .3 -.2 -.2 .3 .2 .1 .1 .2 .3 -.2 -.2 .3 .2 .2 .3 -.2 -.2 .311) .2 .3 -.2 -.2 .3 .2 .1 .1 .2 .3 -.2 -.2 .3 .2 .2 .3 -.2 -.2 .3 .212) .3 -.2 -.2 .3 .2 .1 .1 .2 .3 -.2 -.2 .3 .2 .2 .3 -.2 -.2 .3 .2 .213) -.2 -.2 .3 .2 .1 .1 .2 .3 -.2 -.2 .3 .2 .2 .3 -.2 -.2 .3 .2 .2 .314) -.2 .3 .2 .1 .1 .2 .3 -.2 -.2 .3 .2 .2 .3 -.2 -.2 .3 .2 .2 .3 -.215) .3 .2 .1 .1 .2 .3 -.2 -.2 .3 .2 .2 .3 -.2 -.2 .3 .2 .2 .3 -.2 -.216) .2 .1 .1 .2 .3 -.2 -.2 .3 .2 .2 .3 -.2 -.2 .3 .2 .2 .3 -.2 -.2 .317) .1 .1 .2 .3 -.2 -.2 .3 .2 .2 .3 -.2 -.2 .3 .2 .2 .3 -.2 -.2 .3 .218) .1 .2 .3 -.2 -.2 .3 .2 .2 .3 -.2 -.2 .3 .2 .2 .3 -.2 -.2 .3 .2 .119) .2 .3 -.2 -.2 .3 .2 .2 .3 -.2 -.2 .3 .2 .2 .3 -.2 -.2 .3 .2 .1 .120) .3 -.2 -.2 .3 .2 .2 .3 -.2 -.2 .3 .2 .2 .3 -.2 -.2 .3 .2 .1 .1 .2

Therefore, the rotation 13 indicates the sequence of the values of the chainelements of minimum magnitude. Thus, finally the chain elements: -.2 -.2 .3.2 .1 .1 .2 .3 -.2 -.2 .3 .2 .2 .3 -.2 -.2 .3 .2 .2 .3 represent the chain of thecurve illustrated in Fig. 2(b) invariant under starting point. In some cases,may exist two or more unique starting points. This is common in symmetricalcurves. Then additional criteria mus be included.

3.2 The accumulated slope, the slope change mean, andtortuosity

DEFINITION 6. The accumulated slope Acc of a chain is the sum of all theslope changes around the curve, and is defined by

Page 7: A Contour-Oriented Approach to Shape Analysis via the ... · A Contour-Oriented Approach to Shape Analysis ... i.e. the alphabet of the string (the chain) is nite ... The slope change

A contour-oriented approach to shape analysis 71

Figure 2: Independence of starting point: (a) a continuous curve with a se-lected origin and a straight-line segment, traversing the curve using circles (theradius of each circle is equal to the straight-line segment length) to determineslope changes; (b) the range of slope changes [0, 1) and (−1, 0]; (c) the discretecurve and its ordered sequence of slope changes.

Acc =n∑

i=1

ai. (2)

For example, the sum of all the slope changes shown in Fig. 2(b) is equalto 2, which corresponds to its accumulated slope.

PROPOSITION 7. The accumulated slope Acc of simple closed curves alwaysis equal to 2.

DEFINITION 8. The slope change mean am of a curve is the arithmetic meanof all the slope changes around the curve. The slope change mean is the accu-mulated slope divided by the number of elements, and is defined as follows:

am =1

n

n∑i=1

ai =1

nAcc. (3)

For example, the slope change mean of the curve illustrated in Fig. 2(b) isequal to 0.1.

DEFINITION 9. The tortuosity τ of a curve represented by a chain is the sum

Page 8: A Contour-Oriented Approach to Shape Analysis via the ... · A Contour-Oriented Approach to Shape Analysis ... i.e. the alphabet of the string (the chain) is nite ... The slope change

72 Ernesto Bribiesca

of all the absolute values of the chain elements, and is defined by

τ =n∑

i=1

|ai|. (4)

The Acc and τ are preserved at different resolutions [7]. For any curve theminimum and maximum values of τ belong to the range [0, n), respectively.For example, the numerical value of the measure of tortuosity τ of the curveshown in Fig. 2(b) is equal to 4.4.

3.3 Convex and concave shapes

A convex polygon is described as a polygon which lies entirely in one half-plane of any line containing one of its sides; also, its interior is the intersectionof half-planes determined by these lines. Otherwise it is concave [22]. Ourdiscrete shapes are considered as polygons.

DEFINITION 10. A simple closed curve is convex when the absolute value ofthe accumulated slope is equal to its tortuosity, i.e., |Acc| = τ .

COROLLARY 11. A simple closed curve is concave when the absolute valueof the accumulated slope is less than its tortuosity, i.e., |Acc| < τ .

PROPOSITION 12. The tortuosity τ of any circumference, independent of itsresolution, always is equal to 2.

PROPOSITION 13. The tortuosity τ of any square, independent of its reso-lution, always is equal to 2.

Fig. 3 shows some examples of convex and concave simple closed curves.The left-hand side of Fig. 3 describes the continuous versions of the shapesand the right-hand side the discrete versions, respectively. Taking into accountthe Preposition 7, all the accumulated slopes of all the shapes shown in Fig.3 are equal to 2. Fig. 3(a) shows two examples of convex shapes, in this casetheir values of tortuosity are equal to 2. Considering the Definition 10, theseabove-mentioned curves belong to the family of convex curves. On the otherhand, the shapes presented in Fig. 3(b) belong to the family of concave curves(Corollary 11) where the accumulated slopes of the discrete shapes are lessthan their values of tortuosity.

3.4 Arithmetic operations among convex shapes

Using the concepts of the convex shapes and the SCC, it is possible to doarithmetic operations among convex shapes. For example, the average of a cir-cumference and a square. This average never exceeds the maximum permitted

Page 9: A Contour-Oriented Approach to Shape Analysis via the ... · A Contour-Oriented Approach to Shape Analysis ... i.e. the alphabet of the string (the chain) is nite ... The slope change

A contour-oriented approach to shape analysis 73

Figure 3: Examples of convex and concave curves, the shapes shown in theleft-hand side represent their continuous versions and the shapes in the right-hand side the discrete versions, respectively: (a) the convex shapes and theirmeasures of tortuosity; (b) the concave shapes and their measures of tortuosity.

value of slope change. Fig. 4 shows different averages between a circumferenceand a square. In these mathematical operations is very important to considerboth origins of the above-mentioned curves. These arithmetic operations areperformed element by element of both chains. These simple closed curves arenormalized to have the same number of straight-line segments, i.e. they areisoperimetric.

4 The noncircularity measure

Haralick [18] states that “ a good measure for the circularity of simply closedfigures would have the following properties: 1) as a figure becomes more cir-cular, the measure of its circularity increases; 2) the values for digital figuresfollow the values for the corresponding continuous figures; 3) it is orientationindependent; 4) it is area independent”. The noncircularity measure proposedhere complies with the above-mentioned properties.

DEFINITION 14. The noncircularity measure Dc of a curve is the sum of all

Page 10: A Contour-Oriented Approach to Shape Analysis via the ... · A Contour-Oriented Approach to Shape Analysis ... i.e. the alphabet of the string (the chain) is nite ... The slope change

74 Ernesto Bribiesca

Figure 4: Examples of arithmetic operations among convex shapes.

the absolute values of the differences between the chain elements and the slopechange mean, and is defined as follows:

Dc =n∑

i=1

|ai − am|. (5)

Fig. 5 shows 13 examples of continuous closed curves from (a) to (m). Fig.6 presents the discrete versions of all the curves illustrated in 5 from figs. 6(a)to (m), respectively. These curves were normalized to 20 straight-line segmentsand their chains are as follows:

(a) .1 .1 .1 .1 .1 .1 .1 .1 .1 .1 .1 .1 .1 .1 .1 .1 .1 .1 .1 .1(b) .1 .1 .1 .1 .1 .2 -.1 .2 .1 .1 .1 .1 .1 .1 .1 .1 .1 .1 .1 .1(c) .1 .1 .1 .3 -.1 -.1 .3 .1 .1 .1 .1 .1 .1 .3 -.1 -.1 .3 .1 .1 .1(d) .1 .1 .1 .1 .8 -.1 -.1 -.1 -.1 -.1 -.1 -.1 .8 .1 .1 .1 .1 .1 .1 .1(e) .0 .0 .0 .0 .5 .0 .0 .0 .0 .5 .0 .0 .0 .0 .5 .0 .0 .0 .0 .5(f) .1 .1 .5 -.1 -.1 -.1 -.1 .5 .1 .1 .1 .1 .5 -.1 -.1 -.1 -.1 .5 .1 .1(g) -.2 -.2 .3 .2 .1 .1 .2 .3 -.2 -.2 .3 .2 .2 .3 -.2 -.2 .3 .2 .2 .3(h) .1 .7 -.1 -.1 -.1 -.1 -.1 -.1 .7 .1 .1 .1 .5 -.1 -.1 -.1 -.1 .5 .1 .1(i) .5 .0 .0 .0 .0 .5 .0 .0 .5 .5 .0 -.5 .0 .0 -.5 .0 .5 .5 .0 .0(j) .5 .5 .0 .0 .0 .0 .5 .5 .0 -.5 .0 .0 .0 .5 .5 .0 .0 .0 -.5 .0

Page 11: A Contour-Oriented Approach to Shape Analysis via the ... · A Contour-Oriented Approach to Shape Analysis ... i.e. the alphabet of the string (the chain) is nite ... The slope change

A contour-oriented approach to shape analysis 75

(k) -.1 -.1 -.1 -.1 .9 -.1 -.1 -.1 -.1 .9 -.1 -.1 -.1 -.1 .9 -.1 -.1 -.1 -.1 .9

(l) .3 .3 .3 .3 -.7 .3 .3 .3 .3 -.7 .3 .3 .3 .3 -.7 .3 .3 .3 .3 -.7

(m) .9 -.7 .9 -.7 .9 -.7 .9 -.7 .9 -.7 .9 -.7 .9 -.7 .9 -.7 .9 -.7 .9 -.7

Figure 5: 13 examples of continuous closed curves from (a) to (m).

Fig. 6 presents the examples of all the closed curves illustrated in 5 andtheir measures of toruosity and noncircularity. All the above-mentioned curvesare presented in ascending order of noncircularity. Note that the measure oftortuosity is independent of the circularity measure. The measures of tortu-osity of the curves presented in Fig. 6 are not shown in ascending order oftortuosity.

It is important to note that the noncircularity measure proposed here is acontour-oriented approach which depends on the perimeters of the analyzedshapes. This is different to other measures of circularity which are region-oriented approaches.

Page 12: A Contour-Oriented Approach to Shape Analysis via the ... · A Contour-Oriented Approach to Shape Analysis ... i.e. the alphabet of the string (the chain) is nite ... The slope change

76 Ernesto Bribiesca

Figure 6: The discrete versions of the 13 examples of curves shown in Fig. 5.These discrete curves were normalized to 20 straight-line segments.

4.1 The minimum and maximum values of the noncir-cularity measure

The minimum value of noncircularity measure is equal to zero and correspondsto the most circular shape, whose chain elements have the value of the slopechain mean each one. Fig. 6(a) represents the minimum value of the noncircu-larity measure (of course at this resolution), i.e. Dc = 0. In other words, theshape shown in Fig.6 (a) has the maximum circularity. On the other hand,the maximum value of noncircularity of any curve corresponds to the approx-imated value of n. For instance, the shape presented in Fig. 6(m) has a largevalue of the noncircularity measure. Thus, the noncircularity measure variesin a continuous range between [0, n).

Page 13: A Contour-Oriented Approach to Shape Analysis via the ... · A Contour-Oriented Approach to Shape Analysis ... i.e. the alphabet of the string (the chain) is nite ... The slope change

A contour-oriented approach to shape analysis 77

5 Computation of the Euler Number using the

Slope Chain Code

In this section, we only consider shapes with holes. The Euler number or genusis a fundamental topological property of shapes. Mathematically speaking, theEuler number E or genus is defined as number of connected regions C minusnumber of holes H and is represented as follows.

E = C −H. (6)

PROPOSITION 15. The inverse of a chain of a curve is another chain formedof the opposite-sign elements of the first chain arranged in reverse order.

DEFINITION 16. The inverse chain of a shape corresponds to a hole, in whichthe contour of the original object is preserved.

PROPOSITION 17. The accumulated slope Acc of a hole always is equal to−2.

DEFINITION 18. In order to obtain the chains of contours of shapes and holesin a picture, we always have to walk on contours holding the matter side to theleft hand and the empty side to the right hand, respectively.

THEOREM 19. The number of holes H of any shape is the minus sign of thesum of all its slope changes divided by 2 plus 1 and is defined as follows:

H = −∑n

i=1 ai2

+ 1. (7)

Proof. For the base case, when the shape has no hole the∑n

i=1 ai = 2 andtherefore using Eq. (7): H = 0. Next, when the shape has only one hole, wehave

∑ni=1 ai = 0 . Therefore, using Eq.(7) H = 1. For the next holes in the

same binary shape, according to Eq. (7) the term∑n

i=1 ai will be incrementedby −2 (Proposition 17) for each new hole in the shape, which we know is true.Q.E.D.

THEOREM 20. The number of holes H of any picture is the minus sign ofthe sum of all the slope changes of all the contours divided by 2 plus C and isdefined as follows:

H = −∑n

i=1 ai2

+ C. (8)

Proof. The proof of this theorem is similar like the proof of Theorem 19, justconsidering the variable C. Q.E.D.

Page 14: A Contour-Oriented Approach to Shape Analysis via the ... · A Contour-Oriented Approach to Shape Analysis ... i.e. the alphabet of the string (the chain) is nite ... The slope change

78 Ernesto Bribiesca

Substituting H from Eq. (8) in the Euler-number equation (Eq. (6)), wehave.

E =

∑ni=1 ai2

. (9)

For example, for the shape presented in Fig. 7, the sum of all the slopechanges is equal to −6 and C = 1. Using Eq.(8), we obtain H = 4 and theEuler number E = −3 (eqs. (6) or (9)).

Figure 7: An example of an object with four holes.

6 Results

In order to compute the number of holes and the Euler number, we show anexample of an object of the real world: a piece of polyurethan. Polyurethanesare polymers composed of units of organic chains joined by carbamate links.

Page 15: A Contour-Oriented Approach to Shape Analysis via the ... · A Contour-Oriented Approach to Shape Analysis ... i.e. the alphabet of the string (the chain) is nite ... The slope change

A contour-oriented approach to shape analysis 79

Flexible polyurethane foams are used as cushioning for a great variety of com-mercial products. In this kind of materials it is important to know the numberof holes, the hole sizes, and their porosities. Fig. 8 shows the bubbles in a pieceof polyurethan. Fig. 9. presents a slide of the piece of polyurethan shown in8, this slide was obtained as a result of a previous processing. Now, using eqs.(8) and (9) we calculate H = 31 and E = −30.

Figure 8: Bubbles in a piece of polyurethan.

Figure 9: A slide of the piece of polyurethan shown in Fig. 8.

Page 16: A Contour-Oriented Approach to Shape Analysis via the ... · A Contour-Oriented Approach to Shape Analysis ... i.e. the alphabet of the string (the chain) is nite ... The slope change

80 Ernesto Bribiesca

6.1 Comparison of the proposed method for computingthe Euler number via the SCC with others

Many authors have been proposing different techniques to computer the Eulernumber, such as: Dyer [15] presents the computation of the Euler numberof an image from its quadtree; Bieri [2] defines the computation of the Eulercharacteristic of digital objects from their bintree representation; Chiavettaand Di Gesu [12] present a method of parallel computation of the Euler numbervia connectivity graph, Diaz-de-Leon and Sossa [14] present a method to obtainthe Euler number of a binary object via its skeleton, the number of terminalpoints and the number of three-edge-points in the graph are used to computethis invariant; Bishnu et al. [3] define a pipeline architecture for computingthe Euler number of a binary image; Bribiesca [10] uses the concept of thecontact perimeter [9] to compute the Euler number, however, in this approachonly unit-width objects are considered; and others.

Some authors have used chain coding to compute the Euler number, forexample: Wulandhari and Haron [33] describe a fast algorithm to computerthe Euler number via the Vertex Chain Code. However, this method onlyconsider shapes with one hole; Liying and Xuejun [23] generate tree structuresof contours and then based on the Vertex Chain Code computes the Eulernumber; Sossa-Azuela et. al. [29] count the number of vertices “1” and “3” ofthe Vertex Chain Code and compute the number of holes by a simple formula.Chain code techniques preserve information and allow considerable data re-duction, they are another important tool to compute the Euler number in afast way. To the best of our knowledge this is the first time that the SCC isused to compute the Euler number.

7 Conclusions

A number of definitions, corollaries, and theorems are presented, which allowus to find out interesting properties, such as: the computation of a noncir-cularity measure, arithmetic operations among convex shapes, analysis of theminimum and maximum values of the proposed noncircularity measure, thecomputation of the number of holes in a picture, and the computation of theEuler number. Finally, in order to prove the above-mentioned concepts, wepresented an example of an object (a piece of polyurethan) of the real world.We have concluded that it is possible to obtain geometrical and topologicalinformation of any shape by means of its SCC description.

Suggestion for further work: extend the SCC and the above-mentionedconcepts from 2D to 3D domain.

Acknowledgements. This research work was supported by IIMAS-UNAM

Page 17: A Contour-Oriented Approach to Shape Analysis via the ... · A Contour-Oriented Approach to Shape Analysis ... i.e. the alphabet of the string (the chain) is nite ... The slope change

A contour-oriented approach to shape analysis 81

and SNI-CONACyT.

References

[1] R. Baeza-Yates and G. H. Gonnet, A new approach to text searching,Communications of the ACM, 35 (1992), no. 10, 74-82.http://dx.doi.org/10.1145/135239.135243

[2] H. Bieri, Computing the Euler characteristic and related additive func-tional of digital objects from their bintree representation, Comput. Vis.Graphics and Image Process., 40 (1987), 115-126.http://dx.doi.org/10.1016/0734-189x(87)90059-4

[3] A. Bishnu, B. B. Bhattacharya, M. K. Kundu, C. A. Murthy, T.Acharya, A pipeline architecture for computing the Euler number ofa binary image, Journal of Systems Architecture, 51 (2005), 470-487.http://dx.doi.org/10.1016/j.sysarc.2004.12.001

[4] A. Blumenkrans, Two-dimensional object recognition using a two-dimensional polar transform, Pattern Recognition, 24 (1991), 879-890.http://dx.doi.org/10.1016/0031-3203(91)90007-r

[5] J. Bogaert, P. Van Hecke, R. Ceulemans, The Euler number as an indexof spatial integrity of landscapes: evaluation and proposed improvement,Environmental Management, 29 (2002), 673-682.http://dx.doi.org/10.1007/s00267-001-0051-x

[6] E. Bribiesca, A geometric structure for two-dimensional shapes and three-dimensional surfaces, Pattern Recognition, 25 (1992), 483-496.http://dx.doi.org/10.1016/0031-3203(92)90047-m

[7] E. Bribiesca, A measure of tortuosity based on chain coding, PatternRecognition, 46 (2013), 716-724.http://dx.doi.org/10.1016/j.patcog.2012.09.017

[8] E. Bribiesca, A new chain code, Pattern Recognition, 32 (1999), 235-251.http://dx.doi.org/10.1016/s0031-3203(98)00132-0

[9] E. Bribiesca, Measuring 2-D shape compactness using the contact perime-ter, Computers and Mathematics with Applications, 33 (1997), 1-9.http://dx.doi.org/10.1016/s0898-1221(97)00082-5

[10] E. Bribiesca, Computation of the Euler number using the contact perime-ter, Computers and Mathematics with Applications, 60 (2010), 1364-1373.http://dx.doi.org/10.1016/j.camwa.2010.06.018

Page 18: A Contour-Oriented Approach to Shape Analysis via the ... · A Contour-Oriented Approach to Shape Analysis ... i.e. the alphabet of the string (the chain) is nite ... The slope change

82 Ernesto Bribiesca

[11] M. H. Chen and P. F. Yan, A fast algorithm to calculate the Eulernumber for binary images, Pattern Recognition Lett., 8 (1988), 295-297.http://dx.doi.org/10.1016/0167-8655(88)90078-5

[12] F. Chiavetta, V. Di Gesu, Parallel computation of the Euler numbervia connectivity graph, Pattern Recognition Lett., 14 (1993), 849-859.http://dx.doi.org/10.1016/0167-8655(93)90148-7

[13] M. N. DeMers, Fundamentals of Geographic Information Systems, JohnWiley & Sons, New York, 1997.

[14] J. L. Diaz-de-Leon, J. H. Sossa-Azuela, On the computation of the Eu-ler number of a binary object, Pattern Recognition, 29 (1996), 471-476.http://dx.doi.org/10.1016/0031-3203(95)00098-4

[15] Ch. R. Dyer, Computing the Euler number of an image from its quadtree,Comput. Graphics Image Process., 13 (1980), 270-276.http://dx.doi.org/10.1016/0146-664x(80)90050-7

[16] H. Freeman, On the encoding of arbitrary geometric configurations,IEEE Transactions on Electronic Computers, EC-10 (1961), 260-268.http://dx.doi.org/10.1109/tec.1961.5219197

[17] R. C. Gonzalez and R. E. Woods, Digital Image Processing, Third Edition,Pearson Prentice Hall, Upper Saddle River, New Jersey 07458, 2008.

[18] R. M. Haralick, A measure for circularity of digital figures, IEEE Trans-actions on Systems, Man, and Cybernetics, SMC-4 (1974), 394-396.http://dx.doi.org/10.1109/tsmc.1974.5408463

[19] R. M. Haralick and L. G. Shapiro, Glossary of computer vision terms,Pattern Recognition, 24 (1991), 69-93.http://dx.doi.org/10.1016/0031-3203(91)90117-n

[20] A. M. Herrera-Navarro, H. Jimenez-Hernandez, I. R. Terol-Villalobos,Framework for characterizing circularity based on probability distribu-tion, Measurement, 46 (2013), 4232-4243.http://dx.doi.org/10.1016/j.measurement.2013.08.007

[21] J. E. Hopcroft and J. D. Ullman, Introduction to Automata Theory, Lan-guages, and Computation, Addison-Wesley, 1979.

[22] W. Karush, Webster’s New World Dictionary of Mathematics. Webster’sNew World, Simon & Schuster Inc., New York, 1989.

Page 19: A Contour-Oriented Approach to Shape Analysis via the ... · A Contour-Oriented Approach to Shape Analysis ... i.e. the alphabet of the string (the chain) is nite ... The slope change

A contour-oriented approach to shape analysis 83

[23] Z. Liying, Z. Xuejun, Algorithm for Euler number of image based onchain code, Journal of Liaoning Technical University (Natural Sciences),32 (2013), 539-543.

[24] I. Pitas, Digital Image Processing Algorithms, Prentice Hall, New York,1993.

[25] E. Rahtu, M. Salo, J. Heikkila, A new convexity measure based ona probalilistic interpretation of images, IEEE Transactions on PatternAnalysis and Machine Intelligence, 28 (2006), 1501-1512.http://dx.doi.org/10.1109/tpami.2006.175

[26] A. Rosenfeld, Compact figures in digital pictures, IEEE Trans. Syst.,Man, Cybern., SMC-4 (1974), 221-223.http://dx.doi.org/10.1109/tsmc.1974.5409121

[27] P. L. Rosin, Measuring Sigmoidality, Pattern Recognition, 37 (2004),1735-1744. http://dx.doi.org/10.1016/j.patcog.2004.02.011

[28] T. Roussillon, I. Sivignon, L. Tougne, Measure of circularity for partsof digital boundaries and its fast computation, Pattern Recognition, 43(2010), 37-46. http://dx.doi.org/10.1016/j.patcog.2009.06.014

[29] J. H. Sossa-Azuela, R. Santiago-Montero, M. Perez-Cisneros, E. Rubio-Espino, Computing the Euler number of a binary image based on a vertexcodification, Journal of Applied Research and Technology, 11 (2013), 360-370. http://dx.doi.org/10.1016/s1665-6423(13)71546-3

[30] L. Sterling and E. Shapiro, The Art of Prolog, MIT Press, 1986.

[31] M. Stojmenovic, A. Naya, J Zunic, Measuring linearity of planar pointsets, Pattern Recognition, 41 (2008), 2503-2511.http://dx.doi.org/10.1016/j.patcog.2008.01.013

[32] M. Stojmenovic, J. Zunic, Measuring elongation from shape boundary,Journal Mathematical Imaging and Vision, 30 (2008), 73-85.

[33] L. A. Wulandhari, H. Haron, Characteristic of rectangular VertexChain Code for shapes with hole, 2009 International Conferenceon Information Management and Engineering IEEE, (2009), 648-650.http://dx.doi.org/10.1109/icime.2009.32

[34] H. S. Yang, S. Sengupta, Intelligent shape recognition for complex indus-trial tasks, IEEE Control Syst. Mag., 8 (1988), 23-30.http://dx.doi.org/10.1109/37.473

Page 20: A Contour-Oriented Approach to Shape Analysis via the ... · A Contour-Oriented Approach to Shape Analysis ... i.e. the alphabet of the string (the chain) is nite ... The slope change

84 Ernesto Bribiesca

[35] L.-M. Zhu, H. Ding, Y.-L. Xiong, A steepest descent algorithm for circu-larity evaluation, Computer-Aided Design, 35 (2003), 255-265.http://dx.doi.org/10.1016/s0010-4485(01)00210-x

[36] D. Ziou, M. Allili, Generating cubical complexes from image data andcomputation of the Euler number, Pattern Recognition, 35 (2002), 2833-2839. http://dx.doi.org/10.1016/s0031-3203(01)00238-2

[37] J. Zunic, P. L. Rosin, Rectilinearity measurements for polygons, IEEETransactions on Pattern Analysis and Machine Intelligence, 25 (2003),1193-1200. http://dx.doi.org/10.1109/tpami.2003.1227997

[38] J. Zunic, K. Hirota, P. L. Rosin, A Hu moment invariant as ashape circularity measure, Pattern Recognition, 43 (2010), 47-57.http://dx.doi.org/10.1016/j.patcog.2009.06.017

Received: September 11, 2015; Published: December 12, 2015