Abstract
The pilling grade is one of the important indexes to evaluate the quality of fabric; the traditional method for pilling evaluation is based on manual operation, which is subjective. In this paper, a self-developed system is established and a photometric stereo-based three-dimensional (3D) acquisition method for pilling evaluation has been demonstrated. Firstly, a 3D surface model is obtained by using photometric stereo, mapping a 3D model to a two-dimensional image; the gray value is used to represent the depth value of the fabric surface and the pilling segmentation is realized by the Otsu threshold method after filtering the fabric texture by the relative total variance algorithm. The pilling number and pilling area are used as eigenvectors for pilling classification using the support vector machine. Finally, the classification accuracy of the pilling grade was 95.9%. For pilling evaluation, the developed system and method can be considered reliable and effective according to the experimental results.
Keywords
Rubbing fabric during use causes loose fibers to form small pills that are anchored to the fabric surface. In addition, while destroying the fabric appearance, the pilling will also affect the mechanical properties of the fabric. Therefore, pilling evaluation is an important part of fabric quality control in the textile industry.
At present, the methods of pilling evaluation using image processing technology can be divided into two-dimensional (2D)-based analysis methods and three-dimensional (3D)-based analysis methods. In the research of fabric pilling evaluation, many scholars extract the fabric pilling in the spatial domain and frequency domain to achieve pilling evaluation.
Spatial domain-based methods for evaluating pilling began as early as the 1990 s. In 1990, Konda et al., 1 with a nearly parallel light source from the side of a tangential irradiation fabric for gray images, the maximum ratio of inter-class variance and intra-class variance is used as the segmentation threshold for fabric hairball and texture, and then the pill area and the pill number were extracted as two characteristic parameters for the grade evaluation. Hu and Xin 2 concluded that the fabric pills in the image are brighter compared to the fabric texture background, so they proposed using Gaussian template matching to locate the pilling, but how to select the weight coefficients has a more significant effect on segmenting the fabric hairball. Sekulska-Nalewajko et al. 3 used optical coherence tomography (OCT) to identify the pilling layer to complete hairball segmentation, and then principal component analysis was applied to select strongly correlated features, and the experimental results showed that the method was reliable.
Threshold segmentation using color information in the spatial domain can be affected by noise such as the fabric texture, leading to the inappropriate selection of threshold values, making pilling segmentation inaccurate. To overcome the influence of noise, the noise can be filtered in the frequency domain by using the difference frequency information between the noise and pilling; Fourier transform and Wavelet transform are used most often.
To filter the fabric texture, Xu 4 used spectral analysis, assumed that most of the pills are circular, designed a circular stencil matching method to locate the pills, and selected a global threshold for pilling segmentation. In a study published by Zhang, 5 wavelet analysis was suggested as a method for extracting pills from textures, using wavelet coefficients to construct the characteristic parameters of the complex texture, and conducting grade evaluation of pills according to their density. Deng et al. 6 suggested that pilling images had several frequency components, such as noise, fabric texture, and pilling information. A pilling evaluation method based on a multi-scale 2D bi-plural wavelet was proposed to extract pilling information. Jing et al. 7 proposed an integrated feature extraction technique combining 2D discrete wavelet transform (2DDWT) and local binary patterns (LBPs) for puckered fabric image recognition. Xiao et al. 8 used Fourier transform to convert images into the frequency domain, combined with the energy algorithm, multidimensional discrete wavelet transform, and iterative thresholding method, to obtain the starting image. Finally, deep learning is used to complete the grade classification.
With the advancement of image processing technology, some researchers have tried to extract surface features of fabric pilling by 3D reconstruction to improve the accuracy of quality evaluation. With a 3D non-contact scanning system, Kim and Kang 9 obtained highly accurate 3D surface data to describe the surface firmness of the fabric; wavelet and fractal algorithms were used to calculate the fractal dimension and the standard deviation of average curvature. Finally, analysis of fabric pilling using Bayesian classifiers, minimum distance classifiers, k-nearest neighbor classifiers, and neural networks was carried out. Ouyang et al. 10 used the depth information of the fabric surface to detect pilling and extracted the fabric pilling density and other parameters. Xu et al. 11 investigated a system for 3D fabric surface reconstruction by using only two side-by-side images, where the pilling fabric was captured by a pair of regular digital cameras. Liu et al. 12 used self-developed stereo vision algorithms to complete the 3D reconstruction of fabric surfaces, including the structure from motion (SFM) and patch-based multi-view stereo (PMVS) algorithms. The experimental results show that the method is effective for fabric pilling evaluation.
The analysis methods based on 2D images are not universal due to factors such as lighting and texture. The appearance of the fabric pilling is 3D, and spatial information will be lost when using 2D images for analysis. In 2D imaging, complex textures and colors of fabric surfaces have a noticeable impact on pilling evaluations. However, analysis methods based on 3D reconstruction also have drawbacks: multi-view stereo cannot accurately recover the 3D model of the fabric tissues on the surface with no obvious texture details, but rather can only recover the macro contour. Many conditions must be met for laser triangulation, the scanning process takes a long time, and the equipment is expensive. Structure grating measurement will fail if applied to fabrics with complex surfaces or disordered colors because the grating coding pattern is destroyed. Most other image-based 3D reconstruction methods, such as stereo matching, are based on the features of the surface for 3D reconstruction, which means that when the surface texture is fuzzy, they will not be able to get an acceptable 3D model after reconstruction.
In this paper, a pilling evaluation method based on 3D reconstruction is proposed, as shown in Figure 1. Compared with the previous pilling evaluation based on 3D analysis method, our contributions mainly include the following:
1. The proposed image acquisition system consists of three or more light-emitting diodes (LEDs) and a camera, which is low-cost.
2. For traditional photometric stereo, a calibration of the light source intensity and direction is required, as well as the acquisition under parallel light. Parallel light requirements are challenging to meet, and the calibration procedures are time-consuming. Therefore, a method based on semi-calibrated near-light photometric stereo is proposed, which not only simplifies the calibration procedures but also relaxes the restrictions on light conditions, which allows using low-cost lighting devices such as LEDs.
3. Mapping the 3D model to a 2D image makes subsequent analysis more efficient and straightforward.
Methodology
Image acquisition system
The image acquisition system was developed based on the 3D fabric surface reconstruction method with a near-light photometric stereo vision algorithm. Multi-light source acquisition with different positions is required to acquire fabric images. Therefore, a multi-light source image acquisition device was developed, as shown in Figures 2 and 3. Eight LED lamps with 1 W power were used to illuminate the samples, which were calibrated and concentrated with a range of 15 luminous angles. A Nikon D7200 camera with an AF-S Micro NIKKOR macro lens was used in this study, which can obtain high-resolution microscopic images of the fabric surface. To minimize 3D reconstruction error due to light reflection, the device interior was painted with black matte paint.

