You are on page 1of 5

Fabric Defect Detection Using Local Homogeneity

and Morphological Image Processing


A. Rebhi, S. Abid, F. Fnaiech
Scientific Research Laboratory in Signal, Image Processing and Energy Mastery (SIME)
University of Tunis 5 Av. Taha Hussein 1008, Tunis, Tunisia.
ali_rebhi@yahoo.fr

Abstract— In this paper, a new fabric defect detection optimal filters, such as [11-13] Hong-Dar Lin used the concept
algorithm based on local homogeneity and mathematical of the statisticalzapproach [14, 15] for visual inspection of
morphology is presented. In a first step, the local homogeneity of ripple defects. The approachaused waveletadecomposition to
each pixel is computed to construct a new homogeneity image extract feature vectors to describe the surface properties. Then,
denoted as (H-image). Then a classical histogram is computed for multivariate statistics of Hotelling T2 control chart were
the H-image to choose an optimal thresholding value to produce a applied to integrate the multiplextexture features andajudge the
corresponding binary image, which will be used to extract the existence of ripple defects in the image.
optimal size and the shape of the Structuring Element (SE) for
mathematical morphology. In a second step, the image is In textured images, discontinuities representagenerally an
subjected to a series of morphological operations with this SE to important feature such as boundaries. It is known that the local
detect the possible existing fabric defect. Simulation results homogeneity analysis is the method to detect these
exhibit accurate defect detection with low false alarms. discontinuities [16, 17].
Keywords—Fabric defect detection; local homogeneity (H- Recently, thewtechniques of morphologicalwwimage
image); morphological operations processing are widely used for imagexanalysis and have been a
valuable tool in many computerdvision applications, especially
I. INTRODUCTION in the areas of automated inspection [18]. The morphological
operations for defectxdetection in fabric arewinherently
The high quality is the watchword of any type of industrial sensitive to the size and shape of the defect. Therefore, while
or manufactured products. Any product without good quality applyingxmorphological imagewprocessing technique on the
leads to loss and lack of customer satisfaction. This is the case fabric image for the detection of defects, the software-based
of textile industries for example. Textileamanufacturingais a morphological operations may give poor result. Previous
processaof converting various typesaofafibers into yarn, which research hasxdemonstrated that the use of morphologicalafilters
in turn woven into fabric. In textilezindustries, quality can significantly lower the false alarm rate [19- 21].
inspectionzis one of theqmajor problems fordfabric
manufacturers. Currently in textile industries, manual In this paper, we develop a new algorithm for fabric defect
inspection is carried out. Theafabric obtained from the detection in textile industry. The proposed algorithm uses
productionqmachine are batched intoalarger rolls and subjected morphological operations and the local homogeneity analysis
to the inspection frame. The nature of the work is very dull and (H-image).
repetitive. Due to manualxinspection of the manufactured This paper is organized as follows: The local homogeneity
fabric, there is a possibility of human errors with high computation is presented in section II. The morphological
inspection time. Fabric defects are responsible for nearly 85% operations is then described in section III. Section IV describes
of the defects found in the garment industry [1]. Also, it has the algorithm for fabric defect detection. Section V gives
been observed that price of textile fabric is reduced by 45% to simulation results on different fabric images and several
65% due to defects [2]. The development of an automated defects. Finally in section VI the main conclusions and
inspection system requires robust and efficient fabric defect perspectives are given.
detection techniques.
In textilexxindustry, imaging and image processing II. LOCAL HOMOGENEITY COMPUTATION
techniques arewinvestigated for off-line and on-line visual It is known that discontinuities in textured images
inspection of fabric for the detection of defects [3, 4]. represent generally an important feature such as boundaries.
Numerousnmethods havecbeen designed to solve the defect The main problem is how to detect these discontinuities? A
detectionstask in the fabric images. Chi-ho Chan and Grantham method to resolve this problem is the homogeneity (H). The
[5] provided a comprehensive overview of defectcdetection by calculation of H was proposed first by Jing et al. in [22]. Let P
Fourier analysis. Wavelet transform is another method which be a squared window i.e. a mask of (2N+1) width centered on
was applied in [6-8]. Gaborxfilters has been widely used in the the pixel I c ( x c , y c ) . In the window P one can define
field of fabric defect detection. All the detection approaches
using Gabor filter can be classified into twowcategories. One is different vectors coming from the central pixel and going to
to use a filter bank, such as [9, 10] and the other one is to use

