Defect Detection on Patterned Fabrics Using Entropy Cues

  • Maricela Martinez-Leon
  • Rocio A. Lizarraga-MoralesEmail author
  • Carlos Rodriguez-Donate
  • Eduardo Cabal-Yepez
  • Ruth I. Mata-Chavez
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9680)


Quality control is an essential step in the textile manufacturing industry. There is a growing interest in the field of automation using computer vision for freeing human beings from the inspection task. In this paper, patterned fabric images are analyzed using entropy cues in order to detect different kinds of defects. In our proposal, we transform the test image to an entropy image in which the defects show low values and can be easily separated by a simple thresholding. Our method is evaluated and compared with previously proposed approaches, showing better results on an extensive database of real defective and non-defective fabrics.


Defect detection Fabric Entropy Texture analysis 

1 Introduction

In recent years, computer vision has played an important role in the textile industry. The contribution in this field has been through developing solutions for the automation of production processes. One of the main processes where computer vision has had a major role is in the fabric quality assessment. In this step, fabric is examined for unacceptable defects such as knots, holes or surface blemishes. Traditionally, the quality control is carried out by human visual inspection. However, it is well-known that human-based inspection is imprecise and has disadvantages due to fatigue, visual range, and rate of detection. Therefore, the development of an accurate and robust automatic visual inspection system for quality analysis is a fundamental issue in the modern textile industry [7].

Visual texture analysis applications are of great interest in the automation of textile inspection. Texture is an important feature for the characterization of surfaces of natural and man-made objects. In particular, the analysis of periodic textures, also called patterned textures, is commonly considered in a wide range of applications because of its presence on an assortment of daily-use products such as clothes, shoes, handbags, bed sheets, among others. In order to attend the defect detection problem, researchers in the texture analysis field are actively pursuing new methods to achieve an acceptable detection rate for a variety of defects on different patterned fabrics [13].

A considerable number of methods has been proposed in order to detect defects on different patterned fabrics. These methods can be separated into three categories: spectral, model-based and statistical. Spectral approaches are mainly based on the analysis of the fabric images using tools such as Fourier Transform (FT) [17], wavelet transform (WT) [18], Gabor transform (GT)[2] and filtering [11]. Since the spatial domain is usually noise sensitive, spectral approaches utilize a different domain to characterize defects. The main disadvantage of these approaches is that they cannot detect small defects. Model-based methods characterize fabric patterns with auto-regressive models [1] and Markov random fields [3]. These methods can detect defects by comparing new test fabrics with the corresponding models. A drawback of model-based approximations is that the estimation of the parameters may not be straightforward. Statistical approaches are the most popular because of their simplicity and good performance. In this category, spatial distribution of gray values is defined by different representations such as auto-correlation function [17] and co-occurrence matrix [8, 9]. Auto-correlation functions measure spatial frequency and depicts maxima at multiple locations corresponding to the repetitive primitive on an image. If the intensity of maxima stays constant, the repetitive primitive is perfectly replicated, otherwise, a defect is detected. Gray level co-occurrence matrix (GLCM), originally proposed by Haralick [6], characterizes texture features as second-order statistics by measuring spatial dependence of the gray levels of 2 pixels. Much research has been developed using GLCM-based methods [16], however, the main drawbacks are poor performance and the computational requirements needed for the GLCM calculation.

In this paper, defects on patterned fabrics are detected using the property of entropy computed from the sum and difference histograms (SDH). The SDH were introduced by Unser [16] as an alternative to the GLCM in order to simplify the computation and memory requirements. In our proposal, we transform the test image to an entropy image in which the defects show low values and can be easily separated by a simple thresholding. From now on, we call our method as EDD for Entropy-based Defect Detection. The EDD is evaluated and compared with previously proposed approaches, showing better results on an extensive database of real defective fabric images.

This paper is structured as follows: in Sect. 2, the SDH and the computation of entropy are defined. The proposed EDD is presented in Sect. 3. In Sect. 4, we present the experimental setup and the results performed to validate or method. Finally, Sect. 5 presents a summary of this work and our concluding remarks.

2 Entropy Cues