Pilling grade evaluation system. 3D: three-dimensional; 2D: two-dimensional; SVM: support vector machine.

Self-assembly photometric stereo system. LED: light-emitting diode.

Experimental facility. LED: light-emitting diode.
Different colors and textures of fabrics were selected so that the data would be representative. In accordance with ASTM test method D3512; Martindale pilling testers and random roller pilling machines were used to make pilling samples, then the samples were graded by experienced experts. 13
System calibration
Camera calibration
The intrinsic matrix of the camera is indispensable information for 3D reconstruction. We obtain the internal matrix of the camera and establish the camera imaging model by Zhang’s plane-based method.
14
The single-point distortion-free camera imaging model is as follows
The intrinsic matrix can be expressed as
The images of the checkerboard were acquired, and the pixel coordinates of each corner point were obtained using the corresponding image detection algorithm, as shown in Figure 4. The size of each grid on the calibration board was known, and we could calculate the physical coordinates of each corner point under the world coordinate system, obtaining the intrinsic parameters of the camera through the constraint relationship between the pixel coordinates of each corner point and its world coordinates. The average reprojection error of this calibration was 0.3 pixels, which indicates a high calibration accuracy, and the reprojection error is obtained by calculating the distance between the original and reprojected position of the point.

The 12 checkerboard positions used, marked with the detected points, checkerboard origin, and reprojected points.
Light calibration
In this paper, triangulation was used to estimate the light source position parameters.
15
A pair of metal spheres are placed in the scene to generate visible highlights for each light source and we extract multiple highlight points by the thresholding method, as shown in Figure 5. Then the sphere contour was detected by the Canny operator,
16
as shown in Figure 6. Finally, the light source position parameters were obtained by triangulation. The principle is shown in Figure 7. The incident rays

