Fabric Defect Detection Algorithm Using ...

32 downloads 0 Views 563KB Size Report
yarn quality and/or weaving defects. In [1], it has been estimated that the price of fabrics is reduced by 45%–65% due to the presence of defects. Hence, defects ...
Fabric Defect Detection Algorithm Using Morphological Processing and DCT Mahmoud Abdel Aziz, Ali S. Haggag, and Mohammed S. Sayed Dept. of Electronics and Communications Engineering, Zagazig University, Zagazig, Egypt [email protected], [email protected], and [email protected]

Abstract— Textile industry is one of the major industries in Egypt. Fabric defects severely affect the price of fabrics that represents a major threat to this industry in Egypt. In manual defect detection system, even with highly trained inspectors, small percentage of the defects is detected. A real time automatic defect detection system can increase the detection percentage, hence, reduces the textile fabrication costs. In this paper, we present a new algorithm for fabric defect detection in textile industry. The proposed algorithm uses morphological processing and Discrete Cosine Transform (DCT) to automatically detect fabric defects. The proposed algorithm shows a promising performance and solves several drawbacks associated with the existing algorithms.

specifications are very important since the camera has to be synchronized with the weaving machine’s speed. Fig. 1 shows a pictorial diagram for such arrangements with the camera directly monitoring the production line.

Index Terms— Machine Vision, Fabric Defect Detection, Morphological Processing, DCT Fig. 1. Pictorial diagram of automatic fabric inspection machine

I. INTRODUCTION The end product in textile industry is severely affected by yarn quality and/or weaving defects. In [1], it has been estimated that the price of fabrics is reduced by 45%–65% due to the presence of defects. Hence, defects detection is a vital step for quality assurance in fabric production that helps lowering costs and improving the end product’s quality. Fabric inspection can be accomplished either manually by human inspectors or automatically using computer-vision techniques. In human-based inspection system, many defects are missed, and the inspection is inconsistent, with its outcome depends on the training and the skills level of the human observer. Since the inspection process is an operation with high degree of continuity and repetition, it is impossible to do it online with human inspector. Usually this task is accomplished using offline stations in an inspection stage that is separated from the production lines. This process definitely affects the production speed. Computer-vision-based systems play an essential role to reduce the inspection time and overcome the human monitoring errors. These errors are due to several reasons such as fatigue, boredom, or even carelessness. Computer-visionbased inspection systems have been increasingly applied to replace the human-based systems [2 - 5]. In this solution the human inspector is replaced by a camera that is directly mounted on the weaving machine. The camera is used for real time detection of fabric defects. Therefore, there is no need for detection station. In computer-vision-based systems, camera

The defects detection is usually followed by defects classification and reaction control modules. This paper focuses on the defects detection stage only. The paper presents a new algorithm for defect detection of unpatterned fabric. The proposed algorithm uses morphological processing and DCT to automatically detect fabric defects. Section II reviews a few fabric defect detection techniques. Section III presents the proposed algorithm. Section IV demonstrates and discusses the simulation results. Section V concludes this paper. II. FABRIC DEFECT DETECTION TECHNIQUES Several algorithms have been presented in the literature for fabric defect detection. In [3], a whole system for fabric inspection was presented. The presented system builds image histogram and generates several thresholds for the different defect types. Then neural network is used for defects classification. Using different thresholds increases the detection time that may not be suitable for real time defect detection systems. Another detection method was presented in [4]. This method uses histogram equalization and Fast Fourier Transform (FFT) for fault detection. This method uses FFT to compare the power spectrum plot of an image containing a defect with that of a defect free image. This comparison focuses on shifts in the normalized intensity between one plot and the other, which could signify the presence of a defect. This method clearly depends on having a faultless image of the

same area of the fabric which is not usually available with real time defect detection systems. While in [5], Discrete Cosine Transform (DCT) was used with Artificial Neural Network (ANN). The input to the ANN is the estimated DCT coefficients. The ANN has to be trained with DCT coefficients from several faulty and faultless images. The algorithm accuracy depends on the training sets size and type. In our proposed algorithm we use Morphological processing followed by DCT to estimate dynamic thresholds that are applied on the image to detect fabric defects. More details are presented in the following section. III. THE PROPOSED ALGORITHM The main idea of our proposed algorithm depends on detecting the difference between the defected and the defect free areas of the same image of the monitored fabric production line. There are no inputs to our algorithm except the live textile captured image, i.e. there is no comparison with pre-captured defect free images. Our algorithm depends on using Morphological processing and DCT. Although DCT was used before in defects detection, as mentioned in the review section, but combining between morphological operations and DCT is the new idea proposed in our algorithm. Fig. 2 shows block diagram of the processing operations for our proposed algorithm.

Fig. 2. The processing flow diagram of the proposed algorithm

A. Getting gray image and primitive filtration The captured image by the camera is color image in RGB format while our algorithm processes gray images. Hence, the first step is to convert the color image that has three components, red, green, and blue, into gray image with luminance component only (i.e. gray levels only). In this step also, primitive filtration is applied on gray images for noise removing. The noise results from imperfect imaging conditions which produce some black and white pixels

