Polygon Matching and Indexing Under Affine Transformations

04/18/2013 ∙ by Edgar Chávez, et al. ∙ UMSNH Universidad Nacional Autonoma de Mexico 0

Given a collection {Z_1,Z_2,...,Z_m} of n-sided polygons in the plane and a query polygon W we give algorithms to find all Z_ℓ such that W=f(Z_ℓ) with f an unknown similarity transformation in time independent of the size of the collection. If f is a known affine transformation, we show how to find all Z_ℓ such that W=f(Z_ℓ) in O(n+(m)) time. For a pair W,W^' of polygons we can find all the pairs Z_ℓ,Z_ℓ^' such that W=f(Z_ℓ) and W^'=f(Z_ℓ^') for an unknown affine transformation f in O(m+n) time. For the case of triangles we also give bounds for the problem of matching triangles with variable vertices, which is equivalent to affine matching triangles in noisy conditions.



There are no comments yet.


page 1

page 2

page 3

page 4

This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

The problem of matching point sets under similarities and affine transformations has been addressed by matching sets of triangles, extracted in a consisting way, from the point sets [5]. In this work we propose a technique to matching arbitrary polygons under affine transforms, and as a particular case triangles in noisy conditions.

We will identify points in the plane with the corresponding complex numbers . A polygon in the plane will be an ordered set of points, or complex numbers. Since the set is arbitrary, self intersection and crossings are allowed.

An affine transformation can be (uniquely) written as

where and . Here stands for the complex conjugated of .

Given polygons and with and complex numbers, the problem consist in determining if there exists an affine transformation such that . Since the affine transformation have three complex parameters, it is enough to find two corresponding triples of consecutive points in both polygons. A naïve procedure will be to fix a triple in and try all the shifts in to find the correspondence. This takes operations.

Now assume we have a given collection of polygons and a query polygon , and want to know which of the are affine images of . Using a sequential approach and the simple procedure above the solution can be found in operations. In general, without an index, the complexity will depend linearly on the number of polygons in the collection; multiplied by the complexity of an individual match. We will show how to improve this complexity using invariants.

2 Invariants

We split the invariant in two cases because similarity transformations (rotations, translations, scaling and compositions between them) have relevance per se.

2.1 A Similarity Invariant for Polygons

Let and be integers, with , and let be a permutation. Consider functions given by

where .

The function is well-defined except on

but is a

dimensional vector subspace with null measure in

. Similarly, is well-defined except on a dimensional vector subspace.

Notice that is invariant under the action of similarity transformations on polygons with vertices:

It is also clear that is invariant under the action of similarity transformations:

2.2 An Affine Invariant for Polygons

In this section, denotes either or . Let and , where is an affine transformation. By making and if , or by making and if , we obtain


That is, the number does not depend neither on the -agon nor on the numbers and , nor on the permutation ; it just depends on .

Please notice that similarity invariance in section 2.1 can be obtained from the above taking .

Remark 2.1.

The numerator and denominator involved in the definition of are coefficients of the polygon appearing when it has expressed in certain basis of , namely the basis of star-shaped polygons (see [2], [4, proof of Proposition 3]).

Remark 2.2.

Equality (2.1) is analogous to a well-known result from Teichmüller theory: if we deform the complex structure of a torus by an affine transformation , then the Teichmüller distance between and does not depend of , it just depends on (see [3, chapter V.6] for instance).

2.3 Shifts

A polygon can be enumerated in different cyclic ways or shifts. Notice that , hence we have the equality of potencies


for any , where the subscripts are taken mod .

Remark 2.3.

In what follows we use functions of the form because does not satisfies an identity of the form (2.2) for a general permutation . Each one of the instances of , where ranges in , can be used in the below algorithms for matching polygons. Since they will be used as hashing functions, collisions can be avoided by using multiple instances.

2.4 An Index for Matching Polygons

Assume that a collection of different polygons of edges is given. By a preprocessing step we compute pairs . Assume that a query polygon is given and that the objective is to find all the polygons in the collection such that for some unknown similarity transformation . Using the result from section 2.3, this corresponds to all the polygons such that , assume there are of them. They can be found in operations. Please notice that this search can be implemented using hashing in time independent of the size of the collection.

If the parameters of the affine transformation are known, then all the matching polygons such that can be easily found. Using the result from section 2.2 we compute . If the polygons match, then , where . We can retrieve candidate objects in sublinear time using a spatial access method (e.g. kd-trees), or a metric index [1]. The corresponding candidate objects in the complex plane will be arranged as a circle surrounding the query polygon . Using an index, e.g. kd-trees, the complexity bound of the search will be with the number of edges of the polygon, and the number of polygons in the collection and the cost of checking the matching between a pair of polygons.

2.5 An Index for Matching Pairs of Polygons

If the affine transformation is unknown, the search space cannot be bounded using invariant 2.2. However, the problem can be solved if we have a pair of polygons. Let and be two -sided query polygons, we want to obtain all polygons such that and for some unknown affine transformation . We compute and . Let and with . Abusing the notation, let and . Using the result from section 2.2, what we need is the intersection of the two sets above . The polygons in the intersection are candidates for matching. The algorithm above needs operations. To finish the procedure, match verifications of the polygons in the intersection are needed.