Detect metal sphere highlights.

Test the center and radius of the metal spheres.

Principle of mirror sphere calibration.
The actual radius of the sphere, the focal length of the camera, and the physical pixel size of the camera sensor are needed to calculate the position of the light source using this method.
Firstly, the world coordinates of the highlight point
To calculate the direction of the light source with the coordinates of the obtained highlight point
After obtaining the direction of the light source, calculate the position of the light source
Three-dimensional reconstruction of fabric pilling
Semi-calibrated near-source photometric stereo model
Fabric appearance evaluation requires the close acquisition of fabric images. Traditional photometric stereo assumes the use of parallel light sources, which is difficult to guarantee. To solve this problem, a method based on photometric stereo 17 is proposed.
Suppose that
The point source model needs to calculate the attenuation due to distance. Vector
The second factor represents attenuation due to distance, and
The conjugation relationship between
The expression for the normal vector
Discrete model optimization
The albedo expression was modified following the method of Quéau et al.,
18
which eliminates the nonlinearity caused by the denominator
The expression of Equation (9) can be transformed into a system of nonlinear partial differential equations (PDEs)
We denote
We jointly estimate the albedo value

Example of three-dimensional reconstruction for a pilling sample. (a) Pilling sample; (b) albedo map; (c) normal map and (d) depth map.
Pilling binary graph acquisition
Two-dimensional depth image generation
Before further processing of the image, the 3D model needs to be transformed to a 2D grayscale image, which makes segmenting the pilling more efficient.
19
The abscissa and ordinate coordinates of the point
Comparing the grayscale image with the 2D depth grayscale image indicates that the 2D depth grayscale image filters the interference information of the fabric texture and illumination, as shown in Figure 9.

(a) Grayscale images of pilling and (b) Two-dimensional depth grayscale image of pilling.
Pilling segmentation
The information about pilling in the image are characteristics to measure the pilling level, but the recognition of pilling is affected by the texture of the fabric. To filter the fabric texture, a structure extraction method based on relative total variance (RTV) 20 is proposed.
This method uses a model based on the total variation, as shown in Equation (18)
To solve the above model, Equation (18) is finally expressed as
Controlling the value of λ can affect the smoothness of the result, but it does not help much to separate the texture. Increasing λ will cause more blurriness, and λ = 0.02 can help to extract the pilling information better.
Here,
The window size is controlled by spatial parameters
In the experiments, ε and
After the texture of the fabric is filtered by the structure extraction method based on RTV, the pills are segmented by the Otsu method, as shown in Figure 10.

Pilling binary graph acquisition: (a) the fabric texture filtering image and (b) pilling segmentation.
Experiment and discussion
The severity of pilling is divided into five grades according to ASTM standards, where samples with a grade of 1 indicates very heavy pilling and a grade of 5 indicates almost no pilling. Five standard samples were selected according to ASTM standards, and manual pilling evaluation was achieved by comparing other samples with the standard samples. In this paper, photometric stereo with the Lambert model is used, which only considers the diffuse reflectance component and does not consider the effect of the specular component, so the samples are chosen from plain fabrics. Figure 11 shows the fabric images and depth images of the five standard samples.

Standard pilling images. (a) Pilling grade 1; (b) pilling grade 2; (c) pilling grade 3; (d) pilling grade 4 and (e) pilling grade 5.
In this paper, 98 samples were used for fabric pilling evaluation, and three experts performed subjective evaluation of 98 samples by comparing with standard samples. The support vector machine (SVM) is an effective supervised learning model suitable for binary classification; its basic model is a linear classifier with the largest interval defined in the feature space. Due to the sample data being linearly separable, we use the linear kernel SVM as a classifier. Different characteristic parameters were selected as eigenvectors of the SVM (with a linear kernel) to complete the objective evaluation of fabric pilling, and the five-fold cross-validation method was used to avoid the overfitting problem caused by the small number of samples. Finally, comparison of subjective and objective pilling evaluation results determines the accuracy
The pilling number, the pilling area, and the pilling coverage ratio were used as characteristic parameters for objective evaluation, respectively, as shown in Figure 12.

