Bobbin hairiness defect detection method based on rapid local dynamic threshold segmentation

By using a local dynamic threshold segmentation method, the problem of detection accuracy caused by the background difference between the edge region and the center region of the yarn tube is solved, which significantly improves the recognition accuracy and detection efficiency of fuzz defects.

CN121032897APending Publication Date: 2025-11-28ZHEJIANG GUOCHEN INTELLIGENT INSPECTION TECHNOLOGY CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510962420.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-14
Publication Date
2025-11-28

AI Technical Summary

Technical Problem

Traditional yarn bobbin hair detection methods are inefficient and subject to subjective factors, making it difficult to meet the needs of modern large-scale production. Furthermore, existing automatic detection methods have limitations in terms of misjudgment in edge areas and background interference.

Method used

A fast local dynamic threshold segmentation method is adopted. An edge region mask is constructed by edge feature extraction and mean filtering. Combined with differential operation and differential threshold segmentation, the influence of uneven illumination is suppressed and the detection accuracy is improved.

Benefits of technology

It effectively avoids misjudgment of edge defects, improves the accuracy and efficiency of yarn bobbin hair defect detection, and significantly improves the detection effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121032897A_ABST
    Figure CN121032897A_ABST
Patent Text Reader

Abstract

The invention discloses a yarn cone hairiness defect detection method based on rapid local dynamic threshold segmentation. Shooting the surface of the spool to obtain a surface grayscale image; respectively carrying out edge feature extraction and mean filtering processing on the surface grayscale image to obtain a region-of-interest mask and a fuzzy background image; performing correction processing on the fuzzy background image according to the interested area mask to obtain a corrected fuzzy background image; performing differential operation on the surface grayscale image and the corrected fuzzy background image to obtain a grayscale difference image, and performing threshold segmentation processing on the grayscale difference image to obtain a suspected defect binary image; and extracting a connected domain of the suspected defect binary image, and performing contour filtering on the connected domain of the suspected defect binary image to obtain a yarn cone hairiness defect area. According to the method, a local dynamic threshold segmentation strategy is innovatively adopted, the problem of detection precision caused by background difference between the edge area and the center area of the bobbin is solved, and the identification accuracy and the detection efficiency of the hairiness defect are improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to a computer vision image processing method, in particular to a yarn tube hair defect detection method based on fast local dynamic threshold segmentation. BACKGROUND

[0002] In the textile industry, the quality of the yarn tube directly affects the quality of the final product. Among them, the hair on the surface of the yarn tube is one of the common quality problems, which not only affects the appearance of the yarn, but also may have adverse effects on the subsequent processing process. Therefore, efficiently and accurately detecting the hair defect of the yarn tube is of great significance to improve product quality and reduce production cost.

[0003] The traditional yarn tube surface defect detection method mainly relies on manual visual inspection, which 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 technology, image-based automatic detection methods have gradually become a research hotspot.

[0004] Such as Otsu algorithm, adaptive threshold method or dynamic threshold segmentation technology based on local region statistical features. However, these methods still have limitations such as background interference, edge region misjudgment, and insufficient computing efficiency in yarn tube hair detection. Therefore, there is an urgent need for a yarn tube hair defect detection method that can balance detection accuracy and efficiency, especially to solve the problem of dynamic differentiation segmentation of the edge region and the center region. SUMMARY

[0005] In order to overcome the limitations of the prior art, the present application provides a yarn tube hair defect detection method based on fast local dynamic threshold segmentation.

[0006] The technical scheme of the present application is as follows:

[0007] The present application comprises the following steps:

[0008] S1, photographing the surface of the yarn tube and performing grayscale processing to obtain a surface grayscale image;

[0009] S2, performing edge feature extraction and mean filtering processing on the surface grayscale image to obtain a region of interest mask and a blurred background image;

[0010] S3, performing correction processing on the blurred background image according to the region of interest mask to obtain a corrected blurred background image;

