Method and system for detecting cloth surface defects based on computer vision

Through computer vision technology, the grayscale symbiosis matrix is ​​constructed and the characteristics of the numerical concentrated area are calculated, which solves the problems of low accuracy and slow detection of surface defects of solid color cloth, and achieves efficient defect detection.

CN115049671BActive Publication Date: 2025-01-07KUNSHAN SANCHUAN HI-TECH FABRIC CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210983872.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-17
Publication Date
2025-01-07
Estimated Expiration
2042-08-17

AI Technical Summary

Technical Problem

The existing solid-color cloth surface defect detection methods rely on manual detection, resulting in low detection accuracy and slow speed, and reduced detection accuracy due to labor intensity.

Method used

Using a computer vision-based method, by obtaining the grayscale map of the surface of solid color cloth, a grayscale matrix and a grayscale symbiosis matrix are constructed, the direction and aggregation degree of the numerical concentration area are calculated, and defect detection is used to improve detection speed and accuracy.

Benefits of technology

It effectively improves the speed and accuracy of surface defect detection of solid color cloth, reduces the dependence of manual detection, and improves the consistency and efficiency of detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115049671B_ABST
    Figure CN115049671B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of image processing, and in particular to a method and system for detecting surface defects of cloth based on computer vision, including: obtaining a grayscale image of the surface of a pure color cloth; constructing a grayscale matrix and a grayscale co-occurrence matrix; obtaining a value concentration area in the grayscale co-occurrence matrix; obtaining the largest value concentration area and other value concentration areas in the grayscale co-occurrence matrix; obtaining the value concentration direction of other value concentration areas by using the angle between the line connecting each element and the origin in other value concentration areas and the X-axis; obtaining the value aggregation degree of other value concentration areas by using the distance between the element farthest from the origin in the value concentration direction in other value concentration areas and the origin; obtaining the value change trend value of other value concentration areas by using the value concentration direction and the value aggregation degree of other value concentration areas, and using the value change trend value to perform defect detection on pure color cloth. The above method is used for pure color cloth defect detection, which can improve detection efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing, and in particular to a cloth surface defect detection method and system based on computer vision. Background Art

[0002] Solid color fabrics are widely used in all aspects of life. In the production process of solid color fabrics, due to improper operation and other factors, it is easy to cause defects on the surface of solid color fabrics, affecting the service life and effect of solid color fabrics. Therefore, it is necessary to perform defect detection on solid color fabrics.

[0003] Currently, the commonly used method for detecting defects in solid-color fabrics is manual detection, which uses the method of manual visual recognition to detect solid-color fabrics after production.

[0004] However, during manual inspection, the accuracy of the inspection is affected by the inspection skills of the person, and there is a lack of a unified standard. In addition, during repetitive labor, as the labor time increases, the fatigue level of the cloth inspector will continue to increase, making it increasingly difficult for him to concentrate, and thus the inspection accuracy will decrease. In addition, the speed of manual inspection is low. Therefore, there is an urgent need for a method to improve the speed and accuracy of surface defect detection of solid color cloth. Summary of the invention

[0005] The present invention provides a cloth surface defect detection method and system based on computer vision, which are used to solve the problems of low cloth surface defect detection speed and low precision existing in the prior art.

[0006] The invention provides a cloth surface defect detection method and system based on computer vision, comprising: obtaining a grayscale image of a pure color cloth surface; constructing a grayscale matrix and a grayscale co-occurrence matrix; obtaining a value concentration area in the grayscale co-occurrence matrix; obtaining the largest value concentration area and other value concentration areas in the grayscale co-occurrence matrix; obtaining the value concentration direction of other value concentration areas by using the angle between the line connecting each element and the origin in the other value concentration areas and the X-axis; obtaining the value aggregation degree of other value concentration areas by using the distance between the element farthest from the origin in the value concentration direction and the origin in the other value concentration areas; obtaining the value change trend value of other value concentration areas by using the value concentration direction and the value aggregation degree of other value concentration areas, and performing defect detection on the pure color cloth by using the value change trend value. Compared with the prior art, the invention combines computer vision and image processing, calculates the change direction correlation and distance correlation of the values ​​of the concentrated area in the co-occurrence matrix corresponding to the pixel matrix according to the texture characteristics of the pure color cloth surface, obtains the smoothness of the pure color cloth surface, thereby detecting the defects of the pure color cloth surface, and effectively improving the speed and accuracy of defect detection.

[0007] To achieve the above object, the present invention adopts the following technical solution, a method for detecting surface defects of cloth based on computer vision, comprising:

[0008] Obtaining a grayscale image of the surface of the solid-color cloth to be detected;

[0009] Construct a grayscale matrix using the grayscale values ​​and positions of all pixels in the grayscale image;

[0010] Construct a gray-level co-occurrence matrix using all gray-level values ​​in the gray-level matrix;

[0011] The value concentration area in the gray level co-occurrence matrix is ​​obtained by using the element value in the gray level co-occurrence matrix and the mean of the element value in its eight neighborhoods;

