Image processing and analysis algorithms for yarn hairiness determination

Yarn hairiness is one of the key parameters influencing fabric quality. In this paper image processing and analysis algorithms developed for an automatic determination of yarn hairiness are presented. The main steps of the proposed algorithms are as follows: image preprocessing, yarn core extraction using graph cut method, yarn segmentation using high pass filtering based method and fibres extraction. The developed image analysis algorithms quantify yarn hairiness by means of the two proposed measures such as hair area index and hair length index, which are compared to the USTER hairiness index—the popular hairiness measure, used nowadays in textile science, laboratories and industry. The detailed description of the proposed approach is given. The developed method is verified experimentally for two distinctly different yarns, produced by the use of different spinning methods, different fibres types and characterized by totally different hairiness. 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 coefficient of variation) are calculated. Finally, the obtained results are analyzed and discussed. The proposed approach of yarn hairiness measurement is universal and the presented algorithms can be successfully applied in different vision systems for yarn quantitative analysis.


Introduction
Dynamic development of machine vision techniques broadens the range of their applications. Computer vision systems are commonly used in many branches of science, medicine and industry [43]. In textile, visual assessment is one of the fundamental methods of yarn [2,36] and final products [18] quality evaluation and also of yarn [7,26,55] and fabric [54] structure analysis. For more than 30 years computer vision techniques have been used in textile science for yarn quality inspection [3,27,49]. In modern computer vision systems image processing and analysis algorithms are used for an automatic measurement of important yarn quality parameters, such as hairiness [12,15,20,22,39,40], diameter [13,38], twist [17,41], thickness [17,49], faults [14], density and bulkiness [15], surface defects [29], etc.
The present-day progress in textile industry increases requirements for fabric quality. Uneven effects that influence the appearance of a fabric and decrease its commercial value can appear at each phase of the production cycle [1]. However, most commonly they are caused by defects of yarn from which the fabric is woven. Image analysis techniques are used not only for an automatic thread [35] and warp [16] quality analysis, but also for estimating the dimensions of spliced connections of yarn-ends [19] and repetition of yarn structure [35], which influence fabric quality.
One of the key parameters defining textile yarn quality is its hairiness [4][5][6]. Hairiness arises from protruding fibre ends released from the yarn surface which can be divided into the protruding fibre ends and the looped fibres arched out of the yarn core. The essence of yarn hairiness is shown in Fig. 1 illustrating two views of yarn profiles.
Generally, hairiness is an undesirable yarn feature. It spoils yarn smoothness and negatively influences weaving, knitting and other textile operations following spinning. This in turn degrades fabric quality, negatively impairs its characteristics and causes serious faults in further textile processes. Therefore it is necessary to measure and control yarn hairiness during its production [24]. In some cases, hairiness is a desirable feature, i.e. for fancy yarns, yarns for soft and bulky fabrics, etc. [25]. Yarn hairiness is a complex parameter. Due to its complexity, various measures have already been proposed for quantifying yarn hairiness [4][5][6]. However, it definitely depends on the fibres on the outer layer of the yarn that do not directly adhere to the core. Therefore, most commonly it is defined by means of some properties of protruding fibres, such as: number, length, shape (protruding ends or loops) etc., per unit of yarn core length [2,23].
Although a number of approaches for yarn hairiness determination exist, the methods using image processing and analysis algorithms are still under development. Several image-based approaches dedicated to yarn properties assessment have already been proposed. However, these methods use various kinds of thresholding approaches for yarn core and protruding fibres segmentation [7,[12][13][14][15][16][17][18][19][20]22,27,29,[31][32][33]35,[38][39][40][41]52,54], which often lack universality as they either are dedicated to the certain class of images provided by the certain vision system or require certain yarn orientation and experimental setting of parameters by trial and error examination. This paper presents application of graph based method for yarn core extraction and high pass filtering based method for yarn segmentation.
The paper is arranged as follows. First, in Sect. 2 a short review of well established traditional approaches to yarn hairiness determination is given. Next, in Sect. 3 architecture of the measurement system used in this work is described. In Sect. 4 images used in this work are characterized. Sections 5 and 6 describe in detail image processing and analysis algorithms developed for yarn hairiness determination. This is followed in Sect. 7 by presentation of results obtained for exemplary yarns. Finally, Sect. 8 discusses the obtained results and concludes the paper.

