A fabric pilling detection method based on image processing
The wool information in fabric images is separated by wavelet transformation and grayscale symbiosis matrix technology, and the neural network is used to automatically rating, solving the problem of artificial dependence and incomplete texture removal of existing fabric wool pill detection methods, achieving more accurate and objective detection results.
Patent Information
- Application Number
- CN202211544134.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-03
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2042-12-03
AI Technical Summary
The existing fabric wool pill detection methods have artificial detection dependence, strong subjectivity, and image processing methods are not perfect for texture removal, resulting in inaccurate detection results.
Using an image processing-based method, wavelet transformation is used to decompose the fabric image into multiple levels, and the contrast and correlation are calculated through the grayscale symbiosis matrix, the hair ball information is separated, and input it into the neural network for training to achieve automatic rating.
Improve the accuracy and objectivity of the detection results, reduce manual intervention, and more effectively remove texture information, thereby obtaining a more accurate matte pilling rating.
Smart Images

Figure CN116152163B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of fabric detection, in particular to a fabric pilling detection method based on image processing. Background Art
[0002] The pilling performance of fabrics is an important part of textile testing, but currently most factories and inspection bureaus still use manual testing methods. The most widely used method is to compare with standard samples. However, the traditional standard sample comparison method consumes a lot of manpower and is subjective. Therefore, many experts and scholars have proposed using image processing technology to replace manual testing.
[0003] At present, there are also methods for pilling detection using image methods. The existing image processing methods are mainly divided into three categories. The first is to process the image in the spatial domain. This method can only perform simple processing on some pilling images. The second is to use Fourier transform to transform the fabric image from the spatial domain to the frequency domain, and use low-pass filtering in the frequency domain to filter high-frequency texture information and retain low-frequency pilling information. Figure 3 However, Fourier transform is not local, lacks local information of time, and the scale of parameters is difficult to determine. The third method is to use wavelet energy method to find the optimal number of pilling layers of fabric images, but this method has the problem that the pilling layer and the texture layer are in the same layer, so the texture cannot be completely filtered out or the pilling information is lost, resulting in inaccurate final results. Summary of the invention
[0004] The technical problem to be solved by the present invention is to provide a fabric pilling detection method based on image processing in view of the above shortcomings, which uses computer vision to detect fabric pilling, filters the texture of the fabric and extracts the fabric pills from the whole fabric, thereby improving the time-consuming and labor-intensive disadvantages of the traditional method.
[0005] In order to solve the above technical problems, the present invention adopts the following technical solutions:
[0006] A method for detecting fabric pilling based on image processing comprises the following steps:
[0007] Step 1, perform a pilling experiment on the fabric, and then collect surface image information of the fabric;
[0008] Step 2, performing tilt correction on the surface image of the fabric so that the texture of the fabric is perpendicular to the bottom frame, and obtaining a corrected surface image of the fabric;
[0009] Step 3, using wavelet transform to decompose the corrected fabric surface image multiple times, decomposing the image into multiple levels, and the size of the image is reduced to half of the original after each decomposition, and the information of each level includes low-frequency approximate components, high-frequency horizontal components, high-frequency vertical components and high-frequency diagonal components;
[0010] Step 4: Calculate the contrast of the gray level co-occurrence matrix of the high-frequency vertical component of each layer. If the sum of the contrasts of the first x layers accounts for more than 95% of the sum of the contrasts of all layers, then it is determined that the layers from x+1 to the last layer are hair ball information.
[0011] Calculate the correlation of the gray-level co-occurrence matrix of the high-frequency diagonal components of each layer and draw a correlation difference curve. If the curve tends to be stable starting from the yth layer, it is judged that from the yth layer to the last layer is hair ball information;
[0012] Step 5, superimposing the high-frequency vertical component from the x+1 layer to the last layer and the high-frequency diagonal component from the y layer to the last layer to obtain a hair ball information image;
[0013] Step 6, threshold segmentation is performed on the hair ball information image to obtain a binary image of the hair ball;
[0014] Step 7: Calculate the number of hair balls, hair ball proportion and average hair ball width in the binary image to obtain a training sample;
[0015] Step 8: Repeat steps 1-7 to obtain a training set consisting of multiple training samples;
[0016] Step 9, input the training set into the neural network model, the model outputs the pilling grade of the training sample, compares the result of the training sample with the result of the manual standard sample comparison method, obtains the accuracy, and trains the neural network model by maximizing the accuracy to obtain a fabric pilling grade detection model;
[0017] Step 10: Use the fabric pilling grade detection model to detect the pilling grade of the fabric.
[0018] Furthermore, in step 3, the pre-processed fabric surface image is decomposed into five levels using wavelet transform.
[0019] Furthermore, in step 1, a circular trajectory method is used to perform a pilling experiment on the fabric.
[0020] Furthermore, in step 2, Radon transform is used to perform tilt correction on the fabric surface image.
[0021] Furthermore, in step 4, the formula for calculating the contrast is:
[0022]
[0023] In the formula, n is the gray level, p is ij is the joint probability density of the gray-level co-occurrence matrix at the pixel point (i, j).
[0024] Furthermore, in step 4, the formula for calculating the correlation is:
[0025]
[0026] In the formula, n is the gray level, p is ij is the joint probability density of the gray-level co-occurrence matrix at the pixel point (i, j), μ x μ y are the means of the gray-level co-occurrence matrix along the x-axis and y-axis, σ x σ y are the standard deviations of the gray-level co-occurrence matrix along the x-axis and y-axis, respectively.
[0027] After adopting the above technical solution, the present invention has the following advantages compared with the prior art:
[0028] At present, the evaluation of pilling mainly relies on manual comparison with standard samples, which lacks objectivity and efficiency. Secondly, most of the general computer vision-based image processing methods are not perfect in removing textures, which affects the pilling rating results.
[0029] The present invention utilizes two-dimensional discrete wavelet combined with gray-level co-occurrence matrix to obtain the number of levels of pilling in the wavelet, obtains a pilling image without texture by a decomposition and reconstruction method, and imports the parameters of the pilling into a neural network for training to obtain an automatic rating result of the fabric pilling, so that the detection result is more standardized and more accurate.
[0030] The present invention is described in detail below with reference to the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 It is a schematic diagram of the method flow of the present invention;
[0032] Figure 2 Schematic diagram of wavelet transform decomposition;
[0033] Figure 3 is the fabric surface image;
[0034] Figure 4 Figures a and b in the middle are the results of 2D wavelet decomposition from layers 1 to 7;
[0035] Figure 5 This is a process diagram of obtaining a binary image of hair balls from a fabric surface image in Example 1;
[0036] Figure 6 is a correlation difference curve diagram of Example 1;
[0037] Figure 7 This is a process diagram of obtaining a binary image of hair balls from a fabric surface image in Example 2;
[0038] Figure 8 is a correlation difference curve diagram of Example 2;
[0039] Fig. 9 This is a process diagram of obtaining a binary image of hair balls from a fabric surface image in Example 3;
[0040] Fig.10 is a correlation difference curve diagram of Example 3;
[0041] Fig.11 It is the energy gradient map of wavelet energy method;
[0042] Fig.12 This is a comparison chart of the results of hair bulb layer image extraction using the method of the present invention and the wavelet energy method. DETAILED DESCRIPTION
[0043] The principles and features of the present invention are described below in conjunction with the accompanying drawings. The examples given are only used to explain the present invention and are not used to limit the scope of the present invention.
[0044] like Figure 1 As shown, a method for detecting fabric pilling based on image processing comprises the following steps:
[0045] 1. Use the circular trajectory method to conduct pilling experiments on the fabric, then use a CCD camera or CMOS camera to take pictures of the fabric and store them in the computer system.
[0046] 2. Use Radon transform to correct the fabric tilt so that the fabric texture is perpendicular to the bottom border
[0047] 3. Two-dimensional discrete wavelet multi-level decomposition and reconstruction, using wavelet transform to decompose the fabric into multiple levels, the purpose is to analyze the level of hair balls and texture. Two-dimensional wavelet transform is to filter on the horizontal axis and vertical axis through high-pass filter and low-pass filter to obtain different high-frequency information and low-frequency information. After each decomposition, the size of the image will be reduced to half of the original size, including the low-frequency approximate component cA j , high frequency horizontal component cD j h , high frequency vertical component cD j v , high frequency diagonal component cD j d , together forming [cA j ,cDj h ,cD j v ,cD j d ], in the multi-level wavelet decomposition, bior is selected as the wavelet basis, and the decomposition level is 7, such as Figure 2-4 It can be clearly seen that the fabric pilling is at a higher level in the high-frequency information, and the fabric texture is at a lower level in the high-frequency information.
[0048] 4. Gray-level co-occurrence matrix eigenvalue calculation
[0049] Gray-level co-occurrence matrix is a widely used texture analysis method, which is based on the assumption that the spatial distribution relationship between pixels in an image contains the image texture information. The gray-level co-occurrence matrix is used to distinguish the separation level of hair balls and textures. The gray-level co-occurrence matrix and its eigenvalues are calculated for the sub-images obtained by two-dimensional discrete wavelet.
[0050] 1) Calculation of contrast:
[0051]
[0052] In the formula, n is the gray level, p is ij is the joint probability density of the gray-level co-occurrence matrix at position (i, j). The more texture information an image has, the greater the visual contrast effect and the greater the contrast; calculate the contrast of the gray-level co-occurrence matrix of the vertical component from layer 1 to layer 5. If the first x layers account for more than 95% of the first five layers, then the layers from x+1 to layer 5 are hair ball information.
[0053] 2) Calculation of correlation:
[0054]
[0055] In the formula, μ x μ y are the means of the gray-level co-occurrence matrix along the x-axis and y-axis, σ x σ y are the standard deviations of the gray-level co-occurrence matrix along the x-axis and y-axis, respectively. The more hair ball information an image has, the more uniform the image is, and the greater the correlation is. The correlation of the gray-level co-occurrence matrix of the horizontal diagonal components from layers 1 to 5 is calculated and the correlation difference curve is plotted. If the curve tends to be stable starting from the y-th layer, the last y layers are hair ball information.
[0056] 5. Superimpose the vertical components from the x+1 layer to the 5th layer and the horizontal diagonal components from the y layer to the 5th layer to obtain the hair ball information image, and obtain an image containing only hair balls without texture. Then perform threshold segmentation to obtain a binary image of the hair balls, such as Figure 5-10, are schematic diagrams of three different embodiments. It can be seen from the figure that y in the three embodiments is 3. The contrast ratios of the three embodiments are shown in the following table:
[0057] Example 1 Table 1 (x=3)
[0058] Contrast 35.8796 14.6331 6.5261 1.9514 0.4646 Top 3 percentage 59.4548 57.0388 0.959364
[0059] Example 2 Table 2 (x=2)
[0060] Contrast 35.8796 14.6331 6.5261 1.9514 0.4646 Top 3 percentage 59.4548 57.0388 0.959364
[0061] Example 3 Table 3 (x=3)
[0062] Contrast 24.879 13.7353 14.3737 1.0881 0.6721 total 54.7482 Top three 0.967849
[0063] 6. Calculate the number of pilling in the binary image, the percentage of pilling, and the average width of pilling to obtain a training sample. Repeat the above steps to obtain a training set consisting of multiple training samples. Input the training set into the neural network model, and the model outputs the pilling grade of the training sample. Compare the results of the training sample with the results of the manual standard sample comparison method to obtain the accuracy. By maximizing the accuracy, train the neural network model to obtain a fabric pilling grade detection model.
[0064] As a comparative example, the wavelet energy method calculates the energy of the decomposed sub-image. The horizontal detail coefficient cH, vertical detail coefficient cV, and diagonal detail coefficient cD of each layer are added up respectively to form the sub-image of each layer. Because the reconstructed image contains all the high-frequency components, it can be considered that it can be used to analyze the high-frequency components of each layer. In the Matlab toolbox, there is a function wenergy2 for calculating the energy of two-dimensional wavelet decomposition, [EA, EH, EV, ED] = wenergy2(C, S) which can return the percentage of the corresponding approximate coefficient energy and the corresponding horizontal detail coefficient, vertical detail coefficient, and diagonal detail coefficient energy percentage EH, EV, ED. Then E = EH + EV + ED is used to obtain the sum of the energy percentages of the horizontal detail coefficient, vertical detail coefficient, and diagonal detail coefficient. Through the formula:
[0065]
[0066] The energy gradient map is obtained, such as Fig.11 , and then judge the separation level of hair balls and textures through the extreme points of the energy gradient map. However, this method fails when the texture and hair balls are in the same layer, such as Fig.12 , that is, this method
[0067] There is a problem that the hair ball layer and the texture layer are in the same layer, so the texture cannot be completely filtered out or the hair ball information is lost, resulting in an inaccurate final result. The method of the present invention does not have this problem.
[0068] The above is an example of the best implementation of the present invention, and the parts not described in detail are common knowledge of ordinary technicians in the field. The protection scope of the present invention shall be based on the content of the claims, and any equivalent transformation based on the technical enlightenment of the present invention is also within the protection scope of the present invention.
Claims
1. A method for detecting fabric pilling based on image processing, characterized in that: The following steps are involved: Step 1, perform a pilling experiment on the fabric, and then collect surface image information of the fabric; Step 2, performing tilt correction on the surface image of the fabric so that the texture of the fabric is perpendicular to the bottom frame, and obtaining a corrected surface image of the fabric; Step 3, using wavelet transform to decompose the corrected fabric surface image multiple times, decomposing the image into multiple levels, and the size of the image is reduced to half of the original after each decomposition, and the information of each level includes low-frequency approximate components, high-frequency horizontal components, high-frequency vertical components and high-frequency diagonal components; Step 4: Calculate the contrast of the gray level co-occurrence matrix of the high-frequency vertical component of each layer. If the sum of the contrasts of the first x layers accounts for more than 95% of the sum of the contrasts of all layers, then it is determined that the layers from x+1 to the last layer are hair ball information. Calculate the correlation of the gray-level co-occurrence matrix of the high-frequency diagonal components of each layer and draw a correlation difference curve. If the curve tends to be stable starting from the yth layer, it is judged that from the yth layer to the last layer is hair ball information; Step 5, superimposing the high-frequency vertical component from the x+1 layer to the last layer and the high-frequency diagonal component from the y layer to the last layer to obtain a hair ball information image; Step 6, threshold segmentation is performed on the hair ball information image to obtain a binary image of the hair ball; Step 7: Calculate the number of hair balls, hair ball proportion and average hair ball width in the binary image to obtain a training sample; Step 8: Repeat steps 1-7 to obtain a training set consisting of multiple training samples; Step 9, input the training set into the neural network model, the model outputs the pilling grade of the training sample, compares the result of the training sample with the result of the manual standard sample comparison method, obtains the accuracy, and trains the neural network model by maximizing the accuracy to obtain a fabric pilling grade detection model; Step 10: Use the fabric pilling grade detection model to detect the pilling grade of the fabric.
2. The fabric pilling detection method based on image processing according to claim 1, characterized in that: In the step 3, the pre-processed fabric surface image is decomposed into five levels by using wavelet transform.
3. The fabric pilling detection method based on image processing according to claim 1, characterized in that: In the step 1, a circular trajectory method is used to perform a pilling experiment on the fabric.
4. The fabric pilling detection method based on image processing according to claim 1, characterized in that: In the step 2, Radon transform is used to perform tilt correction on the fabric surface image.
5. The fabric pilling detection method based on image processing according to claim 1, characterized in that: In step 4, the formula for calculating the contrast is: In the formula, n is the gray level, p is ij is the joint probability density of the gray-level co-occurrence matrix at the pixel point (i, j).
6. The fabric pilling detection method based on image processing according to claim 1, characterized in that: In step 4, the formula for calculating the correlation is: In the formula, n is the gray level, p is ij is the joint probability density of the gray-level co-occurrence matrix at the pixel point (i, j), μ x μ y are the means of the gray-level co-occurrence matrix along the x-axis and y-axis, σ x σ y are the standard deviations of the gray-level co-occurrence matrix along the x-axis and y-axis, respectively.
Citation Information
Patent Citations
Woven fabric density detection method based on image processing
CN112330673A
Fabric fuzzing and pilling rating method based on deep learning
CN113205491A