[0012] The largest value concentration region and other value concentration regions in the gray level co-occurrence matrix are obtained according to the sum of the element values ​​in each value concentration region;

[0013] The numerical concentration direction of other numerical concentration areas is obtained by calculating the angle between the line connecting each element and the origin in other numerical concentration areas and the X-axis;

[0014] The degree of numerical aggregation in other numerical concentration areas is obtained by using the distance between the element farthest from the origin in the numerical concentration direction and the origin in other numerical concentration areas;

[0015] The numerical change trend value of other numerical concentration areas is calculated by using the numerical concentration direction and numerical aggregation degree of other numerical concentration areas;

[0016] The numerical change trend values ​​in other numerical concentration areas are used to detect whether there are defects on the surface of the solid color cloth to be tested.

[0017] In the cloth surface defect detection method based on computer vision, the value concentration area in the gray level co-occurrence matrix is ​​obtained in the following manner:

[0018] Select the element with the largest value in the gray level co-occurrence matrix as the starting point, and obtain the eight neighborhood elements of the starting point;

[0019] Calculate the mean and mean variance of the eight neighborhood element values ​​of the starting point;

[0020] The mean similarity range is set according to the mean variance of the eight neighborhood elements of the starting point, and the eight neighborhood elements of the starting point are judged: when the eight neighborhood elements of the starting point are within the mean similarity range, the eight neighborhood elements of the starting point and the starting point are divided into one set; when the eight neighborhood elements of the starting point are not within the mean similarity range, the eight neighborhood elements of the starting point are not processed, and the eight neighborhood elements of the starting point are divided in turn according to this step to obtain the first set;

[0021] Iteratively judge the eight-neighborhood elements of all elements in the set in the same way as the first set, until there are no elements in the eight-neighborhood elements of all elements in the set that are in a range close to the mean, and obtain the first value concentration area and the remaining elements;

[0022] The element with the largest value is selected from the remaining elements as the new initial point, and the second value concentration area is obtained in the same way as the first value concentration area, and so on, to obtain all the value concentration areas in the gray level co-occurrence matrix.

[0023] In the cloth surface defect detection method based on computer vision, the largest value concentration area and other value concentration areas in the gray level co-occurrence matrix are obtained in the following manner:

[0024] The sum of all element values ​​in each value concentration area is counted, and the value concentration area with the largest sum of element values ​​is taken as the largest value concentration area in the gray level co-occurrence matrix, and the remaining value concentration areas are taken as other value concentration areas in the gray level co-occurrence matrix.

[0025] In the cloth surface defect detection method based on computer vision, the expression of the numerical concentration direction of the other numerical concentration area is as follows:

[0026]

[0027] In the formula, T represents the direction of value concentration in other value concentration areas, It represents the angle between the line connecting the element b and the origin in other value concentration areas and the X-axis. Represents the number of elements in a region of other value sets.

[0028] In the cloth surface defect detection method based on computer vision, the expression of the numerical aggregation degree of the other numerical concentration area is as follows:

[0029]

[0030] Where d' represents the degree of numerical aggregation in other numerical concentration areas, ( ) are the coordinates of the origin in the other numerical concentration areas, ( ) is the coordinate of the element farthest from the origin in the direction of the value concentration in the other value concentration area.

[0031] In the cloth surface defect detection method based on computer vision, the expression of the numerical change trend value of the other numerical concentration area is as follows:

[0032]

[0033] In the formula, It represents the value change trend value of other value concentration areas, T represents the value concentration direction of other value concentration areas, and d' represents the value aggregation degree of other value concentration areas.

[0034] The method for detecting surface defects of cloth based on computer vision, the process of detecting whether there are defects on the surface of the solid color cloth to be detected is specifically as follows:

[0035] A threshold is set to judge the numerical change trend value of other numerical concentration areas: when the numerical change trend value of other numerical concentration areas is greater than the threshold value, it is determined that there are defects on the surface of the solid color cloth to be detected.

[0036] In the cloth surface defect detection method based on computer vision, the grayscale image of the pure color cloth surface to be detected is obtained in the following manner:

[0037] Collect the surface image of the solid color cloth to be detected;

[0038] Performing tilt correction processing on the cloth surface image to obtain the cloth surface image after correction processing;

[0039] The cloth surface image after correction is grayed to obtain a grayscale image of the pure color cloth surface to be detected.

[0040] The present invention also provides a cloth surface defect detection system based on computer vision, comprising a collection unit, a processing unit, a calculation unit and a detection unit:

[0041] The acquisition unit uses an industrial camera arranged just above the cloth to acquire the surface image of the solid color cloth to be inspected;

[0042] The processing unit, the computer processes the image collected by the collection unit, obtains the gray level co-occurrence matrix of the pure color cloth to be detected and the value concentration area in the gray level co-occurrence matrix, and then obtains the maximum value concentration area and other value concentration areas in the gray level co-occurrence matrix according to the sum of the element values ​​of the value concentration area;

