Cloth defect rapid detection method based on coupling double integrograms
By performing specific image processing methods on the grayscale image of the fabric, a contour set is constructed to quickly detect fabric defects, solving the problems of slow detection speed and relying on high-cost hardware in the prior art, and achieving fast and accurate fabric defect detection.
Patent Information
- Application Number
- CN202411948796.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-27
- Publication Date
- 2025-05-09
AI Technical Summary
The existing fabric defect detection methods have limited types of surface defect detection, complex calculation methods and slow speed, which are difficult to use for online detection, and rely on high-cost complex hardware imaging technology.
Using a method based on coupled double integral graph, the grayscale image of the fabric is subjected to secondary expansion, expansion corrosion, binarization, reverse, segmentation and contour spacing to quickly and accurately detect fabric defects.
It realizes fast and accurate detection of fabric defects, can effectively filter background interference, fast calculation speed, is suitable for online detection, and has great application value.
Smart Images

Figure CN119963485A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a computer vision image processing method, and in particular to a cloth defect rapid detection method based on a coupled double integral image. Background Art
[0002] With the rapid development of the industrial field, the quality requirements of fabrics are getting higher and higher. The traditional method of using manual methods to detect defects on the surface of fabrics not only affects the production speed, but also easily misses small defects. In recent years, with the gradual improvement of computer vision in the industrial field, image algorithms are gradually replacing manual methods as the main means of fabric surface defect detection.
[0003] Computer vision can be divided into two main types in coating detection:
[0004] 1) Defect detection method based on deep learning. The common method is to manually calibrate the image with defects, train it through the neural network, and use the trained weights to process the image to obtain the defects. This technology can accurately detect obvious and larger defects, but in order to increase the training and detection speed, the image needs to be compressed before the neural network is processed, which makes it easy to lose small defects after compression. If the compression ratio is reduced, it will lead to too long processing time or the need to stack graphics cards, resulting in a large increase in costs.
[0005] 2) Defect detection method using traditional image algorithms. Common methods are to obtain defects by difference with the background or by using template matching. The method of obtaining defects by difference can detect defects well when the background is uniform, but it is difficult to extract defects when the background changes significantly, especially when the defect is similar to the background. Similarly, template matching is similar. Since the distribution of each thread of the fabric has a certain randomness, the normal image is still easy to differ greatly from the template, resulting in a large number of false detections of defects.
[0006] Existing methods have the problems of limited types of surface defects that can be detected, complex and slow calculation methods that make them difficult to use for online detection, or they rely on expensive and complex hardware imaging technology. Therefore, new methods for fabric defect detection are needed. Summary of the invention
[0007] In order to solve the problem that fabric defects are difficult to detect, the present invention provides a method for rapid fabric defect detection based on a coupled double integral graph. Compared with the background technology, the identification method is simple, and defects such as fabric stains and thick yarns can be detected quickly and accurately, which is suitable for online detection occasions.
[0008] The steps of the technical solution adopted by the present invention to solve its technical problem are as follows:
[0009] A method for rapid detection of cloth defects based on coupled double integral graphs, comprising:
[0010] S1. Use a camera to capture a grayscale image R (x, y) of the fabric.
[0011] S2. Performing comprehensive processing of secondary dilation, dilation erosion, binarization and inversion on the grayscale image R(x, y) respectively, to obtain a defect mask after secondary dilation and a defect mask after dilation erosion.
[0012] S3, the grayscale image R(x,y) is processed to obtain the grayscale mean image M(x,y) and the filtered mean image M s (x, y), and then the grayscale mean image M(x, y) and the filtered mean image M are obtained based on the defect mask after secondary expansion and the defect mask after expansion and corrosion. s (x, y) is subjected to segmentation processing and contour spacing processing in sequence, and the results of the contour spacing processing constitute a contour set.
[0013] S4. Connect adjacent contours in the contour set obtained in step S3 to obtain a white connected domain as a defect on the cloth.
[0014] The step S2 includes: performing secondary expansion processing and expansion corrosion processing on the grayscale image R(x, y) to obtain the secondary expansion image PL2(x, y) and the expansion corrosion image PD2(x, y), and then performing binarization processing and inversion processing on the obtained secondary expansion image PL2(x, y) and the expansion corrosion image PD2(x, y) in turn to obtain the secondary expansion defect mask and the expansion corrosion defect mask respectively.
[0015] The step S3 includes: performing integration processing and window mean processing on the grayscale image R(x, y) in sequence to obtain a grayscale mean image M(x, y); performing compression processing, Gaussian filtering processing, integration processing and window mean processing on the grayscale image R(x, y) in sequence to obtain a filtered mean image M s (x, y), and then the grayscale mean image M(x, y) and the filtered mean image M are obtained based on the defect mask after secondary expansion and the defect mask after expansion and corrosion. s (x, y) is segmented and processed with contour spacing in sequence to obtain bright binary coupled double contours and dark binary coupled double contours respectively. The bright binary coupled double contours and the dark binary coupled double contours constitute a contour set.
[0016] The step S2 is specifically as follows:
[0017] S21. Dilate the grayscale image R(x,y) according to the mesh size of the cloth to obtain a dilated image Max(x,y).
[0018] S22. Corrosion processing is performed on the grayscale image R(x, y) according to the mesh size of the cloth to obtain a corroded image Min(x, y).
[0019] S23. Compare the grayscale image R(x,y) with the dilated image Max(x,y) and the eroded image Min(x,y) respectively to obtain the local extreme point set image PL(x,y) after dilation and the local extreme point set image PD(x,y) after erosion.
[0020] S24. Dilate the expanded local extreme point set image PL(x, y) and the eroded local extreme point set image PD(x, y) according to the mesh size of the cloth to obtain a secondary expanded image PL2(x, y) and a expanded eroded image PD2(x, y).
[0021] S25, binarizing the secondary dilation image PL2(x, y) and the dilation-erosion image PD2(x, y) to obtain a secondary dilation binary image and a dilation-erosion binary image.
[0022] S26, respectively performing inversion processing on the binary image after secondary expansion and the binary image after expansion and corrosion to obtain a defect mask after secondary expansion and a defect mask after expansion and corrosion.
[0023] The expansion processing in step S21 and step S24 is set according to the following formula:
[0024]
[0025] In the formula, represents the image after expansion, A represents the image before expansion, B represents the mesh size of the cloth, and z represents the foreground pixel value.
[0026] The corrosion process in step S22 is set according to the following formula:
[0027]
[0028] In the formula, represents the image after corrosion, A represents the image before corrosion, B represents the grid size of the cloth, and z represents the foreground pixel value.
[0029] The comparison process in step S23 is set according to the following formula:
[0030]
[0031] Where M(x,y) represents the pixel value of the image (x,y) coordinate after dilation or erosion, R(x,y) represents the pixel value of the grayscale image (x,y) coordinate, and P(x,y) represents the pixel value of the local extreme image (x,y) coordinate after dilation or erosion.
[0032] The binarization process in step S25 is set according to the following formula:
[0033]
[0034] Where P(x,y) represents the pixel value of the image (x,y) coordinate before binarization, and B(x,y) represents the pixel value of the image (x,y) coordinate after binarization.
[0035] The negation operation in step S26 is set according to the following formula:
[0036] H(x,y)=255-B(x,y)
[0037] Where B(x, y) represents the pixel value of the image (x, y) coordinate before the inversion operation, and H(x, y) represents the pixel value of the image (x, y) coordinate after the inversion operation, which is the defect mask.
[0038] The step S3 is specifically as follows:
[0039] S31. Integrate the grayscale image R(x, y) to obtain a grayscale integral image II(x, y).
[0040] S32, compress the grayscale image R (x, y), and then perform Gaussian filtering on it to obtain a filtered image S (x, y).
[0041] S33, perform integration processing on the filtered image S(x,y) to obtain the filtered integral image II s (x,y).
[0042] S34. Perform window mean processing on the grayscale image R(x,y) according to the grayscale integral image II(x,y) according to a preset window to obtain a grayscale mean image M(x,y).
[0043] S35, according to the filter integral diagram II s (x, y) performs window mean processing on the filtered image S(x, y) according to the preset window to obtain the filtered mean image M s (x,y).
[0044] S36: The grayscale mean image M(x, y) obtained in step S34 and the filtered mean image M(x, y) obtained in step S35 are combined. s (x, y) cross subtraction processing to obtain the brightness difference dual image D l (x,y) and dark difference double image D d (x,y).
[0045] S37, respectively segment the brightness difference dual image D according to the preset segmentation threshold l (x,y) and dark difference double image D d (x, y) is segmented to obtain the initial bright binary contour image B l (x, y) and the initial dark binary contour image B d (x,y).
[0046] S38, convert the initial bright binary contour image B l (x, y) and the initial dark binary contour image B d (x, y) is respectively ORed with the defect mask after secondary dilation and the defect mask after dilation and corrosion obtained in step S2 to obtain the bright binary coupled dual contour image B l2 (x,y) and dark binary coupled double contour image B d2 (x,y).
[0047] S39, according to the bright binary coupling double contour image B l2 (x,y) and dark binary coupled double contour image B d2 (x, y) is processed with contour spacing to obtain the bright binary coupled double contour and the dark binary coupled double contour respectively. The bright binary coupled double contour and the dark binary coupled double contour constitute a contour set.
[0048] The integral processing in step S31 and step S33 is set according to the following formula:
[0049] II(x,y)=II(x-1,y)+S(x,y)
[0050] S(x,y)=S(x,y-1)+g(x,y)
[0051] Wherein, II(x,y) represents the pixel value of the image (x,y) coordinate after integration processing, II(x-1,y) represents the pixel value of the image (x-1,y) coordinate after integration processing, S(x,y) represents the sum of the first y pixel values of the x-th column, S(x,y-1) represents the sum of the first y-1 pixel values of the x-th column, and g(x,y) represents the pixel value of the image (x,y) coordinate before integration processing.
[0052] The mean value processing in step S34 and step S35 is obtained according to the following formula:
[0053]
[0054] Where, mean is the mean of the preset window after mean processing, II(x,y) is the value of the integral image of the (x,y) coordinates, and m and n represent the width and height of the preset window, respectively.
[0055] The Gaussian filtering process in step S32 is set according to the following formula:
[0056]
[0057] Where f(x,y) represents the value of the coordinate (x,y) after Gaussian filtering, x and y represent the horizontal and vertical coordinates respectively, and σ represents the standard deviation of the Gaussian distribution.
[0058] The segmentation process in step S37 is set according to the following formula:
[0059]
[0060] Where B(x,y) represents the pixel value of the initial binary contour image after the segmentation of the image coordinate (x,y), D(x,y) represents the pixel value of the difference image before the segmentation of the image coordinate (x,y), and thresh is the preset segmentation threshold.
[0061] The contour spacing processing in step S39 is processed according to the following formula:
[0062] dis=min(dis i,j )
[0063]
[0064] Where dis is the distance between two contours, dis i,j is the distance between the i-th point of the first contour and the j-th point of the second contour, p i and p j They are the pixel coordinates on the two contours, respectively, and x and y are the horizontal and vertical coordinates.
[0065] The present invention has the following beneficial effects:
[0066] The present invention utilizes the characteristic that the horizontal and vertical thread spacing of the fabric is the same, and uses processing methods such as secondary expansion, expansion corrosion, binarization, negation, segmentation processing and contour spacing processing to perform feature fusion on the collected grayscale image, and combines the coupled double contour to construct a contour set to finally locate the defect. The present invention is accurate and practical in detection and can effectively filter background interference. The image calculation speed is fast, and it can be widely used in similar scenes, with great application value. BRIEF DESCRIPTION OF THE DRAWINGS
[0067] Figure 1 is a flow chart of the method of the present invention.
[0068] Figure 2 is a grayscale image of the cloth in Example 1 of the present invention.
[0069] Figure 3 is the dilated image.
[0070] Figure 4 is the eroded image.
[0071] Figure 5 It is the image of the local extreme point set after expansion.
[0072] Figure 6 It is the image of the local extreme point set after corrosion.
[0073] Figure 7 It is the defect mask after secondary dilation.
[0074] Figure 8 It is the image of the defect mask after dilation and corrosion.
[0075] Fig. 9 is the filtered image.
[0076] Fig.10 It is a brightness difference double image.
[0077] Fig.11 It is a dark difference double image.
[0078] Fig.12 It is a picture of defects on the fabric.
[0079] Fig.13 It is a grayscale image with thick place yarn defects.
[0080] Fig.14 yes Fig.13 Defect detection result diagram.
[0081] Fig.15 is a grayscale image with cloth stain defects.
[0082] Fig.16 yes Fig.15 Defect detection result diagram. DETAILED DESCRIPTION
[0083] The present invention will be further described below in conjunction with the accompanying drawings and specific embodiments.
[0084] like Figure 1 As shown, embodiment 1 of the present invention and its implementation process are as follows:
[0085] S1. Use a camera to obtain a grayscale image R(x,y) of the cloth, such as Figure 2 shown.
[0086] S2. Performing comprehensive processing of secondary dilation, dilation erosion, binarization and inversion on the grayscale image R(x, y) respectively, to obtain a defect mask after secondary dilation and a defect mask after dilation erosion.
[0087] Step S2 includes: performing secondary dilation processing and dilation corrosion processing on the grayscale image R(x, y) to obtain the secondary dilation image PL2(x, y) and the dilation corrosion image PD2(x, y), and then performing binarization processing and inversion processing on the obtained secondary dilation image PL2(x, y) and the dilation corrosion image PD2(x, y) in turn to obtain the secondary dilation defect mask and the dilation corrosion defect mask, respectively.
[0088] Step S2 is specifically as follows:
[0089] S21, dilate the grayscale image R(x,y) according to the mesh size of the cloth to obtain the dilated image Max(x,y), as Figure 3 shown.
[0090] The mesh size of the cloth is set based on empirical values.
[0091] S22, corrode the grayscale image R(x,y) according to the mesh size of the cloth to obtain the corroded image Min(x,y), such as Figure 4 shown.
[0092] The corrosion treatment is set according to the following formula:
[0093]
[0094] In the formula, represents the image after corrosion, A represents the image before corrosion, B represents the grid size of the cloth, and z represents the foreground pixel value.
[0095] S23, compare the grayscale image R(x,y) with the dilated image Max(x,y) and the eroded image Min(x,y), respectively, to obtain the local extreme point set image PL(x,y) after dilation and the local extreme point set image PD(x,y) after erosion, as shown in Figure 5 and Figure 6 shown.
[0096] The comparison process is set according to the following formula:
[0097]
[0098] Where M(x,y) represents the pixel value of the image (x,y) coordinate after dilation or erosion, R(x,y) represents the pixel value of the grayscale image (x,y) coordinate, and P(x,y) represents the pixel value of the local extreme image (x,y) coordinate after dilation or erosion.
[0099] S24. Dilate the expanded local extreme point set image PL(x, y) and the eroded local extreme point set image PD(x, y) according to the mesh size of the cloth to obtain a secondary expanded image PL2(x, y) and a expanded eroded image PD2(x, y).
[0100] The expansion processing in step S21 and step S24 is set according to the following formula:
[0101]
[0102] In the formula, represents the image after expansion, A represents the image before expansion, B represents the mesh size of the cloth, and z represents the foreground pixel value.
[0103] S25, binarizing the secondary dilation image PL2(x, y) and the dilation-erosion image PD2(x, y) to obtain a secondary dilation binary image and a dilation-erosion binary image.
[0104] The binarization process is set according to the following formula:
[0105]
[0106] Where P(x,y) represents the pixel value of the image (x,y) coordinate before binarization, and B(x,y) represents the pixel value of the image (x,y) coordinate after binarization.
[0107] S26, respectively perform inversion processing on the binary image after secondary expansion and the binary image after expansion and corrosion, to obtain the defect mask after secondary expansion and the defect mask after expansion and corrosion, such as Figure 7 and Figure 8 shown. Figure 7 There is a black connected domain in the center of the display, which is the defect mask after secondary expansion; Figure 8 Display all white connected domains, which are defect masks after expansion and corrosion. Figure 7 and Figure 8 The displayed image size is Figure 6 Consistent.
[0108] The negation operation is set according to the following formula:
[0109] H(x,y)=255-B(x,y)
[0110] Where B(x, y) represents the pixel value of the image (x, y) coordinate before the inversion operation, and H(x, y) represents the pixel value of the image (x, y) coordinate after the inversion operation, which is the defect mask.
[0111] S3, the grayscale image R(x,y) is processed to obtain the grayscale mean image M(x,y) and the filtered mean image M s (x, y), and then the grayscale mean image M(x, y) and the filtered mean image M are obtained based on the defect mask after secondary expansion and the defect mask after expansion and corrosion. s (x, y) is subjected to segmentation processing and contour spacing processing in sequence, and the results of the contour spacing processing constitute a contour set.
[0112] Step S3 includes: performing integration processing and window mean processing on the grayscale image R(x, y) in sequence to obtain a grayscale mean image M(x, y); performing compression processing, Gaussian filtering processing, integration processing and window mean processing on the grayscale image R(x, y) in sequence to obtain a filtered mean image M s (x, y), and then the grayscale mean image M(x, y) and the filtered mean image M are obtained based on the defect mask after secondary expansion and the defect mask after expansion and corrosion. s (x, y) is segmented and processed with contour spacing in sequence to obtain bright binary coupled double contours and dark binary coupled double contours respectively. The bright binary coupled double contours and the dark binary coupled double contours constitute a contour set.
[0113] Step S3 is specifically as follows:
[0114] S31. Integrate the grayscale image R(x, y) to obtain a grayscale integral image II(x, y).
[0115] S32, compress the grayscale image R (x, y), and then perform Gaussian filtering after the compression process is completed to obtain a filtered image S (x, y), such as Fig. 9 shown.
[0116] The compression process is to compress the width and height of the grayscale image R(x, y) proportionally.
[0117] Gaussian filtering is set according to the following formula:
[0118]
[0119] Where f(x,y) represents the value of the coordinate (x,y) after Gaussian filtering, x and y represent the horizontal and vertical coordinates respectively, and σ represents the standard deviation of the Gaussian distribution.
[0120] S33, perform integration processing on the filtered image S(x,y) to obtain the filtered integral image II s (x,y).
[0121] The integral processing in step S31 and step S33 is set according to the following formula:
[0122] II(x,y)=II(x-1,y)+S(x,y)
[0123] S(x,y)=S(x,y-1)+g(x,y)
[0124] Wherein, II(x,y) represents the pixel value of the image (x,y) coordinate after integration processing, II(x-1,y) represents the pixel value of the image (x-1,y) coordinate after integration processing, S(x,y) represents the sum of the first y pixel values of the x-th column, S(x,y-1) represents the sum of the first y-1 pixel values of the x-th column, and g(x,y) represents the pixel value of the image (x,y) coordinate before integration processing.
[0125] S34. Perform window mean processing on the grayscale image R(x,y) according to the grayscale integral image II(x,y) according to a preset window to obtain a grayscale mean image M(x,y).
[0126] S35, according to the filter integral diagram II s (x, y) performs window mean processing on the filtered image S(x, y) according to the preset window to obtain the filtered mean image M s (x,y).
[0127] The mean value processing in step S34 and step S25 is obtained according to the following formula:
[0128]
[0129] Where, mean is the mean of the preset window after mean processing, II(x,y) is the value of the integral image of the (x,y) coordinates, and m and n represent the width and height of the preset window, respectively.
[0130] S36: The grayscale mean image M(x, y) obtained in step S34 and the filtered mean image M(x, y) obtained in step S35 are combined. s (x, y) cross subtraction processing to obtain the brightness difference dual image D l (x,y) and dark difference double image D d (x,y), such as Fig.10 and Fig.11 shown.
[0131] The cross subtraction process is the grayscale mean image M(x,y) minus the filtered mean image M s (x,y) to get the brightness difference double image D l (x,y), filtered mean image M s (x, y) minus the grayscale mean image M(x, y) to get the dark difference double image D d (x,y).
[0132] S37, respectively segment the brightness difference dual image D according to the preset segmentation threshold l (x,y) and dark difference double image D d (x, y) is segmented to obtain the initial bright binary contour image B l (x, y) and the initial dark binary contour image B d (x,y).
[0133] The segmentation process is set according to the following formula:
[0134]
[0135] Where B(x,y) represents the pixel value of the initial binary contour image after the segmentation of the image coordinate (x,y), D(x,y) represents the pixel value of the difference image before the segmentation of the image coordinate (x,y), and thresh is the preset segmentation threshold.
[0136] S38, convert the initial bright binary contour image B l (x, y) and the initial dark binary contour image B d (x, y) is respectively ORed with the defect mask after secondary dilation and the defect mask after dilation and corrosion obtained in step S2 to obtain the bright binary coupled dual contour image B l2 (x,y) and dark binary coupled double contour image B d2 (x,y).
[0137] S39, according to the bright binary coupling double contour image B l2 (x,y) and dark binary coupled double contour image B d2 (x, y) is processed with contour spacing to obtain the bright binary coupled double contour and the dark binary coupled double contour respectively. The bright binary coupled double contour and the dark binary coupled double contour constitute a contour set.
[0138] The contour spacing processing in step S39 is processed according to the following formula:
[0139] dis=min(dis i,j )
[0140]
[0141] Where dis is the distance between two contours, dis i,j is the distance between the i-th point of the first contour and the j-th point of the second contour, p i and p j They are the pixel coordinates on the two contours, respectively, and x and y are the horizontal and vertical coordinates.
[0142] S4, in the contour set obtained in step S3, adjacent contours are connected and small impurities are filtered according to the actual defect size to obtain a white connected domain as a defect on the cloth, such as Fig.12 shown.
[0143] Example 2
[0144] Grayscale image with thick yarn defects such as Fig.13 The results after treatment in the same manner as in Example 1 are shown in Fig.14 shown.
[0145] Example 3
[0146] Grayscale image with cloth stain defect Fig.15 The results after treatment in the same manner as in Example 1 are shown in Fig.16 shown.
[0147] After multiple implementations of the examples, the accuracy of the method of the present invention reached 91%.
[0148] By comparing the grayscale images and the detection result diagrams of the above-mentioned embodiments, it can be seen that the present invention can accurately locate and detect defects such as thick yarn and cloth stains on the surface of the fabric. In addition, the image processing speed is fast. The time for realizing a frame of 8192×6000 size coating grayscale image detection on a desktop computer with a CPU of i7-12700 processor is no more than 100ms. If there are no large number of defects, the time can be controlled within 75ms, which has great application value in the detection of fabric surface defects.
[0149] The method of the present invention is simple, conducive to engineering implementation, has a fast processing speed, and has high application value in fabric defect detection.
[0150] The above specific implementation modes are used to explain the present invention rather than to limit the present invention. Any modification and change made to the present invention within the spirit of the present invention and the protection scope of the claims shall fall within the protection scope of the present invention.
Claims
1. A method for rapid detection of cloth defects based on coupled double integral graphs, characterized in that: include: S1. Use a camera to capture a grayscale image R (x, y) of the fabric. S2, performing comprehensive processing of secondary expansion, expansion corrosion, binarization and inversion on the grayscale image R(x, y) to obtain a defect mask after secondary expansion and a defect mask after expansion corrosion; S3, the grayscale image R(x,y) is processed to obtain the grayscale mean image M(x,y) and the filtered mean image M s (x, y), and then the grayscale mean image M(x, y) and the filtered mean image M are obtained based on the defect mask after secondary expansion and the defect mask after expansion and corrosion. s (x, y) is subjected to segmentation processing and contour spacing processing in sequence, and the results of the contour spacing processing constitute a contour set; S4. Connect adjacent contours in the contour set obtained in step S3 to obtain a white connected domain as a defect on the cloth.
2. The method for rapid cloth defect detection based on coupled double integral graph according to claim 1, characterized in that: The step S2 comprises: performing secondary dilation processing and dilation corrosion processing on the grayscale image R(x, y) to obtain a secondary dilation image PL2(x, y) and a dilation corrosion image PD2(x, y), and then performing binarization processing and inversion processing on the obtained secondary dilation image PL2(x, y) and dilation corrosion image PD2(x, y) to obtain a secondary dilation defect mask and a dilation corrosion defect mask respectively; The step S3 includes: performing integration processing and window mean processing on the grayscale image R(x, y) in sequence to obtain a grayscale mean image M(x, y); performing compression processing, Gaussian filtering processing, integration processing and window mean processing on the grayscale image R(x, y) in sequence to obtain a filtered mean image M s (x, y), and then the grayscale mean image M(x, y) and the filtered mean image M are obtained based on the defect mask after secondary expansion and the defect mask after expansion and corrosion. s (x, y) is segmented and processed with contour spacing in sequence to obtain bright binary coupled double contours and dark binary coupled double contours respectively. The bright binary coupled double contours and the dark binary coupled double contours constitute a contour set.
3. The method for rapid cloth defect detection based on coupled double integral graph according to claim 2, characterized in that: The step S2 is specifically as follows: S21, dilating the grayscale image R(x,y) according to the mesh size of the cloth to obtain a dilated image Max(x,y); S22, corroding the grayscale image R(x, y) according to the mesh size of the cloth to obtain a corroded image Min(x, y); S23, comparing the grayscale image R(x, y) with the dilated image Max(x, y) and the eroded image Min(x, y), respectively, to obtain the local extreme point set image PL(x, y) after dilation and the local extreme point set image PD(x, y) after erosion; S24, dilating the expanded local extreme point set image PL(x, y) and the eroded local extreme point set image PD(x, y) according to the mesh size of the cloth to obtain a secondary expanded image PL2(x, y) and a expanded eroded image PD2(x, y); S25, binarizing the secondary dilation image PL2(x, y) and the dilation-erosion image PD2(x, y) to obtain a secondary dilation binary image and a dilation-erosion binary image; S26, respectively performing inversion processing on the binary image after secondary expansion and the binary image after expansion and corrosion to obtain a defect mask after secondary expansion and a defect mask after expansion and corrosion.
4. The method for rapid cloth defect detection based on coupled double integral graph according to claim 3, characterized in that: The expansion processing in step S21 and step S24 is set according to the following formula: In the formula, represents the image after expansion, A represents the image before expansion, B represents the mesh size of the cloth, and z represents the foreground pixel value; The corrosion process in step S22 is set according to the following formula: In the formula, represents the image after corrosion, A represents the image before corrosion, B represents the grid size of the cloth, and z represents the foreground pixel value.
5. The method for rapid cloth defect detection based on coupled double integral graph according to claim 3, characterized in that: The comparison process in step S23 is set according to the following formula: Where M(x,y) represents the pixel value of the image (x,y) coordinate after dilation or erosion, R(x,y) represents the pixel value of the grayscale image (x,y) coordinate, and P(x,y) represents the pixel value of the local extreme image (x,y) coordinate after dilation or erosion.
6. The method for rapid cloth defect detection based on coupled double integral graph according to claim 3, characterized in that: The binarization process in step S25 is set according to the following formula: Where P(x, y) represents the pixel value of the image (x, y) coordinate before binarization, and B(x, y) represents the pixel value of the image (x, y) coordinate after binarization. The negation operation in step S26 is set according to the following formula: H(x,y)=255-B(x,y) Where B(x, y) represents the pixel value of the image (x, y) coordinate before the inversion operation, and H(x, y) represents the pixel value of the image (x, y) coordinate after the inversion operation, which is the defect mask.
7. The method for rapid cloth defect detection based on coupled double integral graph according to claim 2, characterized in that: The step S3 is specifically as follows: S31, performing integration processing on the grayscale image R(x,y) to obtain a grayscale integral image II(x,y); S32, compressing the grayscale image R(x, y), and then performing Gaussian filtering to obtain a filtered image S(x, y); S33, perform integration processing on the filtered image S (x, y) to obtain a filtered integral image II s (x,y); S34, performing window mean processing on the grayscale image R(x,y) according to the grayscale integral image II(x,y) according to a preset window to obtain a grayscale mean image M(x,y); S35, according to the filter integral diagram II s (x, y) performs window mean processing on the filtered image S(x, y) according to the preset window to obtain the filtered mean image M s (x,y); S36: The grayscale mean image M(x, y) obtained in step S34 and the filtered mean image M(x, y) obtained in step S35 are combined. s (x, y) cross subtraction processing to obtain the brightness difference dual image D l (x,y) and dark difference double image D d (x,y); S37, respectively segment the brightness difference dual image D according to the preset segmentation threshold l (x,y) and dark difference double image D d (x, y) is segmented to obtain the initial bright binary contour image B l (x, y) and the initial dark binary contour image B d (x,y); S38, convert the initial bright binary contour image B l (x, y) and the initial dark binary contour image B d (x, y) is respectively ORed with the defect mask after secondary dilation and the defect mask after dilation and corrosion obtained in step S2 to obtain the bright binary coupled dual contour image B l2 (x,y) and dark binarization coupled double contour image B d2 (x,y); S39, according to the bright binary coupling double contour image B l2 (x,y) and dark binarization coupled double contour image B d2 (x, y) is processed with contour spacing to obtain the bright binary coupled double contour and the dark binary coupled double contour respectively. The bright binary coupled double contour and the dark binary coupled double contour constitute a contour set.
8. The method for rapid cloth defect detection based on coupled double integral graph according to claim 7, characterized in that: The integral processing in step S31 and step S33 is set according to the following formula: ΙΙ(x,y)=ΙΙ(x-1,y)+S(x,y) S(x,y)=S(x,y-1)+g(x,y) Wherein, ΙΙ(x,y) represents the pixel value of the image (x,y) coordinate after integration processing, Ⅱ(x-1,y) represents the pixel value of the image (x-1,y) coordinate after integration processing, S(x,y) represents the sum of the first y pixel values of the x-th column, S(x,y-1) represents the sum of the first y-1 pixel values of the x-th column, and g(x,y) represents the pixel value of the image (x,y) coordinate before integration processing.
9. The method for rapid cloth defect detection based on coupled double integral graph according to claim 7, characterized in that: The mean value processing in step S34 and step S35 is obtained according to the following formula: Wherein, mean is the mean of the preset window after mean processing, ΙΙ(x,y) is the value of the integral graph of the (x,y) coordinates, and m and n represent the width and height of the preset window, respectively.
10. The method for rapid cloth defect detection based on coupled double integral graph according to claim 7, characterized in that: The Gaussian filtering process in step S32 is set according to the following formula: In the formula, f(x,y) represents the value of the coordinate (x,y) after Gaussian filtering, x and y represent the horizontal and vertical coordinates respectively, and σ represents the standard deviation of the Gaussian distribution; The segmentation process in step S37 is set according to the following formula: Where B(x,y) represents the pixel value of the initial binary contour image after the segmentation of the image coordinate (x,y), D(x,y) represents the pixel value of the difference image before the segmentation of the image coordinate (x,y), and thresh is the preset segmentation threshold; The contour spacing processing in step S39 is processed according to the following formula: dis=min(dis i,j ) Where dis is the distance between two contours, dis i,j is the distance between the i-th point of the first contour and the j-th point of the second contour, p i and p j They are the pixel coordinates on the two contours, respectively, and x and y are the horizontal and vertical coordinates.