A New High-Speed Foreign Fiber Detection System with Machine Vision

A new high-speed foreign fiber detection system with machine vision is proposed for removing foreign fibers from raw cotton using optimal hardware components and appropriate algorithms designing. Starting from a specialized lens of 3-charged couple device CCD camera, the system applied digital signal processor DSP and field-programmable gate array FPGA on image acquisition and processing illuminated by ultraviolet light, so as to identify transparent objects such as polyethylene and polypropylene fabric from cotton tuft flow by virtue of the fluorescent effect, until all foreign fibers that have been blown away safely by compressed air quality can be achieved. An image segmentation algorithm based on fast wavelet transform is proposed to identify block-like foreign fibers, and an improved canny detector is also developed to segment wire-like foreign fibers from raw cotton. The procedure naturally provides color image segmentation method with region growing algorithm for better adaptability. Experiments on a variety of images show that the proposed algorithms can effectively segment foreign fibers from test images under various circumstances.


Introduction
Before cotton fiber can be spun, the raw cotton must be sorted to remove any foreign particles and fibers. While foreign particles can be clearly distinguished from the raw cotton by color, contrast, and structure, foreign fibers such as polypropylene PP or polyethylene PE films are often light and transparent, making them difficult to detect using conventional foreign fiber separators. Even very low content of foreign fibers in cotton, such contaminants often appear as a discoloration in the fabric, reducing its value when they end up in finished cotton products, and this may lead to great economic loss for cotton textile enterprises 1 .
The nature and extent of foreign fiber contamination are strongly dependent on the origin of the cotton 2 . US and Australian cotton, which are 100% machine picked, do not have significant problems with foreign fiber. Cotton from Turkey contains many red 2 Mathematical Problems in Engineering ribbon-shaped contaminants. In China, mills are battling threads from bleached cotton as well as white fluorescent PP ribbons. Cotton from Central Asia is contaminated with white, nontransparent packaging residues. These are just a few examples.
Currently, foreign fibers are generally eliminated by hand-picking method using human eyes inspection in most Chinese textile mills; this is inefficient and laborious. Various techniques have been developed to implement automatic inspection and elimination of foreign fibers in cotton, including ultrasonic-based inspection, sensor-based inspection, and machine-vision-based inspection 3, 4 . Earlier research work on foreign fiber detection in cotton was designed for cotton grading. The recent research efforts at improving the sensitivity of these systems have generated a few improvements 5, 6 . These include better separation machinery, use of more sophisticated image analysis technique, and more effective sample preparation mechanisms. In the recent years, some machine vision techniques have been applied to textile industries for inspection and elimination of foreign fibers in cotton.
A traditional machine-vision-based foreign fiber detection system mainly consists of line scan camera, frame-grabber, personal computer PC , and high-pressure gas nozzle 7 . Images of cotton layer are first acquired through camera and then are manipulated to reduce noise and to enhance contrast. After that, images are segmented to distinguish foreign fibers from the cotton background according to the differences of image features. The positions of the foreign fibers in processed images are transmitted to the separator to control the solenoid valves, which switch the high-pressure compressed air on or off to blow the foreign fibers off the cotton tufts. However, this device suffers from fundamental limitation of PC such as central processing unit's CPU-long-time overload, and it will frequently lead to undetected foreign fibers in real-time inspection.
Modern manufacturing processes must produce right first time. This is of the highest importance in fiber opening and preparation. In spinning, second-quality or contaminated yarns must be avoided. One obstacle for top-quality yarn is the increasing amount of foreign fibers. This paper, based on experience and information of traditional foreign fiber separator, presents a new high-speed foreign fiber detection system with machine vision to solve the problem of foreign fibers in ginning and spinning.
Image segmentation is the primary stage in image processing of the machine-visionbased foreign fiber detection system. The aim of image segmentation is to partition the image into meaningful connected-components to extract the features of the objects. In the recent years, many segmentation methods have been developed such as segmentation based on fuzzy C means and its variants, mean shift filters, and nonlinear diffusion 8-11 . In our research, a specialized lens with lateral chromatic aberration correction and ultraviolet light illumination for transparent foreign fiber detection were firstly introduced; and then a high-performance embedded controller based on digital signal processor DSP and field-programmable gate array FPGA was designed to perform all the complex computations of image acquisition and processing freeing the host PC from time-consuming task. A rectangular chute cooperating with specially designed compressed air nozzles perpendicular to it was finally selected to separate foreign fibers from cotton tufts. To overcome disadvantage of the undefined velocity of cotton tufts and foreign objects, some nonlinear control methods should be needed in such circumstance [12][13][14][15][16][17][18][19][20][21][22] . In order to improve detection speed and accuracy, an image segmentation algorithm based on fast wavelet transform is proposed to identify block-like foreign fibers, and an improved canny detector is also developed to segment wire-like foreign fibers from raw cotton. The procedure also provides color image segmentation method with region growing algorithm for better adaptability.