Review of existing approaches to yarn hairiness measurements
The history of yarn hairiness measurements dates back to the 50's to the pioneering works of Barella [2] and Onions [36]. Since then various approaches to yarn hairiness determination have been proposed. However, in general they can be qualified into one of the following groups: weighting and capacity methods, photoelectric methods, microscopic methods and image processing methods. Weighting (and capacity) methods define hairiness by means of the difference between weight (or capacity) of yarn before and after singeing (i.e. burning the protruding fibres) [5,46]. The main drawback of these methods is averaging of the results. Moreover, they do not provide information about the spatial distribution of the protruding fibres. Therefore, recently their significance is mostly historical.
Yarn hairiness measurements are now dominated by photoelectric methods that require specialized devices. In the first group of these devices a number of protruding fibres in a few constant distances from the yarn core is measured. Lappage and Onions [34] built an instrument with a small photo-conductive cell, mounted in the screen, which detects the passage of hair shadows. Nowadays, yarn hairiness is determined by means of the number of interruptions to the light beam (which is parallel to the yarn core) caused by the protruding fibres. Various sources of light are used. Among well established photoelectric devices for yarn hairiness determination the most popular are: Shirley Yarn Hairiness Tester [4,46] which uses LCD beam, Zweigle Hairiness Tester [4,46,50] utilizing laser light and Uster Zweigle Hairiness Tester 5 [4,46,51] where infrared light source is applied. Photoelectric devices of this type provide high quality results for straight fibres clearly separated from the yarn core. However, problems are encountered where fibres are looped around the core. In the second group of these devices the measuring field is formed by a homogeneous beam of parallel light, in which yarn is located. Only those rays of light that are scattered by the protruding fibres reach the detector. The intensity of this light is a measure of yarn hairiness. This method using a diffractometer and a special filtering mask was reported by Rodrigues et al. [44]. The most popular devices that use this measurement method are: Uster Tester 3 which uses infrared light [5] and Keisokki Laserpot LSP utilizing laser light [6,30].
Microscopic methods have evolved over the years. In the early stages of their development yarn hairiness was measured manually on the basis of magnified images of yarn. The microscopic image used to be projected on the screen or photographed. Then the number and length of protruding, looped and wild fibres per yarn unit length were measured manually [2,23,28,42]. Such measurements were laborious and time consuming. Moreover they were encumbered with an error due to problems with identifying the boundary of yarn. Recently, modern high quality electron microscopes are used for yarn hairiness measurements [12,13]. These microscopes often provide digital images of the yarn, therefore microscopic methods demand development of image processing and analysis algorithms.
Image processing methods are also applied in vision systems for yarn hairiness determination. A few solutions using image processing and analysis algorithms for hairiness assessment have already been reported [15,17,22,32,33,38,39]. However, there is no commercial vision based system for textile yarn hairiness determination available on the market. Therefore, one of the challenges of the present day machine vision applications is to develop a set of image processing and analysis algorithms for an automatic characterization of textile yarn hairiness.

The experimental setup
In the research being presented the measurement system designed in the Computer Engineering Department of Technical University of Lodz was used [31][32][33]. Its general architecture is shown in Fig. 2. The system consists of: -area scan CCD monochromatic camera with an optical system; -uniformly illuminated screen covered with black velvet; -uniform light source; -yarn mover; -PC computer.
During the measurements the yarn under the investigation is placed on the yarn mover (i.e. motor-driven set of rollers) in front of the CCD camera. Behind the yarn the screen covered with black velvet is located. The screen is illuminated by the light source consisting of a milky light bulb placed behind the milky glass. This ensures uniform illumination of the yarn. Additionally, no reflection from the screen appears, as the black material absorbs the light. This ensures uniform intensity distribution in the background area. The camera CCD Camera The proposed yarn hairiness measurement system acquires images of consecutive sections of the yarn while it is moved by the rollers. It is also possible to move the yarn manually and obtain the image of yarn without motion for the research purposes. The laboratory stand is equipped with a set of digital cameras of different resolutions and optical systems with different magnifications.

Input data
Planar still images of yarns of various hairiness magnified 45 times were considered in this work. The images were acquired with 8-bit resolution and stored as monochromatic images of spatial resolution M × N equal to 480×640 pixels. The exemplary images of the yarns are shown in Fig. 3.