[0043] The computing unit, the computer, calculates the value concentration direction and the value aggregation degree of the other value concentration areas according to the element features of the other value concentration areas acquired by the processing unit, and then calculates the value change trend value of the other value concentration areas;

[0044] The detection unit, the computer detects whether there are defects on the surface of the solid color cloth to be detected according to the numerical change trend values ​​of other numerical concentration areas obtained by the calculation unit.

[0045] The beneficial effects of the present invention are:

[0046] The present invention combines computer vision and image processing, and calculates the change direction correlation and distance correlation of the numerical values ​​of the concentrated area in the co-occurrence matrix corresponding to the pixel matrix according to the texture characteristics of the solid color cloth surface, so as to obtain the smoothness of the solid color cloth surface, thereby detecting the defects of the solid color cloth surface, and effectively improving the speed and accuracy of defect detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0048] Figure 1 A schematic flow chart of a method for detecting surface defects of cloth provided in Example 1 of the present invention;

[0049] Figure 2 A schematic flow chart of a method for detecting surface defects of cloth provided in Example 2 of the present invention;

[0050] Figure 3 A schematic diagram of a gray level co-occurrence matrix provided in Example 2 of the present invention;

[0051] Figure 4 A schematic diagram of the directional distribution of pixels with the same grayscale value provided in Example 2 of the present invention. DETAILED DESCRIPTION

[0052] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0053] Example 1

[0054] The embodiment of the present invention provides a method for detecting cloth surface defects based on computer vision, such as Figure 1 As shown, including:

[0055] S101, obtaining a grayscale image of the surface of a solid-color cloth to be detected.

[0056] Among them, the RGB image of the cloth surface is collected, and the smoothness of the cloth surface texture is processed and then grayed out.

[0057] S102, constructing a grayscale matrix using the grayscale values ​​and positions of all pixels in the grayscale image.

[0058] Among them, the gray-level matrix is ​​used to construct the gray-level co-occurrence matrix.

[0059] S103, constructing a gray-level co-occurrence matrix using all gray-level values ​​in the gray-level matrix.

[0060] In this embodiment, the co-occurrence matrix in each direction is calculated.

[0061] S104, using the element values ​​in the gray level co-occurrence matrix and the mean values ​​of the element values ​​in its eight neighborhoods to obtain the value concentration area in the gray level co-occurrence matrix.

[0062] The determination of the value concentration area is based on the eight neighborhoods with value points in a certain area.

[0063] S105 , obtaining the largest value concentration region and other value concentration regions in the gray level co-occurrence matrix according to the sum of the element values ​​in each value concentration region.

[0064] Among them, the value concentration area with the largest sum of values ​​is taken as the value concentration area corresponding to the normal area in the cloth surface image, and the remaining value concentration areas are taken as the value concentration areas corresponding to the suspected defective areas in the cloth surface image.

[0065] S106, calculating the value concentration direction of the other value concentration region by using the angle between the line connecting each element and the origin in the other value concentration region and the X-axis.

[0066] The direction in which the values ​​are concentrated represents the directional correlation between the corresponding matrices of the pixel points.

[0067] S107 , obtaining the degree of numerical aggregation in other numerical concentration regions by using the distance between the element farthest from the origin in the numerical concentration direction in other numerical concentration regions and the origin.

[0068] Among them, the numerical aggregation degree represents the distance correlation between the corresponding matrices of pixel points.

[0069] S108. Calculate the value change trend value of other value concentration areas by using the value concentration direction and value aggregation degree of other value concentration areas.

[0070] Among them, the numerical change trend value is used for defect detection.

[0071] S109, using the numerical value change trend values ​​in other numerical value concentration areas to detect whether there are defects on the surface of the solid color cloth to be detected.

[0072] Among them, the larger the numerical change trend value is, the smaller the correlation of the numerical points in the numerical concentration area is, which means that the smoothness of the cloth surface is smaller, indicating that the cloth has defects.

[0073] The beneficial effects of this embodiment are:

[0074] This embodiment combines computer vision and image processing, and calculates the change direction correlation and distance correlation of the numerical values ​​of the concentrated area in the co-occurrence matrix corresponding to the pixel matrix according to the texture characteristics of the solid color cloth surface, so as to obtain the smoothness of the solid color cloth surface, thereby detecting defects on the solid color cloth surface and effectively improving the speed and accuracy of defect detection.

[0075] Example 2

[0076] The main purpose of this embodiment is to obtain the pixel matrix of the grayscale image according to the arrangement of pixel points of the surface texture of the solid color cloth, calculate the correlation of pixel points with the same grayscale value in various directions according to the pixel matrix, calculate the change direction correlation and distance correlation of the numerical values ​​in the concentrated area in the co-occurrence matrix corresponding to the pixel matrix, obtain the smoothness of the solid color cloth surface, and thus detect defects on the solid color cloth surface.

[0077] The embodiment of the present invention provides a method for detecting cloth surface defects based on computer vision, such as Figure 2 As shown, including:

[0078] S201, obtaining a grayscale image corresponding to a pure color cloth surface image.