Authorized licensed use limited to: Ming Chi University of Technology. Downloaded on July 27,2021 at 15:55:14 UTC from IEEE Xplore. Restrictions apply.
pixel Pi by: Pi ,c = ( x j − xc , y j − yc ) , note that the index i is Where H min and H max are the minimum and the maximum
an integer number defined as: value of homogeneity respectively.
The resulting H-image is constructed by the different values of
c−N ≤ j ≤c+N
(1) Ĥ computed for each pixel value I c ( x c , y c ) .
1 ≤ i < (2 N + 1) 2 The resulting H-image is a grayscale one whose pixel values
are the Ĥ values of the pixel homogeneities. It is easily noted
Here ( xi , yi ) are the coordinate of the pixel Pi, ( xc , yc ) are
that the Ĥ values are very small for homogenous regions, and
the coordinates of the central pixel (Pc) and N is an integer high within boundaries and non-homogenous regions.
number, which define the mask size. Consequently, the H-image can be viewed as a transformation
Note that this definition allows us to compute the homogeneity of the original one where the homogenous regions are
of a pixel for different mask sizes (3 × 3), (5 × 5) etc. transformed on the dark areas and the non-homogenous region
Figure 1 shows an example of the different pixels used to on gray scale regions. It follows that the H-image can be used
compute homogeneity in a window of size (5x5) pixels. as a discontinuity measurement in the image.

III. MORPHOLOGICAL OPERATIONS


The language of Mathematical Morphology (MM) is set
theory. Sets in MM represent objects in an image. MM is the
science of appearance, shape and organization. MM deals with
non-linear processes which can be applied to an image to
remove details smaller than a certain reference shape called
the structuring element [23]. MM is also the foundation of
morphological image processing, which consists of a set of
operators that transform images according to the above
characterizations. There are four fundamental operations in
morphology, which are dilation, erosion, opening and closing.
Fig. 1 Different vectors fi used to compute the local homogeneity for 5x5
masks
MM was originally developed for binary images, and was later
extended to grayscale functions and images. The foundational
Based on the definition of the vector linking the central pixel operations of binary morphology are defined as follows:
with any arbitrary pixel Pi ,c = ( xi − xc , yi − yc ) a new vector Dilation is similar to convolution, in which the structuring
element is reflected and shifted from left to right and then
fi is constructed as follows: from top to bottom. If X is the reference image and B is the
structuring element, the dilation of X by B is represented as:
Pi ,c
fi = ( I ( xi , yi ) − I ( xc , yc ) ) (2)
{ ( ) ∩ X ≠ 0}

Pi ,c X ⊕B= z\ B
z
(6)

For a mask of width (2 N + 1) , we have (2 N + 1) 2 − 1 vectors


The erosion of X by B is described as follow:
fi :1 ≤ i < (2 N + 1)2

{ () }
Let f be the sum of all vectors defined in the window P, so: 
X ΘB = z \ B ⊆X (7)
z
(2 N +1)2 −1
f = i =1
fi (3)
The opening of set X by structuring element B is represented
The H value measurement (the homogeneity value) is defined as:
as the norm of f , so that:
H= f (4) X  B = ( X ΘB ) ⊕ B (8)

To limit the huge variation of the local homogeneity the


The closing of set X by structuring element B is represented
normalized homogeneity is used:
as:
H − H min
Hˆ = (5) X • B = ( X ⊕ B ) ΘB (9)
H max − H min