Image processing
In the considered application image processing algorithms aim at extracting yarn core and single fibres from the background. They also provide input data for image analysis (i.e. yarn properties determination) performed in further steps of the measurement process. Processing of yarn image is performed in four main steps (see Fig. 4). Firstly, yarn core is extracted. Next the image is enhanced and yarn segmentation is performed. Finally, single (protruding and looped) fibres are separated from yarn core.
The detailed description of the above mentioned steps is given in the following subsections.

Yarn core segmentation
For yarn core segmentation an efficient algorithm proposed by Boykov and Jolly in [9] is applied. The method divides image into subregions by computing a global optimum among all segmentations satisfying some hard constraints imposed for object and background. The division is performed using graph based image representation where image  The main idea of graph cut segmentation [9] is modeled as a weighted undirected graph with nodes representing pixels and weights representing edge capacities. There are two types of edges in the graph: n-links, which connect neighboring pixels, and t-links, which connect pixels with two terminals: the source S (representing conditions imposed on object) and the sink T (representing conditions imposed on background). Every pixel has up to four n-links to its (spatially) nearest neighbors and two t-links connecting it to terminals. Weights assigned to n-links represent boundary term and describe similarity between the neighboring nodes; weights assigned to t-links represent regional term and define the individual penalties for assigning pixel to object and background. The boundary between an object and the background is defined according to min-cut/max-flow theorem. It is determined by edges which get saturated when maximum flow is sent via graph from source S to sink T . This idea is explained in Fig. 5.
The method used for yarn extraction is initialized on the basis of image histogram. Constrains for background and object are obtained from information contained in histogram peaks. 10% of intensities around "lighter" peak (i.e. the one connected with higher intensities) are assigned to object and 10% of intensities around "darker" peak (i.e. the one connected with lower intensities) are assigned to background. Next, globally optimal segmentation is computed with pixel intensities interpreted as the probability of each pixel to belong to the foreground and background respectively.
Result of yarn core extraction using graph cut method on an exemplary image given in Fig. 6a is shown in Fig. 6b.
The advantages of the proposed method for yarn core extraction over previously used solutions should be underlined. In this case the main problem is the definition of boundaries between the core and the surrounding protruding and loop fibres.
In research by Guha et al. [22], Chimeh et al. [15] and Wang et al. [52] borders of the yarn core were approximated with straight lines and a constant core diameter was assumed. Because yarn core diameter often varies along the length of the yarn, this assumption can introduce significant errors into the calculations of yarn hairiness. Whereas graph cut segmentation successfully keeps original shape of the core without averaging variations in its diameter.
Cybulska [17] proposed the method in which the core edges are estimated initially from the connected intervals of foreground pixels having the greatest length by scanning each line in the image perpendicular to the core axis. These initial boundaries are then corrected according to some predefined curves along which points generating the edge of the yarn core are assumed to be randomly distributed. This method is insufficiently accurate also.
The solution proposed in the paper is devoid of weaknesses of the thresholding approaches, which often require images of certain properties, are sensitive to nonuniform background illumination and adjust threshold by experimental setting of parameters.  An interesting threshold based approaches for yarn core extraction was proposed by Ozkaya et al. in [38]. The authors differentiate back-lit images and dark-field images. For backlit images they propose method which uses image histogram to determine two thresholds-one for the yarn core and second for the protruding fibers. This solution is dedicated to images having strongly bimodal histogram with the modes corresponding to the background and the yarn respectively, which are separated by a relatively flat valley. The method falters in case of images regarded in this work where the valley is convex and has similar level to height of the "object" peak (see the histogram shown in Fig. 7). It that case the method can not be unambiguously adapted to the regarded images as it produces similar thresholds for both: the core and the yarn. The method for dark-field images proposed in [38] estimates threshold for yarn simply based on background intensities where no yarn is present. For core extraction a given number of rows is integrated along every column in order to find the core edges from the peaks in obtained intensity profiles.
The advantage of the graph cut method over morphological operations applied earlier by Kuzanski and Jackowska-Strumiłło [31,32] and Fabijanska et al. [20] for yarn core segmentation is also evident. The profit is mainly in time of computations. Morphological yarn extraction require multiple processing-firstly image thresholding is applied to obtain binary image, then time (computationally) expensive sequences of erosion and dilation need to be performed to remove remaining fibres. Graph-cut algorithm produces core in a single processing step. Moreover, the method has been proved very fast and efficient [10]. In case of analyzed images segmentation of yarn core using graph cut took about 23 ms, while morphological core extraction lasted for 43 ms (Intel Core i7 960 3,2 GHz, 8 GB RAM). Additionally, min-cut/maxflow segmentation algorithm avoids joining closely looped fibres into the core occurring during morphological core extraction.
Results of yarn core segmentation using min-cut/maxflow algorithm are shown in Fig. 6 and compared with core extraction results obtained using linear approximation of yarn borders (Fig. 6c) and morphological operations, i.e. thresholding and opening and closing (Fig. 6d).
Finally, universality of the proposed method for yarn core extraction should be underlined. The method successfully extracts yarn core from images obtained from different vision systems and under different lighting conditions. In