[0011] S4, performing difference operation on the surface grayscale image and the corrected blurred background image to obtain a grayscale difference image, and then performing threshold segmentation processing on the grayscale difference image to obtain a suspected defect binary image;

[0012] S5, extracting the connected domain of the suspected defect binary image, and performing contour filtering on the connected domain of the suspected defect binary image to obtain a yarn tube hair defect region.

[0013] In S2, the mean filtering processing is specifically processed according to the following formula:

[0014]

[0015] wherein b(x, y) represents the gray value of the pixel point of the yth row and the xth column of the blurred background image, m and n respectively represent the width and height of the filtering window, i and j respectively represent the horizontal displacement and vertical displacement of each pixel in the filtering window relative to the center pixel (x, y), and p(x, y) represents the gray value of the pixel point of the yth row and the xth column of the surface gray image.

[0016] S3 is specifically:

[0017] S3.1, extracting the edge of the yarn tube by the mask of the region of interest to obtain an edge pixel point set, and then expanding the edge pixel point set along the vertical direction to construct an edge region mask;

[0018] S3.2, positioning the edge reference region and the edge region of the blurred background image according to the edge pixel point set and the edge region mask, and traversing each pixel point of the edge reference region in the blurred background image, correcting all the pixel points according to the following operation to obtain a corrected blurred background image: obtaining the gray value of the pixel point at a preset distance in a preset direction from the current pixel point as a starting point, and then assigning the gray value to the edge region in the column where the current pixel point is located.

[0019] The edge region mask is constructed according to the following formula:

[0020]

[0021] wherein E represents the edge pixel point set, Δ represents the vertical expansion direction, Δ ∈ {1, -1}, N is the number of pixels expanded, f(k) is a one-to-one distance mapping function, k represents the number of pixels from the edge pixel point, k ∈ {1, 2,..., N}, M represents the edge region mask, and ∪ represents the union set.

[0022] S4 is specifically:

[0023] S4.1, performing difference operation on the surface gray image and the corrected blurred background image to obtain a gray difference value image;

[0024] S4.2, constructing a non-edge region mask according to the difference set of the mask of the region of interest and the edge region mask, and then dividing the gray difference value image into an edge region and a non-edge region according to the edge region mask and the non-edge region mask;

[0025] S4.3, the non-edge region of the gray scale difference image is subjected to first threshold segmentation processing to obtain a non-edge region binary segmentation image, and the edge region of the gray scale difference image is subjected to second threshold segmentation processing to obtain an edge region binary segmentation image, and the edge region binary segmentation image and the non-edge region binary segmentation image are subjected to logical OR processing to obtain a suspected defect binary image.

[0026] The first threshold segmentation processing is performed according to the following steps: the gray scale difference image is subjected to binary processing according to a preset threshold to obtain a binary image, and then the binary image is subjected to logical AND operation with a non-edge region mask to obtain a non-edge region binary segmentation image.

[0027] The second threshold segmentation processing is performed according to the following steps:

[0028] 1) The pixel points in the edge region of the gray scale difference image are traversed, and the segmentation threshold of each pixel point in the edge region is set according to the following formula and binary processing is performed according to the segmentation threshold to obtain an edge region preliminary binary segmentation image:

[0029]

[0030] Wherein, W m×n (x,y) represents a window with a size of m*n centered on the pixel point of the xth column and the yth row in the edge region mask, N represents the total number of pixel points in the window in the edge region mask whose gray scale value is equal to the gray scale value of the pixel point of the xth column and the yth row, t(x,y) represents the segmentation threshold of the pixel point of the xth column and the yth row in the edge region of the gray scale difference image, and d(p,q) represents the gray scale value of the qth row and the pth column in the gray scale difference image.

[0031] 2) All connected domain contours in the edge region preliminary binary segmentation image are extracted and traversed, and the neighborhood gray difference filtering is performed on all connected domain contours in the edge region preliminary binary segmentation image to obtain an edge region binary segmentation image.

[0032] The neighborhood gray difference filtering in the second threshold segmentation processing is performed according to the following formula:

[0033]

[0034] p1=(x,y+Δ)

[0035] p2=(x,y-Δ)

[0036] Wherein, Δ represents a vertical expansion direction, Δ∈{1,-1}, p1 and p2 are the positions of the neighboring points corresponding to the contour points, p(p1) and p(p2) represent the gray scale values of the neighboring points p1 and p2 in the surface gray scale image respectively, and C represents the set of contour points.

[0037] The present application has the beneficial effects that:

[0038] The application innovatively guides local dynamic threshold segmentation by constructing an edge region mask representing the edge feature of the yarn tube, adopts differential threshold segmentation aiming at the background difference between the edge region and the center region of the yarn tube, and can effectively avoid the misjudgment of edge defects; and the application combines fuzzy background modeling and differential enhancement, can effectively suppress the influence of uneven illumination, and improve the defect contrast. In summary, the application has high practical value and market prospect. BRIEF DESCRIPTION OF DRAWINGS

[0039] Figure 1 is a flowchart of the method of the application.

[0040] Figure 2 is a surface gray scale image in embodiment 1 of the application.

[0041] Figure 3 is a region of interest mask of Figure 2

[0042] Figure 4 is a fuzzy background image after mean filtering of Figure 2

[0043] Figure 5 is an edge region mask image.

[0044] Figure 6 is a corrected fuzzy background image.

[0045] Figure 7 is a gray scale difference value image.

[0046] Figure 8 is a non-edge region binary segmentation image.

[0047] Figure 9 is an edge region preliminary binary segmentation image.

[0048] Figure 10 is an edge region binary segmentation image after contour filtering of Figure 9

[0049] Figure 11 is a suspected defect binary image after OR operation of Figure 8 and Figure 10

[0050] Figure 12 is a corresponding yarn tube hairiness defect region image. Figure 2 DETAILED DESCRIPTION

[0051] The application will be further described below in combination with the drawings and specific embodiments.

[0052] ​​​​​Embodiments of the present application and its implementation process are as follows:

[0053] As shown in Figure 1 , the present embodiment comprises the following steps:

[0054] S1, photographing the surface of the bobbin and performing grayscale processing to obtain a surface grayscale image P(x, y), as shown in Figure 2 ;

[0055] S2, performing edge feature extraction and mean filtering processing on the surface grayscale image to obtain a region of interest mask as shown in Figure 3 and a blurred background image B(x, y) as shown in Figure 4 ;

[0056] That is, performing edge feature extraction on the surface grayscale image to obtain a region of interest mask, and performing mean filtering processing on the surface grayscale image to obtain a blurred background image;

[0057] The present embodiment uses a filter kernel of size 11x11 to perform mean filtering on Figure 2 , and the mean filtering processing in S2 is specifically processed according to the following formula:

[0058]

[0059] In the formula, b(x, y) represents the grayscale value of the pixel point of the yth row and the xth column of the blurred background image, m and n respectively represent the width and height of the filter window, i and j respectively represent the horizontal displacement and vertical displacement of each pixel in the filter window relative to the center pixel (x, y), and p(x, y) represents the grayscale value of the pixel point of the yth row and the xth column of the surface grayscale image.

[0060] S3, performing correction processing on the edge region of the blurred background image according to the region of interest mask to obtain a corrected blurred background image;

[0061] S3.1, extracting the bobbin edge from the region of interest mask to obtain an edge pixel point set, and then expanding the edge pixel point set along the vertical direction to construct an edge region mask, as shown in Figure 5 ;

[0062] Each column of the edge pixel point set, i.e. the vertical direction, has only one pixel point. Specifically, the edge pixel point set is obtained by extracting the bobbin edge, and each pixel in the pixel point set is traversed, and a specified number of pixels are expanded along the vertical direction away from the bobbin with the current pixel as the starting point to construct an edge region mask.