2.6 Collisions

For two unrelated polygons it is possible that they collide, i.e. without being an affine related. This increase the candidate objects to be reviewed in algorithms above. To decrease the number of candidates we can use multiple instances of . Let be the collection of instances of the affine invariant functions, and the respective lists of candidates. The true matches should be in the intersection. Notice that it is not necessary to use all the functions, only a subset of them.

3 Noisy Polygons

A slightly more general setup is when there is an unknown noise function in the matching. The image of the query polygon is an affine transformation plus noise, namely . We have bounded the difference for the case of triangles, this is explained below. We were not able to give a tight bound for general polygons. To simplify notation, and will be denoted respectively by and in what follows.

3.1 Triangles with Variable Vertex

For the similarity class of a triangle we can choose a representative of the form . The complex number is determined as . Let us define . This is the unique conformal biyection such that


The order 3 ‘rotation’ of , with fixed point , corresponds to cyclic relabelling of the vertices of a triangle, because the triangles , and are similar. We use the term ‘rotation’ because is a rotation by angle .

We shall proof an estimation for perturbations of an equilateral triangle. For a real number

we consider the polydisc


Triangles can be seen as perturbations of the equilateral triangle .

Lemma 3.1.

for any .

Here stands for the product of and a convergent power series in .


First we claim that if we see triangles as triangles in the form , then lies in the non-shaded region showed in fig. 2, which will be described below. To proof the claim, note that the length of the longest edge of a triangle with vertices in is at most , and the length of the shortest edge is at least . It follows that


with . Apollonius’ theorem says that if , then the locus is an euclidean circle centered at the real axis. Since is a positive oriented triangle, we have that the imaginary part of is positive. Inequalities (3.3) imply that can not lay in the shaded regions of fig. 1, and can not lay in the rotations by and of the shaded regions. Hence should lay in a curvilinear hexagon ‘centered’ at (see fig. 2). The claim is proved.

Figure 1: The Apollonian circles and , where and , which have respectively diameter and with .
Figure 2: Curvilinear hexagon centered at with a symmetry group .

To conclude the proof of the lemma, consider the vertex

showed in fig. 2. The points are also vertices of the curvilinear hexagon. The transformationation maps the circle through onto a circle of radius

centered at the origin.

We have , and with is a degenerated triangle.

The first two coefficients of the Taylor series result from a straightforward calculation. ∎

Now we deal with perturbations of a general triangle .

Notice that the unique affine transformation that takes the equilateral triangle to a non-degenerated triangle is


In order to give a geometric interpretation to the affine transformation , we set , and . Then is equal to

Therefore maps a circle of radius onto an ellipse with major axis of length inclined at angle with the real axis, and minor axis of length . It is convenient introduce to denotes the open (i.e. without boundary) ellipse with major axis of length inclined at angle with the real axis, minor axis of length , and centered at the point . The proof of the next result is immediate from the above geometric interpretation for affine transformations.

Lemma 3.2.

Given and a non-degenerated triangle, we set

with . Let where . Then the affine transformation such that takes to maps triangles with vertices in (see eq. (3.2)) onto triangles with vertices in .

By the proof of lemma 3.1, triangles are similarity equivalent to triangles with in a region inside the circle through , where

and this circle is mapped by to a circle centered at the origin. Circles centered at the origin are preserved under multiplication by , therefore is preserved under . Hence is a circle with diameter between and

The hypothesis in the next result are the same as in the previous lemma.

Theorem 3.3.

Given and a non-degenerated positively oriented triangle , we set

with . Let where . Then the triangles with vertices in are similar to triangles with in a region inside of the ellipse



We saw above that triangles are similar to triangles with inside the circle of radius

centered at ; but now we are concerned with triangles with vertices in .

Let be an affine transformation of the form on . We have , which is similar to . That is, the affine transformation , acting on the three vertices of the triangles, translates to the affine transformation acting on the vertex of . We apply this remark to the transformation where and are the affine transformations which maps respectively to and to . For this , the corresponding is

Finally, the circle is mapped by to the ellipse


Remark 3.4.

To obtain a bound for the image under of triangles with vertices in , it is sufficient apply the transformation (see equation (3.1)) to the ellipse

of theorem 3.3.


  • [1] E. Chávez, G. Navarro, R. Baeza-Yates, and J.L. Marroquin, Searching in metric spaces, ACM Computing Surveys 33 (2001), no. 3, 273–321.
  • [2] J. Chris Ficher, D. Ruoff, and J. Shilleto, Perpendicular polygons, Amer. Math. Monthly 92 (1985), no. 1, 23–37.
  • [3] Olli Lehto, Univalent functions and teichmüller spaces, Graduate Text in Mathematics, vol. 109, Springer-Verlag, 1987.
  • [4] Jorge L. López-López, The area as a natural pseudo-Hermitian structure on the spaces of plane polygons and curves, Diff. Geom. Appl. 28 (2010), no. 5, 582–592.
  • [5] Barbara Zitová and Jan Flusser, Image registration methods: a survey, Image and Vision Computing (2003), no. 21, 977–1000.