Objective evaluation by different pilling features: (a) objective grade by the number, area, and coverage ratio of pills; (b) objective grade by the area and coverage ratio of pills; (c) objective grade by the number and area of pills; (d) objective grade by the number and coverage ratio of pills; (e) objective grade by the number of pills; (f) objective grade by the area of pills and (g) objective grade by the coverage ratio of pills.
Figure 12(a) shows the objective evaluation results using the pilling number, area, and coverage ratio as characteristic parameters with an accuracy of 93.9%; Figure 12(b) shows the objective evaluation results using the pilling area and coverage ratio as characteristic parameters with an accuracy of 87.8%; Figure 12(c) shows the objective evaluation results using the pilling number and area as characteristic parameters with an accuracy of 95.9%; Figure 12(d) shows the objective evaluation results using the pilling number and coverage ratio as characteristic parameters with an accuracy of 93.9%; Figure 12(e) shows the objective evaluation results using the pilling number as the characteristic parameter with an accuracy of 63.3%; Figure 12(f) shows the objective evaluation results using the pilling area as the characteristic parameter with an accuracy of 88.9%; Figure 12(g) shows the objective evaluation results using the pilling coverage ratio as the characteristic parameter with an accuracy of 86.7%.
In this paper, the pilling number and area were objectively evaluated as characteristic parameters, which had a higher consistency with the subjective evaluation results.
The sample images acquired under eight different light sources were used for 3D reconstruction, and the 3D models were used for the following experiments: 2D depth image generation, fabric texture filtering, pilling segmentation, and fabric pilling grade evaluation, as shown in Figure 13.

Fabric pilling samples: (a) two-dimensional (2D) image of pilling; (b) three-dimensional (3D) model of pilling; (c) 2D depth image; (d) 2D depth map with texture filtered out and (e) pilling segmentation image.
Five-fold cross-validation of this experiment was performed and then the 98 samples were divided into five mutually exclusive subsets with approximately equal sample sizes. In the classification experiments, each subset was used for testing, and the remaining four subsets for training. Thus, each subset was tested exactly once. After testing of the SVM model was completed for all datasets, the test results were used to compare with the subjective evaluation results, and the comparison results were used to determine the accuracy of the classification experiments.
In order to verify the effectiveness of the SVM, seven classifiers were used for comparative experiments. As shown in Figure 14, the horizontal coordinate represents the pill number, the vertical coordinate represents the pill area, the green dots represent the misclassified samples, and the other color dots represent the subjective evaluation level of the fabric. The classification results of different classifiers are satisfactory and the accuracy is similar, proving that the method of extracting feature parameters in this system is reliable and can be adapted to different classifiers. Among them, the SVM with a linear kernel has the best result with 95.9% classification accuracy. The performance of the naive Bayesian classifier was the worst, with an accuracy of 92.9%.

Comparison of different classifier results: (a) subjective evaluation, (b) support vector machine (SVM) classifier with a linear kernel, with accuracy of 95.9%; (c) SVM classifier with a Gaussian kernel, with accuracy of 94.9%; (d) k-nearest neighbor classifier, with accuracy of 93.9%; (e) decision tree, with accuracy of 94.9%; (f) naive Bayes, with accuracy of 92.9%; (g) quadratic discriminant analysis, with accuracy of 94.9% and (h) linear discriminant analysis, with accuracy of 94.9%. (Color online only.)
Conclusion
In this paper, a system based on photometric stereo was proposed, designed, and developed with the function of fabric 3D model reconstruction and objective pilling evaluation. The proposed system contains a camera and eight light sources with different locations. It is possible to generate a 3D model of fabric pilling using algorithms of near-light semi-calibrated photometric stereo. The reconstructed 3D model was used for the following experiments: 2D depth image generation, fabric texture filtering, pilling segmentation, and fabric pilling grade evaluation. For classification experiments, the pill number and pill area were selected as the eigenvectors. This experimental results of the study demonstrate the effectiveness and reliability of the system and method, with a recognition accuracy of 95.9%.The proposed pilling evaluation method does not perform well for pilling samples with complex colors, which will be supplemented in a subsequent study.
Footnotes
Declaration of conflicting interests
The author(s) declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.
Funding
The author(s) disclosed receipt of the following financial support for the research, authorship, and/or publication of this article: This work was supported by the Natural Science Foundation of China (grant 61876106).