[0063] S3.2, positioning the edge reference region and the edge region of the blurred background image according to the edge pixel point set and the edge region mask, and traversing each pixel point of the edge reference region of the blurred background image, and performing correction processing on all pixel points according to the following operation to obtain a corrected blurred background image as shown inFigure 6 The modified blurred background image is shown: the gray value of the pixel point at a preset distance in a preset direction from the current pixel point is obtained, and then the gray value is assigned to the edge region of the column where the current pixel point is located.

[0064] The edge reference region and the edge region of the blurred background image are positioned according to the edge pixel point set and the edge region mask, which means that the edge reference region is the region corresponding to the position of the edge pixel point set in the blurred background image, and the edge region is the region formed by the pixels corresponding to the position of the edge region mask with a non-zero gray value in the blurred background image.

[0065] Specifically, each pixel in the edge pixel point set is traversed, and the b(x, y) value at the position is recorded and assigned to the b(x, y) corresponding to the non-zero pixel position in the same column in the edge region mask, starting from the current pixel and moving d pixels along the specified direction Δ.

[0066] The edge region mask is constructed according to the following formula:

[0067]

[0068] where E represents the edge pixel point set, Δ represents the vertical expansion direction, Δ ∈ {1, -1}, N is the number of expanded pixels, f(k) is a one-to-one distance mapping function, each different input k corresponds to a unique mapping value, and the value of f(k) is not zero, k represents the number of pixels from the edge pixel point, k ∈ {1, 2,..., N}, M represents the edge region mask, i.e. the set of points whose mask value at the position (x, y+kΔ) is f(k), and the mask value of the rest of the image is 0 ∪ represents the union.

[0069] In this embodiment, N is 7 and Δ is -1, i.e. the edge region mask is constructed by expanding 7 pixels in the vertical direction.

[0070] S4, difference operation is performed on the surface gray image and the modified blurred background image to obtain a gray difference value image D(x, y), as shown in Figure 7 Then, the gray difference value image is threshold segmented to obtain a suspected defect binary image.

[0071] S4.1, difference operation is performed on the surface gray image and the modified blurred background image to obtain a gray difference value image;

[0072] S4.2, a non-edge region mask is constructed according to the difference set of the region of interest mask and the edge region mask, and then the gray difference value image is divided into an edge region and a non-edge region according to the edge region mask and the non-edge region mask.

[0073] S4.3, the non-edge region of the gray scale difference image is subjected to first threshold segmentation processing to obtain a non-edge region binary segmentation image, the edge region of the gray scale difference image is subjected to second threshold segmentation processing to obtain an edge region binary segmentation image, the edge region binary segmentation image and the non-edge region binary segmentation image are subjected to logical OR processing to obtain a suspected defect binary image, as shown in Figure 11 .

[0074] The first threshold segmentation processing is performed according to the following steps: the gray scale difference image is subjected to binary processing according to a preset threshold to obtain a binary image, and the binary image is further subjected to logical AND operation with the non-edge region mask to obtain a non-edge region binary segmentation image, as shown in Figure 8 . In this embodiment, the preset threshold is 2.

[0075] The second threshold segmentation processing is performed according to the following steps:

[0076] 1) The pixel points in the edge region of the gray scale difference image are traversed, the segmentation threshold of each pixel point in the edge region is set according to the following formula, and the binary segmentation image of the edge region is obtained according to the segmentation threshold, as shown in Figure 9 .

[0077]

[0078] wherein, W m×n (x, y) represents a window with a size of m x n centered on the pixel point at the xth column and yth row in the edge region mask, N represents the total number of pixel points in the window in the edge region mask whose gray scale value is equal to the gray scale value of the pixel point at the xth column and yth row, t(x, y) represents the segmentation threshold of the pixel point at the xth column and yth row in the edge region of the gray scale difference image, and d(p, q) represents the gray scale value of the pixel at the qth row and pth column in the gray scale difference image.