Image preprocessing
After yarn core is extracted the original (input) image u is used again for yarn segmentation.
Due to imperfections of the vision system there is a high noise level in the background of the considered images. It negatively influences the subsequent stages of image processing. Therefore, background noise should be removed before the main processing while enhancing significant image regions belonging to the fibres at the same time. In order to do so, firstly a median filter is applied (see Eq. 1) in order to reduce noise but preserve the image fibres regions. where where u σ denotes Gaussian-smoothed version of image u 2 and k is a scaling constant. Finally background noise is reduced by comparing it to the reference pattern. As a reference pattern small square window (2 × 2 pix.) taken from the bottom right corner of the image is used. This part of the image always belongs to the background. The reference pattern is described by feature vector h = [h 1 , h 2 , h 3 , h 4 ] where: h 1 average intensity, h 2 standard deviation of intensity, h 3 maximum intensity, h 4 minimum intensity.
Then the squared window (2 × 2 pix.) is moved through the image and the Euclidean distance d between the reference pattern and the region within the window is calculated. Regions which are distant to the reference pattern more than the average distance computed for the whole image are excluded from further analysis. This rule can be expressed by Eq. (3).
where: h i is a feature vector describing ith square region of the image, h ref is a feature vector describing the reference pattern and d is given as follows: Symbols M and N denote image dimensions. Results of image enhancement are shown in Fig. 9b. The source yarn image is given in Fig. 9a. (b) (a)

Yarn segmentation
Yarn segmentation is performed on the enhanced image u 4 . High pass filtering [21] is applied in this step. Specifically, the input image is convolved with mask p in accordance with Eq. 5. The applied mask kernel p is shown in Fig. 10.
In the resulting image u 5 all values above 0 are set to 1. Others are set to 0. In consequence binary image of yarn is obtained. The resulting image after segmentation is shown in Fig. 11b.
The proposed solution is superior over thresholding based approaches used so far for yarn extraction [15,20,22,31,38]. As it was proved by Ozkaya et al. [38] popular adaptive thresholding methods falter due to background noise and nonuniform background distribution. They often require exhausting, empirical and experimental setting of parameters what makes them lack universality. The method proposed in [38] based on two thresholds also fails when histogram of yarn image is not bimodal. The method proposed in this paper is resistant to nonuniform background distribution and extracts nonfocused and unsharp fibres which are often omitted by standard thresholding and edge-detection based techniques eg. Canny (see Fig. 11c-f). The extracted fibres are disjoint and well-defined while fibres segmented by the thresholding methods are often discontinuous and merged into one region. Hence, using the proposed method yarn hairiness can be determined more accurately.
The proposed method for yarn extraction is also universal as it successfully segments different yarn images. Yarns extracted by the method from various images used in previous studies are presented in Fig. 12. The source of the image is indicated in the figure caption. The corresponding input images are shown in Fig. 8.

Fibres extraction
In the final image processing step the protruding and looped fibres are separated from the yarn. It is done simply by subtracting the core c obtained in the first processing step from the image of yarn u 5 given in the previous step: Fibres separated from the exemplary image from Fig. 13a are shown in Fig. 13b.

Image analysis
Image analysis aims at determining yarn properties based on results provided by image processing steps.
The considered application determines fundamental statistical yarn parameters which are the following: hair area index H A , hair length index H L , mean absolute deviation of hair length index MAD, standard deviation of the hair length index S and coefficient of variation of the hair length index CV H [12,22]. The definitions of these parameters and the proposed algorithms for their determination are presented in the following subsections.