Authorized licensed use limited to: Ming Chi University of Technology. Downloaded on July 27,2021 at 15:55:14 UTC from IEEE Xplore. Restrictions apply.
Note that dilation and erosion on binary images can be Step 4: Applied the closing operation: The smoothed fabric
viewed as a form of convolution over a Boolean algebra of image is then closed again by using a 3 × 3 square structuring
operations (NOT, AND, OR, XOR), which are defined element.
between pixels of corresponding locations in two images Step 5: Defect extraction: after applying the opening and
of equal dimensions [24]. Furthermore opening and closing closing operation, the last step of the scheme is the producing
are two higher order operations built on dilation and the final detection result.
erosion. Due to the connection with Boolean operations,
the erosion and dilation can turn black pixels white and V. SIMULATION RESULTS
white pixels black when certain conditions are met. In the purpose of evaluating the performances of the
proposed method, we present simulation results on different
IV. A PROPOSED ALGORITHM FOR FABRIC DEFECT textured images; each one may contain several defects. All
DETETCTION simulations were wrote in Matlab language on a personal
computer (Intel® core™ 2Duo CPU T5870 @2Gh). The
This method consists in scanning the original image with a
whole textured images are 256x256 pixels wide with 8-bit
squared window and computing the local homogeneity for
gray levels.
each pixel and constructing the (H-image). In our work, we
have used a window of size (11× 11) pixels. After, every H- Figure 3 and 4 show results of the proposed method for
image is histogram equalized and then thresholded to produce fabric defects detection. In Figure 3 we used images with only
binary image. Then a series of morphological operations such one defect and in Figure 4 we shown examples of images with
as opening and closing using the Structuring Element (SE) is various defects. In each figure the first line shows fabric
applied to the binary image. Figure 2 shows the Flowchart of images that contains defects. The second line shows the
the proposed method. various defects extracted using the H-image and the
In the following we give a brief description of each step morphological operations. The proposed algorithm was able to
For an image I of the size (NxM) pixels correctly detect the defect.
Step 1:Scan the input image I with a squared window and Figure 3 shows the results of the proposed method for
compute the local homogeneity for each pixel and construct fabric defects detection. The first line shows fabric images that
the (H-image). contains defects. The second line shows the various defects
Step 2: Thresholding using the histogram: in this step the extracted using the H-image and the morphological
classical histogram is computed for the H-image to choose the operations. The proposed algorithm was able to correctly
optimal thresholding value for binarization. In the H-image if detect the defect.
the mask size is chosen correctly then the histogram will be The performance of the scheme is evaluated by visually
almost uniform for defect less image and bimodal for textures assessing the quality of the binary output images. True
containing defects. detections (TD) are recorded when (1) the white areas of the
Step 3: Applied the opening operation: this step involves binary output image only overlap the areas of the
applying an opening operation by a square structuring element corresponding defects in the fabric image, and (2) no white
in order to eliminate as much as possible the texture area appears in the binary output image if the fabric image
background in the fabric image.

Fig.2 Flowchart of the proposed methods

