Threefold Symmetry Detection in Hexagonal Images

0 downloads 0 Views 592KB Size Report
Feb 11, 2015 - Dummit, D.S., Foote, R.M.: Abstract Algebra. John Wiley&Sons (2004). 16. Campello de Souza, R.M., de Oliveira, H.M., Silva, D.: The Z ...
Threefold Symmetry Detection in Hexagonal Images Based on Finite Eisenstein Fields Alexander Karkishchenko1 and Valeriy Mnukhin1 Southern Federal University, 105/42, Bolshaya Sadovaya, 344006, Rostov-na-Donu, Russia, [email protected] [email protected]

Abstract. This paper considers an algebraic method for symmetry anal-

ysis of hexagonally sampled images, based on the interpretation of such images as functions on "Eisenstein elds". These are nite elds GF(p2 ) of special characteristics p = 12k + 5, where k > 0 is an integer. Some properties of such elds are studied; in particular, it is shown that its elements may be considered as "discrete Eisenstein numbers" and are in natural correspondence with hexagons in a (p × p)-diamond-shaped fragment of a regular plane tiling. The concept of logarithm in Eisenstein elds is introduced and used to dene a "log-polar"-representation of hexagonal images. Next, an algorithm for threefold symmetry detection in gray-level images is proposed.

Keywords: image analysis, threefold symmetry, hexagonal image, Eisenstein numbers, nite elds, log-polar coordinates, polar representation

1 Introduction Symmetry is a central concept in many natural and man-made objects and plays a crucial role in visual perception, design and engineering. That is why symmetry detection and analysis is a fundamental task in such elds of computer science as machine vision, medical imaging, pattern classication and image database retrieval [1,2]. Numerous applications have successfully utilized symmetry for model reduction [3], segmentation [4], shape matching [1], etc. When discussing image symmetries, the crucial dierence between continuous and discrete cases must be taken into account. Indeed, a continuous object can be characterized by its symmetry group, which is invariant to rotation, scale and translation transformations. At the same time, for digital images we may talk only about some measure of symmetry, which depends on rotations and scaling. For example, rst three parts of Fig. 1 demonstrate eects of rotation on digital images with square sampling lattice. To reduce the eects, one can use hexagonal lattice-based images, see the right side of Fig. 1. Indeed, it is known [14] that hexagonal lattice has some advantages over the square lattice which can have implications for analysis of images dened on it. These advantages are as follows:

Fig. 1. Change of symmetry measure under rotations • Isoperimetry. As per the honeycomb conjecture, a hexagon encloses more area than any other closed planar curve of equal perimeter, except a circle. • Additional equidistant neighbours. Every hexagonal pixel has six equidistant neighbours with a shared edge. In contrast, a square pixel has only four equidistant neighbours with a shared edge or a corner. This implies that curves can be represented in a better fashion on the hexagonal lattice. • Additional symmetry axes. Every hexagon in the lattice has 6 symmetry axes in contrast with squares, which have only 4 axes. This implies that there will be less ambiguity in detecting symmetry of images. In general, the hexagonal structure provides a more exible and ecient way to perform image translation and rotation without losing image information [28]. A considerable amount of research in hexagonally sampled images processing (HIP) is taking place now [14] despite the fact that there are no hardware resources that currently produce or display hexagonal images. For this, software resampling is in use, when the original data is sampled on a square lattice while the desired image is to be sampled on a hexagonal lattice. Moreover, hybrid systems involving both types of sampling are useful for taking advantage of both in real-life applications. (Note that for the sake of brevity, the terms square image and hexagonal image will be used throughout to refer to images sampled on a square lattice and hexagonal lattice, respectively.) When developing algorithms for image analysis, both in square and hexagonal grid, it is quite common to proceed on the assumption of continuity of images. Then powerful tools of continual mathematics, such as complex analysis and integral transforms, can be eciently used. However, its application to digital images often leads to systematic errors associated with the inability to adequately transfer some concepts of continuous mathematics to the discrete plane. As examples we can point to such concepts as rotation in the plane and the polar coordinate system. Being natural and elementary in the continuous case, they lose these qualities when one tries to dene them accurately on a discrete plane. As a result, formal application of continuous methods to digital images could be complicated by systematic errors [5,6]. This raises the issue of the development of methods initially focused on discrete images and based on tools of algebra and number theory. One of such methods is considered in this paper. It is based on the interpretation of hexagonal images as functions on "Eisenstein elds". These are nite elds

