Computer vision techniques for detecting yarn defects
6
F. Pereira*,†, V. Carvalho*,†, F. Soares*, R. Vasconcelos*, J. Machado* *University of Minho, Guimara˜es, Portugal, †IPCA-School of Technology, Barcelos, Portugal
6.1
Introduction
In the textile industry, the quality of the final product is directly related to the quality of the yarn and thereby the costs and claims due to foreign fibers can be prevented by setting up a quality management system to eliminate or minimize the quantity of foreign fibers in yarns. A continuous incoming inspection guarantees a constant satisfactory quality of the end product. The implementation of a new project aims at the development of a new technological solution based on the image-processing technique for automatic characterization of the main parameters of a textile yarn, with a higher level of parameterization compared to commercial solutions. It will measure mainly the irregularities, the hairiness, the diameter, and the mass and yarn production characteristics like twisting step, the winding direction of the fibers, and the number of cables. Through the analysis of the yarn parameters with techniques based on imageprocessing, all the drawbacks identified, in the traditional equipment, will be overcome. Technological solutions based on image-processing are characterized by low-cost, low volume, high-resolution, and accuracy due to the equipment employed. This new solution will achieve higher product quality, and higher production efficiency, increasing the competitiveness of the textile industry. Another advantage of this solution is the possibility of yarn analysis during production with integrated hardware on the machine itself and without a need of substantial maintenance. The pilosity, the twist, strength and stretching have a lot of influence in practically all aspects related to the quality of the textile yarn. The appearance and durability of the fabric is affected, as well as the productivity and efficiency of other manufacturing functions, by the characteristics referred to earlier. Accuracy in determining twist levels is the major requirement, and to achieve this, it is important to have the best-possible technological solution. Increasingly, manufacturers should have detailed information on the quality of textile yarn and that the speed of data processing over their characteristics should be increased to assess the elimination of some intermediate steps in data processing. The evaluation of yarn quality is still based on offline techniques and uses measurement systems in laboratorial environment, which contribute to the automatic and Applications of Computer Vision in Fashion and Textiles. https://doi.org/10.1016/B978-0-08-101217-8.00006-3 Copyright © 2018 Elsevier Ltd. All rights reserved.
124
Applications of Computer Vision in Fashion and Textiles
integrated control of the textile yarn. The solution based on image-processing techniques allows a high level of advantages, among others, reduced hardware and maintenance necessities with a very high-resolution. This chapter is organized in five sections: – – – – –
In the first section an overview of the problem is presented In the second section some theoretical concepts and the most important parameters in the classification and evaluation of a textile yarn are presented; The third section describes the methods for detecting yarn parameters; The fourth section is a review of yarn defect detection systems. The fifth section presents some final comments on technical solutions in the detection of defects in textile yarn.
6.2
Fundamentals of textile yarn
This section describes the most important parameters in the classification and evaluation of a textile yarn.
6.2.1
Textile yarn
The textile yarn is the final product of the spinning step, from natural or chemical origin, showing a high ratio between its length and diameter. In general, the yarn can be defined as an array of linear fibers or filaments, which forms a continuous line with textile characteristics, especially resistance (durability) and high flexibility [1]. Yarns are thin and long structures to be assembled and interlocked to produce textile articles such as woven or knitted fabrics, threads, and ropes. They may be produced directly from continuous filaments or otherwise from staple fibers. In most cases, the cohesion of the yarn is obtained by twisting. In the case of continuous filament, twisting gives the yarn a certain cohesion and unity, preventing their separation [1]. The most important textile-manufacturing processes aim to produce cohesive structures, which have maximum flexibility. The dimensions and structural details of the yarn result from the yarn and the twist number. These factors are extremely important in the design of textile structures, being largely responsible for the appearance and behavior of various types of yarns and fabrics. The twist of the yarn is the number of turns per unit length of cord (turns/m). The spiral arrangement of components of a wire or twisting typically results in relative rotation of the wire ends [2]. The direction of twisting at different stages of production is indicated by the letters S and Z in accordance with the following standards (Fig. 6.1): l
l
When a single yarn S twisting is placed upright, the fibers are inclined relative to the axis of the yarn according to the central portion of the letter S; When a single yarn Z twisting is placed upright, the fibers are inclined relative to the axis of the yarn according to the central portion of the letter Z [3].
The major parameters used in the specification of the quality of textile yarn are linear density, structural characteristics and composition linear density, structural characteristics, and composition of fibers [3].
Computer vision techniques for detecting yarn defects
125
Fig. 6.1 Yarn twisting.
Fig. 6.2 [3] shows the direct relationship between the variation of yarn mass and the yarn diameter. In the international system of measurement, the linear mass is expressed in Tex, which corresponds to the mass (g) of a textile yarn in a length of one kilometer, although it is usual in industry to use Ne [4], which corresponds to the number of skeins of 840 yards needed to get the weight of a pound. Thus, the calculation of the diameter can be obtained through Eq. (6.1) [4]. pffiffiffiffiffiffi d ðmmÞ ¼ 0:037 tex
6.2.2
(6.1)
Types of defects in textile yarn
The most relevant parameters for assessing yarn and classifying them in terms of quality and application are the linear mass irregularities, imperfections (thin places, thick places, and neps), and hairiness. The types of textile yarn imperfections or faults are [4]: – – –
thin places; thick places; neps. Diameter
Mean value Length
Fig. 6.2 Relationship between the variation of yarn mass and the yarn diameter [3].
126
Applications of Computer Vision in Fashion and Textiles
The thin places show a decrease of mass to the default value of 50% of the mass average value over a short length of yarn (Fig. 6.3). The thick places show an increase in the mass, normally more than 50% and lower than 100% of the mass average value, and lasting more than 4 mm (Fig. 6.4) [4]. The thick places are less torsional than thin places in cross section. The thin and/or thick places can cause holes in the mesh, breaking needles or pauses in the machines. Neps are entangled fibers, which are divided into two types [5]: – –
small knots of fibers; strange particles in the fiber impurities.
A nep is a huge amount of yarn mass (equal or superior to 100% of the mass average value in a short length of yarn (Fig. 6.5) [4]. The conditions of the yarn-manufacturing process contribute more to the formation of neps than the fiber properties. A high number of neps and impurities cause failures in dyeing, needle wear and lower productivity, so it is very important to maintain the uniformity of the yarn. Another significant feature that greatly influences the appearance of fabrics is the level of yarn hairiness. Hairiness is the loose fiber ends that are not integrated in the yarn and therefore protrude from the yarn bundle (Fig. 6.6) [4]. −50%
Fig. 6.3 Thin place.
+50%
Fig. 6.4 Thick place.
Fig. 6.5 Nep.
Fig. 6.6 Yarn hairiness.
Computer vision techniques for detecting yarn defects
127
A high hairiness of a yarn can have a negative effect, both because of the fuzzy appearance of the tissue and also in further processing due to a tendency to grab and deposit fiber in the machines. If these deposits reach the final fabric, they are generally classified as troublesome defects [4,6].
6.2.3
Statistical yarn parameters
The most significant statistical yarn parameters are the average deviation of the mass (U%), the coefficient of variation (CV%), the hairiness coefficient (H), absolute mean deviation of the hairiness coefficient (UH%), and the standard deviation of hairiness coefficient (sH%).
6.2.3.1 Average deviation of the mass (U%) U% is proportional to the mass variation of the samples from the average, regardless of the test time, if the mass variation is distributed uniformly and approximates a normal distribution, as presented by Eq. (6.2) [7–14]. 100 U¼ xT
ðT
jxi xjdt
(6.2)
0
where xi is the value of the instantaneous mass; x is the average mass during the acquisition; T is the acquisition time.
6.2.3.2 Coefficient of variation (CV%) The CV is related to the standard deviation and the mean value, as presented by Eq. (6.3) [7–14]. 100 CV ¼ x
sffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi ð 1 T ðxi xÞ2 dt T 0
(6.3)
6.2.3.3 Hairiness coefficient The hairiness coefficient (H) corresponds to the length of hairiness per meter of yarn, as presented by Eq. (6.4) [7–14]. H¼
lH lyarn
where IH is the total length of hairs (m) and lyarn is the yarn length (m).
(6.4)
128
Applications of Computer Vision in Fashion and Textiles
6.2.3.4
Absolute mean deviation of hairiness coefficient
The absolute mean deviation of the hairiness coefficient (UH) corresponds to the deviation of the hairiness from the mean value. It is presented by Eq. (6.5) [7–14]. UHð%Þ ¼
N 100 X H i H HN i¼1
(6.5)
where Hi is the current sample hairiness value, H is the average hairiness value during the evaluation time, and N is the number of samples.
6.2.3.5
Standard deviation of the hairiness coefficient
The standard deviation of the hairiness coefficient (sH) is presented by Eq. (6.6) [7–14]. vffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi u N u1 X 2 Hi H sHð%Þ ¼ t N i¼1
6.3
(6.6)
Methods for detecting yarn parameters
The highlighted parameters in the assessment of quality of textile yarn by traditional methods are yarn diameter variation, yarn mass variation, and yarn hairiness measurement [7–14].
6.3.1
Yarn mass variation measurement systems
The mass analysis of variance used in commercial devices is based on parallel-plate capacitive sensors in which the yarn mass variation causes a change dielectric between the plates of the sensors. These sensors have the disadvantage of being highly permeable to temperature and humidity, which can cause read errors. Equipment using this technique are the Quantum 2 USTER with a length of 2-mm sample, Keisokki Ket-80 with a 5-mm sample or greater, and Tester 5 of USTER with sample 8 mm or more. The Yarn System Quality (YSQ) [7–14] uses differential parallel-plate capacitive sensors to reduce the external factors influence, with a length sample of 1 mm based on the integrated circuit MS3110 from Irvine Sensors. Fig. 6.7 presents an example of the capacitive sensor variation relative to the mean signal value.
6.3.2
Yarn diameter variation measurement systems
The diameter is an important parameter; it provides structural parameters such as width, coverage factor, porosity, and comfort of the fabric [7–14].
Computer vision techniques for detecting yarn defects
129
Capacitive sensor-variation over average (%) 15
Variation (%)
10 5 0 –5 –10 –15 0
200
400
600 800 Samples
1000
1200
Fig. 6.7 Capacitive sensor signal variation relative to the average [3].
Some studies on the measurement of the diameter through image-processing techniques were performed. One of the techniques used is based on the extraction of the yarn core, by quantifying the distance between the detected edges [7–14]. The mean distances were found to determine the wire diameter [7–14]. For this measurement, a function called Clamp Vertical Max was used. This function allows the edges to be obtained along a set of parallel search lines in a region of interest. Once obtained, the diameter is calculated by averaging the distances measured between the pairs of edges detected by the search lines [7–14]. Fig. 6.8 shows the final result with the edges detected. After obtaining data, a mean is calculated as is the wire diameter. Algorithms for the exact measurement of the length of the wire irregularities (thin, thick, and nep) have to be developed. The characterization of the yarn mass can be inferred through the yarn diameter, depending, among other parameters, on yarn density and porosity [7–14]. These systems are based on a red/green wavelength light source, which transmits a portion of the amount of light into the part blocked by the wire. The signal received by the optical sensor is proportional to the diameter of the wire. The Keisokki-Laserspot device determines the diameter based on a pair of line/laser vectors, which considers the defragmented light that is not received by the hair sensor [7–14]. Most of the commercial systems employ optical methodologies to quantify diameter variations, such as the diameter module Quantum-2 and 5 of Uster Tester and the Oasys Zweigle (acquired by Uster).
Fig. 6.8 Image in the application of the vertical clamp function for the diameter of yarn textile [4].
130
Applications of Computer Vision in Fashion and Textiles
These systems are based on a light source of length red/green wave, which transmits a quantity of light that is blocked by the yarn. The signal received by an optical sensor (the light that is not blocked by the yarn) is proportional to the yarn diameter. The Keisokki-Laserspot equipment determines the yarn diameter based on a pair laser/ line array considering the diffracted light, which is not received by the hairiness sensor described. The yarn diameter is measured by the width between the edge of the first and the last segments. In addition, another company, Lawson-Hemphill, employs an optical system (EIB) with a line-scan camera, where the diameter is the distance between the pixels near a user-set threshold level [3,4]. The measuring range of the Uster Quantum-2 is 3 mm, in the Zweigle 2 mm, while in the USTER Tester 5, and in Keisokki-Laserspot and Lawson-Hemphill EIB less than 1 mm [7–14]. The USTER Tester 5 shows resolution in two dimensions, which allows 3D diagrams and reduces the influence of the yarn shape measurements. The YSQ [7–14] basically uses the photoelectric method [7–14], which consists in the use of a Led as light source and a photodiode, as receiver on opposite sides and placed at a distance from the wire under analysis. When hairiness appears, the transmitter light is blocked by detecting it, however with reversal of the optical filter.
6.3.3
Yarn hairiness analysis systems
Due to its influence on the quality of textile yarn, the hairiness (the loose fibers ends that are not incorporated in the yarn) is considered one of the most significant parameters. Its traditional measurement is based on a microscope method, weighing methods, and photoelectric methods, while image-processing methods are in a development stage. Microscopic methods consist of measuring hairiness by observing the yarn in a microscope. Several companies such as Barella use this methodology. It counts the number of protruding hairs, loops, and respective hair lengths in a specific yarn section. However, in this method it is difficult to identify the yarn boundaries as, looped fibers, wild fibers, low twisted portions; also, diameter variations may interfere in the identification process. Weighing techniques are based on the difference of yarn mass before and after singeing (burning the protruding hairs). However, a large number of samples should be analyzed for a clear estimate. Furthermore, singeing often does not remove completely the hairiness of a yarn, especially with shorter lengths. So, this method is inaccurate. Other method used is the photoelectric method, which consists of using a light source and a detector located on opposite sides and displaced by a distance (dh) from the yarn under analysis. When yarn hairs appear, the light, from the emitter, is partially blocked, detecting the presence of hairiness. This low-cost process, using a simple led as a source and a photodiode or photocell as a detector, could be extended for several distances, allowing the determination of hair lengths. Several companies use equipment that employ photoelectric methods. Shirley (Atlas Hairiness Tester) uses a LED beam/Photocell pair (measuring head adjustable
Computer vision techniques for detecting yarn defects
131
between 1 and 10 mm) to count the number of interruptions that the protruding hairs provoke in the light beam. Zweigle (G 566 Hairiness Tester) also employs the same methodology but defines nine length zones between 1 mm and 12 mm or 15 mm, using different optical channels. Zweigle G567 Tester, Uster Testers, and Premier Electronic Tester use homogeneous rays of parallel light from a red-light source, where the scattered light from the protruding hairs of yarn is detected by an optical sensor and then converted into an electronic signal [3]. In this approach, called dark-field microscopy optics, the body of the yarn is dark and the protruding fibers are bright. Barella employs a red laser source/CCD pair using coherent signal-processing establishing a reference of the yarn without hairiness with a “mask.” Keisokki-Laserspot considers a red laser source/photodiode pair and the Fresnel diffraction principle to extract hairiness. Despite the advantages of the photoelectric method compared to the method of weight and microscope, it has some drawbacks. Due to the various geometrical shapes that hairiness presents, systems based on this method have difficulties in defining the hair length, in addition to containing a high level of inaccuracy. The prototype—YSQ [7–14] has been developed where determining the hairiness is based on an optical signal-processing technique using Fourier analysis using a singular projection. In terms of image-processing methods, a correct classification of hairiness requires the development of a well-defined algorithm to identify the hairs from the main core, a camera with a high level of optical magnification, and a computer that is able to process results in quick time. Several algorithms based on image-processing techniques to characterize the hairiness have been developed. The method proposed by Kuzanski and JackowskaStrumill [7–14,52] measures the actual length of the protruding fibers leaving the core of the yarn, as well as their number, for measuring the hairiness. Guha [15] introduce a new method for measuring hairiness, based on the assumption that the protruding fibers next and parallel to the core would be a better indicator of hairiness, proposing a new parameter: Hair Area Index. This concept measures the wider area by which the hairiness is divided by the yarn core area, thereby allowing one to obtain a dimensionless quantity.
6.3.4
Yarn production characteristics measurement systems
The industry uses the twist meter to determine how many turns per meter a thread or the twist has. With this equipment, it is possible to determine the three fundamental characteristics of the yarn—the twisting step, the number of cables, and the production method. Twist is defined as the number of turns present in a unit length of yarn and it is the most important structural parameter in a twisted yarn. Besides strength, twist also influences other properties of yarn like abrasion resistance, bending rigidity, fatigue resistance, among others. The twisting process causes the filaments to follow a helical path around the yarn axis.
132
Applications of Computer Vision in Fashion and Textiles
Analog microscope
USB Webcam
Image processing
Fig. 6.9 Yarn image capture system [3].
The operation of the twist meter translates in holding up a yarn portion in each end, in brackets, but only one can be fixed. The device has a handle, if manual or a motor if automatic, to perform the movement. In the textile industry, image-processing is not yet used for determining the characteristics of the yarn [5,16–26], although the YSQ [5,16–26] presented some preliminary algorithms to obtain these characteristics. Fig. 6.9 shows the system used in the YSQ to capture yarn images. For the analysis of characteristics of textile yarn, image-processing techniques can be applied with the aid, e.g., of the toolkit IMAQ Vision from NI [27–39]. The example shown in Fig. 6.10 was obtained using the previous described apparatus where the yarn production characteristics as well as the yarn hairiness and diameter were obtained.
Fig. 6.10 Yarn image capture.
Computer vision techniques for detecting yarn defects
133
Apart from the IMAQ Vision toolkit, several other image-processing tools can be considered to develop the required algorithms as the Open CV library or even MATLAB.
6.4
Yarn defect detection system review
Increasing international competition, rising cost pressure, customer demand of high and consistent product quality, variety of products, and the need to quickly satisfy customer demand make modern and efficient quality control systems crucial. In the words of Gupta [40] “Defects rate causes a direct effect on the profit margin of the product and decrease the quality cost during the manufacturing of product”; therefore, it is crucial to develop new yarn textile quality control techniques. Quality inspection can be made online and offline. Francini and Longobardi [41] developed an optical filtering technique to improve the online quality characteristic of textile yarn that allows measurements to be made of the size of the main body of the yarn and the variation in hairiness along the length of the yarn. Offline inspection is used mainly to check the properties of the finished products in testing laboratories and online quality control is used to monitor process parameters on the production line. In textile industry, the manual test system has been used to test the quality of textile yarn, such as yarn irregularities, neps, and impurities, for long time. This method presents several disadvantages, such as time-consuming and laborious problems, ensuing fatigue, inattentiveness, and operator errors, which would cause unreliability and inaccuracy of results. Further, for yarn quality estimation, a microscopic analysis requires a lot of manual efforts and time and that on compromising on uniformity of quality judgment. Sari-Sarraf and Goddard [42] showed that only about 70% of the defects could be detected by the most highly trained inspectors. Automatic inspection system has become a more effective way to improve textile quality; therefore, research in this field has exponentially grown, and some PC-based prototype systems have been developed. Introducing image analysis techniques in the textile industry could enhance quality through the efficient use of metrology and control. Technological solutions based on image-processing are characterized by high reliability and efficiency, and can remove all the drawbacks identified in traditional solutions. Zhang et al. [43] used an image analysis system to continuously test the actual yarn diameter. Data on the diameter of ideal yarns were obtained from computational simulation. A 2D yarn-fault-analysis program was designed according to a comprehensive definition of yarn faults so that it can give overall results of yarn faults in a mapping table in which the differences are shown in a comparison to corresponding ideal yarns. This system was focused only on analyzing a single textile yarn defect. The yarn defect identification through images was becoming progressively more significant and other types of defects of textile yarn were subject of study. For instance, a promising study was developed using the features extracted from the images of neps (knots of highly entangled cotton) [44], and then classified by means of probabilistic neural network (PNN). A k-fold cross validation technique has been
134
Applications of Computer Vision in Fashion and Textiles
applied to assess the performance of the PNN classifier and the results showed that the neps classification, accomplished by means of image recognition through the PNN classifier, agrees eminently well. However, artificial neural network models have been used through an enormous amount of noise-free input-output data, which are difficult to collect from the spinning industries. Tuna´k et al. proposed [45] a control plot to monitor various types of defects occurring in chenille wires. To apply the control chart, a gray-scale image of the wire was captured as an image array and then either image preprocessing was applied. Image preprocessing is applied and this involves a threshold for a binary image and a morphological aperture operation to remove small objects from the image. The height of the hair yarn, which was measured in the processed images, was selected as quality characteristics to be monitored and analyzed. Since a quality-monitored feature was highly autocorrelated, a first-order autoregressive AR model (a representation of a type of random process) was considered valid for modeling an autocorrelation structure. Due to the AR process estimation, an exponentially weighted media control card (EWMA) for waste was implemented as a tool to monitor and detect defects in textile yarn. Fabijanska [46] presented an automatic determination of yarn hairiness using image-processing methods to extract the protruding hairs of the yarn, presented in Fig. 6.11 [46]. The key steps of the proposed algorithms are image preprocessing, yarn core extraction using graph cut method, yarn segmentation using high-pass filtering-based method, and fiber extraction. The developed image analysis algorithms quantify yarn hairiness by means of the two proposed measures, namely hair area index and hair length index, which are compared to the USTER hairiness index. The proposed algorithms are compared with computer methods previously used for yarn properties’ assessment. Statistical parameters of the hair length index (mean absolute deviation, standard deviation and CV) are calculated. The presented approach of yarn hairiness measurement is universal and the proposed algorithms can be successfully applied in different vision systems for yarn quantitative analysis. Moving yam
Milky glass Milky light-bulb PC computer
CCD Camera
Black screen
A/D converter
Image analysis
Image aquisition
Image processing
Fig. 6.11 Yarn hairiness measurement system [46].
Presentation of results
Computer vision techniques for detecting yarn defects
135
Yuvaraj and Nayar proposed a simple imaging and processing of the yarn image when compared with the commercial testers [47]. This study concentrates on the acquisition of the yarn images effectively without missing the hairs. To do so it uses an innovative technique: a 2-kV high-power voltage is generated so that the yarn hairs project away from the yarn surface. As referred in the previous section, Guha et al. developed a method to measure the true length of all the hairs of yarn under a microscope [48]. Measurement has been done by observing the yarn under a microscope and obtaining a trace of hairs. To automate this task digital image-processing was used, by developing an algorithm capable of analyzing yarn images taken under varying lighting conditions and yarn positions, and determining the minimum requirement of the image-capturing instrument. Despite the significant progress in last decade, there is no commercial solution in the market that offers a complete solution to analyze the main characteristics of textile yarn, although the YSQ [3] presented some preliminary algorithms to obtain a varied range of characteristics. The prototype YSQ [3] presents an affordable image acquisition and processing system for determining yarn production characteristics, namely, the fiber twist orientation, the twist step and orientation in folded yarns and the number of cables, spun yarn (single cable), or folded yarn (multiple cables). The imaging hardware consists of a Universal Serial Bus (USB) Web Camera that was placed at the exit plane of an analog ocular microscope. To capture the images, a monochromatic light source was also used to achieve higher contrasts for the yarn geometry relief. Finally, an appropriate image-processing was developed using the IMAQ Vision software from National Instruments. To determine the yarn production characteristics, certain procedures are applied: – –
– –
The twist step in folded yarns consists of determining the average of the horizontal pixel distance between particles (this parameter is relevant only when the yarn contains more than one cable (folded yarn), i.e., when at least two particles have been identified); The twist orientation in folded yarns is determined by the orientation angle for each particle under the following conditions: (1) If the orientation angle lies between 90 and 180 degrees, then the twist orientation is counterclockwise; (2) If it is between 0 and 90 degrees, then the twist orientation is in the clockwise direction; Number of cables (folded or spun yarn): (1) If only one particle is identified, then it can be concluded that the yarn is a spun yarn (single cable); (2) If the number of particles is greater than one, then the yarn is a folded yarn (multiple cables); Fiber twist orientation: two possible situations may occur: (1) When the yarn is folded, the fiber twist orientation is opposite to the twist orientation identified in the folded yarn; (2) When it is a spun yarn, a new function is called.
For the classification of the twist orientation in a spun yarn, a new algorithm was developed by Carvalho [3] taking into account the following steps. 1. Removal of the Intensity Plane of the HIS (Hue, Intensity, and Saturation) Color-Encoding Scheme—in a spun yarn, a large region has a high-intensity level. The intensity distribution becomes more homogeneous with the removal of the intensity plane. 2. Convolution (highlight details)—a convolution is an algorithm that recalculates the value of a pixel based on its own value and the pixel values of its neighbors weighted by the
136
Applications of Computer Vision in Fashion and Textiles
coefficients of a convolution kernel. The convolution kernel defines how the associated filter alters the pixel values in a gray-scale image. It is a 2D structure whose coefficients define how the filtered value at each pixel is computed. 3. Autothreshold (Moments)—this method recalculates a theoretical binary image function and was considered to isolate the white details. The kth moment (mk) of an image is calculated by [3]. mk ¼
1 Xig ¼Ni 1 k ig h ig ig ¼0 np
(6.7)
where np is the total number of pixels in the image. 4. Small object removal—this option was used to remove all the small particles. 5. Labeling—this function assigns a different gray-level value to each particle in the image. This function identifies particles using either connectivity-4 or connectivity-8 criteria. The connectivity defines the neighborhood of each pixel. For connectivity-4, only adjacent pixels in the horizontal and the vertical directions are considered neighbors; for connectivity8, all adjacent pixels are considered neighbors. 6. Exponential—this function decreases brightness and increases contrast in bright regions of an image, thereby decreasing contrast in dark regions. It is important to eliminate the fibers protruding from the yarn core. 7. Convex Hull—this function was used to allow making the appropriate particle measurements. 8. Particle filter—the objective of this is function to remove all the particles with reduced areas. 9. Particle analysis (orientation)—measuring the orientation angle of each particle enables the determination of the twist orientation. The considered strategy calculates the average orientation of all particles in the image. Then, as before: a. If the average angle orientation lies between 90 and 180 degrees, then the fiber twist orientation is counterclockwise; b. Conversely if the average angle orientation lies between 0 to 90 degrees, then the fiber twist orientation is anticlockwise.
A system based on a microscope coupled to a webcam also allows determining other characteristics of the textile yarn like diameter, imperfections, and hairiness. The algorithm in Fig. 6.12 describes the application of various image-processing techniques to obtain, as a final result, the contours of the core of the wire and at the same time exclude all protruding fibers around the nucleus. After obtaining the contours of the nucleus, the detection of all the edges along these contours is carried out with the help of parallel lines of research. Once all edges are detected, the distance is calculated through the pairs of edges detected by the search lines, where the average of all calculated distances is subsequently averaged [4]. For the determination of the diameter, the following procedures were used [3,4]: – – –
Function rotate: The purpose of this function is to rotate the image to the horizontal position if it is not in that position. Extract single-color plane: The luminance is removed from the HSL plane to better homogenize the near-color pattern and to simplify the binarization process. Autothreshold: The purpose of this function is to segment the image into two regions: the wire region and the background region.
Computer vision techniques for detecting yarn defects
137
Begin
Image acquisition
No Image is in horizontal position?
Rotate image
Yes Detection of all edges
Luminance extraction Measurement of the distances of all pairs of edges detected
Binarization Calculation of the average of all distances measured
Segmentation End
Fig. 6.12 Block diagram of the algorithm [4].
– – –
Close: It aims to fill small holes and smooth borders. This function is one that presents the least changes to the wire structure. This is a relevant factor in ensuring greater accuracy in diameter measurement. Convolute: The convolution allows recalculating the value of the pixel based on its own value and the values of the neighboring pixels with the weight of the convolution kernel coefficients. Canny edge detection: Finally, to detect the contours of the wire, the Canny edge filter was used. This function uses the pixel value at any point along the pixel profile to define the “force” of the contour at that point. To locate a vantage point, several profile scans run pixel by pixel from beginning to end.
138
–
Applications of Computer Vision in Fashion and Textiles
Clamp vertical Max: This function allows the edges to be obtained along a set of parallel search lines in a region of interest. Once obtained, the diameter is calculated by averaging the distances measured between the pairs of edges detected by the survey lines. Since it is the user who chooses the region of interest, it is defined in the parameters of the clamp function that the separation of two consecutive lines of research is one pixel. Otherwise dependent on the region of interest selected by the user, the number of edges detected would be different, which would imply a decrease of precision in the calculation of the diameter.
Tresanchez et al. [49] presented an alternative for measuring yarn diameter, which presents a novel approach, using an optical mouse sensor to estimate yarn diameter. This approach uses the image acquisition capabilities of an inexpensive optical mouse sensor; the main advantage of this sensor is the short focal distance that enables the development of very compact measurements systems. Yarn imperfections or flaws can also be determined using the prototype YSQ [3]. The large and thin places can be analyzed by comparing the distances measured along the wire to the average diameter at various levels of analysis. After defining the sensitivity to which the analysis will be made, the reference values are calculated in pixels, relative to the imperfections of the textile yarn (Fig. 6.13). For example, if the sensitivity is 10%, the reference value for thick points will be 0.1 above the mean diameter value; values below 0.1 of the mean diameter will be reference values for thin points. Only thin or coarse points are counted in the abrupt transition of distance values relative to the reference values. To determine the coefficient of hairiness, it is imperative to use preprocessing techniques, spatial filtrations as well as segmentation to isolate the core of the wire and to highlight the hairiness. To isolate hair piles for the hairiness coefficient measurement, logical operators are used between the image with the highlighted hairpins and the wire core. Fig. 6.14 presents the block diagram of the algorithm. The algorithm has three phases. The first phase isolates the core from the protruding fibers, through spatial filtering and segmentation, i.e., removes the hairiness around the nucleus as much as possible. The second stage is to emphasize the same protruding fibers. Finally, logical operations are performed between the two images to isolate the hairiness and calculate the coefficient of hairiness. The following settings are used to isolate yarn core [3,4]: – – – – – –
Function rotate: The purpose of this function is to rotate the image to the horizontal position if it is not in that position. Inverse: Inverts the intensity of the pixels of an image to calculate the negative. This operation allows highlighting white and gray details in large areas of black. Equalize: This function redistributes the pixel values of an image to the histogram linearization. Autothreshold: This function is necessary to segment the image into two regions, the region of the object (in this case the yarn) and the background region. Filter nth order: Removes the protruding fibers around the core. Remove particles: It eliminates the particles resistant to a certain number of 3 3 erosions.
Computer vision techniques for detecting yarn defects
139
Begin
Calculation of the reference value for thick points
Calculation of the reference value for fine points
No End
Last distance value?
Yes
Compare with reference values with distance value
No Thick spots?
Counts thick points
No Fine points?
Increment to next distance value
Fig. 6.13 Algorithm flowchart [4].
Counts fine points
140
Applications of Computer Vision in Fashion and Textiles
Begin
Image acquisition
Image in horizontal position?
No
Yes
Isolate core with segmentation and filtering techniques
Application of spatial preprocessing techniques to enhance the fibers
Detection of points and contours by filters
Isolate the fibers with logical operations
Removal of small particles and extraction of skeleton from yarn
Area measurement
Division of angle by length of wire — coefficient of hairiness
End
Fig. 6.14 Algorithm block diagram [4].
Computer vision techniques for detecting yarn defects
141
To emphasize, the protruding fibers are used the following settings [3,4]: – – – –
Function rotate: The purpose of this function is to rotate the image to the horizontal position if it is not in that position. Inverse: Inverts the intensity of the pixels of an image to calculate the negative. This operation allows highlighting white and gray details in large areas of black. Equalize: This function redistributes the pixel values of an image to the histogram linearization Convolute: This function, previously described in the section of the calculation of the diameter, was used to convolve with a Laplace filter to detect discontinuity points, with the following kernel: 2
3 0 1 0 4 1 5 1 5 0 1 0 –
Remove particles: It eliminates the particles resistant to a certain number of 3 3 erosions.
The hairiness and loop fibers are evidenced by removing the background and all the unwanted particles [3,4]. To calculate the coefficient of hairiness, the following settings are used: –
Skeleton: Calculates the skeleton of the particles contained in an image or the lines of delimitation of the zones of influence of the objects; It applies a succession of erosions until the width of each particle becomes equal to one pixel. The structuring element used is the skeleton L with the following kernel: 2
3 0 ? 1 40 1 15 0 ? 1 –
Particle Analysis Report: This function parses the particles and extracts data such as the area of the particles, the number of holes in the particle (even those of a pixel size), bounding rectangle, i.e., the smallest rectangle with sides parallel to the X axis and the axis Y, which completely envelops the particles, the center of mass or the midpoint representing the mean position of the total mass of the particle, assuming each point at which the particle has a constant density and orientation, i.e., the angle of the line passing through center of mass of the particles with lower moment of inertia.
Since the skeleton function reduces the particles to one pixel, the length of the protruding fibers is given by the measured area. The hairiness coefficient is calculated by dividing the area measured over the length of the wire [3,4]. Recently, Sengupta et al. [50] had proposed a computerized system to measure different yarn parameters such as diameter, diameter variation, number of thick/thin places and neps, hairiness indices (hair length index and hair area index), and number of hairs in a single run in moving state with the help of image-processing. The developed system can give the average diameter of the yarn under test in real-time unit (millimeter), which means that hairiness is more meticulously defined. An inexpensive USB web camera, mechanical setup for yarn movement, computer, and LabVIEW software are used. Textile yarns have been tested with cut length 1–4 mm, and the
142
Applications of Computer Vision in Fashion and Textiles
results have been compared with a commercial capacitive tester, i.e., Uster tester 3. Calibration has been done by taking image of a standard wire and correcting the multiplying factor in the software if necessary. The developed system is just as valuable for colored yarns. Furthermore, the system does not present fluctuation of ambient temperature, humidity, and illumination level. Bardla and others [51] proposed an automated method for verifying defects on yarn orientation in three-dimensionally draped, multilayered fabrics. The developed process can be used in quality inspection, process development, and validation of results obtained by modeling simulation. A high-frequency, robot-guided, eddy current sensor was used to obtain an image of the conductivity and local permittivity of the sample. From this image, the orientation of the fibers not only of the upper layers, but also of the optically nonvisible lower layers can be verified. A 2D Fast Fourier Transform is applied to local segments of the eddy current image to determine the local orientation of the wire. Guidelines are derived for the processing of eddy current data, including phase rotation, filtering, and size of the evaluation segment. Only with the recent development of high-resolution test equipment has it been possible to use local changes in conductivity to individually check wires. Highfrequency Foucault scanning can be used to generate a conductivity path in which the individual wire systems are visible as overlapping band patterns.
6.5
Final comments
Today, the selection of the right yarn for the right product is crucial due to economic reasons. A continuous incoming inspection guarantees a constant satisfactory quality of the end product. Because of this issue, yarn-classifying systems play a very important role. Thin places, e.g., mainly affect the productivity (machine stops caused by end breaks) whereas coarse yarn faults in woven or knitted fabrics result in costly rejects. Following this necessity and considering the computer-processing evolution, this chapter reviewed the principal systems that use an image-processing/computer vision solution to detect yarn defects. The implementation of a new project aims at the development of a new technological solution based on the image-processing techniques for automatic characterization of the main parameters of a textile yarn, with a higher level of parameterization compared to commercial solutions. This new development of the project will overcome the problems associated with traditional commercial equipment, contributing to the increase of the efficiency of the textile industry.
References [1] V.H. Elsasser, Textiles: Concepts and Principles, third ed., Fairchild Books, London, 2011. [2] R.M. Vasconcelos, Contribution to the Application of Artificial Intelligence Techniques in Spinning Technology, Ph.D. thesis, University of Minho, Braga, 1993. [3] V. Carvalho, Automatic Yarn Characterization System, Ph.D. thesis, University of Minho, Braga, 2008.
Computer vision techniques for detecting yarn defects
143
[4] N. Gonc¸alves, Parametrization of a Textile Wire Based on Image Processing Techniques, Master thesis, University of Minho, Braga, 2010. [5] V. Carvalho, N. Gonc¸alves, F. Soares, R. Vasconcelos, M. Belsley, Yarns parameterization and fabrics prediction using image processing, J. Text. Light Ind. Sci. Technol. 2 (1) (2013) 6–12. [6] Uster Company—URL: (consulted in September 2016). [7] V. Carvalho, J.G. Pinto, J.L. Monteiro, R. Vasconcelos, F.O. Soares, On-line measurement of textile thread irregularity, Textı´lia 48 (2003) 36–40 (in Portuguese). [8] V. Carvalho, J.G. Pinto, J.L. Monteiro, R. Vasconcelos, F.O. Soares, Yarn parameterization based on mass analysis, Sensors Actuators A Phys. 115 (2–3) (2004) 540–548. [9] J.G. Pinto, V. Carvalho, J.L. Monteiro, R. Vasconcelos, F.O. Soares, Yarn mass measurement with 1 mm length samples, IEEE Trans. Ind. Electron. 54 (2) (2007) 1177–1183. [10] V. Carvalho, P. Cardoso, M. Belsley, R. Vasconcelos, F.O. Soares, Yarn hairiness parameterization using a coherent signal processing technique, Sensors Actuators A Phys. 142 (1) (2008) 217–224. [11] V. Carvalho, J.L. Monteiro, R. Vasconcelos, F.O. Soares, Yarn evenness parameters evaluation: a new approach, Text. Res. J. 78 (2) (2008) 119–127. [12] V. Carvalho, R. Vasconcelos, F.O. Soares, M. Belsley, A comparative study between yarn diameter and yarn mass variation measurement systems using capacitive and optical sensors, Indian J. Fibre Text. Res. 33 (2008) 119–125. [13] V. Carvalho, M. Belsley, R. Vasconcelos, F.O. Soares, Yarn hairiness and diameter characterization using a CMOS line array, Measurement 41 (10) (2008) 1077–1092. [14] V. Carvalho, P. Cardoso, M. Belsley, R. Vasconcelos, F.O. Soares, Yarn diameter measurements using coherent optical signal processing, IEEE Sensors J. 8 (11) (2008) 1785–1793. [15] A. Guha, Measurement of yarn hairiness by digital image processing, J. Text. Inst. 101 (2010) 214–222. [16] L. Ferreira, Determinac¸a˜o de caracterı´sticas de produc¸a˜o de fio t^extil utilizando tecnicas de processamento de imagem (Master thesis), University of Minho (in Portuguese). [17] V. Carvalho, P. Cardoso, M. Belsley, R. Vasconcelos, F.O. Soares, Yarn irregularity parameterization using optical sensors, Fibres Text. East. Eur. 17 (1(72)) (2009) 26–32. [18] V. Carvalho, P. Cardoso, M. Belsley, R. Vasconcelos, F.O. Soares, Yarn hairiness characterization using two orthogonal directions, IEEE Trans. Instrum. Meas. 58 (3) (2009) 594–601. [19] V. Carvalho, M. Belsley, R. Vasconcelos, F.O. Soares, Yarn diameter and linear mass correlation, J. Nondestruct. Eval. 28 (2) (2009) 49–54. [20] V. Carvalho, M. Belsley, R. Vasconcelos, F.O. Soares, Automatic yarn characterization system: design of a prototype, IEEE Sensors J. 9 (8) (2009) 987–993. [21] V. Carvalho, P. Cardoso, M. Belsley, R. Vasconcelos, F.O. Soares, Yarn diameter characterization using two orthogonal directions, J. Exp. Tech. 35 (5) (2011) 7–15. [22] V. Carvalho, M. Belsley, R. Vasconcelos, F.O. Soares, Determination of yarn production characteristics using image processing, Int. J. Imaging Syst. Technol. 20 (2010) 391–399. [23] V. Carvalho, M. Besley, R. Vasconcelos, F. Soares, A comparison of mass parameters determination using capacitive and optical sensors, Sensors Actuators A 167 (2) (2011) 327–331. [24] V. Carvalho, N. Gonc¸alves, F. Soares, R. Vasconcelos, M. Belsley, Characterization of yarn mass parameters and production characteristics using optical sensors, capacitive sensors and image processing, Int. J. Sens. Wirel. Commun. Control 2 (3) (2012) 1–10.
144
Applications of Computer Vision in Fashion and Textiles
[25] V. Carvalho, M. Belsley, R. Vasconcelos, F.O. Soares, Yarn periodical errors determination using three signal processing approaches, Digital Signal Process. 23 (5) (2013) 1427–1440. [26] N. Gonc¸alves, V. Carvalho, F. Soares, R. Vasconcelos, M. Belsley, J. Machado, Yarn features extraction using computer vision—a study with cotton and polyester yarns, Measurement 68 (2015) 1–15, https://doi.org/10.1016/j.measurement.2015.02.010. [27] IMAQ Vision Concepts Manual by National Instruments. Available from: http://www.ni. com/pdf/manuals/322916a.pdf, Accessed 12 December 2016. [28] R.C. Gonzalez, R.E. Woods, Digital Image Processing, second ed., Pearson Education, Nova Jersey, EUA, 2002. € Demir, A. Buldu, Determination of yarn twist using image [29] K. Yıldız, Z. Yıldız, O. processing techniques, in: Proceedings of 2015 International Conference on Image Processing, Production and Computer Science (ICIPCS’2015), 2015. [30] M. Kaur, M. Sharma, Evaluation of yarn quality in fabric using image processing techniques, Int. J. Appl. Eng. Technol. 4 (4) (2014) 54–60. [31] Y. Li, J. Ai, C. Sun, Online fabric defect inspection using smart visual sensors, Sensors 13 (2013) 4659–4673. [32] D. Schneider, T. Holtermann, F. Neumann, A. Hehl, T. Aach, T. Gries, A vision based system for high precision online fabric defect detection, 2005. [33] M. Tarek Habib, R.H. Faisal, M. Rokonuzzaman, F. Ahmed, Automated fabric defect inspection: a survey of classifiers, Int. J. Found. Comput. Sci. Technol. 4 (1) (2014) 17–25. [34] K.L. Mak, P. Peng, H.Y.K. Lau, A real-time computer vision system for detecting defects in textile fabrics, in: Proceedings Of The Ieee International Conference On Industrial Technology, 2005, pp. 469–474. [35] R.S. Sabeenian, M.E. Paramasivam, P.M. Dinesh, Computer vision based defect detection and identification in handloom silk fabrics, Int. J. Comput. Appl. 42 (17) (2012) 36–40. [36] R. Drobina, M.S. Machnio, Application of the image analysis technique for textile identification, AUTEX Res. J. 6 (1) (2006) 40–48. [37] P. Ghaderpanah, F. Mokhtaria, M. Latifi, Evaluation of false-twist textured yarns by image processing, Indian J. Fibre Text. Res. 40 (2015) 399–404. [38] J.P. Singh, G. Anuhbav, A. Aprajita, S. Himanshi, J. Vandana, Digital image processing techniques: a versatile system for textile characterization, J. Text. Sci. Eng. 4 (2014) 156. [39] S.V. Cay, M. Rangoussi, I. Tarakc¸ioglu, On the use of image processing techniques for the estimation of the porosity of textile fabrics, Proc. World Acad. Sci. Eng. Technol. 2 (2005) 73–76. [40] N. Gupta, Analysis on the defects in yarn manufacturing process & its prevention in textile industry, Int. J. Eng. Invent. 2 (7) (2013) 45–67. e-ISSN: 2278-7461, p-ISSN: 2319-6491. [41] F. Francini, G. Longobardi, Quality control of textile yarn by optical filtering technique, Opt. Lasers Eng. 10 (2) (1989) 119–126. [42] H. Sari-Sarraf, J.S. Goddard Jr., Vision system for on-loom fabric inspection, IEEE Trans. Ind. Appl. 35 (6) (1999) 1252–1259. [43] W. Zhang, C. Iype, W. Oxenham, The analysis of yarn thin places and unevenness with an image-analysis system and program design, J. Text. Inst. 89 (Part 1, No. 1) (1998) 44–58. [44] A. Ghosh, H. Abul, H. Santanu; D. Subhasis, A proposed system for cotton yarn defects classification using probabilistic neural network, Recent Adv. Innov. Eng. 2014. [45] M. Tuna´k, V. Bajzik, C.T. Murat, Monitoring chenille yarn defects using image processing with control charts, Text. Res. J. 81 (13) (2011) 1344–1353.
Computer vision techniques for detecting yarn defects
145
[46] A. Fabijanska, Image processing and analysis algorithms for yarn hairiness determination, Mach. Vis. Appl. 23 (2012) 527–540. Springer. [47] D. Yuvaraj, R.C. Nayar, A simple yarn hairiness measurement setup using image processing techniques, Indian J. Fibre Text. Res. 37 (2012) 331–336. [48] M. Gunay, Characterization and Quantification of Woven Fabric Irregularities Using 2-D Anisotropy Measures, Ph.D. thesis, North Carolina, 2005. [49] Tresanchez, T. Pallejà, M. Teixido´, J. Palacı´n, Measuring yarn diameter using inexpensive optical sensors, Procedia Eng. 5 (2010) 236–239. [50] A. Sengupta, S. Roy, S. Sengupta, Development of a low cost yarn parameterization unit, Measurement 59 (2015) 96–109. Elseiver. [51] G. Bardla, A. Nockea, C. Cherifa, M. Poochb, M. Schulzeb, H. Heuer, M. Schillerd, R. Kupkee, M. Kleine, Automated detection of yarn orientation in 3D-draped carbon fiber fabrics and preforms from eddy current data, Compos. Part B 96 (2016) 312–324. [52] M. Kuzanski, Measurement methods for yarn hairiness analysis – the idea and construction of research standing, in: MEMSTECH’2006, May 24–27, Lviv-Polyana, Ukraine, 2006, pp. 87–90.