[0079] This embodiment is to detect the texture defects on the surface of pure color cloth, and it is necessary to collect images of the surface of pure color cloth. Because it is necessary to analyze the texture characteristics and grayscale characteristics of the surface of pure color cloth, a clear and flat image is required. The RGB image of the surface of pure color cloth is collected by deploying industrial cameras, and the flatness of the texture of the surface of pure color cloth is processed to prevent the judgment of the regularity of the texture from being affected by factors of the image itself.

[0080] Assuming that the sliding of the solid-color cloth is a uniform motion, the acquisition camera collects images of the surface of the solid-color cloth at short intervals, and the collected images are corrected so that the distorted textures are arranged approximately in parallel.

[0081] Radon transform is used to perform tilt correction to ensure that the tilt angle of the image texture is within 2°. The principle of Radon transform is as follows:

[0082]

[0083] In the formula, For point ( ), are the horizontal and vertical coordinate values ​​of the point, is the Dirac function, r' is the point ( ) to the origin, is the angle between the perpendicular line through the origin and the horizontal axis. Radon transformation is a known technology and will not be described in detail here. is the image after transformation.

[0084] The corrected image is grayed to obtain a corresponding grayscale image.

[0085] At this point, the grayscale image corresponding to the pure color cloth surface image is obtained.

[0086] In the production process of solid-color cloth, common defects are holes, oil stains, warp and weft defects (missing warp and weft, double warp and weft), etc. For normal cloth, the warp and weft are evenly arranged according to a certain interweaving rule, and the texture surface of the cloth is evenly distributed, with a certain fluctuation range and uniformly distributed texture characteristics. When defects appear in the cloth, the organization structure of the cloth changes, destroying the periodicity and uniformity of the texture on the surface of the cloth. At the same time, the influence of light and noise will cause a certain change in grayscale, and the directional correlation between the corresponding matrices of pixel points is obtained. The smoothness of the texture is calculated based on the directional correlation and distance correlation.

[0087] S202, obtaining a grayscale matrix of a grayscale image of a pure color cloth surface.

[0088] In the actual measurement of cloth density, each row or column of the cloth grayscale image should only have the grayscale information of the yarn or the gap between the yarns. The grayscale value of the image where the warp and weft yarns are located will be significantly higher than that of the gaps, so according to the change law of the grayscale value of the pixel points on the surface of the pure color cloth, the pixel matrix of the grayscale image of the pure color cloth surface is obtained.

[0089] Specific implementation: After grayscale processing of the collected pure color cloth surface image, due to the presence of warp and weft yarns, the grayscale value of the image where the warp and weft yarns are located will be significantly higher than the gap, thus forming a brightness peak within a certain width range centered on the yarn. After making the image grayscale curve, the peak of the curve corresponds to the position of the yarn, and the trough corresponds to the yarn gap. However, due to the interference of impurity signals, the curve will produce a certain number of impurity small peaks, so these small peaks are removed.

[0090] When drawing the grayscale curve of the cloth image, in order to reduce the interference signal caused by the hairiness of the yarn itself and the information error generated during image recording, this embodiment uses the average value of the grayscale of each row or column of the image as the vertical coordinate, and the calculation formula is as follows:

[0091]

[0092] In the formula, is the average grayscale value of each row or column of the image, The coordinate information of the pixel. is the number of pixels in the image row or column, is the gray value of the e-th pixel in the row or column of the image. After extracting the grayscale curve of the cloth, two characteristic values, the peak value of the curve peak (ordinate) and the peak position (abscissa), can be obtained. If abnormal information appears on the longitude and latitude lines, the corresponding peak will fluctuate greatly. For example: if there are stains on the longitude and latitude lines that are darker than the surface of the pure color cloth, the grayscale value of the corresponding pixel will decrease and be less than the grayscale value of the pixel in the normal area. At this time, the average grayscale value of the corresponding longitude and latitude lines will also decrease. Conversely, if there are stains on the surface of the pure color cloth that are lighter than the color of the cloth, the grayscale value of the corresponding pixel will increase and be greater than the grayscale value of the pixel in the normal area. At this time, the average grayscale value of the corresponding longitude and latitude lines will also increase.

[0093] The grayscale matrix of the surface grayscale image is obtained based on the grayscale value on each longitude and latitude line. The number of pixels and grayscale values ​​on a longitude and latitude line correspond to a column of values ​​in the grayscale matrix, so Figure 3 As shown, the left side is the grayscale matrix of the grayscale image of the solid color cloth surface.

[0094] At this point, the grayscale matrix of the grayscale image of the pure color cloth surface is obtained.

[0095] S203, obtaining a gray level co-occurrence matrix.

[0096] According to the above steps, the arrangement of pixels on the longitude and latitude lines is obtained. Since the grayscale values ​​at the longitude and latitude lines are significantly higher than the grayscale values ​​at the gaps, the grayscale values ​​of the pixels on the longitude and latitude lines are within a certain range, and the grayscale values ​​of the pixels at the gaps are within a certain range. This embodiment obtains the abnormal conditions on the surface of the solid color cloth by calculating the abnormalities of the grayscale values ​​at the longitude and latitude lines and the gaps.

