A Fabric Defect Detection Algorithm Based on Improved Valley-Emphasis Method

: Valley-emphasis is a simple and efficient image segmentation method by adaptively calculating threshold. Due to the uneven illumination or complex image texture, this method directly used for fabric image defect detection will cause inaccurate segmentation result. In this study, we propose a novel fabric image segmentation algorithm for fabric defect detection. The optimal threshold is calculated by considering inter-class variance and between-class variance based on Fisher linear discriminant analysis theory. The fabric defect regions are extraceted from the whole fabric image by threshold segmentation algorithm. Experimental results and comparisons demonstrate the effectiveness of the proposed method. And it can implement on-line due to its simplicity.


INTRODUCTION
In textile products, fabric defect have a serious influence on textile price.According to market research, the price of fabric product will be dropped 45-53% due to the fabric defect.Therefore, the fabric defect detection is important for fabric production.The traditional fabric defect detection task has conducted by workers.However, manual work is very tedious and time consuming.The workers need to detect small details which spread over the wide fabric area moving through their visual field.And the identification rate is about 70%, moreover, the effectiveness of visual inspection decrease quickly for different kinds and moving speed of fabric.Therefore, it is urgent to develop an efficient automatic detection technology to replace manual detection.
Digital image processing techniques have been adopted detection for fabric defect over the last ten years.The defect detection can be regarded as image segmentation tasks which segment the fabric region from the whole fabric image.Many traditional image segmentation methods have been proposed, such as iterative method, bimodal method, Otsu method and valley-emphasis method etc., (Bu and Lu, 2010;Shen and Li, 2012) proposed a threshold segmentation technology based on the iterative method.Although this method can segment the target from the whole image by automatically selecting threshold, the segmentation results are not ideal.Yang (2012), Chen (2011) and Liu (2005) proposed the threshold segmentation technology based on the bimodal method.According to histogram distribution of the gray image, this method chooses a gray value at the valley as the threshold for segmentation.However this method is only applicable to the image which has simple background and bimodal distribution histogram.In Ref. (Chen et al., 2012;Wang and Li, 2011), the threshold segmentation method only consider between-class variance not inter -class variance into account when selecting segmentation value.In addition, due to calculating the gray statistic, therefore when the intensity ratio of the target image and the background image is smaller or illumination is uneven, this algorithm will be failure.Ng (2006) proposed a novel threshold segmentation method, named as valley-emphasis method.This method optimized the segmentation threshold by introducing a weight to the Otsu threshold.But this method cannot efficiently apply it into the segmentation of complicated texture.Aiming at segmenting the defect from the fabric images which have complicated texture, we propose a novel threshold segmentation method by introducing the theory of Fisher Linear discriminate analysis.

METHODOLOGY Automatic threshold selection:
The Otsu method: The Otsu method is also known as Nobuyuki Otsu method (for short Otsu), which proposed by the Nobuyuki Otsu in 1979.According to gray characteristics of image, the image is divided into two parts, namely target and background.The bigger the inter-class variance is, the larger the difference is between the two parts.So the best threshold value can be obtained when the inter-class variance is largest.The algorithm can be described as follows: • Image classification: f (x, y) is an input image and it can be separated into two parts with the threshold T according to the image's gray level of image by the following equation: where f min , f max are the minimum value and maximum value of the image gray respectively.