[0079] Specifically, each non-zero pixel in the edge region mask is traversed, the gray scale value f(k) corresponding to the position of the pixel is recorded, then a window with a size of m x n is selected in D(x, y) with the current pixel as the center, all pixels in the window whose gray scale value in the edge mask is equal to f(k) are screened, and the mean value of the screened pixels is calculated as the segmentation threshold of the current pixel. In this embodiment, the window size is 9 x 9.

[0080] 2) All connected domain contours in the edge region preliminary binary segmentation image are extracted and traversed, and the neighborhood gray difference filtering is performed on all connected domain contours in the edge region preliminary binary segmentation image to obtain an edge region binary segmentation image, as shown in Figure 10 .

[0081] The neighborhood gray difference filtering is performed according to the following formula: if the filtering condition is met, the contour is filtered, otherwise, the contour is retained:

[0082]

[0083] p1 = (x, y + Δ)

[0084] p2 = (x, y - Δ)

[0085] Wherein, Δ represents a vertical expansion direction, Δ∈{1,-1}, p1, p2 are the position of adjacent points corresponding to the contour point, p(p1), p(p2) respectively represent the gray value of P(x,y) at point p1, p2, C represents the contour point set.

[0086] Specifically, that is, traversing the edge region, binarizing and segmenting all connected domain contours in the image, for each contour, traversing each pixel point on the contour, finding two adjacent point positions in the vertical direction at a unit pixel length from the point, and recording the gray values of the two points in the original image P(x,y), if the filtering condition is met, the contour is filtered, otherwise, the contour is retained, all unfiltered contours are retained, and an edge region binarization and segmentation image is obtained.

[0087] S5, extracting the connected domain of the suspected defect binarization image, combining the geometric feature parameters of the hairiness to filter the contour of the connected domain of the suspected defect binarization image to obtain the yarn drum hairiness defect region, as shown in Figure 12 .

[0088] After multiple implementations of the embodiment, the accuracy of the method reaches 96%.

[0089] As can be seen from the comparison of the original image and the detection result image of each embodiment, the present application can accurately locate the yarn drum hairiness defect. The present application innovatively uses a local dynamic threshold segmentation strategy, effectively solves the detection accuracy problem caused by the background difference between the edge region and the center region of the yarn drum, significantly improves the recognition accuracy and detection efficiency of the hairiness defect, and has great application value for the detection of yarn drum hairiness defects.

[0090] The above specific embodiments are used to explain and illustrate the present application, rather than limit the present application, any modification and change made to the present application within the spirit and protection scope of the claims of the present application, falls within the protection scope of the present application.

Claims

1. A method for detecting a capillary tube hairiness defect by fast local dynamic threshold segmentation, characterized by, The method comprises the following steps: S1, photographing the surface of the yarn drum and performing grayscale processing to obtain a surface grayscale image; S2, performing edge feature extraction and mean filtering processing on the surface grayscale image to obtain a region of interest mask and a blurred background image; S3, performing correction processing on the blurred background image according to the region of interest mask to obtain a corrected blurred background image; S4, performing difference operation on the surface grayscale image and the corrected blurred background image to obtain a grayscale difference image, and then performing threshold segmentation processing on the grayscale difference image to obtain a suspected defect binary image; S5, extracting a connected domain of the suspected defect binary image, and performing contour filtering on the connected domain of the suspected defect binary image to obtain a yarn drum hair defect region.

2. A rapid local dynamic threshold segmentation based tube hairiness defect detection method as claimed in claim 1 wherein: In S2, the mean filtering processing is specifically processed according to the following formula: Wherein, b(x,y) represents the grayscale value of the pixel point of the yth row and the xth column of the blurred background image, m and n respectively represent the width and height of the filtering window, i and j respectively represent the horizontal displacement and vertical displacement of each pixel in the filtering window relative to the center pixel (x,y), and p(x,y) represents the grayscale value of the pixel point of the yth row and the xth column of the surface grayscale image.