in the image. Median filter is the best order-static filter in digital image processing. Order-static filters are non-linear spatial filters whose response is based on ordering the pixels contained in an image neighborhood and then replacing the value of the center pixel in the neighborhood with the value determined by the ordering result. Ordering result will be the median value of the neighborhood pixels. The value of the center pixel will be replaced by the median value. B. Morphological processing Since fabric inspection cameras are installed in an uncontrolled illumination environment then adjusting the image lighting intensity is of great importance. Differences of lighting intensity all over the image makes some portions appear brighter while others appear darker. Brighter pixels have higher intensity values while darker pixels have lower ones. These changes in the intensity may cause false detection of unreal fabric faults. Such intensity changes disturb the defect detection algorithm and reduce its efficiency. So, our goal is having a smooth image with less lighting disturbance. Adjusting the degree of lighting to get the desired results is a tedious process and needs a lot of practical experiments. In our algorithm we use Morphological processing for adjusting the image lighting. Erosion and dilation are two basic operations in morphological processing. For erosion, the value of the output pixel is the minimum value of the input pixel’s neighborhood. For dilation, the value of the output pixel is the maximum value of the input pixel’s neighborhood. Pixel’s neighborhoods are determined through structure element. It is a matrix consisting of only 0's and 1's that can have any arbitrary shape and size. The pixels with values of 1 define the neighborhoods. And the center defines the pixel of interest. In our algorithm morphological processing is accomplished in the following three steps using two filters top-hat and bottom-hat: 1. Applying erosion followed by dilation produces opened image, subtracting opened image from gray image produce top-hat filtration image. The top-hat filter can be used to select bright or dark objects for retention or removal. The features that are too large for the central region are ignored by the filter. Features that fit into the smaller interior neighborhood (the crown of the hat) and are separated by the difference between the two neighborhood sizes (the width of the brim of the hat) are selected. The result of the top hat filter is a medium grey value except where features are found, where the difference between the brightest (or darkest) pixel value in the interior region and the brim is suitable for thresholding. 2. Applying dilation followed by erosion produce closed image, subtracting closed image from gray image produce bottom-hat filtration image. The Bottom-hat filter provides a method by which to capitalize on the distinctive dark on light pattern. Because the image closing expands the white areas in an image but does not significantly alter those areas which are already white, the only areas left after subtracting the original are those that were originally black but surrounded by white. This effectively “highlights” the defected portions.

3.

By adding gray image to the top-hat filtration image and subtracting the result from bottom-hat filtration image and adjusting the contrast of the produced image, we get the best contrast enhancement and illumination uniformity image.

C. DCT and Thresholding Acquiring threshold value using Otsu’s method [6] from the processed image with the Morphological techniques does not produce satisfactory results. Hence, Discrete Cosine Transform (DCT) was used. DCT gives a good representation of the image in the frequency domain. High frequency components of the image correspond to pixel values that change rapidly across the image while low frequency components correspond to large scale features in the image. Thresholding is a well-known technique for image segmentation. Thresholding is a process applied to the image to separate the pixels with values higher than the threshold. These pixels correspond to areas with defects. Otsu method [6] is used for threshold selection from the image gray-level histogram. As mentioned before, estimating the threshold directly from the image in the spatial domain causes bad defect detection performance. So our algorithm estimates the threshold value from the DCT image using Otsu’s method. Applying DCT on the gray image and getting threshold value from the produced image, then applying this value on top-hat and bottom-hat filtered image will give a clear appearance of the defects separated from the background. D. Final Filteration Some extra steps are carried out to enhance the appearance of defects and make them easier for detection: 1. Cropping the borders that have high illumination disturbances. 2. Removing small areas that can be considered faulty defects. By determining a specific threshold area under which the defected area is considered false detection. 3. Surrounding the defects by boundaries for better visibility. IV. SIMULATION RESULTS To evaluate the proposed algorithm a simple fabric inspection prototype was built as shown in Fig. 3. The built prototype is similar to the arrangement shown in Fig. 1 with an inspection camera between two lighting sources. The camera has a resolution of 1.3 MP and it is hanged 28 cm above the fabric. Several faulty fabrics have been examined with the built inspection prototype. These faulty fabrics have different types of faults. The detection results are shown in Fig. 4.

Fig. 3. Fabric inspection prototype

V. CONCLUSION This paper presents a new algorithm for fabric defect detection. The proposed algorithm uses morphological Processing and DCT to automatically detect fabric defects. A prototype has been built of a fabric inspection machine to evaluate the proposed algorithm performance. The proposed algorithm has a promising performance as shown in the simulation results. ACKNOWLEDGMENT The authors would like to thank the Information Technology Industry Development Agency (ITIDA) and Nahdet El Mahrousa agency for funding this project. REFERENCES [1] A. Kumar, “Computer-Vision-Based Fabric Defect Detection: A Survey,” IEEE Transactions on Industrial Electronics, vol. 55, no. 1, pp.348 – 363, 2008. [2] M. Shi, R. Fu, Y. Guo, Sh. Bai, and B. Xu, “Fabric defect detection using local contrast deviations,” Multimedia Tools and Applications, vol. 52, no. 1, pp. 147 – 157, 2011. [3] T. E. Murslin, F. Z. Eishita, and A. R. Islam, “Fabric Defect Inspection System Using Neural Network and Microcontroller,” Journal of Theoretical and Applied Information Technology, pp.560 – 570, 2008. [4] S. F. Bhope and S. P. Patil, “Defects Identification in Textile Industries,” International Journal of Chemical Sciences and Applications, vol. 1, no. 1, pp 37 – 41, June 2010. [5] B. K. Behera and M. P. Mani, “Characterization and Classification of Fabric Defects Using Discrete Cosine Transformation and Artificial Neural Networks,” Indian Journal of Fibre & Textile Research, vol. 32, pp. 421 – 426, Dec. 2007. [6] N. Otsu, “A threshold selection method from gray-level histogram,” IEEE Transactions on Systems, Man and Cybernetics, vol. 9, no. 1, pp. 62-66, 1979.

(a)

(b)

Fig. 4. The simulation results of the proposed algorithm (a) original images (b) processed images with the detected faults marked (All images were taken using the fabric inspection prototype shown in Fig. 3)

Suggest Documents