[0097] Specific implementation: The grayscale values ​​of the pixels on the warp and weft lines of a normal solid-color cloth are within a certain range, and the grayscale values ​​of the pixels in the gaps are within a certain range. When the solid-color cloth has stains or the warp and weft are broken, the grayscale values ​​of the pixels in a certain area will change, and the grayscale values ​​on the warp and weft lines will also change. Therefore, the correlation of the pixels on the warp and weft lines is calculated to indicate the abnormality on the surface of the solid-color cloth.

[0098] Select several pixels in a certain area as a region and determine the gray value The pixel point is used as a reference point, and the correlation of the pixels with the same gray value in all directions of this point is calculated. Figure 4 As shown, Pixels are reference points with the same gray value. Directional distribution of points.

[0099] Figure 4 The grayscale values ​​are the same The distribution positions of two pixels in space are expressed as For pixel of , , , Analyze the pixels in four directions and their spatial position relationship They are:

[0100]

[0101]

[0102]

[0103]

[0104] For the pixel , The probabilities of occurrence are:

[0105]

[0106]

[0107] In the formula, is the generated distance, To generate the direction, and Pixels and Coordinate value in space. Represents the grayscale range of the grayscale matrix. Represents pixel and The gray value of .

[0108] In the above formula, the calculation is , , , Texture information in four directions, in the same image, choose different generation distances and generate direction The calculated gray-level co-occurrence matrix can analyze texture information of different sizes and directions. Therefore, appropriate parameters should be selected according to the texture characteristics of the solid-color cloth to be tested in order to obtain statistical features that can accurately distinguish defective areas from normal areas. This embodiment generalizes it to the calculation of pixel points in a certain gray range in any direction. The correlation is used to indicate the uniformity of the texture of solid color cloth.

[0109] like Figure 3 As shown in the figure, assuming that the pixel point in the first row and fourth column of the grayscale matrix is ​​taken as the initial pixel point, points in a certain grayscale range are selected for correspondence and pixel statistics are performed. In practice, the pixel point with the smallest grayscale value in the pixel matrix is ​​taken as the starting point. The pixel points in this grayscale range are the grayscale values ​​of the pixel points with normal texture on the surface of pure color cloth. The calculation formula is as follows:

[0110]

[0111] In the formula, is the angle in any direction. The co-occurrence matrix corresponding to the pixel matrix is ​​obtained according to the above formula. The co-occurrence matrix in each direction is calculated to obtain multiple matrix images, and then the smoothness of each matrix image is calculated. Because the pixels in a certain grayscale range are used for correspondence, the number of diagonal lines in the co-occurrence matrix is ​​more than the number of pixels with the same grayscale, but it also represents the characteristics of texture. Figure 3 As shown, this is the correspondence between the pixel matrix and the co-occurrence matrix.

[0112] So far, the gray-level co-occurrence matrix is ​​obtained.

[0113] S204, obtaining the directional correlation between pixel point correspondence matrices.

[0114] The same pixel or adjacent pixels represent the same texture or the same part of the texture, that is, the part without defects or the part with all defects. The more concentrated the values ​​in the co-occurrence matrix are, the smaller the grayscale change is, and the more uniform the texture of the cloth surface is. Therefore, according to the directional relationship between adjacent pixel pairs in the co-occurrence matrix, the correlation between pixels in a certain range is obtained to represent the uniformity of the pixels on the surface of pure color cloth.

[0115] For the gray-level co-occurrence matrix, the determination of the value concentration area is based on the eight neighborhoods with value points in a certain area. The point with the largest value in the gray-level co-occurrence matrix is ​​selected as the initial point. With this point as the center, eight neighborhoods are selected, and the mean of the values ​​of the eight neighborhoods is calculated. Then, the points in the eight neighborhoods are compared with the mean of the eight neighborhoods. If the values ​​of the eight neighborhood points are within a range close to the mean, they are classified into this area. If they are not in this range, they are not regarded as points in this range.

[0116] As for whether the points in the eight neighborhoods are in a similar range, this range is determined based on the mean variance of the eight neighborhoods. If the value is within the range, the point is determined to be within this range and is classified as the value concentration area. Otherwise, it is not classified into this concentration area. Then the maximum value point among the remaining values ​​is selected, and all the value concentration areas in the gray level co-occurrence matrix are obtained in turn according to the above steps.

[0117] Determine the value concentration area: Count the sum of all the values ​​in the value concentration area, and take the value concentration area with the largest value sum as the value concentration area corresponding to the normal area in the pure color cloth surface image, and the other smaller value concentration areas as the value concentration areas corresponding to the suspected defective areas in the pure color cloth surface image. Figure 3 As shown, the dark areas in the gray-level co-occurrence matrix are the areas with the largest value concentration, and the light areas are the areas with smaller value concentration.

[0118] The maximum value concentration area and the smaller value concentration area in the gray level co-occurrence matrix obtained at any angle are obtained in the above manner. The angle containing the most values ​​in the smaller value concentration area is taken as the optimal angle, and the smaller value concentration area in the gray level co-occurrence matrix at this angle is used to determine whether there are defects on the surface of the solid color cloth.