Sensors
Photo sensors are relatively cheap sensors that are arranged in-line and detect differences in brightness in the passing flow of fibrous tufts. Ultrasonic sensors, also arranged in-line, detect foreign parts with solid, sound-reflecting surfaces but cannot detect foreign fibers, threads, and strings 23 .
Color sensors, or 1-CCD charged couple device cameras, are line-scan cameras with a single CCD chip. Sensitivity depends on the resolution of these cameras and the scanning width. Because these cameras work with three adjacent scan lines-red, green, and bluewith a certain offset, the color recognition of moving objects is limited and results in a socalled color noise effect.
Much more effective, although more expensive, are 3-CCD cameras. The three basic colors-red, green, and blue-are separated by a prism and simultaneously directed onto three CCD chips 24 . This system is also called a true-color system. Thanks to this simultaneous process, the variable speed of objects in the material flow no longer has  a negative effect. Currently, 3-CCD cameras represent the high-end approach to foreign fiber detection.
To correct for the possible aberrations of the triple-channel prism used in the camera, we used a specialized lens design. Lateral chromatic aberration was minimized by aligning within less than 2 microns. Another central aspect is appropriate color splitting in the triple prism by dielectric color-splitting coatings. To produce high-fidelity color images, two coatings were used in the beamsplitter. While the first coating reflects blue and lets red and green pass, the second reflects red and lets green pass. Figure 1 illustrates mounting location of cameras with specialized lenses.

Illumination
Another important factor in determining object detectability is the type of illumination. Cameras, as well as the human eye, can detect only objects that distinguish themselves in color, contrast, structure, or luster from cotton tufts. For this reason, the type of illumination applied in foreign fiber detection system plays an essential role. Today's standard is illumination units with fluorescent tubes operating in reflected light mode.
Polarized transmitted light is the ideal system for detecting transparent and semitransparent objects, such as PE foil or PP fabric from bale packaging. To detect such Mathematical Problems in Engineering 5 R e ct a n g u la r ch u te foreign fibers and separate them safely, the raw cotton is illuminated under polarized light, ultraviolet UV light, for instance, as showed in Figure 2, making the foreign plastic fibers appear colored. In this way, the foreign fibers can be distinguished from the raw cotton and separated. Such objects may include pieces of polyester PET , PP, or even bleached cotton treated with optical brighteners 25 . With polarized reflected light and the corresponding camera filters, differences in surface luster of foreign objects can be detected. The system reaches its limits with dull objects. The presence of these particles often results in the dreaded foreign fiber claim.

Image Acquisition and Processing Controller
High-performance embedded controller, which features a TMS320DM648 DSP TI Corp and an XC2S300E-7PQ208C FPGA Xilinx Corp is designed to significantly reduce image acquisition and processing times for PC-based platform. With its 8800 MIPS processor, 5 configurable video ports, and 1 GBps total system bandwidth, the embedded controller is ideal for high-speed image acquisition and processing systems in foreign fiber detection. The controller performs all the complex computations of image acquisition and processing, freeing the host PC from this time intensive task. Figure 3 illustrates the architecture of image acquisition and processing controller, and Figure 4 shows the assembly status of controllers in industrial PC IPC . The detailed designing method will be introduced in another paper.

Material Presentation
The presentation of the fibrous material to the sensors also affects the performance of foreign fiber separators. Almost all systems on the market monitor the tuft flow in a rectangular chute. One major disadvantage is the undefined velocity of cotton tufts and foreign objects. Because the velocity is not constant, the downstream separation nozzles must be activated for a longer period of time. This inevitably results in an increasing loss of good fibers. However, one advantage that should not be underestimated is the gentle treatment of cotton fibers, which are not mechanically stressed. Systems that feature detection on or close to the surface of a rotating needle roll have three very important advantages. First is the accurately 6 Mathematical Problems in Engineering defined material velocity and, hence, the minimal loss of good fibers during removal. Second, accurately detecting the position of foreign objects is advantageous, as there are no problems due to differences in illumination intensity depending on chute depth, as is the case with chute-based systems. The third advantage lies in the high degree of material opening and the associated excellent exposure of the foreign objects. Figure 5 shows the rectangular chute of tuft flow.