Authorized licensed use limited to: Ming Chi University of Technology. Downloaded on July 27,2021 at 15:55:14 UTC from IEEE Xplore. Restrictions apply.
contains no defect. False alarms (FA) are recorded when the [3] R Drobino, M. S. Machnio. ‘‘Application of image analysis technique
for textile identification’’ AUTEX Research Journal. Vol. 6, No. 1,
white areas appearing in the binary output image do not pp. 40-48, 2006
only overlap the areas of the corresponding defects in the [4] Y. F. Zhang, R. R. Bresee, ‘‘Fabric defect detection and classification
fabric image, but also appear in some other areas using image analysis’’. Textile Research Journal. Vol. 65, No. 1, pp.
significantly distant from the defect areas, or when white 1-10. 1995.
[5] C. H. Chan and G. Pang, «Fabric defect detection by Fourier
areas appear in the binary output image when the fabric analysis». IEEE Trans. Ind. Appl., vol. 36, no. 5, pp. 1267–1276,
image contains no defect. Overall detection (OD) is the sum Sep./Oct. 2000.
of TD and FA. Missed detection (MD) means that no white [6] X. Yang, G. Pang and N. Yung ‘‘Robust fabric defect detection and
area appears in the binary output image even if the fabric classification using multiple adaptive wavelets’’. IEE Proc.-Vis.
Image Signal Processing vol. 152, No. 6, December 2005.
image contains a defect. Table 1 summarizes the test results [7] D.M. Tsai and B. Hsiao ‘‘Automatic surface inspection using
over 90 test images. wavelet reconstruction’’. Pattern Recognition, vol. 34, pp. 1285–
It is interesting to note that despite the varying size and 1305, 2001.
orientation of the defects, the algorithm managed to identify [8] Y. Han, P. Shi, ‘‘An adaptive level-selecting wavelet transform for
texture defect detection’’. Image and Vision Computing, vol. 25, no.
accurately most of the defects. 8, pp. 1239-1248, 2007
Note that these results reveal that the defects in all [9] A. Kumar and G. Pang, ‘‘Fabric defect segmentation using
defective surfaces are correctly detected. multichannel blob defectors”, Opt. Eng, vol. 39, no. 12, pp. 3176-
3190, 2000.
[10] A. Kumar and G. K. H. Pang ‘‘Defect detection in textured materials
TABLE I. THE OVERALL TEST RESULTS OF THE PROPOSED using Gabor filters’’. IEEE Trans. Ind. Appl, vol. 38, no. 2, pp. 425-
DETECTION SCHEME 440, 2002.
[11] A. Hamid, A. Alireza, S. Esmaeil ‘‘Defect detection in textiles using
The detection scheme Performance morphological analysis of optimal Gabor wavelet’’. International
Overall Detection (OD) 86 (95.6%) Conference on Computer and Automation Engineering pp. 26-30,
2009.
False alarm (FA) 2 (2.2%)
Missed Detection (MD) 2 (2.2% ) [12] R. Han, L. M. Zhang, «Fabric defect detection method based on
Gabor filter mask». Global Congress on Intelligent Systems, pp.
184-188, 2009.
Based on these results, it can be concluded that the [13] M. Li, R. C. Staunton, ‘‘Optimum Gabor filter design and local
morphological operations provide a good performance for binary patterns for texture segmentation’’. Pattern Recognition
the given fabric defect detection problem. Letters, pp. 664-672, 2008.
[14] H. D. Lin ‘‘Automated visual inspection of ripple defects using
wavelet characteristic based multivariate statistical approach’’. Image
and Vision Computing, vol 25 pp. 1785–1801, 2007.
VI. CONCLUSION [15] H. D. Lin ‘‘Automated defect inspection of light-emitting diode
In this paper, a new morphological approach for detecting chips using neural network and statistical approaches’’. Expert Systems
with Applications vol 36 pp. 219–226, 2009.
fabric defects is presented. It is based on the local [16] A. Rebhi, I.Benmhamed, S. Abid, F. Fnaiech “Fabric defect
homogeneity of each pixel (H-image). In this proposed detection using local homogeneity analysis and neural network’’.
approach we use opening and closing operations, using a Journal of photonics, vol 2015, ID 376163, 2015.
square structuring element, to extract fabric defect. [17] A. Rebhi, S. Abid, F. Fnaiech “Fabric defect detection using line
variances of the local homogeneity images’’. Computer System
The performance of the scheme has been extensively Science & Engineering. Vol 30, No 4, pp. 1-11, 2015
evaluated by using a variety of fabric samples, which differ [18] R. Haralick, S. Sternberg, and X. Zhuang, ‘‘Image analysis using
in defect type, size and shape, texture background, and mathematical morphology’’, IEEE Trans Pattern Analysis and
image resolution. The results obtained have shown that the Machine intelligence. Vol 9, no 4,pp. 532-533, 1987.
[19] K.L. Mak, P. Peng, K.F.C. Yiu ‘‘Fabric defect detection using
scheme is effective and robust. morphological filters’’, Image and Vision Computing Vol. 27, pp.
1585–1592, 2009.
ACKNOWLEDGMENT [20] V. Tiwari , G. Sharma, ‘‘ Automatic Fabric Fault Detection Using
Morphological Operations on Bit Plane’’, International Journal of
The authors would like to thank the Industrial Automation Engineering Research & Technology , Vol. 2, pp. 856-861, 2013.
Research Laboratory Dept. of Electrical and Electronic [21] F. Jing, M. Liz, H. Jiang Z. B. Zhang ‘‘Unsupervised image
Engineering, The University of Hong Kong for providing segmentation using local homogeneity analysis’’. Proceeding of IEEE
the fabric image database. International Symposium on Circuits and Systems, pp. 456-459, 2003.
[22] M. Tabassian, R. Ghaderi, R. Ebrahimpour, “Knitted fabric defect
REFERENCES classification for uncertain labels based on Dempster–Shafer theory of
evidence”, Expert Systems with Applications, vol.38, pp.5259-5267,
[1] P. Sengottuvelan, A. Wahi, A. Shanmugam, “Automatic fault 2011.
analysis of textile fabric using imaging sustems”, Research Journal [23] R. A. Peters, II, “Mathematical morphology for angle-valued
of Applied Sciences, vol. 3, pp. 26-31, 2008. images,” Proc. SPIE, vol. 3026, 1997.
[2] T. Vikrant, S. Gaurav, “Automatic Fabric Fault Detection Using [24] I.T. Young, J.J. Gerbrands, L.J. vanVliet, ‘‘Fundamentals of image
Morphological Operations on Bit Plane” International Journal of processing’’, The Digital Signal Processing Handbook, CRC Press,
Engineering Research & Technology, vol. 2, pp. 856-861, 2013. Boca Raton

Authorized licensed use limited to: Ming Chi University of Technology. Downloaded on July 27,2021 at 15:55:14 UTC from IEEE Xplore. Restrictions apply.
Fig.3 First line: images with defects and second line: defects localization

Fig.4 First line: images with defects and second line: defects localization

Authorized licensed use limited to: Ming Chi University of Technology. Downloaded on July 27,2021 at 15:55:14 UTC from IEEE Xplore. Restrictions apply.

You might also like