[0119] Assume that a rectangular coordinate system is established with the center point of the value concentration area corresponding to the suspected defect area as the origin, and the eight neighborhoods are taken as a unit. The change in the direction of the values ​​in the eight neighborhoods is calculated, and the trend of the values ​​in the co-occurrence matrix is ​​expressed according to the directional surplus of the points in the eight neighborhoods.

[0120] The categories are classified according to the angle between the two values. Let the coordinates of the origin be ( ), calculate the angle between the line connecting the point in the region and the origin and the X-axis The coordinates of other points are ( ), then its angle is:

[0121]

[0122] The direction surplus is calculated based on the angle between each point and the origin and the X-axis. The calculation formula is as follows:

[0123]

[0124] In the formula, It represents the overall directional surplus of the value concentration area corresponding to the suspected defect area in the co-occurrence matrix. Indicates that there are numerical points.

[0125] At this point, the directional correlation between the corresponding matrices of the pixel points is obtained.

[0126] S205: Obtain the distance correlation between pixel point correspondence matrices.

[0127] Through the above steps, the directional correlation between the matrices corresponding to the pixel points is obtained, and the changing trend of the corresponding matrix values ​​is obtained through the directional correlation. Because the more concentrated the values ​​on the diagonal in the co-occurrence matrix are, the larger the number of values ​​of a certain element is, and the smaller the change in the grayscale value of the pixel point in the grayscale image of the corresponding solid-color cloth is, the more regular the texture of the solid-color cloth is, and the fewer the defects are. The degree of aggregation is expressed by calculating the degree of aggregation of the value concentration area corresponding to the suspected defect area in the co-occurrence matrix, that is, the distance between the farthest value point in the direction of directional surplus and the origin in the value concentration area. The calculation formula is as follows:

[0128]

[0129] In the formula, Indicates the degree of aggregation of the area where the values ​​are concentrated. ) is the coordinate of the origin, ( ) is the coordinate of the farthest numerical point in the direction of directional surplus in the numerical concentration area.

[0130] S206: Obtain the value change trend of the value concentration area.

[0131] The numerical points in the co-occurrence matrix represent the quantitative relationship between the same pixels. The larger the numerical value, the more concentrated the area, indicating that the texture of the solid color cloth surface is smoother. The smoothness of the surface is calculated based on the direction and distance obtained.

[0132] Specific implementation: The directional surplus of the values ​​in a concentrated area in the co-occurrence matrix represents the change trend of the value points in the area, and the distance between the farthest value point and the origin in the directional surplus direction represents the degree of aggregation. These two parameters are used to obtain the degree of change of the pixels in the corresponding grayscale image. The calculation formula is as follows:

[0133] '

[0134] In the formula, Indicates the numerical change trend of a concentrated area in the co-occurrence matrix.

[0135] At this point, the numerical variation trend of the numerical concentration area corresponding to each suspected defect area is obtained, which is used to indicate the smoothness of the pure color cloth.

[0136] S207, detecting whether there are defects on the surface of the solid color cloth according to the smoothness of the surface of the solid color cloth.

[0137] Through the above steps, the correlation of the numerical points of the numerical concentration area corresponding to the suspected defect area is obtained according to the directional characteristics and aggregation degree of the concentration area in the co-occurrence matrix to indicate whether the surface of the solid color cloth has defects.

[0138] According to the numerical change trend of the numerical concentration area corresponding to each suspected defect area, the judgment is made. When >0.15, it means that the correlation between the numerical points in the numerical concentration area corresponding to the suspected defective area is small, which means that the surface smoothness of the solid color cloth is small, indicating that the solid color cloth has defects.

[0139] So far, the surface defects of solid color cloth are detected by the smoothness of the solid color cloth texture.

[0140] The beneficial effects of this embodiment are:

[0141] This embodiment combines computer vision and image processing, and calculates the change direction correlation and distance correlation of the numerical values ​​of the concentrated area in the co-occurrence matrix corresponding to the pixel matrix according to the texture characteristics of the solid color cloth surface, so as to obtain the smoothness of the solid color cloth surface, thereby detecting defects on the solid color cloth surface and effectively improving the speed and accuracy of defect detection.

[0142] Example 3

[0143] The embodiment of the present invention provides a cloth surface defect detection system based on computer vision, including a collection unit, a processing unit, a calculation unit and a detection unit:

[0144] The acquisition unit uses an industrial camera arranged just above the cloth to acquire the surface image of the solid color cloth to be inspected;

[0145] The processing unit, the computer, obtains the grayscale matrix of the pure color cloth to be detected according to the grayscale values ​​of the pixels in the image collected by the collection unit, obtains the grayscale co-occurrence matrix according to the grayscale matrix, obtains the value concentration area in the grayscale co-occurrence matrix according to the characteristics of the values ​​in the grayscale co-occurrence matrix, and then obtains other value concentration areas according to the sum of the element values ​​in the value concentration area;