Foreign Fiber Blowing
The designed air scavenging system and a separation device provided with at least eight compressed air nozzles which are perpendicular to pneumatic cotton tufts conveying conduit are successively mounted in a direction of conveyance, wherein said fiber conveying conduit is provided with a removing opening arranged in front of the compressed air nozzles. Contrary to state of the art of actual methods and devices, the foreign fibers are not removed to a substantially pressure-tight separation container. According to our design, the removing opening is connected to a derivation in which a permanent airflow for transporting separated foreign fibers away is maintained. Figure 6 illustrates the compressed air tank, and Figure 7 illustrates the solenoid valves at the right side.

Image Segmentation Algorithm Based on Fast Wavelet Transform
In the original image, cotton can be treated as background, while foreign fibers are expressed as foreground. Consequently, edge detection is a feasible way to our problem. When digital images are to be viewed or processed at multiple resolutions, the discrete wavelet transform DWT is the mathematical tool of choice 26-29 . In this paper, the fast wavelet transform FWT is adopted to achieve the edge feature extraction. It is defined as where h ϕ and h ψ -the expansion coefficients-are called scaling and wavelet vectors, respectively. They are the filter coefficients of the FWT, an iterative computational approach to the DWT shown in Figure 8. 2D wavelet transform is a direct promotion of 1D wavelet transform 30-32 . It is one of the most prevalent techniques for edge detection and texture extraction. Through the 2D wavelet decomposition, symlets wavelet in this paper, the original cotton image w ϕ j 1, m, n is transformed to 4 parts, w D ψ j, m, n denotes the detail component in diagonal orientation, w V ψ j,m,n denotes the detail component in vertical orientation, w H ψ j, m, n denotes the detail component in horizontal orientation, w ϕ j, m, n denotes the morphology component. In Here, we propose an algorithm based on FWT to segment foreign fiber from input image. The algorithm can be described as follows.
1 Input the original input image, denoted as f. 2 The horizontal, vertical, and directionality of the single-scale wavelet transform of f with respect to "sym4" wavelets, described as f 2 .
3 To merge above information into a single edge image, just zero the approximation coefficients of the generated transform, compute its inverse, and take the absolute value. The resulting edge image is f 3 . The inverse FWT uses the equivalent computation as follows: where ↑ 2m and ↑ 2n denote upsampling along m and n, respectively.
4 Region growing is used to segment the foreign fiber from f 3 . The values of initial seed points S 0 and threshold T 0 are empirical data, in general S 0 is between 10 and 20, and T 0 is between 20 and 40. The resultant image is f 4 . Figure 9 illustrates the segmentation process of the given algorithm.

An Improved Canny Detector
The canny detector is the most powerful edge detector provided by function edge 33 . Here, the improved edge feature extraction algorithm can be summarized as follows.
1 Instead of using Gaussian smoothing filter, the improved algorithm carries on the smoothing operation by an adaptive median filter for the characteristics of input image.
2 The local gradient, g x, y G 2 x G 2 y 1/2 , and edge direction, α x, y tan −1 G y / G x , are computed at each point. An edge point is defined to be a point whose strength is locally maximum in the direction of the gradient. 3 The edge points determined in 2 give rise to ridges in the gradient magnitude image. The algorithm then tracks along the top of these ridges and sets to zero all pixels that are not actually on the ridge top so as to give a thin line in the output, a process known as nonmaximal suppression. The ridge pixels are then thresholded using two thresholds, T 1 and T 2 , with T 1 < T 2 . Ridge pixels with values greater than T 2 are said to be "strong" edge pixels. Ridge pixels with values between T 1 and T 2 are said to be "weak" edge pixels. 4 The algorithm performs edge linking by incorporating the weak pixels that are 8 connected to the strong pixels. The morphological closing of A by B denoted A·B is a dilation followed by an erosion: Geometrically, A·B is the complement of the union of all translations of B that do not overlap, and it generally joins narrow breaks fills long thin gulfs, and fills holes smaller than the structuring element. However wire-like foreign fibers are relatively difficult to be processed by virtue of their narrow and twining objects. To make the wire-like foreign fibers more clear, a modified closing operation is given by where B L is a larger structuring element for dilation and B S is relatively a smaller one for erosion. Figure 10 illustrates the result of the above algorithm.

Region Growing Color Image Segmentation Algorithm
The aim is to segment the color image and extract foreign fiber regions. Suppose that the objective is to segment objects of a specified color range in an RGB image. Given a set of sample color points representative of a color of interest, we obtain an estimate of the "average" or "mean" color that we wish to segmentation. Let this average color be denoted by the RGB pixel in an image as having a color in the specified range or not. To perform this comparison, we need a measure of similarity. One of the simplest measures is the Euclidean distance. Let z denote an arbitrary point in the RGB space. We say that z is similar to m a b c if the distance between them is less than a specified threshold, T . The Euclidean distance between z and m is given by 26 where · is the norm of the argument, and the subscripts R, G, and B, denote the RGB components of vectors m and z. The locus of points such that D z, m ≤ T is a solid sphere of radius T . By definition, points contained within, or on the surface of the sphere, satisfy the specified color criterion; points outside the sphere do not. The algorithm starts with a seed pixel, examines local pixels around it, determines the most similar one, which is then included in the region if it meets certain criteria. This process is followed until no more pixels can be added. The definition of similarity may be set in any number of different ways. Figure 11 illustrates the images segmentation.

