A Matrix Iterative Approach to Systematically Generate Hilbert-type Space-filling Curves

Hilbert-type space-filling curve has attracted much interest thanks to its mathematical importance and extensive applications in signal processing. In this paper, we construct the complete six Hilbert-type space-filling curves form a matrix point of view. The address matrix for each considered Hilbert-type space-filling curve can be easily generated by a recursive manner. Besides the six Hilbert-type space-filling curves, we also construct their corresponding variation versions. The merit of the matrix approach is that the iterative algorithm is easy to implement and can be generalized to produce any other Hilbert-type space-filling curves and their variation versions.


INTRODUCTION
Thanks to the good filling nature of space-filling curves, they not only show good mathematical features but also can be applied widely in many fields, especially in digital image processing, such as image clustering, image encryption, image encoding, image storing/retrieving, and pattern recognition [1][2][3]. A space-filling curve is a continuous mapping from the unit interval onto the N-dimensional unit hypercube and passes through each point of the unit hypercube. Italian Mathematician G. Peano ingeniously discovered a space-filling curve of traversing points on a two-dimensional square grid exactly once for any nature number and without crossing the path in 1890. The space-filling curve presented by Peano surprised the mathematical world greatly and encouraged many mathematicians to explore the research [4]. Since then, many kinds of space-filling curves are discovered and constructed [5]. Among them, the Hilbert space-filling curve, another famous space-filling curve presented by Hilbert to traverse points on a two-dimensional square grid, preserves point neighborhoods as much as possible [6]. A mathematical and historical review of Hilbert space-filling curve applications can be seen in [5] and the references therein.
There have been many research works on how to formally construct the Hilbert space-filling curve using either an operation model or a functional model since the fundamental work of Hilbert, and various algorithms were presented to generate Hilbert space-filling curves, such as the Butz algorithm [7], the Quinqueton algorithm [8] and the Agui algorithm [9] etc. However, these algorithms have more or less restrictions on their applications, and this becomes a stumbling block to put the algorithms in practice. For example, Butz computed the mapping function by bit operations such as shifting, exclusive OR, etc. The algorithm is complex to compute and difficult to implement in hardware. Agui and Quinqueton applied the recursive functions to generate the space-filling curve, and their algorithms were also complex and took much time to compute the one-to-one mapping correspondence. To improve the scanning efficiency via Hilbert space-filling curve, Kamata et al. constructed a simple, non-recursive algorithm for N-dimensional Hilbert space-filling curve using lookup tables [10]. The algorithm contributed faster computation and easier implementation than previous ones. Similar techniques based on lookup tables are adopted by Zhang et al. [11]. Lin et al. put forward an algorithm to generate Hilbert curves by tensor product [12]. The tensor product formulas can be directly translated into computer programs; it is simple and easy to manipulate. On the other hand, other Hilbert-type space-filling curves are still designed and studied. Liu presented four alternative patterns of the Hilbert curves in [13]. The four patterns proposed, together with Hilbert's original pattern and Moore's pattern [14], constitute a complete set of the Hilbert space-filling curve. Liu used a parameter called resolution to describe the domain granularity of the considered curves, then constructed the Hilbert-type space-filling curve patterns via generation of the configuration of considered pattern from resolution k to k+1. The generation of Hilbert spacefilling curves is determined by some affine transformations expressed in complex variables. Liu did not present the operable algorithm in [13], frustrating the proposed method in practice as well.
In this paper, we will explore the generation of Hilbert-type space-filling curves via matrix iterative approach. It is a simple address generator for two-dimensional Hilbert-type space-filling curves. Based on an iterative approach instead of recursive one, we generate the address matrix for the considered Hilbert-type space-filling curve at any resolution n efficiently. We express the Hilbert-type space-filling curve as an algebraic matrix consisting of the position orders for all vertices at the consider curve pattern. It is easy to produce the matrix of resolution n by an iterative way and some matrix operations: transposition, rotation, flip up and down, flip left and right. These matrix operations and iteration procedure can be mapped to constructors of high-level programming languages. Hence, the Hilbert-type space-filling curve formulas can be easily translated into a computer program. The program produces the Hilbert-type space-filling curve according to the data element orders of the yielded two-dimensional matrix. Matrix iterative algorithm is easy to implement and the proposed algorithm in this paper can be generalized to produce other variation versions of Hilbert-type space-filling curves even in higher dimensional spaces. Furthermore, the generated matrix can be easily applied to translate the twodimensional gray values of digital images into one-dimensional version, so it can be effectively employed for image processing, such as image compression and image encryption, etc.