In order to obtain the entropy cus, let us define an image I of \(M\times N\) pixels size, which has K gray levels \(k={0,1,\dots ,K-1}\). Consider a pixel positioned in the coordinates (mn) with intensity \(I_{m,n}\) and a second pixel in the relative position \((m+v_{m},n+v_{n})\) with intensity \(I_{m+v_{m},n+v_{n}}\). The non-normalized sum and differences, of two pixels associated with the relative displacement vector \(V=~(v_{m},v_{n})\), are defined as:
$$\begin{aligned} s_{m,n}= & {} I_{m,n}+I_{m+v_{m},n+v_{n}}\end{aligned}$$
$$\begin{aligned} d_{m,n}= & {} I_{m,n}-I_{m+v_{m},n+v_{n}}. \end{aligned}$$
Sum and Difference Histograms \(h_{s}\) and \(h_{d}\), with displacement vector \(V=(v_{m},v_{n})\) over the image domain D, are defined as:
$$\begin{aligned} h_{s}(i)= & {} Card\{(m,n)\in D,s_{m,n}=i\}\end{aligned}$$
$$\begin{aligned} h_{d}(j)= & {} Card\{(m,n)\in D,d_{m,n}=j\}. \end{aligned}$$
The total number of counts in each histogram is
$$\begin{aligned} A =\sum _{i}h_{s}(i)=\sum _{j}h_{d}(j). \end{aligned}$$
The normalized sum and difference histograms are estimates of the sum and difference probability functions defined by
$$\begin{aligned} P_{s}(i)= & {} \frac{h_{s}(i)}{A}; (i=0,1,\dots , 2K-2),\end{aligned}$$
$$\begin{aligned} P_{d}(j)= & {} \frac{h_{d}(j)}{A}; (j=-K+1,-K+2, \dots ,K-1). \end{aligned}$$
A number of features computed from the sum and difference probability functions have been proposed to be used as textural features like homogeneity, contrast, entropy, etc. and these features were simplified by Unser. Entropy, is defined as:
$$\begin{aligned} entropy = E = -\sum _{i} P_s(i) log\left( P_s(i)\right) -\sum _{j} P_d(j) log\left( P_d(j)\right) . \end{aligned}$$

3 Defect Detection Using Entropy Cues

In this section, the use of entropy cues for defect detection on patterned fabrics is presented. The proposed framework (EDD) is illustrated in Fig. 1, where it can be seen that it is performed in four steps: histogram equalization, entropy computation, filtering and thresholding.
Fig. 1.

Diagram of the proposed approach.

The pre-processing step is executed to accentuate the defects on the test images. In this step, a histogram equalization was performed. Concerning this task, we have found that this pre-processing offers better results in terms of detection accuracy, in comparison to without any adjustment. After that, the extraction of entropy cues is accomplished. The original Unser proposal is to obtain a unique entropy value for each image. However, in this paper we propose to compute the local entropy of each image, in such a way that entropy may provide information about the uniformity of the analyzed fabric. In the entropy image, each pixel contains the entropy value of a \(P\times Q\) neighborhood around the corresponding pixel in the input image. In the EDD method, the size of the neighborhood is fixed according the size of the repetitive primitive of the patterned fabric. The size of the repetitive pattern can be estimated automatically using different methods. In our approach, the neighborhood size is estimated using the algorithm presented by Lizarraga-Morales et al. [10]. Such method is completely automatic, robust, accurate and computationally efficient.

As we can see in the entropy image (presented in Fig. 2), the defects get lower values than the rest of the image, therefore it is possible to separate them from the healthy part of the fabric. This behavior is due to the fact that the defects occurring in the analyzed fabrics are more uniform in terms of the gray levels than the rest of the image. Before the thresholding, an adaptive noise reduction filtering [5] of \(5\times 5\) pixels size is performed, in order to diminish the variations of the entropy values. The final thresholding is accomplished using the Otsu method [15]. The resulting images from each step of the defect detection procedure are depicted in Fig. 2. It is important to mention that all the parameters used in our experiments (displacement vector and filter size) were empirically estimated.
Fig. 2.

Resulting images of each step of the EDD.

4 Experimental Setup

