The fabric pattern extraction based on dual-tree complex wavelet transform and Gaussian mixture models ZhangYong1, MaJun1*, DengZhongmin2, HuXinrong1 1 College of Mathematics and Computer Science, Wuhan Textile University, Hubei 430200, China; 2College of Textile Science and Engineering, Wuhan Textile University, Hubei 430200, China Abstract: In order to extract the fabric patterns automatically and improve the efficiency of decorative pattern design, a method to describe texture features of jacquard warp knitting based on dual-tree complex wavelet transform and energy matrix was proposed. Then mainly based on color and texture feature, the Gaussian mixture model was established and we used EM algorithm to convert pattern extraction to parameters of maximum likelihood estimation problem. Finally, according to the posteriori probability, fabric image was annotated. The results proved that the method proposed worked effectively in extracting the complete pattern, which had a high accuracy and certain practical value. Key words: Jacquard Warp Knitting; GMM; DT-CWT; Pattern extraction; Texture feature 1 Introduction Fabric pattern extraction is significant for the apparel industry. Normally, in the process of pattern design and fabric pattern extraction from the samples must depend on manual operation [1].The traditional design patterns cannot meet the requirements of modern design. This subjective 基金项目:国家自然科学基金(11071280) 作者简介:张勇(1991—),男,硕士研究生,主要从事计算机在纺织方面的研究与应用。 method may be inconsistent, inaccurate and accuracy may vary from one person to another. In order to enhance the efficiency and reduce unnecessary consumption, a digital method that can recognize and extract patterns of fabric images automatically is urgently needed. Reliable and accurate objective methods are necessary for the textile industry [2]. In this paper we plan to automate this process of source and target region identification. Many different approaches have been proposed to extract fabric pattern. Sambhare (2003) introduced a method to detect artifacts and textures in wavelet coded images [3]. Sambhare used the differences of offset Gaussian filters to create a feature set and a variation of k-means clustering algorithm to segment the image. However, k-means for image segmentation suffers from the simple defect that spatially discontinuous regions might get classified into the same cluster. Although Sambhare improved the k-means algorithm, it is still difficult to ascertain the boundary between each cluster. Previously Yang and Hu [4] have reported a dithering based approach to recover some high-frequency components in a JPEG-encoded image. Their approach employs a parameter-estimation method based on the k-means algorithm. However, this approach seems to be applicable only to fine-grain textures like photo granular noise. Kim and Kang (2005) stated that the periodic back-ground texture can be attenuated by the undecimated DWT [5]. By using a simple threshold proposed by Otsu (1979), pattern can be separated from the background in the reconstructed smooth (approximation) sub-images at an appropriate decomposition level. Because the approximation sub-images comprise not only the pattern information but also the surface unevenness, illuminative variation and determination of the threshold is critical for extracting the fabric pattern. 2 The multi-scale two-dimensional dual-tree complex wavelet transforms (DT-CWT) can perform multi-decomposition and directional selectiveness analysis [6]. The approximate shift-invariant property of the dual-tree complex wavelet and its good directional selectivity in two dimensions improve the recognition rate dramatically and identify similar patterns (Kingsbury, 2000). In this study,an integrated feature extraction technique based on DT-CWT for fabric image recognition is proposed. Gaussian mixture model (GMM) is a specific method which is proposed and applied to the fabric image clustering [7]. Gaussian mixture model (GMM) has gained a great success in describing the statistical properties of data. If there are enough items and enough training data, GMM can approximate any distribution model [8-9]. The Gaussian mixture model has more advantage in pattern recognition, so in this paper, Gaussian mixture model is introduced to cluster the fabric image [10-11]. 2 Materials and methods 2.1 Fabric image acquisition In this study,we used fabric images which were taken by a digital camera. Every fabric image was cropped and resized to a 256×256 pixels color image so that only the tested area was used for subsequent numerical calculation. Some test images which were jacquard warp knitting fabric images were shown in Fig.1. 3 Fig.1. Test images for GMM clustering algorithm 2.2 Dual-tree complex wavelet transforms (DT- CWT) The CWT is a relatively recent enhancement to the DWT, with important additional properties: it is nearly shift invariant and directionally selective in two and higher dimensions. The most important property of CWT is that it can separate more directions than the real wavelet transform. The CWT can provide six sub-images in two adjacent spectral quadrants at each level, which are oriented at angles of ±15o, ±45o, and ±75o. The strong orientation occurs because the complex filters are asymmetry responses. The directionally selectivity is shown in Fig.2. Fig.2. Impulse response of 2-D complex wavelet filter 4 2.3 Feature Extraction As shown in Fig.3, the blue frame meant the original image, the red frame meant a sliding window and the green frame meant the epitaxial part which was inflated by zero. In general, the size of sliding window was N N ( N was odd). The window slid from left to right and from top to bottom. For each pixel in the image, the pixel was located in the middle of its sliding window and two layers of dual tree complex wavelet transform were applied to the window. Then six high frequency subbands of each layer and a low frequency subband could be got. There were a total number of 13 subbands. For each subband, we used the formula (1) to calculate the complex wavelet energy as one value of the eigenvector. Finally all energy features of the window were chosen to represent the energy eigenvector of each pixel, which had constructed the energy feature matrix of the image. The energy of each subband was calculated by the formulas (1), which were dependent on the input factors s( x, y) , and the relationship between the energy and the input process was described by e 1 N N s( x, y) N N x 1 y 1 (1) Where s( x, y) is the decomposition coefficient matrix of each subband, N N is the size of the sliding window, and e is the energy feature. This kind of energy feature extraction can not only consider the local but also the global information of the fabric image. 5 Fig.3. A window slides through the fabric image 2.4 Feature dimensionality reduction We represented each pixel in the image using an 18 dimensional feature vector. Two features were used to represent spatial relationships between pixels; the x and y pixel coordinates normalized by image dimensions. RGB color space was chosen and we used 3 features to represent the color information of fabric image. Then we used 13 features to represent texture information, using responses to a bank of oriented filters. We realized that reducing the number of dimensions would immediately reduce the complexity of algorithm. We could effectively only use the spatial features and still gained a good segmentation. This kind of feature dimensionality reduction could be done automatically by Principal Component Analysis. We found the correlation between features and found the eigenvectors of this correlation matrix. The number of principal component was mainly determined by the accumulation of contribution. The more contribution, the more information the principal component contained. We retained those eigenvectors for which the eigenvalues’ 6 accumulation of contribution was greater than 85% of the total contributions. The contribution of each eigenvalue is described by s i (2) p i 1 i Where i is eigenvalue and p is the total number of principal components. Finally we project the features into this eigenspace to get final feature set. This is the feature space accurately represents image features using the smallest number of dimensions. 2.5 Gaussian mixture models of EM algorithm GMM is a mathematical model which is usually used in the aspect of speech and image recognition and has achieved good results. GMM clustering algorithm was selected for segmentation. For a simple 256 by 256 pixel image, this means that we had to cluster 65536 points. There is a data set X x1 , x 2 , , xn which contains N points. The data set X is a sample that has some kind of distribution. That distribution of the data set can be approximated by Gaussian probability-density function. The generalized GMM model is M P( x ) jG( x, j , j ), 0 and j 1 M j 1 T 1 exp x j j 1 x j 2 G ( x, j , j ) 1/2 d /2 2 j j 1 (3) (4) Where G is the Gaussian probability-density function which illustrates the probability of each pixel, M is the total number of Gaussian probability-density function, 7 j is weight of each function G, j is the mean, j is the variance, and d is the dimensionality of eigenvector x , parameter set is j j , j , j . 2.5.1 Expectation maximization (EM) algorithm In GMM, if the estimation of the model parameters j j , j , j is completed, hence the probability of each feature vector can be determined in each Gaussian. For the parameters estimation, generally we use derivation, but it is complex and there is no closed solution for this problem. One way to solve the problem with missing data is the expectation maximization (EM) algorithm that consists of the following two steps: E-Step and M-Step. In E-Step of the EM algorithm, we take expectation of the log-likelihood function with respect to the missing data j j , j , j . E-Step Calculate the posterior probability of each feature vector xi which belongs to Gaussian distribution mj j i p m j xi , j j p xi j (5) px M j j 1 i j M-Step When the posteriori probability is got from E-Step, then mainly by solving logarithmic likelihood equation, update each Gaussian distribution parameters j j , j , j next iteration 8 for the 1 N j i N i 1 j (6) N j i x j i 1 N i (7) i j i 1 i x x N j i 1 T j i j i j (8) N i i 1 j Repeating these two steps until the fluctuation is small, which means that after two consecutive iterations the difference between two likelihood values is less than preset convergence coefficient =0. 00001. Hence, it will stop the iteration and approximately peak. The initial values of GMM have great influence on the results of clustering and EM algorithm may fall into local optimal solution. This paper chose some random values to initialize the EM algorithm. 2.6 Image processing procedure The proposed new method was mainly a three-stage approach as shown in Fig.4. Our initial efforts focused on feature extraction which constituted the data set. The first stage used DT-CWT to extract the texture features and used energy matrix to describe the features. In the second stage, Principal Component Analysis (PCA) was used to reduce feature dimensionality. The third stage established the Gaussian mixture model and used EM algorithm which converted pattern extraction to parameters of maximum likelihood estimation problem. According to the procedure the fabric image could be clustered into different parts [12]. 9 Fig.4. Block diagram of the pattern extraction method To get the number ( M ) of the clusters which represented for the number of Gaussian mixture models, by observing the fabric image, an appropriate number was chosen. Then the posteriori probabilities of each eigenvector which belonged to different Gaussian models were calculated. The following process was to sort the posteriori probabilities and the biggest posteriori probability was selected. Furthermore, each eigenvector was marked yi j . By this way, a mark matrix p ( y1, y2, , yN ) could be got. Then previous mark matrix p was transformed into the following mark matrix Q x1 1 x 1 2 x x 22 Q 21 xr 1 xr 2 x c 1 x c 2 xrc (9) Where r is the row of fabric image, c is the column of fabric image, N r * c is the total number of pixel. Based on the mark matrix ( Q ), the last step was to annotate each individual cluster of pattern and synthesize all the segmentation effect patterns. 10 3 Results and discussions 3.1 Pattern extraction by GMM Many jacquard warp knitting fabric images were selected for the experiments. As shown in Fig.5, the clustering results of GMM algorithm were shown. Test images were Fig.5 (a), Fig.6 (a) and Fig.6 (c). Because of the differences of textures, as we can see from Fig.5 (a), the fabric image can be roughly divided into three regions, pattern, bottom net and image background. So number 3 was chosen in advance as the number of Gaussian mixture models. In Fig.5 (d), the main pattern was extracted. The three segmentation effect were synthesized and shown in Fig.5 (b), which was useful for digital design. (a)Test image 1 (b) Synthesized image 11 (c) Mesh (d) Pattern of test image1 (e) Background Fig.5. GMM sub-image and synthesized image The same experiment was repeated to demonstrate the validity of the GMM clustering algorithm. As shown in Fig.6, the fabric images were complex. The results showed that the algorithm could also extract fabric pattern effectively. The results proved that DT-CWT was well-suited and efficient to extract the texture feature of fabric image. One of the major advantages of the DT-CWT filter was its directionality. The program was written in straight forward Matlab and tested on a 2.50GHz dual-Pentium PC with 4G RAM running on Windows NT 4.0. 12 (a)Test image 2 (b) Pattern 2 (c) Test images 3 (d) Pattern 3 Fig.6. Image analysis of complex fabrics 3.2 Compare to k-means algorithm In order to verify the effectiveness of the GMM clustering algorithm, the contrast test was made and k-means clustering algorithm was chosen. Fig.7 showed the result of k-means clustering algorithm. The image in Fig.7 (a) showed the pattern extracted from test image 1, the image in Fig.7 (b) showed the pattern extracted from test image 2 and Fig.7 (c) showed the pattern extracted from test image 3. The results showed that k-means clustering was able to extract the fabric patterns basically. But the accuracy was not enough, the edge was vague and some small interior regions were divided into large external area. Because k-means clustering mainly depended on the initial clustering center, the result may deviate from the global optimal classification and trapped in local optimal solution, which resulted in the instability of data clustering. As shown in Fig.7, k-means suffered from the simple defect that spatially discontinuous regions might get classified into the same cluster. It was also evident 13 that GMM was better to segment the fabric image and can extract the pattern accurately. (a) Pattern 1 (b) Pattern 2 (c) Pattern 3 Fig.7. Results of k-means clustering algorithm 3.3 Selection of clustering number It should also be noted that as the k value (the total number of clustering) increased, more and more detail categories was divided, the noise in the image were separated too. Experiments showed that too large value of k would produce the phenomenon of over-segmentation, which also couldn't get the applicable fabric pattern. Over-segmentation of fabric image couldn't meet the needs of actual production, so the value of k was not the bigger the better. For jacquard warp knitting fabric, generally it only has 3-5 patterns. Considering the practical process, generally k took its value from 3 to 5, which was more appropriate. Therefore actual production requirement was needed to consider, then we could select the right number of clustering to get ideal fabric patterns. As shown in Fig.8, k took its value 8. Compared with Fig.5, Fig.8 (b)-Fig.8 (g) was the over-segmentation of Fig.5(c). 14 (a) (e) (b) (c) (f) (g) (d) (h) Fig.8. K took its value 8 4 Conclusion In summary, this paper presented an effective way of extracting pattern from fabric images. It has been found that the fabric texture information is from high-frequency detail images. It has been proved that DT-CWT algorithm was reasonable and effective to extract texture feature. Through the establishment of Gaussian mixture models, the EM algorithm was proposed to estimate the optimal parameters of each Gaussian probability-density function. After we got the parameters, the following step was to calculate the posteriori probability of each eigenvector which belongs to different Gaussian probability-density function. Furthermore, the biggest posteriori probability was chosen. Based on the posteriori, the pixels of fabric image were marked by different number. Finally, the fabric pattern could be extracted. The results demonstrated that the new integrated method proposed in this study was feasible to extract fabric pattern. 15 Compared with k-means clustering algorithm, GMM clustering algorithm which based on EM algorithm is a better way to extract fabric pattern and comes out with a better result. It is realized that the method proposed in this paper can improve the efficiency of pattern design. For the further improvement, other clustering algorithm for fabric image will be discussed, such as spectral clustering and hierarchical clustering. Finally, the combination of this method with a new method may be possible for getting a better result to extract fabric pattern. Acknowledgments This work was financially supported by the National Natural Science Foundation of China (NO.11071280). References 1. C. M. Bishop, “Pattern Recognition and Machine Learning”, Springer ,2006. 2. S. Kim and C. K. Park, “Evaluation of fabric pilling using hybrid imaging methods”, Fiber. Polym., 7:57-61(2006). 3. R. Sambhare, “Detecting Artifacts and Textures in Wavelet Coded Images”, ECE 738,Spring, 2003. 4. S. Yang, Y. H. Hu, D. L. Tull, and T. Q. Nguyen, “Maximum likelihood parameter estimation for image ringing artifact removal”, IEEE T Cirs Syst Vid, vol.11, no.8, August, pp. 963-973(2001). 5. S. C. Kim and T. J. Kang, “Automated defect detection system using wavelet packet frame and Gaussian mixture mode”, JOSAA; 23(11):2690-2701(2006). 16 6. S. Palmer and X. Wang, “Objective classification of fabric pilling based on the two-dimensional discrete wavelet transform”, J.Text Res., 73:713-720(2003). 7. N. G. Kingsbury, “Dual-tree Complex Wavelet Transform with Improved Orthogonality and Symmetry Properties”, ICIP, BC, Canada, 2000. 8. H. Permuter and J. Francos, “Jermyn I. A study of Gaussian mixture models of color and texture feature for image classification and segmentation”. Pattern Recogn., 39:696-706(2006). 9. M. Sujaritha and S. Annadurai, “Color image segmentation using adaptive spatial Gaussian mixture model”, J.IJICT., 6(1):28-32(2010). 10. S. Cherifa and R. Messaoud, “New technique to use the GMM in speaker recognition system (SRS)”, ICCAT,2013. 11. H. Permuter, J. Francos and I. Jermyn. “A study of Gaussian mixture models of color and texture features for image classification and segmentation”, Pattern Recogn., 39:695-706(2006). 12. Z. Deng, L. Wang and X. Wang, “An integrated method of feature extraction and objective evaluation of fabric pilling”, J.Text I, 102:1, 1-13(2011). 17