Affine Shape Comparison Using Different Distances

In this work, we propose to compare affine shape using Hausdorff distance (HD), Dynamic Time Warping (DTW), Frechet (DF), and Earth Mover distance (EMD). Where there is only a change in resolution shape distance are computed between shape coordinates because the distance is not invariant under rotation or affinity. In case of transformation, distances are calculated not between shape coordinates but between Arc length or Affine Arc length. Arc length is invariant under rotation while Affine Arc length is invariant under affinity. The main advantage is invariance under change of resolution, rotation, and affinity. Keywords— HD; EMD; DF; DTW; invariant; arc length; affine arc length.


I. INTRODUCTION
A study of affine shape is needed in certain problems that arise in bioinformatics and Pattern Recognition. The affine shape of finite point configurations has been introduced and studied in a series of papers by Sparr [1], [2]. In [2] a reconstruction algorithm, by using affine shape, has been proposed. To retrieve an image from a large database, we need shape descriptors that have sufficient discriminatory properties and are robust to noise. These descriptors should be invariant to translation, rotation, scale and also affinity.
Shape matching is a fundamental problem in computer vision: given two shapes and , one wants to determine how closely resembles , according to some distance measure between the shapes. In order to measure the similarity of and independently of transformations such as translations or rotations and affinity. The problem has received a lot of attention, both in the computer vision and computational geometry community; see the surveys by Hagedoorn and Vetkamp [3] and Alt and Guibas [4]. An efficient and robust shape representation method for shape similarity retrieval is proposed by Abbasi et al [5].
In [6] examine the performance of the representations under affine transformation. The paper [7] introduces a new technique for multi-scale curvature computation on a smoothed 3-D surface.
In this paper, we evaluate each metric in two ways. We first examine the distances produced when the metric is used to discriminate one shape from another. We then examine the metric under transformations and under change of resolution. Figure 1 presents all the possible scenario to compare two shapes.
The remainder of this paper is organized as follows: In Section II, we briefly provide background information on Frechet distance, Earth Mover distance, Dynamic time warping and Harsdorf distance. The remainder of this paper is organized as follows: In Section II, we briefly provide background information on Frechet distance, Earth Mover distance, Dynamic time warping and Harsdorf distance. In Section III, we use Arc length or Affine Arc clength to compare between shapes under similitude or affinity transformation, section IV presents some experiments results and discussion. Finally, we conclude the work and highlight some possible perspectives in Section V.

A. Frechet distance
The Frechet distance is a measure of similarity between curves that take into account the location and order of the points along the curves. It is named after Maurice Frechet [8].
Let X and X % be two given curves.
Then, the Frechet distance between X and X % is defined as the infimum over all reparameterizations α and β of [0,1] of the maximum over all [0,1] t ∈ of the distance between ( ( )) X t α and ( ( )) X t β % .
In mathematical notation, the Frechet distance ( , ) F X X % can be expressed as: where d is a distance function. For two curves X and X % of lengths m and n respectively, discrete distance ( , ) DF X X % is given by In the experiments, we choose n=31 and m=51 sizes for original curve and for the same curve but with another resolution.

B. Earth mover distance
The Earth Mover's Distance (EMD) [9] is a method to evaluate dissimilarity between two multidimensional distributions in some feature space where a distance measure between single features, which we call the ground distance is given. This can be formalized as the following linear programming problem: The first constraint allows moving supplies from X to X % and not vice versa. The next two constraints limits the amount of supplies that can be sent by the clusters in X to their weights, and the clusters in X % to receive no more supplies than their weights; and the last constraint forces to move the maximum amount of supplies possible. We call this amount the total flow. Once the transportation problem is solved, and we have found the optimal flow * F , the earth mover's distance is defined as the work normalized by the total flow: C. Dynamic type warping Dynamic time warping (DTW) [10] is an algorithm for measuring the similarity between two temporal sequences which may vary in time or speed. The following code (Algorithm 2) illustrates the implementation of the dynamic time warping algorithm.   [11] is a mathematical construct to measure the "closeness" of two sets of points that are subsets of a metric space.
Let X and X % be two 2D curves. We define their where sup represents the supremum and inf the infimum.