In order to study the performance of the proposed algorithm, images of patterned fabrics with defects are analyzed. Although there is an innumerable amount of different designs, it has been proven that all patterned fabrics can be classified into only 17 groups [4]. Each group is defined by the shape of its primitive and its inner symmetry. For these experiments, we have used the database of fabrics provided by Henry Y.T. Ngan from the Industrial Automation Research Laboratory in the Department of Electrical and Electronic Engineering at the University of Hong Kong. Such database is a widely used empirical basis for algorithms of defect detection on patterned fabrics. It consists of 3 different fabrics belonging to the 3 major groups of patterns: p4m (box-patterned), pmm (dot-patterned) and p2 (star-patterned). The groups pmm, p2 and p4m are called major due to the fact that all the other 14 groups can be transformed into these 3, via geometric transformation [12]. Defective samples previously labeled with five of the most common defects are provided: Broken End, Thick Bar, Thin Bar, Hole and Multiple Netting. Furthermore, for each defective image, a ground truth is available and can be used to quantify the reliability of a given method. This database contains 30 healthy samples and 5 samples of each defect for each fabric pattern, giving a total of 165 images of both defective and non-defective images. Examples of the patterned fabrics used for experiments are shown in Fig. 3.
Fig. 3.

Patterned fabrics used for experiments: p4m (box-patterned), pmm (dot-patterned) and p2 (star-patterned), respectively.

For a quantitative evaluation, we have adopted the evaluation setup mentioned by Ngan et al. [13] in order to measure the accuracy of detection. Specifically, we have measured the accuracy of our method using the Detection Success Rate (DSR) also known as detection accuracy, which is defined in Eq. 9.
$$\begin{aligned} DSR = \frac{TP + TN}{TS}, \end{aligned}$$
where TP stands for True Positives, which are the defective samples classified as defective, TN are the True Negatives: non-defective samples that are correctly classified. TS is the total number of samples.

5 Results

Samples of the resulting images of each test pattern with different defects are presented in Fig. 4. In this figure we can see that with the DEE approach, it is possible to detect both small and big defects occurring among different fabric patterns. Quantitative results are provided in Table 1, where the DSR is presented for each defect type occurring in each patterned fabric. From this table, the DSR is 95.7 %, 95.8 % and 97 % for the p4m (box-patterned), pmm (dot-patterned) and p2 (star-patterned), respectively.
Fig. 4.

Samples of defect detection on the p4m, pmm and p2 patterns.

Table 1.

EDD Detection success rate for each defect in each fabric pattern.


Broken End

Thick Bar

Thin Bar


Multiple Netting























A comparison with other state-of-the-art methods can be consulted in Table 2. For the comparison, methods belonging to the spectral and statistical categories, were selected. From this table it can be seen that our EDD attains a 96.16 % of average performance accuracy for the complete database. In contrast, the previously proposed methods are considerably below this performance with 82.8 %, 88.3 %, 90.7 %, 93.3 %, and 96 % of average detection rate.
Table 2.

Comparison chart of the proposed method against previously proposed methods.



Overall Accuracy

Badnarova et al. [2]

Gabor transform

82.8 %

Ngan et al. [14]

Image Subtraction

88.3 %

Latif-Amet et al. [9]


90.7 %

Yang et al. [18]

Wavelet transform

93.3 %

Kuo and Su [8]


96.0 %

Proposed Methodology

Statistical (Entropy)

96.1 %

Regarding the computation time of the EDD approach, the processing time required for analyzing one image is of 120 ms using a non-optimized MATLAB implementation in an ordinary CPU.

6 Conclusions

In this paper, defect detection problem on patterned fabrics is approached using entropy cues, which are computed from the sum and difference histograms. The proposed procedure is conformed by simple, yet effective, steps in order to determine if there is a defect on the image. From the experiments, it has proven to be robust to detect five of the most common defects, regardless of its shape or size. In comparison with other approaches, the EDD has attained the higher accuracy when testing it on a standard database. Such attributes, which overtake different drawbacks of previously proposed methods, make the proposed methodology a good option for defect detection on patterned fabrics.