[0146] The computing unit, the computer, calculates the numerical concentration direction and numerical aggregation degree of the other numerical concentration areas according to the element features of the other numerical concentration areas acquired by the processing unit, and then calculates the numerical change trend value of the other numerical concentration areas by using the numerical concentration direction and numerical aggregation degree;

[0147] The detection unit, the computer detects whether there are defects on the surface of the solid color cloth to be detected according to whether the numerical change trend value of other numerical concentration areas obtained by the calculation unit is greater than the set threshold.

[0148] The beneficial effects of this embodiment are:

[0149] This embodiment combines computer vision and image processing, and calculates the change direction correlation and distance correlation of the numerical values ​​of the concentrated area in the co-occurrence matrix corresponding to the pixel matrix according to the texture characteristics of the solid color cloth surface, so as to obtain the smoothness of the solid color cloth surface, thereby detecting defects on the solid color cloth surface and effectively improving the speed and accuracy of defect detection.

[0150] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for detecting cloth surface defects based on computer vision, characterized in that: include: Obtain a grayscale image of the surface of a solid color cloth to be detected; the grayscale image of the surface of a solid color cloth to be detected is obtained in the following manner: Collect the surface image of the solid color cloth to be detected; Performing tilt correction processing on the cloth surface image to obtain the cloth surface image after correction processing; Grayscale processing is performed on the cloth surface image after correction processing to obtain a grayscale image of the pure color cloth surface to be detected; Construct a grayscale matrix using the grayscale values ​​and positions of all pixels in the grayscale image; Using all the gray values ​​in the gray matrix, construct gray co-occurrence matrices at several different angles; The value concentration area in the gray level co-occurrence matrix is ​​obtained by using the element value in the gray level co-occurrence matrix and the mean of the element value in its eight neighborhoods; When the gray level co-occurrence matrix at each angle includes the most values ​​in all other value concentration areas, the gray level co-occurrence matrix at the corresponding angle is recorded as the gray level co-occurrence matrix at the optimal angle; the value concentration area in the gray level co-occurrence matrix is ​​obtained as follows: Select the element with the largest value in the gray level co-occurrence matrix as the starting point, and obtain the eight neighborhood elements of the starting point; Calculate the mean and mean variance of the eight neighborhood element values ​​of the starting point; The mean similarity range is set according to the mean variance of the eight neighborhood elements of the starting point, and the eight neighborhood elements of the starting point are judged: when the eight neighborhood elements of the starting point are within the mean similarity range, the eight neighborhood elements of the starting point and the starting point are divided into one set; when the eight neighborhood elements of the starting point are not within the mean similarity range, the eight neighborhood elements of the starting point are not processed, and the eight neighborhood elements of the starting point are divided in turn according to this step to obtain the first set; Iteratively judge the eight-neighborhood elements of all elements in the set in the same way as the first set, until there are no elements in the eight-neighborhood elements of all elements in the set that are in a range close to the mean, and obtain the first value concentration area and the remaining elements; The element with the largest value is selected from the remaining elements as the new initial point, and the second value concentration area is obtained in the same way as the first value concentration area, and so on, to obtain all the value concentration areas in the gray level co-occurrence matrix; The largest value concentration region and other value concentration regions in the gray level co-occurrence matrix are obtained according to the sum of the element values ​​in each value concentration region; The center point of the other value concentration area in the gray level co-occurrence matrix under the optimal angle is taken as the origin, and the value concentration direction of the other value concentration area is calculated by using the angle between the line connecting each element and the origin in the other value concentration area and the X-axis; The degree of numerical aggregation in other numerical concentration areas is obtained by using the distance between the element farthest from the origin in the numerical concentration direction and the origin in other numerical concentration areas; The numerical change trend value of other numerical concentration areas is calculated by using the numerical concentration direction and numerical aggregation degree of other numerical concentration areas; Utilize the numerical change trend values ​​of other numerical concentration areas to detect whether there are defects on the surface of the solid color cloth to be tested; The largest value concentration area and other value concentration areas in the gray level co-occurrence matrix are obtained as follows: Count the sum of all element values ​​in each value concentration area, take the value concentration area with the largest sum of element values ​​as the largest value concentration area in the gray level co-occurrence matrix, and the remaining value concentration areas as other value concentration areas in the gray level co-occurrence matrix; The expression of the numerical concentration direction of the other numerical concentration areas is as follows: In the formula, T represents the direction of value concentration in other value concentration areas, It represents the angle between the line connecting the element b and the origin in other value concentration areas and the X-axis. Indicates the number of elements in the region of other numerical sets; The expression of the numerical aggregation degree of the other numerical concentration areas is as follows: Where d' represents the degree of numerical aggregation in other numerical concentration areas, ( ) are the coordinates of the origin in the other numerical concentration areas, ( ) is the coordinate of the element farthest from the origin in the direction of the value concentration in the other value concentration areas; The expression of the numerical change trend value of the other numerical concentration area is as follows: In the formula, It represents the value change trend value of other value concentration areas, T represents the value concentration direction of other value concentration areas, and d' represents the value aggregation degree of other value concentration areas.