E. Chamfer distance
Given a neighbourhood and associated move lengths, the chamfer distance [12] between X and X % relative to this neighbourhood is the length of the shortest digital arc form X and X % .

III. SIMILITUDE AND AFFINITY TRANSFORMATIONS
In case there is no transform between X and X % we can use directly HD, EMD, DF, and DTW. In case there is a transformation we must first extract invariant signatures against this transformation, then we compare these signatures. Among these signatures, we can use arc length in case rotation, and affine arc Length in affinity case.

A. Similitude and Arc length invariance
Curvature: Let X be a smooth curve with position vector ( ) r s r where s is the arc length parameter. The curvature k of X is defined by: where T r is the unit tangent vector. If a curve X is defined parametrically by x(t) and y(t), then its arc length is defined by Then cos sin sin cos Here x & denotes the first derivative of x and x && denote second derivative. The main disadvantage of the affine length is that its computation requires higher order derivatives. The computation starts from convolving each coordinate x(t) and y(t) of the curve with a Gaussian function ( , ) g t σ . In continuous form we have: x t x t g t y t y t g t Where ⊗ denote convolution operator.
x & , x && denote respectively first and second derivative approximation. The

1D Gaussian function ( , )
g t σ of width σ is defined as follow: Under general affinity coordinated in the two images are related by the formula: The equation (16) y a x a y a x a y a x a y   a a xx a a xy a a yx a a yy a a xx a a xy a a yx a a

IV. EXPERIMENTAL RESULTS AND DISCUSSION
In order to demonstrate the effectiveness of the proposed methods, we use the different distances HD, EMD, DTW, and DTW. However, distances EMD, HD, DF and DTW depends on the starting point, for instance, two visually similar curves but a shift can have a very large distance (see Figures 8 and 9). Figure 8 shows the shift between Arc Length, coordinates in case of resolution. It is clear from Table 1 and Table 4 that DF gives good results then DTW doesn't.

A. Curve with resolution and noise
If no transformations are possible between X and X % , then we can use directly HD, EMD, DF, and DTW between coordinates; if there is only change in resolution for the shape we compute a distance between shape coordinates because the distance is not invariant under transformation e.g. rotation. As shown in Figure 2; the curve 2.b) is the same as 2.a) but with another resolution, 2.c) noisy curve and 2.d) affinity curve. Tables 1, 2, 3 and 4 present some results.

B. Arc length invariant under rotation
In case there is a transformation we must extract invariant signature against the transformations, then we compare these signatures, for example for our case: a rotation we propose first to extract a quantity invariant with respect to rotation, then secondly we calculate HD, EMD, DF between these invariant, among these signatures we can use Arc Length, and Affine Arc Length. Also, in general if there is transformation distances are calculated not between shape coordinates but between Arc length. Figure 3 shows a curve and its transformed (rotation). Figure 4 shows the Arc length for curves in Figure 3. Table 5 presents a different distance between the curve and its transformed. In Table 6 Figure 5 shows a curve and its transformed (affinity). Figure 6 shows the Affine Arc length for curves in Figure 5. In Table 7 different distance between the curve and its transform are presented. In Table 8 different distance between Affine Arc length are presented.

V. CONCLUSIONS AND FUTURE WORKS
In this paper we have presented a comparison affine shape with different types of distances. We showed that DTW, HD, EMD, and DF are not invariant under rotation and affinity. If no transformation is possible between curves, we can use directly HD, EMD, DF, and DTW. In case there is a transformation we extract invariant signature, then we compare these signatures. But using Arc length and Affine Arc length invariance is assured respectively for rotation and affinity. Where there is shift DTW is not suitable. As future perspectives, we are working on integrating our study in the context of a 3D object.