Efficient Fractal Method for Texture Classification Andreea Lavinia Popescu1 , Dan Popescu1 , Radu Tudor Ionescu2 , Nicoleta Angelescu3 , Romeo Cojocaru1
Abstract— This paper presents an alternative approach to classical box counting algorithm for fractal dimension estimation. Irrelevant data are eliminated from input sequences of the algorithm and a new fractal dimension, called efficient fractal dimension (EFD), which is based on the remaining sequences is calculated. The discriminating capacity and the time efficiency of EFD are evaluated in comparison with fractal dimension (FD) computed by box counting both theoretically and empirically. The results revealed that EFD is better than FD for texture identification and classification.
I. INTRODUCTION Fractals are characterized in a special geometry called fractal geometry which was introduced in [1] to characterize complex, irregular or fragmented natural forms like coastlines and landscapes. One of the most familiar indicators to describe fractals is the fractal dimension. Because it can be computed automatically and saves time and memory, the box-counting algorithm is widely used to evaluate fractal dimension [2]. On the other hand, complex images such as textures are characterized by varying spatial intensity and color of pixels and usually have statistic descriptors: characteristics associated with the grey level histogram, the grey level image difference histogram, the grey level cooccurrence matrices [3] and the features extracted from such matrices [4], the auto-correlation based features, the power spectrum, the edge density per unit of area, and so on. Some researchers have used fractal techniques to describe image textures and classify various types of texture-based images. The work of [5] showed the correlation between fractal dimension and texture coarseness. In a similar fashion, the work of [6] used fractal dimension to effectively classify natural texture. In [7] a comparative study of fractal approach versus statistic approach, in texture analysis of remotely sensed images, is made. Two differential box counting algorithms that reduce the quantization errors when calculating fractal dimension and give more satisfactory results on textured images are presented in [8], [9]. Due to the simplicity and less calculus amount, the boxcounting algorithm is widely used to estimate the fractal dimensions of textured images with or without self-similarity. 1 Faculty
of Automatic Control and Computer Science, Politehnica University of Bucharest, 313 Splaiul Independentei Street, Bucharest, Romania
[email protected],
dan popescu
[email protected],
[email protected] 2 Faculty
of Bucharest,
of
Mathematics and 14 Academiei
Computer Science, Street, Bucharest,
University Romania
of Electrical Engineering, Valahia Targoviste, 2 Carol I Blvd, Targoviste,
UniverRomania
[email protected] 3 Faculty
sity
of
[email protected]
Some authors have tried to improve efficiency of the classical algorithms for estimating the texture features. To follow this line of research, the purpose of [10] is to increase the efficiency of box counting method by assigning the smallest number of boxes to cover the entire image at each selected scale as required. The result was the improvement of estimation accuracy of fractal dimension in the textured image cases. In a classification application a feature is efficient if relative values for different classes are farther apart. Therefore, the goal of this work is to increase texture classification efficiency by adapting to texture specificity of the box counting method. A novel estimation procedure, called efficient fractal dimension (EFD), is presented in this paper. Theoretical results are presented to support the fact that EFD is more efficient than the fractal dimension (FD) computed by box counting. Theoretical statements are validated by experimental results conducted on the popular Brodatz [11] dataset of texture images. In the experiments, other statistical features are associated with fractal dimension to create feature vectors for texture classification. Empirical results show that EFD is better than fractal dimension. The paper is organized as follows. The fractal dimension computed by box counting is described in section II. The novel approach and theoretical properties are presented in section III. Experiments are presented in IV. Finally, conclusions are drawn in section V. II. FRACTAL DIMENSION In the basic box counting algorithm, the binary image is successively divided in finer equivalent sub-regions (4, 16, 64 and more), by ratio (r = 2, 4, 8, and so on) on both horizontal and vertical axis respectively. If the object pixel value is represented by logical 1 and the background pixel value is represented by logical 0, then the fractal dimension is calculated as:
D = lim
n−→∞
log N (r) , log r
(1)
where N (r) is the number of the same size squared subregions containing one or more pixels of value 1. In real representation of digital images, the maximum of value of r (denoted by rmax ) is limited by the image resolution. Real textured images differ from ideal fractals and therefore the points given by the coordinates logr and logN (r) are not positioned on a line. To address this issue, the fractal dimension D has different approximations: the slope of the line of least squares (LLS) of the set of points given by the
plane coordinates logr and logN (r), the most frequent local slope and the last ratio given by: log N (rmax ) . log rmax For simplicity of calculation, usually the logarithm to base 2 is employed. Because most of information is contained in contrast lines, we can consider the edges as object (logical value 1) and the rest as background (logical value 0). If xi , yi , i = {1, 2, ..., n}, are the coordinates in the log-log representation, the LLS slope is calculated as the coefficient, denoted by a, of the corresponding regression line: y = ax + b n
n P
xi yi −
n P
xi
n P
yi
(2)
Fig. 1. Log-log representation of the vector [a], corresponding to the image imA .
If the image is represented by a multilevel intensity function, then the fractal dimension can be evaluated as the average AFD of fractal dimensions F Dj of the representative contour images (binary type) which are extracted from the original image, for specified segmentation thresholds Tj , where j = {1, 2, ..., m}, as follows [12]:
where ak = Ok Ak = logNk and Nk represents the number of boxes of division level k which contain at least one pixel of the contour image. In the case of logarithm to base 2, the fractal dimension (FD) can be obtained by the following equation which is a more simple equation than (2): n n n P P P n iai − i ai i=1 i=1 F D = i=1 2 n n P P i n i2 − (7) i=1 i=1 n n P P 12 iai − 6(n + 1) ai i=1 i=1 = . (n − 1)n(n + 1)
a = FD =
i=1
i=1
n
n P i=1
x2i −
n P
i=1 2
.
xi
i=1
m
AF D =
1 X F Dj . m j=i
(3)
Choice of thresholds for binarization (and hence selected values of fractal dimensions to calculate AFD) is a delicate issue because they influence the average fractal dimension. Choosing Tj for calculating AFD is presented in [13], namely the range [lmax − 0.1 · lmax , lmax + 0.1 · lmax ], where lmax is the gray level for which the number of edge points is maximum. III. AN EFFICIENT BOX COUNTING ALGORITHM It is interesting to note the following features of the box counting algorithm for textures. First, one can observe that for r = {1, 2, ..., k}, all the boxes contain points of the edges. This means that the corresponding slopes have a value of 2. Second, due to finite resolution of images, the limit given in (2) may be approximated by the following equation: yn F Dl = . (4) xn Let imA be a textured-image and A1 , A2 , ..., An be the corresponding points in the log-log representation as presented in Figure 1. Therefore, we have that: OO1 = O1 O2 = ... = On−1 On = 1.
(5)
Consequently, the textured image imA can be characterized by a vector (vector of boxes) VA : [VA ] = [a1 a2 ...an ]T ,
(6)
Proposition 1: Whatever the segment Ak Ak+1 , the slope is less than or equal to 2. Proof: The proof is obvious. It begins with the following equation: logNk − logNk−1 Ak C k = Ok+1 Ok 1 = logNk − logNk−1 .
tan αk =
(8)
Since it obvious that Nk ≤ 4 · Nk−1 , it follows that: tan αk ≤ 2 + logNk−1 − logNk−1 = 2.
(9)
For simplicity, we assumed that the fractal dimension (in this case defined by F DC ) is the slope of the secant line OAn , given by tan αF (see Figure 1): F DC = tan αF =
An C n An C n = . OOn n
(10)
The points: A1 , A2 , ..., Ak (for which the slopes OA1 , OA2 , ..., OAk are equal to 2) can be neglected. Let Ak (k, ak ) be the last point for which the slope of OAk is equal to 2 (tan αk = 2). Considering Ak and the remaining
points Ak+1 , Ak+2 , ..., An , a shorter vector of boxes, denoted by EVA (efficient vector of boxes), can be taken into account: [EVA ] = [ak ak+1 ...an ]T ,
(11)
We can apply the estimation of the fractal dimension for the curve with the origin in Ak , namely the efficient fractal dimension (EFD), as follows: ! ! n n n P P P xi yi − xi yi (n − k) i=k+1
EF D =
(n − k)
i=k+1 n P
x2i
(n − k) =
iai −
−
(n − k)
n P
The fractal dimensions F DC of the images imA and imB are F DC (imB ) = tan βF and F DC (imA ) = tan αF , respectively (see Figure 2). Similarly, the dimensions EF DC of the two images are EF DC (imB ) = tan βF E and EF DC (imA ) = tan αF E , respectively (see Figure 3).
xi
i=k+1
!
n P
i2 −
i=k+1
n P
i
i=k+1
i=k+1
!2
n P
i=k+1 n P
i=k+1
Proof: Let [VB ] = [b1 b2 ...bn ]T be the vector (of boxes) for the textured-image imB (reference) and [VA ] = [a1 a2 ...an ]T be the vector for the textured-image imA . Suppose that the corresponding efficient vectors EVB and EVA have the same size. In other words they can be defined as [EVB ] = [bk bk+1 ...bn ]T and [EVA ] = [ak ak+1 ...an ]T .
! ai
i=k+1 n P
!2
.
i
i=k+1
(12) Similar to F DC we can approximate EFD by EF DC , which is the slope of the secant line Ak An , given by tan αF E (see Figure 1): EF DC = tan αF E =
An On − Ak Ok An On − Ak Ok = . OOn − OOk n−k (13)
Two properties of EF DC , which are also true for EFD, are presented next. Proposition 2: Fractal dimension is smaller than efficient fractal dimension: Fig. 2. imB .
F DC ≤ EF DC . Proof: Because Ak Ok = 2k, we obtain that: An O n An On − 2k − = n n−k 2kn − kAn On = n(n − k) k = (2n − An On . n(n − k)
Estimation of fractal dimension (FD) for two images imA and
tan αF − tan αF E =
(14)
It follows that: An On = (An On − An−1 On−1 )+ + (An−1 On−1 − An−2 On−2 )+
(15)
+ ... + (A2 O2 − A1 O1 ) + A1 O1 ≤ 2n. Therefore, tan αF − tan αF E ≤ 0 or equivalently tan αF ≤ tan αF E . Regarding the discrimination power, the following proposition establishes that EF DC has a better discrimination power than F DC . Proposition 3: The relative difference of fractal dimension F DC is less than that of EF DC : F DC (imB ) − F DC (imA ) ≤ F DC (imB ) EF DC (imB ) − EF DC (imA ) ≤ . EF DC (imB )
Fig. 3. Estimation of efficient fractal dimension (EFD) for two images imA and imB .
(16) Then, taking into account the relative differences, it fol-
lows that:
goal of the classification task is to compare the accuracy levels obtain with these three type of feature vectors. The classifier that is used in the experiments is the Linear Discriminant Analysis (LDA). For a particular classification problem, some methods may be more suitable than others. The accuracy level depends on many aspects such as class distribution, the number of classes, data noise, size of the training data, and so on. In some particular cases, when the number of classes is greater than 2, there is a serious problem with the regression methods. More precisely, some classes can be masked by others. The LDA classifier is able to improve accuracy by avoiding the masking problem [15].
F DC (imB ) − F DC (imA ) − F DC (imB ) EF DC (imB ) − EF DC (imA ) − EF DC (imB ) tan βF − tan αF tan βF E − tan αF E = − tan βF tan βF E Bn On −Bk Ok Bn On An On n −Ak Ok − An On−k − n−k = n Bn On n − Bn On −Bk Ok n
n−k
B n An = (−Bk Ok ) < 0. Bn On (Bn On − Bk Ok )
B. Brodatz Preliminary Test To evaluate the effectiveness of the proposed algorithms, the relative difference between a reference imA and another image imX can be computed as follows: ∆(X) =
F (imA ) − F (imX ) , F (imA )
(17)
where F can be replaced with either the F D or the EF D of the input image. IV. EXPERIMENTS The dataset used for testing the EFD approach presented in this paper is the Brodatz dataset [11]. This dataset is probably the best known benchmark used for texture classification, but also one of the most difficult, since it contains 111 classes with only 9 samples per class. Experiments are conducted to asses the discriminatory power of EFD by comparing it with compare FD. Preliminary experiments are performed on a few sample images from the Brodatz dataset. In the next experiment, EFD and FD are evaluated in a texture classification context. They are used in combination with other features in a classification task performed on the full Brodatz dataset. A. Learning Method for Classification For the classification task, texture specific features are extracted from each image. An image is then be represented by a feature vector. The simplest statistical features extracted are the mean and the standard deviation. Relevant statistical features for texture classification can be computed from the Grey-Level Co-Occurrence Matrix (GLCM). Among the features that show a good discriminating power proposed by [4], we use only four of them, namely the contrast, the energy, the homogeneity, and the correlation. Gabor features, such as the mean-squared energy and the mean amplitude, can be computed through the phase symmetry measure (LIPSyM) presented in [14], for a bank of Gabor filters with various scales and rotations. These features are relevant because Gabor filters have been found to be particularly appropriate for texture representation and discrimination. Three variants of feature vectors are used. The first variant includes the 8 features described above. The second one, includes the fractal dimension besides the 8 features described above. For the third variant, FD is replaced with EFD. The
For preliminary experimental validation we used four monochrome images from three classes presented in Figure 4. The first two images (imA1 and imA2 ) are of the same class, while imB and imC are of different classes. First, selected test images have been resized to 512 × 512 pixels with intensity levels of 8 bits. Next, images have been converted to binary format using the threshold Tj . If a pixel had a gray value greater than Tj , then the pixel is assigned the value of 0 (black), otherwise the pixel is assigned the value of 1 (white). Contour images are obtained from binary images by edge extraction using a local algorithm. Finally, the vector of boxes and the efficient vector of boxes can be extracted from this representation. The resulted vectors computed from images imA1 , imA2 , imB and imC are presented in Table I. Observe that the box counts obtained for r ≤ 32 are equal for all images in Table I. Thus, k can be selected to be log32 = 5 for the EFD computation. To evaluate the effectiveness of the proposed approach by comparing it with FD, the relative difference between the reference imA1 and the other images can be calculated using (17). Both EFD and EF DC are evaluated and compared with FD and F DC , respectively. Obtained results are presented in Table II. Empirical results confirm that the relative difference for different classes is higher in the case of EF D than in the case of F D. In conclusion, EF D can be used as good feature for texture classification, showing a high discriminatory power. C. Brodatz Classification Test In this experiment, images are represented by normalized feature vectors. The baseline feature set includes the following 8 features: the mean and the standard deviation of the patch, the contrast, the energy, the homogeneity, and the correlation extracted from the GLCM, and the mean-squared energy and the mean amplitude extracted by using Gabor filters. The FD is added to the baseline feature set to obtain the second feature vector. Finally, the EFD is added to the baseline feature set to obtain the third feature vector. These three different variants of feature vectors are used to perform the classification task. The goal of this experiment is to assess the discriminatory power of FD and EFD. Table III compares accuracy rates of the LDA classifier based on the proposed
Fig. 4.
Images selected for preliminary test from Brodatz database.
variants of feature vectors. The accuracy rates presented in Table III are actually averages of accuracy rates obtained over 100 runs for each feature set. There are 3 random samples per class for training, while the other 6 images from each class are left for testing.
ACKNOWLEDGEMENT The work has been funded by FP7-REGPOT, ERRIC:Empowering Romanian Research on Intelligent Information. R EFERENCES
TABLE III ACCURACY RATES ON THE ENTIRE B RODATZ DATASET USING 3 RANDOM SAMPLES PER CLASS FOR TRAINING . R ESULTS OBTAINED WITH SEVERAL VARIANTS OF FEATURE VECTORS ARE PRESENTED . Feature set baseline (8 features) FD + baseline (9 features) EFD + baseline (9 features)
Accuracy 78.92% 79.52% 79.84%
Empirical results show that both FD and EFD improve accuracy when they are added to the baseline feature set. However, the LDA classifier based on the feature set that inculdes EFD has an accuracy rate with 0.32% higher than the one based on the feature set that inculdes FD. Thus, the discriminatory power of EFD is greater than that of FD. But, another advantage of EFD is that it takes less time to be computed. To compute EFD for the entire Brodatz database, it takes 5.07 seconds on a computer with 2.3 GHz Intel Core i7 processor and 8 GB of RAM memory using a single Core. On the same machine, FD needs 5.28 seconds. In conclusion, EFD is better than FD in terms of accuracy and time efficiency. This experiment was designed to show the discriminatory power of EFD. The classifier presented here uses a small feature set which doesn’t give impressive results. However, this classifier serves its purpose to show the difference between EFD and FD. State of art classifiers obtain accuracy levels up to 90% on this dataset. For example, in [16] the accuracy rate reported on the Brodatz dataset using 3 training samples per class is 88, 15%. V. CONCLUSIONS In the textured image cases, efficient fractal dimension can be considered as an additional and cost efficient feature to improve texture characterization and classification. The proposed algorithm derives directly from box counting by eliminating insignificant terms from the beginning of the computation. The results confirm that efficient fractal dimension offers better results in texture classification than box counting estimation of fractal dimension.
[1] B. B. Mandelbrot, The fractal geometry of nature, 1st ed. W.H. Freeman, Aug. 1982. [Online]. Available: http://www.worldcat.org/isbn/0716711869 [2] H. O. Peitgen, H. J¨urgens, and D. Saupe, “Chaos and fractals: new frontiers of science,” 1992. [3] L. G. Shapiro and G. Stockman, Computer Vision, 1st ed. Upper Saddle River, NJ, USA: Prentice Hall PTR, 2001. [4] R. M. Haralick, K. Shanmugam, and I. Dinstein, “Textural Features for Image Classification,” IEEE Transactions on Systems, Man and Cybernetics, vol. 3, no. 6, pp. 610–621, Nov. 1973. [5] A. P. Pentland, “Fractal-Based Description of Natural Scenes,” IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 6, no. 6, pp. 661–674, Nov. 1984. [Online]. Available: http://dx.doi.org/10.1109/TPAMI.1984.4767591 [6] J. M. Keller, S. Chen, and R. M. Crownover, “Texture description and segmentation through fractal geometry,” Computer Vision, Graphics and Image Processing, vol. 45, no. 2, pp. 150–166, Feb. 1989. [7] S. W. Myint, “Fractal approaches in texture analysis and classification of remotely sensed data: Comparisons with spatial autocorrelation techniques and simple descriptive statistics,” International Journal of Remote Sensing, vol. 24, no. 9, pp. 1925–1947, 2003. [8] N. Sarkar and B. Chaudhuri, “An efficient differential box-counting approach to compute fractal dimension of image,” IEEE Transactions on Systems, Man and Cybernetics, vol. 24, no. 1, pp. 115–120, 1994. [9] W.-S. Chen, S.-Y. Yuan, H. Hsiao, and C.-M. Hsieh, “Algorithms to estimating fractal dimension of textured images,” Proceedings of IEEE International Conference on Acoustics, Speech, and Signal Processing, vol. 3, pp. 1541–1544, 2001. [10] J. Li, Q. Du, and C. Sun, “An improved box-counting method for image fractal dimension estimation,” Pattern Recognition, vol. 42, no. 11, pp. 2460–2469, Nov. 2009. [Online]. Available: http://dx.doi.org/10.1016/j.patcog.2009.03.001 [11] P. Brodatz, Textures: a photographic album for artists and designers, ser. Dover pictorial archives. New York, USA: Dover Publications, 1966. [12] D. Popescu and R. Dobrescu, “Carriage road pursuit based on statistical and fractal analysis of the texture,” International Journal of Education and Information Technologies, vol. 2, no. 11, pp. 62–70, 2008. [13] R. Dobrescu and D. Popescu, “Image processing applications based on texture and fractal analysis,” Applied Signal and Image Processing: Multidisciplinary Advancements, pp. 226–250, 2011. [14] M. Kuse, Y.-F. Wang, V. Kalasannavar, M. Khan, and N. Rajpoot, “Local isotropic phase symmetry measure for detection of beta cells and lymphocytes,” Journal of Pathology Informatics, vol. 2, no. 2, p. 2, 2011. [15] T. Hastie, R. Tibshirani, and J. Friedman, The Elements of Statistical Learning, corrected ed. Springer, July 2003. [16] S. Lazebnik, C. Schmid, and J. Ponce, “A Sparse Texture Representation Using Local Affine Regions,” PAMI, vol. 27, no. 8, pp. 1265– 1278, Aug. 2005.
TABLE I VALUES OBTAINED FOR VECTORS OF BOXES CORRESPONDING TO THE FOUR TEST IMAGES . T HE FOLLOWING NOTATIONS ARE USED r – THE NUMBER OF SUB - REGIONS FOR EACH OF THE AXES , NX (r) – NUMBER OF BOXES THAT CONTAIN AT LEAST A SINGLE 1 IN IMAGE imX . EFD IS COMPUTED FROM
r log r log NA1 (r) log NA2 (r) log NB (r) log NC (r)
2 1 2 2 2 2
4 2 4 4 4 4
8 3 6 6 6 6
r = 32 TO r = 512.
16 4 8 8 8 8
32 5 10 10 10 10
64 6 11.82 11.84 11.99 12
128 7 13.39 13.44 13.83 13.96
256 8 14.76 14.77 15.22 15.33
512 9 15.59 15.59 16.06 16.17
TABLE II VALUES OBTAINED BY EFD, EF DC , FD AND F DC WHEN APPLIED ON THE TEST IMAGES . R ELATIVE DIFFERENCES FROM THE REFERENCE IMAGE imA1 TO THE OTHER IMAGES COMPUTED WITH (17) ARE ALSO SHOWN . Image FD EFD F DC EF DC
imA1 1.794 1.412 1.732 1.398
imA2 1.796 1.411 1.732 1.398
∆(A2 ) 0.11% 0.07% 0% 0%
imB 1.856 1.534 1.784 1.515
∆(B) 3.46% 8.64% 3.00% 8.37%
imC 1.871 1.567 1.797 1.543
∆(C) 4.29% 10.98% 3.75% 10.37%