Results and Discussion
The close examination of the different sensors, illumination systems, and methods of material presentations clearly shows that there is no single ideal system. However, by using systems precisely adapted to the actual requirements, one can come very close to this ideal. An optimum solution consists of an intelligent combination of different systems.
To balance quality and cost, we used two 3-CCD cameras illuminated by UV lights and two gray cameras with fluorescent lights. Some typical foreign fibers like PP twine, color thread, and hair were selected for the experiments. The foreign fibers were mixed into pure cotton and then made into uniform thin layer. The test images were captured by a 24-bit scanner with nearly 17 million colors offline, and some of them were transformed into gray images before image processing. Matlab 7.04 was used to implement and validate algorithms before the final burn program gets close to real environment. An Intel Pentium IV 2.66 GHz CPU personal computer with 1 GB SDRAM was chosen as the test environment and Windows XP sp2 was selected as the operation system.

Deficiency of Edge Feature Extraction Algorithms
Three tests were performed to evaluate the segmentation performance of the foreign fiber detection. In test 1 Section 3.1 , the original gray image was used, and segmentation results of the images listed in Figure 9. The results indicated that different segmentation results occurred when different types of algorithms were used. The images of block-like foreign fibers received good segmentation in Figure 9 b by the proposed algorithm, while the other algorithms did not obtain the expected results. It informs that the proposed algorithm in Section 3.1 is more suitable for block-like foreign fibers detection than the traditional edge detectors.
In test 2 Section 3.2 , the original gray image was processed first by an adaptive median filter, and then it was segmented by the canny operator; finally it was enhanced by the modified closing operation. The result indicates that the canny operator is very useful for wire-like foreign fiber detection. As other edge operators such as sobel and prewitt are not as good as canny operator and the algorithm proposed in Section 3.1 cannot segment wire-like foreign fiber at all; the comparative segment results are not list in this paper.

About Color Image Segmentation
A large variety of segmentation methods are available at present, but speed and accuracy of an algorithm are key factors for the online visual inspection system 34 . Hence, in addition to ensuring the segmentation accuracy, algorithms with faster speed are more attractive. Therefore, in most cases the methods of foreign fiber detection are not suitable for using the color image segmentation algorithm. However ultraviolet light can make the PE or PP foreign plastic fibers appear colored as the above mentioned in Section 2.2, under such circumstance, color image is very useful and necessary.
Common approaches for color image segmentation are clustering algorithms such as k-means 35 or Mixture of Principal Components 36 ; however these algorithms do not take spatial information into account. Furthermore, clustering algorithms require prior information regarding number of clusters, which is a difficult or ambiguous task, requiring the assertion of some criterion on the very nature of the clusters being formed. Some progress has been made on this issue; however much experimentation still needs to be done 37 . An alternative set of algorithms exists which uses color similarity and a regiongrowing approach to spatial information 38 . Region-growing algorithms have been used mostly in the analysis of grayscale images, and some significant work has been completed in the color realm by Tremeau and Borel 39 . They discuss the segmentation of color regions which are homogeneous in color i.e., no illumination effects are considered thus restricting the application domain. They use a set of thresholds when calculating whether a color pixel is part of a region or not, and the Euclidean distance is used as the measure of similarity between two color vectors. It is well established 40 that the human perception of color similarity is poorly modeled by the Euclidean distance. More researches about color segmentation will be carried out in the future work.

Conclusion
A new high-speed foreign fiber detection system has been developed in this research, and images of foreign fibers can be processed more effectively and efficiently using optimal hardware components and appropriate algorithms designing. An image segmentation algorithm based on fast wavelet transform is proposed to identify block-like foreign fibers, and an improved canny detector is also developed to segment wire-like foreign fibers from raw cotton. The color image segmentation with region growing algorithm is introduced for better adaptability. The effectiveness of foreign fiber detection algorithms is demonstrated on a variety of test images. Some quantitative image segmentation methods are used to assess the results.
More rapid and stable foreign-fiber detection methods are now being considered. The useful and effective algorithms will be burned to the designed image acquisition and processing controller soon. A complete system debugging for cotton foreign fibers detection will be carried out very shortly.