2. The method for detecting cloth surface defects based on computer vision according to claim 1, characterized in that: The process of detecting whether there are defects on the surface of the solid color cloth to be detected is as follows: A threshold is set to judge the numerical change trend value of other numerical concentration areas: when the numerical change trend value of other numerical concentration areas is greater than the threshold value, it is determined that there are defects on the surface of the solid color cloth to be detected.

3. A cloth surface defect detection system based on computer vision, characterized in that: Including acquisition unit, processing unit, calculation unit and detection unit: The acquisition unit uses an industrial camera arranged just above the cloth to acquire the surface image of the solid color cloth to be inspected; The processing unit processes the image collected by the collection unit to obtain the grayscale co-occurrence matrix of the solid-color cloth to be detected at several different angles and the value concentration area in the grayscale co-occurrence matrix at each angle, and then obtains the maximum value concentration area and other value concentration areas in the grayscale co-occurrence matrix at each angle according to the sum of the element values ​​of the value concentration area; The gray level co-occurrence matrix is ​​obtained as follows: Performing tilt correction processing on the cloth surface image to obtain the cloth surface image after correction processing; Grayscale processing is performed on the cloth surface image after correction processing to obtain a grayscale image of the pure color cloth surface to be detected; Construct a grayscale matrix using the grayscale values ​​and positions of all pixels in the grayscale image; Construct a gray-level co-occurrence matrix using all gray-level values ​​in the gray-level matrix; The value concentration area in the gray level co-occurrence matrix at each angle is obtained as follows: Select the element with the largest value in the gray level co-occurrence matrix as the starting point, and obtain the eight neighborhood elements of the starting point; Calculate the mean and mean variance of the eight neighborhood element values ​​of the starting point; The mean similarity range is set according to the mean variance of the eight neighborhood elements of the starting point, and the eight neighborhood elements of the starting point are judged: when the eight neighborhood elements of the starting point are within the mean similarity range, the eight neighborhood elements of the starting point and the starting point are divided into one set; when the eight neighborhood elements of the starting point are not within the mean similarity range, the eight neighborhood elements of the starting point are not processed, and the eight neighborhood elements of the starting point are divided in turn according to this step to obtain the first set; Iteratively judge the eight-neighborhood elements of all elements in the set in the same way as the first set, until there are no elements in the eight-neighborhood elements of all elements in the set that are in a range close to the mean, and obtain the first value concentration area and the remaining elements; The element with the largest value is selected from the remaining elements as the new initial point, and the second value concentration area is obtained in the same way as the first value concentration area, and so on, to obtain all the value concentration areas in the gray level co-occurrence matrix; The calculation unit obtains the largest value concentration region and other value concentration regions in the gray level co-occurrence matrix at each angle according to the sum of the element values ​​in each value concentration region; When the gray-level co-occurrence matrix at each angle includes the most values ​​in all other value concentration areas, the gray-level co-occurrence matrix at the corresponding angle is recorded as the gray-level co-occurrence matrix at the optimal angle; The center point of the other value concentration area in the gray level co-occurrence matrix under the optimal angle is taken as the origin, and the value concentration direction of the other value concentration area is calculated by using the angle between the line connecting each element and the origin in the other value concentration area and the X-axis; The degree of numerical aggregation in other numerical concentration areas is obtained by using the distance between the element farthest from the origin in the numerical concentration direction and the origin in other numerical concentration areas; The numerical change trend value of other numerical concentration areas is calculated by using the numerical concentration direction and numerical aggregation degree of other numerical concentration areas; The detection unit, the computer detects whether there is a defect on the surface of the solid color cloth to be detected according to the numerical change trend value of other numerical concentration areas obtained by the calculation unit; The largest value concentration area and other value concentration areas in the gray level co-occurrence matrix are obtained as follows: Count the sum of all element values ​​in each value concentration area, take the value concentration area with the largest sum of element values ​​as the largest value concentration area in the gray level co-occurrence matrix, and the remaining value concentration areas as other value concentration areas in the gray level co-occurrence matrix; The expression of the numerical concentration direction of the other numerical concentration areas is as follows: In the formula, T represents the direction of value concentration in other value concentration areas, It represents the angle between the line connecting the element b and the origin in other value concentration areas and the X-axis. Indicates the number of elements in the region of other numerical sets; The expression of the numerical aggregation degree of the other numerical concentration areas is as follows: Where d' represents the degree of numerical aggregation in other numerical concentration areas, ( ) are the coordinates of the origin in the other numerical concentration areas, ( ) is the coordinate of the element farthest from the origin in the direction of the value concentration in the other value concentration areas; The expression of the numerical change trend value of the other numerical concentration area is as follows: In the formula, It represents the value change trend value of other value concentration areas, T represents the value concentration direction of other value concentration areas, and d' represents the value aggregation degree of other value concentration areas.

Citation Information

Patent Citations

  • Cloth defect marking method and system based on machine vision

    CN114529549A