Fractal Signals Characterization Using Fractal Dimension Approach B. Vojnović, A. Maksimović Laboratory for Stochastic Signals and Processes Research, Electronic Division Ruđer Bošković Institute Bijenička 54, Zagreb, Croatia Phone/Fax: +385 1 4680 090, E-mail: vojnovic@irb.hr; maks@faust.irb Abstract – In study of many natural phenomena, as well as dynamic systems and processes, we have to analyze and process obtained experimental informations (data). It appears often, that these data could be beter approximated by fractal structures (functions) rather by ordinary diferentiable functions. By means of Mathematica program we have extracted fractal sets from choosen complex picture formats. The fractal dimension of extracted sets of points, calculated by box-counting (BC) method, shows good agreement with values calculated directly from known dynamics. I. INTRODUCTION In recent years, many natural phenomena, as well as complex systems and processes, of interest to science and technology, have been quantitatively analyzed and characterized using idea of fractal [1, 2, 3]. It was shown that these phenomena display fractal features, when plotted as a function of time or expressed as two or threedimensional structures (pictures). Mandelbrot, often considered as the father of fractal geometry, derived word "fractal" from Latin "fractus", which means "fragmented" or "irregular". Latin verb "frangere" also means "to break" or "to create irregular fragments". In his original essay he define a fractal to be a set with fractal (Hausdorf) dimension, strictly greater than its topological dimension. The set F which is considered as a fractal has the following features: It has fine structure, which assures to see details on arbitrary small scales. F could be not described in classical geometry way, due to high irregularity, both globaly and localy. In most practical cases F is defined in a very simple mathematical way. Often it is characterized by self-similarity. Ussualy, the fractal dimension of F is greather than its topological dimension. Most popularly known fractals are two-dimensional «beautiful» pictures (Mandelbrot, Julia sets, Koch snowflake, Serpinski triangle, «ferns» etc.). Zooming any part of them, with arbitrary scale, we get a picture which resembles the whole set. Fractal functions (signals) have some common characteristics with elementary "Euclidean" functions, they have geometrical character, they can be represented by formulas, and they can be computed. However they are non-smooth, they have no derivative at any point and they have noninteger fractal dimension. Strictly speaking, there are no true fractals in nature (in the mathematical sense), but it is the case with functions in clasical geometry too. Ther are two particular fractal structures of our interest: 1. Structures that could be represented and described by "one dimensional" fractal functions in time (signals and time-series). These functions are mostly derived from experimental data, and are important in analysis of complex processes and systems in electronics and information techologies, economy and finances, bioinformatics, physics and chemistry, etc. The examples of processes and systems, described by such functions include, among many others: - noise in electronic devices and systems, - "one-over-f noise" in many natural as well astechnical systems and processes such as: DNA sequences, heart-beat phenomena, music and speech, traffic flow, financial data, neuro systems, geophysical records, radioactive decay, written language etc. 2. Two-dimensional fractal structures (images) that appear in picture simulation and computer graphics, in study of ecological systems, in fluidic dynamics ,in written language analysis, etc. The analysis of these structures includes feature extractions, characterization and compression and pattern recognition. It could be emphasized, that the theory and practice of fractals is complementary connected to chaos theory and application, because many representations of chaotic phenomena have a fractal structure. These totaly irregular structures are often generated by nonlinear dynamic processes and systems, characterized as deterministic ones, whose anlytical expressions are known or not. From the technical point of view, it is sufficient to know some parameters of the processes and systems. One of the most important parameter is the fractal dimension. II. THE CALCULATION OF FRACTAL DIMENSION Fractal dimension, as the measure of the fractal structure complexity, is an objective means to characterize and compare fractals. It can be defined often in connection with real-world-data and could be measured approximately using the data from experiments. For example, it is reported in heart-rate-variability signal analysis that the fractal dimension reduction is indication of loss of the heart-system complexity, associated with orthostatic stress. In the theory and practice of fractal structures analysis, several definitions (approaches) to fractal dimension calculation are in use. Hausdorff dimension was defined by the minimum number of balls N(ε) of radius ε, required to cover bounded fractal set Θ. Then the Hausdorf dimension is defined as ln N 0 ln d lim (1) Information dimension is expressed by N lim P ln P i 1 i (2) ln 0 where Pi is the probability of finding a point of fractal set in the i-th cube of size ε. Correlation dimension is defined through correlation integral using the similar relation as in (1) lim 0 ln C ln (3) where the correlation integral is defined as N H x N C lim 1 N 2 i , j 1,i j i xj (4) where H denotes Heaviside step function. Box-Counting dimension also called Capacity dimension is of our dominant interest, because its suitability for computing. We compute the box-counting dimension from a grid of equally sized elements (boxes) with edge size ε that is superimposed (covers) on a fractal set (image). We than count how many boxes in the grid contain part of the fractal. During the process of counting the boxes gets smaller, but their number increases, covering the same area of fractal image. The box-counting dimension is than ln N 0 ln 1 D lim (5) It should be noted , finally, that the following relation is valid D (6) III. EXTRACTING FRACTAL SET FROM PICTURE In practice, one often has a picture of complex structure in some of the available electronic (digital) formats, such as portable bitmap (pbm), CompuServe graphics interchange format (gif), Microsoft windows bitmap (bmp) , or some other well known format. Pictures in one of these formats can be obtained by various means, for example one can obtain the picture with scanner or digital camera. If the object in the picture is too complex, or if we need only a segment of the picture, we can change or extract part in some of the popular software for image analysis. For example, we can convert a picture to a gray scale, or change the format. Mathematica program recognize wide range of a picture formats, and one can import the picture with command Import. We wrote functions, which extract points from imported picture with chosen color and save result in a list which represents the coordinates of extracted points. The object can be displayed with command ListPlot. We applied the functions on the pictures of the few famous fractals in order to obtain a corresponding data series. By using the BC (box counting) software [4, 5], the fractal dimension was calculated from the image of fractal object and compared with values of the fractal dimension, obtained from the corresponding dynamical systems. The fractal dimension D of a set F can be obtained from the relation (4). The format of the imported graphics depends on the format of the original picture. The black and white portable bitmap picture is in the form of a matrix which contain only 0 and 1 as the matrix elements. Position of a some point in the matrix (row, column) determines relative coordinate of that point. We take all relative positions with chosen value in the matrix (0 or 1) and save result in the list as a set of pairs of the (x, y) coordinates. The calculated list is suitable for displaying with ListPlot command. Color pictures instead of one value in the matrix have three values, which represent color in the form {red, green, blue}. We use the function GetPictureCoordinates,which returns a list of coordinates from the imported picture in Mathematica, together with the Box-Counting package (BC) to estimate fractal dimension of an object represented as a black and white images or color image. This approach allows implementation for wide range of picture formats. Another benefit is that the data sets obtained from images, can be manipulated as a List objects and compared to the values calculated from corresponding dynamical systems or maps. The application of the function on the image in bmp format gives us the data series of the fractal Sierpinski triangle as the first example. We calculated the capacity dimension using the same parameters and procedure as before. The calculated capacity dimension for IFS is D=1.5860.002. These results are in good agreement with analytical calculation for fractal dimension of the Sierpinski triangle which is log(3)/log(2) = 1.58496. The second example is Henon map, xi 1 1 y i ax 2 , y i 1 bx Fig. 1. The Sierpinski triangle generated with ListPlot command for the data series, obtained from picture of the attractor. The data series are displayed in Fig. 1. with ListPlot command. It is evident from Fig. 1. that there is no visible difference with the original image of the Sierpinski triangle fractal. Using the function CountBox we obtain a list of occupied boxes nb and coresponding probabilities for length scales 1/ε, ε=2k, k=1, 2,......,12. The capacity dimension and the figure of the data fit is obtained with the command CapacityDim[nb,2,7], where nb is a listof occupied boxes, while second and third argument determine range of the length scales ε=2k, k=2,....,7 used in the fit. Calculated capacity dimension is D= 1.610.02. (see Fig.2) lnN() (8) where a = -1.4 and b = 0.3. We iterate Henon map 10000 times from the initial point (0,0) and exclude first 500 transient points with the command iterate from the BC package. The number of occupied boxes and probabilities is obtained with the function CountBox for length scales 1/ε, ε = 2k , k = 1,....10. The fit of the occupied boxes vresus ln(1/ε) for the range of the length scales ε = 2k , k = 2,...9 determines the value of the capacity dimension D = 1.210.01. The black and white picture in the pbm format is generated with the gnuplot program from the dataset obtained with function iterate. The data set isextracted with the function GetPictureCoordinate from the image as in the previous example (see Fig. 3.). In Fig. 4. it was shown the least square fit of the number of occupied boxes versus log( 1/ε ) for the coordinates obtained from the picture. The value of the slope determines fractal dimension D=1.210.02. The calculated capacity dimension in this example is the same for the dynamical system and the data series obtained from the image. ln(1/ ) Fig. 2. Plot of lnN(ε) versus ln(1/ε) for Sierpinski triangle. Full line shows least square fit. To compare estimated value of the fractal dimension with the value calculated from the dynamical system, we construct the fractal Sierpinski triangle by means of an Iterated Function System (IFS). It is obtained by using the following set of a three affine transformations: xi 1 xi 2 ak , yi 1 yi 2 bk (7) with k = 1,2,3, where a1=a2=b1, a3=b2=50, and all transformations were applied with equal probability. One way to generate the Sierpinski triangle with IFS is to use random iteration algorithm [4]. One of the mappings is chosen at random and applied at point (0,0) producing a new point. This random procedure is reapplied to the new point and so on. Function ifs from the BC package [5] implements this algorithm, which is also called chaos game. Excluding first 1000 transient points with command Drop, the data series are obtained with following command Drop{ifs[mmap, 100000], 1000}, where mmap is affine transformatiom [6]. Fig. 3. The Henon attractor, generated with ListPlot command for the data series, obtained from the image of the attractor. lnN() ln(1/) Fig. 4. Plot of lnN(ε) versus ln(1/ε) for Henon attractor Our final example is Fern Attractor. The data series are obtained from the picture in the jpg format. Fig. 5. shows the Fern Attractor displayed with ListPlot command. We applied the functions to the three well known attractors, and by using be package the fractal dimension was calculated. Although the precision depends on the resolution and format of the picture, the values for fractal dimension are in good agreement with values calculated directly from dynamical system. IV. CONCLUSION Fig. 5. Fern attractor, generated for data series, obtained from jpg picture. Associated fractal dimension was calculated as in the two previous examples and we got D = 1.768+0.02. (see Fig. 6.) lnN() ln(1/) Fig.6- Plot of lnN(ε) versus ln(1/ε) for Fern attractor We have implemented the function GetPictureCoordinates which extract the relative coordinates for a points with desired color and save the result in a list. By means of Mathematica programming we implemented a method for extracting a fractal set of points from picture. The method was applied to three well known attractors, and by using BC package, the fractal dimension was calculated. Although the precision depends on the resolution and format of the picture, the values for the fractal dimension are in good agreement with values calculated directly from associated dynamical systems. LITERATURE [1] K. Falconer: FRACTAL GEOMETRY-Mathematical Foundations and Applications, John Willey and Sons Ltd.,1995. [2] M. Barnsley: Fractals Everywhere, Academic Press, New York, 1988. [3] B. B. Mandelbrot: The Fractal Geometry of Nature, Freeman, San Francisco, 1982. [4] A. Maksimović, S. Lugomer, B Vojnović: Fast procedure for estimatin capacity dimension of the fractal object by the box counting, Fizika, B 4 (1995); 29. [5] A. Maksimović, B Vojnović: Box Counting in Mathematica, Proceedings PrimMath2001, 1st Meeting, Mathematica in Science, Technology and Education, Zagreb, Croatia ,September 2001, pp.207-214. [6] P. Grassberger: Generalized dimension of strange attractors, Phys. Let. A 97 (1983), 6, 227.