3. A rapid local dynamic threshold segmentation based tube hairiness defect detection method as claimed in claim 1 wherein: S3 is specifically as follows: S3.1, extracting the edge of the yarn drum from the region of interest mask to obtain an edge pixel point set, and then expanding the edge pixel point set along the vertical direction to construct an edge region mask; S3.2, positioning the edge reference region and the edge region of the blurred background image according to the edge pixel point set and the edge region mask, and traversing each pixel point of the edge reference region in the blurred background image, all pixel points are corrected and processed according to the following operation to obtain the corrected blurred background image: obtaining the grayscale value of the pixel point at a preset distance in a preset direction from the current pixel point as a starting point, and then assigning the grayscale value to the edge region of the column where the current pixel point is located.

4. A rapid local dynamic threshold segmentation based tube hairiness defect detection method as claimed in claim 1 wherein: The edge region mask is constructed according to the following formula: Wherein, E represents the edge pixel point set, Δ represents the vertical expansion direction, Δ∈{1,-1}, N is the number of expanded pixels, f(k) is a one-to-one distance mapping function, k represents the number of pixels from the edge pixel point, k∈{1,2,...,N}, M represents the edge region mask, and ∪ represents the union set.

5. A quick local dynamic thresholding segmented yarn tube hairiness defect detection method as claimed in claim 1, wherein: S4 is specifically as follows: S4.1, performing difference operation on the surface grayscale image and the corrected blurred background image to obtain a grayscale difference image; S4.2, constructing a non-edge region mask according to the difference set of the region of interest mask and the edge region mask, and then dividing the grayscale difference image into an edge region and a non-edge region according to the edge region mask and the non-edge region mask; S4.3, performing first threshold segmentation processing on the non-edge region of the grayscale difference image to obtain a non-edge region binary segmentation image, performing second threshold segmentation processing on the edge region of the grayscale difference image to obtain an edge region binary segmentation image, and performing logical or processing on the edge region binary segmentation image and the non-edge region binary segmentation image to obtain a suspected defect binary image.

6. A rapid local dynamic threshold segmentation based tube hairiness defect detection method as claimed in claim 1 wherein: The first threshold segmentation processing is performed according to the following steps: a binary image is obtained by binarizing the gray difference image according to a preset threshold, and then the binary image is subjected to a logical AND operation with a non-edge region mask to obtain a non-edge region binary segmentation image.

7. A quick local dynamic thresholding segmented yarn tube hairiness defect detection method as claimed in claim 1, wherein: The second threshold segmentation processing is performed according to the following steps: 1) The pixel points in the edge region of the gray difference image are traversed, and the segmentation threshold of each pixel point in the edge region is set according to the following formula and the preliminary binary segmentation image of the edge region is obtained by binarization according to the segmentation threshold: wherein W m×n (x, y) represents a window of size m x n in the edge region mask centered at the pixel point in the xth column and yth row, N represents the total number of pixel points in the window of the edge region mask whose gray scale value is equal to that of the pixel point in the xth column and yth row, t(x, y) represents the segmentation threshold of the pixel point in the xth column and yth row of the edge region of the gray scale difference image, and d(p, q) represents the gray scale value of the pixel point in the qth row and pth column of the gray scale difference image. 2) All connected domain contours in the preliminary binary segmentation image of the edge region are extracted and traversed, and the edge region binary segmentation image is obtained by performing neighborhood gray difference filtering on all connected domain contours in the preliminary binary segmentation image of the edge region.

8. A rapid local dynamic threshold segmentation based tube hairiness defect detection method as claimed in claim 1, wherein: The neighborhood gray difference filtering in the second threshold segmentation processing is performed according to the following formula: p1 = (x, y + Δ) p2 = (x, y - Δ) Where Δ represents a vertical expansion direction, Δ ∈ {1, -1}, p1 and p2 are the positions of the adjacent points corresponding to the contour points, p(p1) and p(p2) represent the gray values of the adjacent points p1 and p2 in the surface gray image respectively, and C represents the set of contour points.

Citation Information

Cited By

  • Image processing system and method for automatically unloading glass fiber yarn roll from drum

    CN122156204A