Determination of hair area index
Hair area index H A is a unit-less parameter defined as a ratio between the total area of single (i.e. looped and protruding) fibres S F and the total area of core S C [22,27]. It can be expressed by the following equation: Both the total area of fibres and the total area of yarn core can be easily determined directly from binary images by counting number of white (i.e. these with 1's assigned) pixels which are known to belong to the certain region (i.e. fibres and yarn core). These operations are expressed by Eqs. (8) and (9).
where f is a binary image of fibres (given by Eq. (6)), c is binary image of yarn core and M, N denote dimensions of the image.

Determination of hair length index
Hair length index H L (known also as hairiness index) is a unit-less parameter defined as a ratio between the total length of single (i.e. looped and protruding) fibres L F and the total length of core L C [12]. It can be expressed by Eq. (10).
Hairiness index H L as defined in Eq. (10) for the sensing length L C of 1 cm is used, as a measure defined in Uster Tester 3 apparatus. It is valid for cotton yarns with average fibre finesses [5]. Due to the method used in this apparatus the measured intensity of light scattered by the protruding fibres is proportional to the total length of protruding fibres. This assumption is correct only, if the fibres cross-section is approximately symmetric.
The aim of this work is to determine and compare two hairiness measures defined in Eqs. (7) and (10). Application of image processing and analysis methods allows for hair length index calculation.
Analogously, for H L index calculation both lengths are determined from binary images of fibres and core. However, the parameters cannot be determined directly. Therefore in order to determine desirable lengths, image skeletonization is applied to both the binary images (i.e. images of core and fibres).
Skeletonization produces line representation of both the yarn core and the fibres. In particular, it provides skeletons i.e. set of white (with 1's assigned) points equi-distant to borders of objects.
Results of applying skeletonization algorithm to the core and the fibres of exemplary image from Fig. 6a are shown in Fig. 14, where Fig. 14a presents skeleton of the core and Fig. 14b presents skeletons of looped and protruding fibres. In Fig. 14c the comparison of the obtained skeletons and the original image is shown. The skeletons were obtained using thickening as described in [21].
Obtained skeletons retain topology of objects, therefore they can be successfully used for determination of total length of the core and the protruding fibres. Specifically, the lengths are calculated by counting number of pixels belonging to the skeleton of the core and the fibres in accordance with Eqs. (11) and (12) respectively.
where SK denotes skeletonization by thinning performed on the binary image given as a parameter and z is parameter which equals 1 when two neighbouring pixels are horizontal or vertical and √ 2 when neighbouring pixels are diagonal. Finally, based on hair length indices obtained for the consecutive images of yarn, mean absolute deviation of the hair length index MAD [12], standard deviation of the hair length index S [8] and coefficient of variation of the hair length index CV H [8] are determined in accordance with Eqs. (13), (14) and (15) respectively.
CV H = 100 S H L (15) where: n denotes number of images (samples), H L i is hair length index obtained for i-th image (sample) and H L is average value of hair length index.

Results
In this section results of yarn parameters determination using the proposed methods are presented and compared with the results obtained using alternative methods for core extraction (discussed in Sect. 5.1). Two yarns of distinctly different (i.e. low and high) hairiness, bulkiness and other properties were examined. They are denoted by labels Yarn 1 and Yarn 2 respectively. Their characteristics are given in Table 1.  For each yarn, a series of still images were acquired. The yarn sections for obtaining images were chosen randomly at a distance of at least 250 mm from one another, as it was suggested by Jedryka [28], so that errors due to some periodic yarn irregularities should be eliminated.
In Tables 2 and 3 exemplary (representative) yarn images selected from each series are shown. Specifically, Table 2 refers to Yarn 1 and Table 3 refers to Yarn 2. Yarn 1 is rotor spun yarn produced from cotton fibres, which are stapled fibres and therefore a lot of short protruding fibres can be seen in images in Table 2. Yarn 2 is a pneumatically textured yarn produced from filament polyester fibres, dedicated to bulky knitted products. Therefore, mainly loops and almost no protruding fibres can be seen in images in Table 3. These yarns characterize with totally different properties, i.e. low and high hairiness, low and high bulkiness, high and low yarn core density, etc. In the second and the third row of each table, corresponding values of hair length index (H L ) and hair area index (H A ) are given. The values were provided by the proposed method.
Values of hair length index and the corresponding hair area index obtained for 30 randomly selected samples in both series are shown in Figs. 15, 16, 17 and 18. Figures illustrate hair length and hair area indices obtained from yarn images segmented using the proposed method (see Sect. 5) after extracting yarn core using graph cut, morphological operations and approximating core area with straight lines. Figures 15 and 16 correspond to Yarn 1 and present hair length indices and hair area indices respectively. Figures 17  and 18 present these parameters obtained for Yarn 2. Sample ID indicated on the category axis corresponds to the number of the image in the considered series. Series GraphCut corresponds to results provided by graph cut segmentation algorithm as proposed in this work. Results obtained using morphological operations for yarn core extraction are represented by series Morph. Finally, results from series Line were obtained by assuming constant core diameter.
Mass irregularity of fibres stream in time is usually assumed to be random stationary and ergodic process [25], hence investigation of a finite set of randomly selected samples allows to calculate yarn parameters with high confidence. This is consistent with traditional -microscopic methods for yarn hairiness assessment in which sets of randomly selected yarn samples were investigated, containing from 36 samples of 6 mm length, which were divided into 216 sections of 1 mm length [23] to 100 samples of 1 mm length [28,36]. The number of samples n for yarn testing depends on the assumed measurement accuracy. On the basis of preliminary results obtained for 30 yarn samples of 4 mm length, it was calculated (using the Student distribution for the confidence Table 2 Results of yarn parameters determination obtained for Yarn 1 Table 3 Results of yarn parameters determination obtained for Yarn 2 level 0.95 [48]) that minimum of 25 samples for Yarn 1 and minimum of 65 samples for Yarn 2 are needed to obtain satisfactory measurement accuracy, i.e. random relative error below 10%. Therefore, a set of 30 samples for Yarn 1 and a set of 70 samples for Yarn 2 were selected for further investigation.
Values of hair area indices H A , hair length indices H L and their statistical parameters (i.e. average, mean absolute deviation, standard deviation and coefficient of variation) deter-   hair length index (series S) and coefficient of variation of the hair length index (series CVH). Small dependence of the determined values in function of the number of samples can be observed. The comparison of the results provided by the graph cut method (series GraphCut) to the results obtained using the morphological operations for yarn core extraction (series Morph) and the results obtained at assumption of constant core diameter (series Line) is given in Table 4. Additionally, the comparison to the results obtained from Uster Tester 3 apparatus is provided (where possible). Random errors of hair area and hair length indices determination were calculated using the Student distribution for the confidence level 0.95.
The methods for yarn core segmentation were also compared visually by three various groups of independent testers i.e.: 4 textile experts, 2 authors and 33 students and researchers from other than textile disciplines. Firstly, the experts inspected the original image of yarn section and 3 images with the extracted yarn core and ranked the three methods, which one is the best, the second, and the worst. A criterion of the comparison, proposed by the textile experts and the authors, was the best fibres classification, i.e. if they belong to the yarn core or if they are protruding fibres or loops.
The tests were repeated for 30 different sections of Yarn 1 and 30 different sections Yarn 2. The experts decided that an assumption of constant core diameter introduces significant error into measurements and that this method is the worst and stands out from the other methods. In the case of graph cut and morphological operations their opinion was, that the both methods yield very good results and for some yarn sections it is difficult to decide, which method is better. Specifically, in the case of Yarn 2, it was difficult to determine the boundaries between the core and the surrounding protruding and loop fibres, because of the low density of the textured yarn core. Finally, the comparison tests for graph cut and morphological methods were performed for other testers. The tests results are gathered in Table 5. The results show percentage indications for the superior method. The number of experts and testers is given in parentheses.
The comparison of the results in Table 5 indicate that the proposed graph cut method outperforms the morphological method in detecting image regions representing yarn core.
The definition of boundaries between the core and the surrounding protruding and loop fibres is the main problem in yarn core segmentation. Visual comparison of yarn core segmentation methods is a subjective method of their quality assessment and its result depends on the experts and comparison criteria. However, there is no other better possibility to compare the quality of the investigated methods.
The dependency of hair area index on the hair length index was investigated by means of linear regression (Fig. 21). The values of linear regression coefficients a and b for the tested yarns, their standard deviations S a and S b and the coefficients of linear correlation R obtained for 30 randomly selected samples are listed in Table 6.
The values of the coefficients of linear correlation R within the range (0.9-1) confirm a very strong correlation dependency between the hair area index and the hair length index for the tested yarns. However, for the Yarn 2 (polyester) the correlation is stronger than for the Yarn 1 (cotton). A possible explanation for this result is that polyester fibres   . 22 Photos of cotton (a) and polyester (b) fibres taken from lanameter cross-section is circular (Fig. 22b) and the shape of cotton fibres resembles a twisting ribbon (Fig. 22a). It should be also underlined that the hair area index depends on the method used for yarn core separation. This effect is especially visible in case of Yarn 2 (see Fig. 21b), which is a fantasy yarn and the borders of a yarn core are not as well defined as in case of Yarn 1.

Conclusions
Image processing and analysis algorithms for quantitative assessment of yarn hairiness are reported in this paper. The proposed segmentation algorithms use graph cut method for yarn core extraction and high pass filtering based method for fibres extraction. The results presented in Table 4 show that the proposed approach to yarn hairiness determination proved successful for distinctly different tested yarns: the one with low and the one with high level of hairiness. The results for Yarn 1 and Yarn 2 obtained by the use of image processing and analysis methods were comparable to the results obtained from Uster Tester 3 apparatus, so the new method was verified successfully. Results provided by all tested methods for yarn core extraction are similar, however hair length indices determined using the graph cut and morphological operations are closer to those provided by Uster Tester 3 than hair length indices obtained at the assumption of constant core diameter.
The visual comparison with the results obtained using different methods for yarn core extraction proves superiority of the proposed solution over previously used approaches (see Table 5). The quality of yarn core segmentation for the graph cut method is slightly higher than for the morphological method. However an additional advantage of using graph cut for yarn core extraction is lower computation time and universality of the method (as discussed in Sect. 5.1).
The visual comparison of the obtained results proves superiority of the proposed solutions over thresholding and edgebased methods used previously for yarn segmentation. The algorithms are valid for two distinctly different yarns, produced in different spinning systems, different fibres types and characterized by significantly different (i.e. high and low) hairiness and various other parameters. They also prove successful in analysis of yarn images obtained under various lighting conditions and from different vision systems, regardless of the background brightness. The method can be considered universal, as it works well both in case of yarns seen on the dark and the light background. These properties of the proposed method are proven by results of applying the proposed image processing algorithms to various yarn images taken from earlier published studies on yarn properties investigation.
The proposed solution enables measurement of the hair length index, which is considered as a viable measure of hairiness. This measure is used in popular and widely used Uster Tester 3 apparatus. The algorithm for the hair area index determination was also tested. Numerical complexity of the hair area index calculation is significantly lower than for the hair length index calculation. The research results proved experimentally a linear dependence between these two indices. Hence, the hair area index can be regarded as a viable approximation of the hair length index for the yarn types, which are made of fibres that feature close to symmetric cross-sections. However, because the value of hair area index depends on yarn core width, the dependence between hair area index and hair length index should be determined for each yarn linear mass and yarn type separately.
The further research will involve simultaneous processing two orthogonal images of the yarn as proposed in [38] or analyzing data composed from images provided by two cameras located at different views. Additionally, it is planned to focus on developing on-line algorithms for yarn quality assessment and image analysis algorithms for distinguishing between the looped and free fibres ends, and also calculation of their number and length.
Acknowledgments The authors would like to thank Mr Marcin Kuzanski from the Computer Engineering Department for providing the yarn photographs, Professor Tadeusz Jackowski with his research staff from the Department of Spinning Technology and Yarn Structure, Faculty of Textile Engineering and Marketing, TUL for providing yarn testing apparatus and for valuable consultations. We also thank students and researchers from the Faculty of Electrical, Electronic, Computer and Control Engineering, TUL for taking part in comparison tests. Finally, we are grateful to the authors of references [15,22,33,38,47,53] for their agreement to use images shown in Fig. 8. This research was partially supported by Ministry of Science and Higher Education of Poland in a framework of the research project no. N N516 490439 (funds for science in years 2010-2012). Additionally, Anna Fabijańska receives financial support from the Foundation for Polish Science in a framework of START fellowship.
Open Access This article is distributed under the terms of the Creative Commons Attribution License which permits any use, distribution, and reproduction in any medium, provided the original author(s) and the source are credited.