GF(p2 ) of special characteristics p = 12k +5, where 0 ≤ k ∈ Z. We show that elements of such elds may be considered as "discrete Eisenstein numbers" and are in natural correspondence with hexagons in a (p × p)-diamond-shaped fragment of a regular plane tiling. Hence, non-negative functions on Eisenstein elds may be considered as hexagonal images of prime "sizes" p = 5, 17, . . . , 113, . . . , 257, ets. (Note that this is not a limitation since every image can be trivially extended to an appropriate size.) The signicance of such approach is based on the fact that nite Eisenstein elds inherit some properties of the continuous complex eld. In particular, we show that the concept of principal value complex logarithm can be transferred to Eisenstein elds. As an immediate result, we derive discrete "logpolar"-coordinates in hexagonal images. It occurs that the corresponding "logpolar"-representation of hexagonal images can be used for the analysis of their symmetry in the same fashion as for continuous images in [2,5,6,7] and for squaresampled digital images in [17,20,21,22,23]. In this paper we consider the most simple case of threefold symmetry detection, which, nevertheless, has important practical applications. The proposed algorithm is optimal for hexagonal images but can be also used for regular square images after resampling (in fact, that is how examples of the last section have been worked out).

2 Background A lot of research has been done in the areas of symmetry detection (see, for example, [1-5]) and of hexagonal image processing, but only a few, if any, have been deal with symmetry of hexagonal images (in any case, the book [14], which seems to be the most exhaustive HIP survey at the moment, contains no references to the subject). Possibly it is related with the fact of existence dierent addressing schemes in hexagonal lattices. In particular, I. Her suggested 3-coordinate scheme that exploits the implicit symmetry of the hexagonal lattice and introduced a series of geometric transformations such as scaling, rotation and shearing on the corresponding 3-coordinate system ([14, p. 20], [27]), but apparently not studied symmetry of hexagonal images; see also [28]. In this paper we exploit nite elds to produce a new coordinate scheme in fragments of hexagonal lattices. It should be noted that there has been a signicant amount of work in applications of algebraic structures and numbertheoretic transforms in image processing; such methods have been around for 40 years [26] now and have received extensive theoretical and experimental treatment [24,25]. In particular, in 1993 H.G. Baker [19] proposed the ring of Gaussian integers for square image processing; later "nite complex elds" were in use [18,21,22,23,20,16]. Nevertheless, applications of "nite Eisenstein elds" in HIP seem to be new. The threefold symmetry detection is currently claimed in various areas of crystallography [9,10], virology [11], analysis of electron microscope images [12],

Fig. 2. Examples of EM-images with local three-fold symmetry. From left to right:

