Bobbin hairiness defect detection method based on multi-representation information fusion
By performing multi-characterization information fusion processing on the surface of the yarn barrel, multiple characteristics of the yarn barrel hair defect are extracted, and the existing detection methods are solved, and more efficient and accurate detection of the yarn barrel hair defect is achieved.
Patent Information
- Application Number
- CN202510216100.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-26
- Publication Date
- 2025-06-13
AI Technical Summary
The existing yarn tube hair defect detection methods are inefficient and have poor accuracy, making it difficult to meet the needs of modern large-scale production, especially when facing complex and changeable yarn tube surface defects.
Using a detection method based on multi-characterization information fusion, a gradient calculation, grayscale symbiosis matrix processing, binarization processing and window mapping processing of the grayscale image on the surface of the yarn barrel, combined with logical operations and morphological processing, a variety of characteristics of the hair defect of the yarn barrel are extracted.
It improves the accuracy and robustness of yarn tube hair defect detection, reduces manual intervention, improves detection speed and work efficiency, and can effectively respond to the detection needs in complex environments.
Smart Images

Figure CN120147253A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a computer vision image processing method, and particularly to a method for detecting yarn bobbin hairiness defects based on multi-representation information fusion. Background Art
[0002] In the textile industry, the quality of yarn bobbins directly affects the quality of the final products. Among them, the hairiness on the surface of yarn bobbins is one of the common quality problems, which not only affects the appearance of the yarn, but may also have an adverse impact on the subsequent processing process. Therefore, it is of great significance to efficiently and accurately detect the surface defects of yarn bobbins for improving product quality and reducing production costs.
[0003] Traditional methods for detecting surface defects of yarn bobbins mainly rely on manual visual inspection. This method is inefficient and greatly affected by subjective factors, making it difficult to meet the needs of modern large-scale production. In recent years, with the development of computer vision and image processing technologies, automatic detection methods based on images have gradually become a research hotspot. However, most of the existing automatic detection technologies focus on the extraction and analysis of single features, such as only considering the gray information or texture features of the image, which seems inadequate when facing complex and variable surface defects of yarn bobbins, and the detection accuracy and robustness need to be improved.
[0004] Existing detection methods often rely on manual visual inspection or single-modal image processing technologies, and these methods have problems of low efficiency and poor accuracy. Therefore, a more efficient and accurate method for detecting yarn bobbin hairiness defects is needed to improve the level of product quality control. Summary of the Invention
[0005] To overcome the limitations of the existing technology, the present invention provides a method for detecting yarn bobbin hairiness defects based on multi-representation information fusion.
[0006] The steps of the technical solution adopted by the present invention to solve its technical problems are as follows:
[0007] The method for detecting yarn bobbin hairiness defects includes the following steps:
[0008] S1. Photograph the surface of the yarn bobbin and perform graying processing to obtain a surface gray image;
[0009] S2. Perform gradient calculation processing and gray-level co-occurrence matrix processing on the surface gray image in sequence to obtain a texture feature image;
[0010] S3. Perform binarization processing and window mapping processing on the surface gray image in sequence to obtain a texture mask image;
[0011] S4. Perform logical operation and binarization processing on the texture feature image and the texture mask image to obtain a binarized image, and perform morphological processing on the binarized image to obtain morphological connected regions;
[0012] S5. Extract the connected regions in the binary image, perform a first filtering operation on the connected regions in the binary image, and then perform a second filtering operation based on the morphological connected regions to obtain the yarn bobbin hairiness defect region.
[0013] In the above-mentioned S2, the gradient calculation process is specifically processed according to the following formula:
[0014]
[0015] In the formula, g y (i, j) is the gradient value of the pixel at the i-th row and j-th column along the vertical direction, * is the convolution operator, σ is the standard deviation of the Gaussian distribution, m and n respectively represent the number of rows and columns of the convolution kernel, x and y respectively represent the row index and column index of the convolution kernel, represents an image window centered on the pixel at the i-th row and j-th column and with a size of m×n.
[0016] In the above-mentioned S2, the gray-level co-occurrence matrix process is specifically as follows: construct a gray-level co-occurrence matrix through the preset number of image gray levels, distance, and direction, extract texture feature quantities according to the gray-level co-occurrence matrix, and then generate a texture feature image;
[0017] By different processing methods of the gray-level co-occurrence matrix, different texture feature quantities will be obtained, and then the corresponding texture feature images will be generated.
[0018] The values of the elements in the gray-level co-occurrence matrix are specifically set according to the following formula:
[0019]
[0020] In the formula, L is the number of image gray levels, α is a parameter controlling the influence degree of distance on the weight, C represents the set of distances d k , |C| represents the number of elements in the set C, n(i, j|d k , θ) represents the number of occurrences of pixel pairs with gray levels i and j under the given distance d k and direction θ, and p(i, j|C, θ) represents the occurrence probability of pixel pairs with gray levels i and j under the given distance set C and direction θ.
[0021] In the above-mentioned S3, the binarization process is specifically as follows:
[0022] 1) Calculate the gray-level average value of each column of pixel points in the surface gray-level image;
[0023] 2) Taking the grayscale average value of each column of pixel points as the segmentation threshold for each column of pixel points, and then performing binarization operations on the grayscale values of each pixel point in the current column according to the segmentation threshold of each column of pixel points respectively according to the following formula to generate a non-highlight area mask image:
[0024]
[0025] In the formula, p'(i, j) is the grayscale value of the pixel point at the i-th row and j-th column after binarization operation, p(i, j) is the grayscale value of the pixel point at the i-th row and j-th column, and thresh(j) represents the segmentation threshold of the pixel points in the j-th column.
[0026] The window mapping process in S3 is specifically set according to the following formula:
[0027]
[0028] In the formula, w and h are the width and height of the window respectively, T mask (i, j) is the grayscale value of the pixel point at the i-th row and j-th column in the texture mask image, and blockNum(i, j) is the number of pixel points with non-zero grayscale values in the window of the non-highlight area mask image mapped by the pixel point at the i-th row and j-th column in the texture mask image.
[0029] S4 is specifically as follows:
[0030] S4.1: Performing a logical AND operation on the texture image and the texture mask image to obtain an image after the logical AND operation, and then performing binarization processing on the image after the logical AND operation according to a preset first threshold to generate a binarized image;
[0031] S4.2: Sequentially performing a dilation operation and an erosion operation on the binarized image, and traversing each pixel point to extract connected regions;
[0032] S4.3: Traversing all connected regions, obtaining the minimum bounding rectangle of each connected region, and then respectively performing the following operations on all connected regions to screen the connected regions, and finally retaining the connected regions as morphological connected regions:
[0033] If the longest side of the minimum bounding rectangle of the connected region is greater than a preset length threshold, then retain the connected region; otherwise, filter out the connected region.
[0034] In S4, the dilation and erosion are specifically set according to the following formula:
[0035]
[0036] In the formula, f represents the binarized image, b is the structuring element, is the dilation operation operator, is the corrosion operation operator, (x, y) represents the position of the current pixel to be processed, (i, j) is the relative coordinate in the structuring element b, and {f(x + i, y + j)} represents the set of all pixel values within the range of the structuring element b centered at (x, y).
[0037] Specifically, S5 is as follows:
[0038] S5.1: Extract all connected components in the binary image, and perform a first filtering operation on all connected components according to a preset second threshold group to filter out the connected components whose minimum circumscribed rectangle size and area of the connected component are smaller than the second threshold group, obtaining suspected defect connected components;
[0039] S5.2: Calculate the overlap ratio of each suspected defect connected component and the morphological connected component respectively according to the following formula, and perform a second filtering operation to filter out the suspected defect connected components whose overlap ratio exceeds the preset overlap threshold, and retain the suspected defect connected components with an overlap ratio less than the preset overlap threshold as the yarn bobbin hairiness defect area:
[0040]
[0041] In the formula, overlapRatio is the overlap ratio, overlapSize is the number of overlapping pixels between the suspected defect connected component and the morphological connected component, and contourSize is the total number of pixels of the suspected defect connected component.
[0042] The beneficial effects of the present invention are as follows:
[0043] By fusing image gradients, textures, grayscales, and morphological features, the present invention can capture various features of yarn bobbin hairiness defects more comprehensively, thereby improving the accuracy of detection. The automated processing flow reduces the need for manual intervention, improves the detection speed and work efficiency. Through the comprehensive analysis of various features, the present invention can effectively meet the detection requirements in various complex environments and improve the robustness of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 is the flowchart of the method of the present invention;
[0045] Figure 2 is the surface grayscale image without the boundary of the yarn bobbin;
[0046] Figure 3 is the surface grayscale image with the boundary of the yarn bobbin;
[0047] Figure 4 is based on Figure 2 is the gradient image processed with the surface grayscale image;
[0048] Figure 5 is based on Figure 2The texture feature image processed for the surface grayscale image;
[0049] Figure 6 is Figure 2 The non-highlight area mask image processed for the surface grayscale image;
[0050] Figure 7 is Figure 2 The texture mask image processed for the surface grayscale image;
[0051] Figure 8 is Figure 5 AND Figure 7 The image after the AND operation;
[0052] Figure 9 is Figure 8 The corresponding binary image;
[0053] Figure 10 is Figure 2 The defect detection result image processed for the surface grayscale image;
[0054] Figure 11 is Figure 3 The defect detection result image processed for the surface grayscale image. Specific implementation mode
[0055] The present invention will be further described below in conjunction with the accompanying drawings and specific embodiments.
[0056] A method for detecting yarn bobbin hairiness defects based on multi-characteristic information fusion is as Figure 1 shown, and includes the following steps:
[0057] S1. Photograph the surface of the yarn bobbin and perform grayscale processing to obtain a surface grayscale image, as Figure 2 and Figure 3 shown, where Figure 2 represents the surface grayscale image without the yarn bobbin boundary in the figure, Figure 3 represents the surface grayscale image with the yarn bobbin boundary in the figure, and the surface of the yarn bobbin refers to the outer peripheral surface of the yarn bobbin.
[0058] S2. Perform gradient calculation processing and gray-level co-occurrence matrix processing on the surface grayscale image in sequence to obtain a texture feature image.
[0059] The gradient calculation processing is performed along the vertical direction of the image, and is specifically processed according to the following formula:
[0060]
[0061] In this embodiment, the gradient calculation processing generates a gradient image G(i,j) by calculating the pixel value difference in the vertical direction of the image.
[0062] where g y (i,j) is the gradient value of the pixel at the i-th row and j-th column along the vertical direction, * is the convolution operator, σ is the standard deviation of the Gaussian distribution, m and n respectively represent the number of rows and columns of the convolution kernel, x and y respectively represent the row index and column index of the convolution kernel, represents an image window centered on the pixel at the i-th row and j-th column and with a size of m×n, where both m and n are odd numbers. In this formula, the symbol " / " is the integer division operator, and rounding down makes the resulting value an integer. For example, when m = 7, m / 2 = 3.
[0063] For the m / 2 columns of pixels at the outermost edges on the left and right sides of the image and the n / 2 columns of pixels at the outermost edges on the top and bottom sides of the image, the gradient values of the pixels are treated as 0.
[0064] In this embodiment, the value of σ is set to 1, and a 3×3 convolution kernel is generated using the gradient calculation formula to calculate the gradient of the surface gray image ( Figure 2 ) along the vertical direction to generate a gradient image, as Figure 4 shown.
[0065] The gray-level co-occurrence matrix processing is specifically as follows: a gray-level co-occurrence matrix is constructed by setting the number of gray levels, distance, direction, and window size of the image, and texture feature quantities are extracted from the gradient image according to the gray-level co-occurrence matrix, and then a texture feature image is generated;
[0066] Different texture feature quantities will be obtained through different processing methods of the gray-level co-occurrence matrix, and then corresponding texture feature images will be generated.
[0067] In this embodiment, energy is selected as the texture feature quantity, and the texture feature image corresponding to the gradient image is calculated accordingly, as Figure 5 shown.
[0068] The value of each element in the gray-level co-occurrence matrix is specifically set according to the following formula:
[0069]
[0070] where L is the number of gray levels of the image, α is a parameter that controls the influence degree of distance on the weight, C represents the set of distances d k , |C| represents the number of elements in the set C, n(i,j|d k ,θ) represents the number of occurrences of pixel pairs with gray levels i and j under the given distance d k and direction θ, and p(i,j|C,θ) represents the occurrence probability of pixel pairs with gray levels i and j under the given distance set C and direction θ.
[0071] In this embodiment, the parameters of the gray-level co-occurrence matrix are set as follows: the number of gray levels is set to 8, the pixel distances are set to 1 and 2 respectively, the angle is set to 0° (horizontal direction), the window size is set to 5×5, and the value of α is set to 2.
[0072] The calculation formula for the energy feature is as follows:
[0073]
[0074] where Energy is the energy feature,
[0075] S3. Perform binarization processing and window mapping processing on the surface gray-scale image in sequence to obtain a texture mask image;
[0076] The binarization processing is specifically as follows:
[0077] 1) Calculate the gray-scale average value meanPerCol(j) of each column of pixel points in the surface gray-scale image;
[0078] 2) Use the gray-scale average value of each column of pixel points as the segmentation threshold thresh(j) of each column of pixel points. Then, according to the segmentation threshold of each column of pixel points, perform binarization operations on the gray-scale values of each pixel point in the current column according to the following formula to generate a non-highlight area mask image nonHighLightMask(i,j), as Figure 6 shown:
[0079]
[0080] In the formula, p’(i,j) is the gray-scale value of the pixel point at the i-th row and j-th column after binarization operation, p(i,j) is the gray-scale value of the pixel point at the i-th row and j-th column, and thresh(j) represents the segmentation threshold of the pixel points in the j-th column.
[0081] Set the window size, divide the non-highlight area mask image into several non-overlapping windows. The non-highlight area mask image and the texture mask image have different sizes. Each window in the non-highlight area mask image corresponds to a pixel in the texture mask image, and determine the texture mask image according to the mapping formula;
[0082] The window mapping processing is specifically set according to the following formula:
[0083]
[0084] In the formula, w and h are the width and height of the window respectively, T mask(i, j) is the gray value of the pixel at the i-th row and j-th column in the texture mask image, and blockNum(i, j) is the number of pixels with non-zero gray values within the window in the non-highlight area mask image mapped by the pixel at the i-th row and j-th column in the texture mask image. Here, the window size w×h is the same as the window size used when calculating the gray-level co-occurrence matrix.
[0085] In this embodiment, a mapping operation is performed on the non-highlight area mask image according to the same 5×5 window size as the gray-level co-occurrence matrix to generate a texture mask image, as Figure 7 shown.
[0086] S4. Perform a logical operation and binarization on the texture feature image and the texture mask image to obtain a binary image, and perform morphological processing on the binary image to obtain morphological connected components;
[0087] S4.1. Perform a logical AND operation on the texture image and the texture mask image to obtain an image after the logical AND operation, as Figure 8 shown, to filter out the features of the highlighted area of the image, and set a first threshold. Then, perform binarization on the image after the logical AND operation according to the preset first threshold to generate a binary image, as Figure 9 shown;
[0088] S4.2. Perform morphological processing on the binary image, that is, sequentially perform a dilation operation with a 5×5 window and an erosion operation with an 8×1 window, and traverse each pixel to extract connected components;
[0089] S4.3. Traverse all connected components, obtain the minimum bounding rectangle of each connected component, and then perform the following operations on all connected components respectively to filter connected components. The finally retained connected components are used as morphological connected components:
[0090] If the longest side of the minimum bounding rectangle of the connected component is greater than the preset length threshold, the connected component is retained; otherwise, the connected component is filtered out.
[0091] Morphological processing includes operations such as dilation, erosion, extraction of connected components, and filtering of connected components.
[0092] Dilation and erosion are specifically set according to the following formulas:
[0093]
[0094] In the formula, f represents the binary image, b is the structuring element, is the dilation operation operator, is the erosion operation operator, (x, y) represents the current pixel position to be processed, (i, j) is the relative coordinate in the structuring element b, and {f(x + i, y + j)} represents the set of all pixel values within the range of the structuring element b centered on (x, y).
[0095] S5. Extract the connected components in the binary image, perform a first filtering operation on the connected components in the binary image, and then perform a second filtering operation based on the morphological connected components to obtain the yarn bobbin fluff defect area.
[0096] S5.1. Traverse each pixel point in the binary image to extract all connected components in the binary image. Traverse all connected components, set a second threshold group according to the size of the minimum circumscribed rectangle of all connected components and the area of the connected components, and perform a first filtering operation on all connected components according to the preset second threshold group to filter out the connected components whose size of the minimum circumscribed rectangle of the connected components and the area of the connected components are less than the second threshold group, and obtain suspected defect connected components;
[0097] S5.2. Calculate the overlap ratio of each suspected defect connected component and the morphological connected component according to the following formula respectively, set an overlap threshold, and perform a second filtering operation to filter out the suspected defect connected components whose overlap ratio exceeds the preset overlap threshold, and retain the suspected defect connected components whose overlap ratio is less than the preset overlap threshold as the yarn bobbin fluff defect area, as Figure 10 、 Figure 11 shown, where Figure 10 is the defect detection result diagram with Figure 2 as the surface grayscale image, Figure 11 is the defect detection result diagram with Figure 3 as the surface grayscale image:
[0098]
[0099] In the formula, overlapRatio is the overlap ratio, overlapSize is the number of overlapping pixels between the suspected defect connected component and the morphological connected component, and contourSize is the total number of pixels of the suspected defect connected component.
[0100] After being implemented multiple times in the embodiments, the accuracy rate of the method of the present invention reaches 93%.
[0101] It can be seen from the comparison of the original images and the detection result diagrams of the above various embodiments that the present invention can accurately locate the defects on the surface of the yarn bobbin. The present invention integrates various features on the surface of the yarn bobbin, can effectively improve the accuracy and reliability of the detection of yarn bobbin fluff defects, and has great application value for the detection of yarn bobbin fluff defects.
[0102] The above specific implementation manners are used to explain and illustrate the present invention, rather than to limit the present invention. Any modifications and changes made to the present invention within the spirit and scope of the claims of the present invention fall within the protection scope of the present invention.
Claims
1. A yarn bobbin hairiness defect detection method based on multi-characterization information fusion, characterized in that: The method comprises the following steps: S1, photographing the surface of the yarn tube and performing grayscale processing to obtain a surface grayscale image; S2, performing gradient calculation processing and gray-level co-occurrence matrix processing on the surface grayscale image in sequence to obtain a texture feature image; S3, performing binarization processing and window mapping processing on the surface grayscale image in sequence to obtain a texture mask image; S4, performing logical operation and binarization processing on the texture feature image and the texture mask image to obtain a binary image, and performing morphological processing on the binary image to obtain a morphologically connected domain; S5, extracting a connected domain in the binary image, performing a first filtering operation on the connected domain in the binary image, and then performing a second filtering operation according to the morphological connected domain to obtain a yarn bobbin hairiness defect region.
2. The yarn bobbin hairiness defect detection method based on multi-characterization information fusion according to claim 1 is characterized in that: In S2, the gradient calculation process is specifically processed according to the following formula: In the formula, g y (i, j) is the vertical gradient value of the pixel point in the i-th row and j-th column, * is the convolution operator, σ is the standard deviation of the Gaussian distribution, m and n represent the number of rows and columns of the convolution kernel, x and y represent the row index and column index of the convolution kernel, respectively. Represents an image window centered at the pixel in the i-th row and j-th column and of size m×n.
3. The yarn bobbin hairiness defect detection method based on multi-characterization information fusion according to claim 1 is characterized in that: The gray level co-occurrence matrix processing in S2 is specifically as follows: constructing a gray level co-occurrence matrix by using preset image gray levels, distances and directions, extracting texture feature quantities according to the gray level co-occurrence matrix, and then generating a texture feature image; Different texture feature quantities can be obtained by processing the gray-level co-occurrence matrix in different ways, and then the corresponding texture feature image can be generated.
4. The yarn bobbin hairiness defect detection method based on multi-characterization information fusion according to claim 3 is characterized in that: The values of the elements in the gray level co-occurrence matrix are specifically set according to the following formula: In the formula, L is the grayscale level of the image, α is a parameter that controls the influence of distance on the weight, and C represents the distance d k The set of |C| represents the number of elements in the set C, n(i,j|d k ,θ) represents the k p(i,j|C,θ) represents the number of occurrences of pixel pairs with grayscale i and grayscale j under the given distance set C and direction θ, and p(i,j|C,θ) represents the probability of occurrence of pixel pairs with grayscale i and grayscale j under the given distance set C and direction θ.
5. The yarn bobbin hairiness defect detection method based on multi-characterization information fusion according to claim 1 is characterized in that: The binarization process in S3 is specifically as follows: 1) Calculate the grayscale average value of each column of pixels in the surface grayscale image; 2) The grayscale average value of each column of pixels is used as the segmentation threshold of each column of pixels, and then the grayscale value of each pixel in the current column is binarized according to the following formula according to the segmentation threshold of each column of pixels to generate a mask image of the non-highlighted area: Where p'(i,j) is the grayscale value of the pixel in the i-th row and j-th column after binarization, p(i,j) is the grayscale value of the pixel in the i-th row and j-th column, and thresh(j) represents the segmentation threshold of the pixel in the j-th column.
6. The yarn bobbin hairiness defect detection method based on multi-characterization information fusion according to claim 1 is characterized in that: The window mapping process in S3 is specifically set according to the following formula: In the formula, w and h are the width and height of the window respectively, T mask (i, j) is the grayscale value of the pixel in the i-th row and j-th column in the texture mask image, and blockNum(i, j) is the number of pixels with non-zero grayscale values in the window of the non-highlight area mask image mapped by the pixel in the i-th row and j-th column in the texture mask image.
7. The yarn bobbin hairiness defect detection method based on multi-characterization information fusion according to claim 1 is characterized in that: The S4 is specifically: S4.1, performing a logical AND operation on the texture image and the texture mask image to obtain an image after the logical AND operation, and then performing a binarization process on the image after the logical AND operation according to a preset first threshold value to generate a binary image; S4.2, performing dilation and erosion operations on the binary image in sequence, traversing each pixel point to extract the connected domain; S4.
3. Traverse all connected domains, obtain the minimum circumscribed rectangle of each connected domain, and then perform the following operations on all connected domains to filter the connected domains. The connected domains that are finally retained are regarded as morphological connected domains: If the longest side of the minimum circumscribed rectangle of a connected domain is greater than a preset length threshold, the connected domain is retained; otherwise, the connected domain is filtered out.
8. The yarn bobbin hairiness defect detection method based on multi-characterization information fusion according to claim 1 is characterized in that: In S4, the expansion and corrosion are specifically set according to the following formula: In the formula, f represents the binary image, b is the structural element, is the expansion operator, is the erosion operator, (x, y) represents the current pixel position to be processed, (i, j) is the relative coordinate in the structure element b, and {f(x+i, y+j)} represents the set of all pixel values within the structure element b centered at (x, y).
9. The yarn bobbin hairiness defect detection method based on multi-characterization information fusion according to claim 1, characterized in that: The S5 is specifically: S5.
1. Extract all connected domains in the binary image, perform a first filtering operation on all connected domains according to a preset second threshold value group, and filter out connected domains whose minimum circumscribed rectangle size and area are smaller than the second threshold value group, to obtain suspected defect connected domains; S5.
2. Calculate the overlap rate of each suspected defect connected domain and the morphological connected domain according to the following formula, perform a second filtering operation to filter out the suspected defect connected domains whose overlap rate exceeds the preset overlap threshold, and retain the suspected defect connected domains whose overlap rate is less than the preset overlap threshold as the yarn bobbin hairiness defect area: Where overlapRatio is the overlap ratio, overlapSize is the number of overlapping pixels between the suspected defect connected domain and the morphological connected domain, and contourSize is the total number of pixels in the suspected defect connected domain.
Citation Information
Cited By
3D printing defect monitoring method
CN121033015A
Ramie yarn hairiness detection method and system based on line scanning imaging
CN121527036A