Hilbert's Original Pattern
We denote the Hilbert-type space-filling curve matrix of order 2 k by 2 k H at resolution k. Let Hilbert's original pattern starts at one corner of the unit square, for example, (0, 0), and ends up at its adjacent corner, for example, (1,0). The matrices of Hilbert's original patterns are generated iteratively by the following transformation:

Pattern L1
Suppose the space-filling curve starts at the center of the unit square and ends up at the same point. This yields a new space-filling curve whose four patterns for resolution 2 to resolution 5 are shown in Fig. 3. The graphical representation of resolution 1 for pattern L1 is the same as shown in Fig. 1(a). The matrices of patterns L1 with any resolutions are generated iteratively by the following transformation:

Pattern L2
Suppose the pattern curve starts at the midpoint of one side of the unit square and ends up at the midpoint of the opposite side. This yields a new space-filling curve whose four patterns for resolution 2 to resolution 5 are shown in Fig. 4. The graphical representation of resolution 1 for pattern L2 is the same as Fig. 1(a). The matrices of patterns L2 are generated iteratively by the following transformation:

Pattern L3
If the Hilbert-type space-filling curve starts at the lower left corner of the unit square and ends up at the center of the square, we can produce an alternative space-filling curve whose four patterns for resolution 2 to resolution 5 are shown in Fig. 5. The pattern of resolution 1 is just the same as Fig. 1(a)

Pattern L4
Let the Hilbert-type space-filling patterns curve starts at the midpoint of one side of the unit square and ends up at the midpoint of its adjacent side. One can generate a new space-filling curve whose four patterns for resolution 2 to resolution 5 are shown in Fig. 6. The matrices of patterns L4 are generated iteratively by the following transformations:

Variation of Hilbert's Original Pattern
As mention above, Hilbert's original pattern starts at one corner of the unit square, for example (0, 0), and ends up at one of its adjacent corners, (1,0) for example. To get a variation version, we change the end point to be (1,1), that is, the space-filling curve is from one corner of the unit to the opposite corner instead of the adjacent corner. We can also get a space-filling curve and the matrices are derived by

Variation of Moore's Pattern
Let the space-filling curve starts at the midpoint of one side of the unit square, for example (1/2, 0), and ends at the same point. Meanwhile, the curve passes through center of the unit square two times from which the Moore's pattern is different. We can also get a space-filling curve. The matrices are derived by

Variation of Pattern L1
Suppose the space-filling curve starts at the center of the unit square and ends at the same point. However the curve is different from pattern L1. We can also get a space-filling curve and the matrices are derived by

Variation of Pattern L2
Suppose the curve starts at the midpoint of one side of the unit square and end up at the midpoint of the opposite side and the curve pass through the center two times. This yields a new space-filling curve whose four patterns for resolution 4 and resolution 5 are shown in Fig. 10

Variation of Pattern L3
Suppose the curve starts at the lower left corner of the unit square and ends up at the center of the square, but this time the curve passes through alternative way different from L3. This yields a new space-filling curve whose two patterns for resolution 4 and resolution 5 are shown in Fig. 11. The matrices of this pattern are generated iteratively by

Variation of Pattern L4
Suppose the curve starts at the midpoint of one side of the unit square and ends up at the midpoint of its adjacent side. But it passes the center two times from which pattern L4 is different. This yields a new space-filling curve whose two patterns for resolution 4 and resolution 5 are shown in Fig. 12. The matrices of variation of patterns L4 are generated iteratively by the following transformations:

CONCLUSIONS
Hilbert-type space-filling curve has attracted much interest thanks to its mathematical importance and extensive applications in signal processing, such as encoding, image clustering, encryption, image storing/retrieving, and pattern recognition, etc. Besides the original one discovered by Hilbert himself, there exist other patterns, including the Moore pattern presented in 1900 and four alternative ones explored by Liu in 2004. In this paper, we construct the six patterns from a matrix iterative point of view. The address matrix for the considered pattern can be easily generated by an iterative manner. It is then easy to produce the corresponding pattern. The generated address matrices can be regarded as ergodic matrices and therefore can be directly applied to image processing, especially in image encryption, image watermarking preprocessing, image hiding. Besides the six Hilbert-type space-filling patterns, we also construct their corresponding variation versions thoroughly in this paper as well.