a-b) electron diraction pattern of a nickel titanium crystal and of P bCr3 S4 crystals; c) high-resolution transmission electron microscope image of a P bCr3 S4 crystal (from http://www.mineralsocal.org/micro/ and http://www.globalsino.com/EM/).

ets. In particular, Fig. 2 demonstrates some examples of EM images with local threefold symmetry.

3 Finite Fields of Eisenstein Integers Let Z and C be the ring of integers and the complex eld respectively, let Zn = Z/nZ be a residue class ring modulo an integer n ≥ 2, and let GF(pm ) be a Galois eld with pm elements, where p is a prime and m > 0 is an integer. In number theory [13, Ch. 1.4] a Gaussian integer is a complex number z = a + bi ∈ C whose real and imaginary parts are both integers. Further, Eisenstein integers are complex numbers of the form z = a + bω , where a, b ∈ Z and ω = exp(2πi/3) ∈ C is a primitive (non-real) cube root of unity, so that ω 3 = 1 and ω 2 + ω + 1 = 0. Note that within the complex plane the Eisenstein integers may be seen to constitute a triangular lattice, in contrast with the Gaussian integers, which form a square lattice. Both Gaussian and Eisenstein integers, with ordinary addition and multiplication of complex numbers, form, respectively, subrings Z[i] and Z[ω] in the eld C. Unfortunately, lack of division in these rings signicantly restricts its applicability to image processing problems [19]. So it is natural to look for nite elds, whose properties would be in some respect similar to properties of Z[i] and Z[ω]. In fact, it is known that if p is a prime number such that p ≡ 3 mod 4, def

then the factor ring C(p) == Zp [x]/(x2 + 1) ' GF(p2 ) is a "nite complex eld". Its applications in analysis and processing of square sampled digital images have been considered in [16,18,20,21,22,23]. We will use now the similar approach to construct "nite elds of Eisenstein integers". Indeed, it easy to show that if p = 12k + 5 is a prime, then the polynomial x2 + x + 1 is irreducible over Zp but x2 + 1 = 0 is not. As an immediate corollary, the next denition follows.

Fig. 3. The nite Eisenstein eld E(5).

Denition 1. Let p ≥ 5 be a prime number such that p ≡ 5 (mod 12). Then

the nite eld

def

E(p) == Zp [x]/(x2 + x + 1) ' GF(p2 )

will be called Eisenstein eld. Elements of E(p) will be called discrete Eisenstein numbers. Thus, Eisenstein elds have p2 elements, where

p = 5, 17, 29, 41, 53, 89, 101, 113, 137, 149, 173, 197, 233, 257, . . . . In particular, there are 44 elds E(p) for 5 ≤ p < 1000. Elements of Eisenstein elds are of the form z = a + bω , where a, b ∈ Zp and ω denotes the class of residues of x, so that ω 2 + ω + 1 = 0. The product of a + bω ∈ E(p) and c + dω ∈ E(p) is given by

(a + bω)(c + dω) = (ac − bd) + (bc + ad − bd)ω, the addition is straightforward. The number z ∗ = a + bω 2 = (a − b) − bω ∈ E(p) is conjugate to z , and the product zz ∗ = a2 − ab + b2 ∈ pZp is the norm N (z) of z . (Note that in E(p) the concept of modulus |z| = N (z) is not dened.) It is easy to show that N (z1 z2 ) = N (z1 )N (z2 ) and N (z) = 0 ⇔ z = 0. Thus, nonzero elements z 6= 0 have inverses z −1 = z ∗ N (z)−1 , and so division is dened in E(p).

4 Polar Decompositions of Eisenstein Fields Let us use the analogy between C and E(p) to represent elements of E(p) in an "exponential form". For this, let us recall the algebraic method of introducing log-polar coordinate system onto a continuous complex plane.

Let C∗ be the multiplicative group of complex numbers and R = hR, +i be the additive group of reals. Note that the correspondence

0 6= z = reiθ = eln r+iθ ↔ (l, θ),

where l = ln r ∈ R and 0 ≤ θ < 2π ,

between non-zero complex numbers z and its log-polar coordinates (l, θ) may be considered as an isomorphism

C∗ ' R × (R/2πZ).

(1)

In fact, any direct product decomposition of C∗ produces a representation of complex numbers. Let us transfer the previous construction to E(p). For this, note that since E(p) is a nite eld, its multiplicative group E∗ (p) = E(p) r {0} is cyclic [15, p. 314] and is generated by a primitive element g . For example, it is easy to check that g = 1 + 3ω is primitive in E∗ (p) when p = 5, 17, 89, 101, 257, and g = 1 + 5ω is primitive for p = 29, 53, 113, 233, ets. We need the following elementary verifying result.

Lemma 1. For every p = 12k + 5, numbers m = 2(p − 1) = 8(3k + 1) and n = (p + 1)/2 = 3(2k + 1) are relatively prime, gcd(m, n) = 1.

Note that mn = p2 − 1 = |E∗ (p)| and so for E∗ (p) there appears [15, p. 163] the following analogue of the decomposition (1).

Theorem 1. For every nite Eisenstein eld E(p), its multiplicative group is

decomposed into direct product of cyclic groups of orders m = 2(p − 1) and n = (p + 1)/2, E∗ (p) = hgi ' Zm × Zn . (2) We will call (2) the polar decomposition of E(p). The polar decomposition can be used to transfer onto E(p) the concept of complex logarithm. For this, x any primitive element g and dene the mapping Exp g : Zm × Zn → E∗ (p) as follows:

Exp g (l, θ) = g nl+mθ = z ∈ E∗ (p),

where (l, θ) ∈ Zm × Zn .

(3)

Thus, Exp g is an isomorphism between the additive group of the ring Zm × Zn and the multiplicative group of the Eisenstein eld E(p).

Denition 2. The mapping Exp g : Zm × Zn → E∗ (p) is called the modular

exponent to base g, and its inverse mapping Ln g : E∗ (p) → Zm × Zn is the modular logarithm to base g. Its domain Zm × Zn is called the polar domain. The "basic logarithmic identity " follows immediately:

Ln g (z1 z2 ) = Ln g (z1 ) + Ln g (z2 ) .

(4)

Note that Ln g (0) is not dened, and to evaluate (l, θ) = Ln g (z) for any z = g s ∈ E∗ (p) one just needs to solve the Diophantine equation nx + my = s and set (l, θ) = (x mod m , y mod n) ∈ Zm × Zn . (5)

Fig. 4. A discrete torus and a fragment of the picture  Torus and Sphere by Tom Wilcox (2008) as an illustration to the concept of extended polar domain.

For example, let g = 1 + 3ω ∈ E∗ (5) and z = g 2 = 2 + 2ω . Then s = 2, m = 8, n = 3 and the equation 3x + 8y = 2 has the evident solution x = −2, y = 1. Hence, Ln g (2 + 2ω) = (−2 mod 8 , 1 mod 3) = (6, 1) ∈ Z8 × Z3 . Note that depending on g , either Ln g (ω) = (0, n/3) or Ln g (ω) = (0, 2n/3). We will consider the pair (l, θ) ∈ Zm × Zn as "log-polar coordinates" of the corresponding discrete Eisenstein number z . It is useful to consider Zm × Zn as a m × n-discrete torus, see Fig. 4.

5 Hexagonal Images as Functions on Eisenstein Fields Let E(p) be any Eisenstein eld of a characteristic p = 12k + 5 and let f (z) : E(p) → R be any real-valued function on E(p). Due to our geometric interpretation of Eisenstein elds, we call f (z) a hexagonal gray-level image of size p × p, or just hexagonal image briey. Other way to describe hexagonal images is based on polar decompositions of Eisenstein elds. Namely, we may associate with a p × p-hexagonal image f (z) a square-sampled image ψ of size m × n. For this, x any primitive element g ∈ E∗ (p) and dene a function ψ : Zm × Zn → R such that

ψ(Ln g (z)) = f (z),

0 6= z ∈ E∗ (p) .

(6)

Denition 3. The transform Pg [f ] = ψ will be called log-polar transform to base g of the hexagonal image f , or just its polar transform P briey. The square image ψ will be called the polar form of f .

Thus, the polar form of f may be considered as some arrangement of all its pixels except f (0, 0) in the form of a m × n-matrix, as it is shown in Fig. 5. Thus, the image f is "almost" recovered by its polar form ψ . In order to achieve full recoverability, let us formally agree to extend the polar domain by an extra element ∞, assuming that ψ(∞) = f (0, 0). Note that in such an extended polar

µ = 0.8695

µ = 0.0411

µ = 0.0046

Fig. 5. Images and its polar form matrices. domain Zm × Zn ∪ {∞} the polar transform P becomes invertible. The linearity of P is obvious. (Just as discrete torus is an intuitive interpretation of the polar domain, we may interpret the extended polar domain as a torus with a small sphere inside, see the right side of Fig. 4.) As the following statement shows, the transform P indeed can be regarded as a discrete analogue of the transition to the log-polar coordinate system.

Proposition 1. If Pg [f (z)] = ψ(l, θ), then P[f (wz)] = ψ(l − l0 , θ − θ0 )

(7)

where 0 6= w ∈ E(p) and Ln (w) = (l0 , θ0 ). We will apply the previous relation (7) to symmetry analysis in hexagonal images. As is known, a continuous object is said to have r-fold rotational symmetry with respect to a point C if a rotation by an angle of 2π/r around C does not change the object. Unfortunately, this denition does not work for digital images because digital rotation is much more hard to dene (see, for example, [8, p. 377] for square images and [27,28],[14, p. 97] for hexagonal images) As a result, for digital images we may talk only about some measure of symmetry, which depends on rotations and scaling. The geometric interpretation of Eisenstein elds immediately implies the following denition.

Denition 4. A hexagonal image f is said to have threefold central rotational symmetry if and only if f (ωz) = f (z).

Let ψ = P[f ] be the polar form of an hexagonal p × p-image f . We may consider ψ as an m × n-matrix, where n = 3(2k + 1), m = 8(3k + 1) and k = (p − 5)/12 ∈ Z. Since n is multiple of 3, decompose ψ into three blocks ψ0 , ψ1 , ψ2 of equal size m × n/3.

Proposition 2. An image f is threefold central symmetric if and only if its polar form ψ can be decomposed into three equal blocks, ψ0 = ψ1 = ψ2 . Proof. Since the polar transform is invertible, it follows from Denition 4, that f is threefold symmetric if and only if P[f (ωz)] = P[f (z)] = ψ(l, θ). But it have been noted in Section 4 that Ln g (ω) = (0, ±n/3) for every primitive g ∈ E∗ (p). Hence, threefold symmetry of f is equivalent to the condition ψ(l, θ ± n/3) = ψ(l, θ) for all

l ∈ Zm , θ ∈ Zn ,

or just ψ0 = ψ1 = ψ2 . Evidently, for real-world images one can expect only approximate equalities ψ0 ' ψ1 ' ψ2 , so that the problem to choose an appropriate measure of symmetry µ(f ) for an image f arise. One of possible ways is the following. For any normalized polar form matrix ψ˜ = ψ/ max{ψ} of an image f take ( ) ³ ´ ˜i − ψ˜j k k ψ µ(f ) = exp −αxβ , where x = max . (8) 0≤i