• The probability of occurrence of gray-level i:
Supposing N i is the number of pixels with graylevel i (f min ≤i≤f max ) and ˚= ˚ ( is the total number of pixel in a given image.The probability of occurrence of gray-level i is defined as: • The probabilities and the mean gray-level values of the two classes: The probability of occurrence of C 1 class can be described as: The mean gray-level value can be described as: The probability of occurrence of C 2 class can be defined as: The mean gray-level value is computed as: • The average gray-level of the entire image is computed as: • The optimal threshold T: The optimal threshold T can be determined by maximizing the inter-class variance, namely: The valley-emphasis method: The valley-emphasis method optimized the segmentation threshold by introducing a weight to the Otsu threshold.The formulation for this method is described as follow: The purpose of the adaptive threshold technology is finding a gray-level which can separate the target from the background and such a gray level generally exists at the valley.We can see that the probability of occurrence of the valley is very small.Therefore, we should select a threshold value that has a small probability of occurrence, meanwhile can be maximize the inter-class variance.This is the principal of the valley-emphasis method.
The improved algorithm of this study: When we calculate the threshold, the traditional Otsu method just takes the between-class variance into consideration, ignoring the function of the inter-class variance.Therefore, the traditional Otsu method is not a good choice to segment for complicated texture image.Based on the Fisher Linear Discriminated Analysis theory, this study presents an improved method to solve the segmentation of complicated texture fabric image.
Fisher criterion function: Bian and Zhang (2000)  described that Linear Discriminated Analysis for short LDA (also referred to as Fisher Linear Discriminant) is a classical algorithm of the pattern recognition.In 1996, Belhumeur introduced this algorithm into the area of pattern recognition and artificial intelligence.Before giving the LDA criterion function, we explain several parameters.Supposing a set X, it contains N samples, namely vectors x 1 , x 2 , …, x N and each sample has d dimensions.Among the N samples, there have N 1 samples belong to C 1 class, recording set X 1 ; and the other N 2 samples belong to C 2 class, recording set X 2 .Let's do a linear combination to the component of x n and get scalar quantities Here, y n has two subsets named y 1 and y 2 and it is the projection Vector of x n .w is the direction.
In the d dimensions of X space, detailed formulas can be described as follows: • Average vector of two classified samples is defined as: • Within-class scatter Q i of samples and the total within-class scatter Q can be described as follows: • Between-class scatter Q b of samples is defined as: In the one dimension of Y space, formulas for calculating can be described as follows: • Within-class scatter $ of samples and the total within-class scatter is defined as: We hope that the high dimensional samples are projected into a one-dimensional space at the same time these samples of two parts as possible share while the more intensive the better within the various samples.The bigger class means the better, the smaller withinclass mean the better.This is the Fisher linear discriminated principle.We know from formulas above that the Fisher criterion function should be expressed as follow: The operations of the algorithm of this study: The improved algorithm processes of this study can be defined as follows: • Molecule part m 1 of the improved criterion function can be calculated as: • According to the definition of within-class scatter of the Fisher criterion function, we define withinclass variance of the image as follows: Inter-class variance of the first class C 1 : Inter-class variance of the second class • Denominator part m 2 of the improved criterion function is defined as: • The improved criterion function is M: • The method of computing segmentation threshold t of the improved algorithm is calculated as: The formula (24) shows that the improved algorithm for image segmentation, not only takes into account the distance of between-class of samples, but also considers the distance of inter-class of samples.And only when both of them achieve relatively better values, the segmentation threshold t can be obtained.

EXPERIMENTAL RESULTS AND ANALYSIS
This experiment is completed through MATLAB 7.0 and samples are gray fabric images (if it is the color image, we need to convert it to gray image).This study's algorithm is compared with the Otsu method and the valley-emphasis method respectively and the test results are shown as follows: Shown in Fig. 1 and 2, sample 1 and 2 both of them contain blemishes and other defects.Influenced by the light conditions, the brightness of sample-1 is uneven; besides uneven illumination, the surface texture of the sample-2 is relatively complex.The results of the Otsu method, the valley-emphasis method and our method are shown in Fig. 1b to d and 2b to d respectively.We can see from these results that due to the impact of the light and the complexity of the surface texture of the fabric, neither the Otsu method nor the valley-emphasis can correctly detect the defect our algorithm is able to detect the defect correctly.Shown in Fig. 3, the sample-3 contains thick diameter defect, some noise and complex texture.The results of detections of the Otsu method, the valley emphasis method and our method are shown to d respectively.Due to the small ratio of the gray level of the target image and the background image, Otsu method can't detect the defective portion of the fabric; Influenced by noise and complex textures, the test results of the valley-emphasis are very poor; However, our algorithm can accurately detect the defect part correctly.
As can be seen from Fig. 3d, although the defect has been detected, the noise in the image still exists.We can use a low-pass filter to remove the noise.There are many commonly low-pass filtering methods.respectively.We can see from these results that due to the impact of the light and the complexity of the surface texture of the fabric, neither the Otsu method nor the emphasis can correctly detect the defect, while our algorithm is able to detect the defect correctly.
3 contains thick complex texture.The results of detections of the Otsu method, the valleyshown in Fig. 3b d respectively.Due to the small ratio of the graylevel of the target image and the background image, Otsu method can't detect the defective portion of the fabric; Influenced by noise and complex textures, the is are very poor; However, our algorithm can accurately detect the defect , although the defect has been detected, the noise in the image still exists.We pass filter to remove the noise.There are methods.Such as

CONCLUSION
This study proposes an improved fabric defect detection algorithm based on the valley method.This study first introduces these advantages and disadvantages of the Otsu method and the valley emphasis method.To resolve the shortcomings of the valley-emphasis method, we combine the principle of Fisher linear discriminant classification with existing method.When we select the image segmentation threshold, the new algorithm mentioned in the study not only considers the between-class variance, but als takes the inter-class variance into account.The

CONCLUSION
This study proposes an improved fabric defect detection algorithm based on the valley-emphasis method.This study first introduces these advantages and disadvantages of the Otsu method and the valleyemphasis method.To resolve the shortcomings of the emphasis method, we combine the principle of Fisher linear discriminant classification with existing method.When we select the image segmentation threshold, the new algorithm mentioned in the study not class variance, but also lass variance into account.The experimental results show that, compared with the Otsu method and the valley-emphasis method, the new algorithm mentioned in the study has a strong adaptability, it is suitable for fabric defect detection.
Fig. 1: Experimental result I Fig. 3: Experimental result III Exponential Low-Pass Filtering, Butterworth Low Filtering, Gaussian Low-Pass Filtering and so on.Here, we choose the Gaussian Low-Pass Filtering.Besides removing the noise, it can also reserve the edge information.It also avoids the presence of rin detection result of sample 3 after shown in Fig. 3f to h.In our experiment, the order of filter n = 2, the filter radius D 0 = 20.
Butterworth Low-Pass Pass Filtering and so on.Here, Pass Filtering.Besides removing the noise, it can also reserve the edge information.It also avoids the presence of ringing.The after image filtering as .In our experiment, the order of .