The authors would like to thank Henry Y.T. Ngan from the Industrial Automation Research Laboratory in the Department of Electrical and Electronic Engineering at the University of Hong Kong, for providing the database of fabrics. Martinez-Leon would like to acknowledge for the grant provided by the Mexican National Council of Science and Technology (CONACyT). This research was supported by the PRODEP through the NPTC project with number DSA/103.5/15/7007.


  1. 1.
    Alata, O., Ramananjarasoa, C.: Unsupervised texture image segmentation using 2-D quarter plan autorregresive model with four prediction supports. Pattern Recogn. Lett. 26(8), 1069–1081 (2005)CrossRefGoogle Scholar
  2. 2.
    Badnarova, A., Bennamoun, M., Latham, S.: Optimal gabor filter for textile flaw detection. Pattern Recogn. 35, 2973–2991 (2002)CrossRefzbMATHGoogle Scholar
  3. 3.
    Chan, H.-Y., Raju, C., Sari-Sarraf, H., Hequet, E.F.: A general approach to defect detection in textured materials using wavelet domain model and level sets. In: Proceedings of SPIE 60010D, pp. 1–6 (2005)Google Scholar
  4. 4.
    Conway, J.H., Burgiel, H., Goodman-Strauss, C.: The Symmetries of Things. AK Peters/CRC Press, Taylor and Francis, Boca Raton (2008)zbMATHGoogle Scholar
  5. 5.
    Gonzalez, R.C., Woods, R.E.: Digital Image Processing. Prentice-Hall, Upper Saddle River (2002)Google Scholar
  6. 6.
    Haralick, R.M., Shanmugan, K., Dinstein, I.: Textural features for image classification. IEEE Trans. Syst. Man Cybern. 3(6), 610–621 (1973)CrossRefGoogle Scholar
  7. 7.
    Kumar, A.: Computer-vision-based fabric defect detection: a survey. IEEE Trans. Ind. Electron. 55(1), 348–363 (2011)CrossRefGoogle Scholar
  8. 8.
    Kuo, C.J., Su, T.: Gray relational analysis for recognizing fabric defects. Text. Res. J. 73(5), 461–465 (2003)CrossRefGoogle Scholar
  9. 9.
    Latif-Amet, A., Ertuzun, A., Ercil, A.: An efficient method for texture defect detection: sub-band domain co-occurrence matrices. Image Vis. Comput. 18(6–7), 543–553 (2000)CrossRefGoogle Scholar
  10. 10.
    Lizarraga-Morales, R.A., Sanchez-Yanez, R.E., Ayala-Ramirez, V.: Fast texel size estimation in visual texture using homogeneity cues. Pattern Recogn. Lett. 34(4), 414–422 (2013)CrossRefGoogle Scholar
  11. 11.
    Neubauer, C.: Segmentation of defects in textile fabric. In: Proceedings of IEEE 11th International Conference on Pattern Recognition, vol. 1, pp. 688–691, September 1992Google Scholar
  12. 12.
    Ngan, H.Y.T., Pang, G.K.H.: Regularity analysis for patterned texture inspection. IEEE Trans. Autom. Sci. Eng. 6(1), 131–144 (2009)CrossRefGoogle Scholar
  13. 13.
    Ngan, H.Y.T., Pang, G.K.H., Yung, N.H.C.: Automated fabric defect detection - a review. Image Vis. Comput. 29(7), 442–458 (2011)CrossRefGoogle Scholar
  14. 14.
    Ngan, H.Y.T., Pang, G.K.H., Yung, S.P., Ng, M.K.: Wavelet based methods on patterned fabric defect detection. Pattern Recogn. 38(4), 559–576 (2005)CrossRefGoogle Scholar
  15. 15.
    Otsu, N.: A threshold selection method from gray-level histograms. Automatica 11(285–296), 23–27 (1975)Google Scholar
  16. 16.
    Unser, M.: Sum and difference histograms for texture classification. IEEE Trans. Pattern Anal. Mach. Intell. 8(1), 118–125 (1986)MathSciNetCrossRefGoogle Scholar
  17. 17.
    Wood, E.J.: Applying fourier, associated transforms to pattern characterization in textiles. Text. Res. J. 60, 212–220 (1990)CrossRefGoogle Scholar
  18. 18.
    Yang, X.Z., Pang, G.K.H., Yung, N.H.C.: Discriminative fabric defect detection using adaptive wavelets. Opt. Eng. 41(12), 3116–3126 (2002)CrossRefGoogle Scholar

Copyright information

© Springer International Publishing Switzerland 2016

Authors and Affiliations

  • Maricela Martinez-Leon
    • 1
  • Rocio A. Lizarraga-Morales
    • 1
    Email author
  • Carlos Rodriguez-Donate
    • 1
  • Eduardo Cabal-Yepez
    • 1
  • Ruth I. Mata-Chavez
    • 1
  1. 1.Departamento de Estudios Multidisciplinarios, Division de IngenieriasUniversidad de GuanajautoYuririaMexico

Personalised recommendations