Defect detection method for printed cloth
By extracting the luminance channel in the Lab color space and combining it with Z-score values and sliding window calculations to determine the difference, the problem of low efficiency and insufficient accuracy in defect detection in digital printing is solved, achieving real-time and accurate defect detection to meet the needs of different production lines.
Patent Information
- Application Number
- PCT/CN2024/139208
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-11-26
- Filing Date
- 2024-12-13
- Publication Date
- 2026-06-04
AI Technical Summary
Existing defect detection methods are inefficient in digital printing and cannot adapt to complex image features. Traditional methods lack sufficient detection accuracy, while machine learning methods are time-consuming and cannot meet the needs of real-time detection.
The luminance channel is extracted using the Lab color space, and the difference value is calculated by combining the Z-score value and the sliding window. The height of the pattern is determined by matching search and normalized coefficient matching method. The similarity is calculated by histogram to determine image replacement, thereby reducing the false judgment of image offset and realizing real-time defect detection.
It improves the accuracy and practicality of detection, reduces processing time, adapts to the needs of different production lines, meets real-time detection requirements, and provides accurate defect detection results.
Smart Images

Figure CN2024139208_04062026_PF_FP_ABST
Abstract
Description
Methods for detecting defects in printed fabrics Technical Field
[0001] This invention relates to the field of printing technology, and more specifically to a method for detecting defects in printed fabrics. Background Technology
[0002] In the digital printing industry, image quality directly impacts a product's market competitiveness. Traditional defect detection methods rely primarily on manual inspection, which is inefficient and susceptible to human error, failing to meet the demands of modern production. With the development of machine vision and image processing technologies, automated defect detection methods based on computer vision are gradually becoming an industry trend.
[0003] Current defect detection methods in the market mostly rely on fixed thresholds or simple image comparisons, making it difficult to adapt to various complex image features and defect types. This is especially true in digital printing, where the diversity and complexity of images render traditional methods insufficient in terms of accuracy and reliability. Meanwhile, while some machine learning detection methods show good accuracy, they are often time-consuming and cannot meet the demands of production implementation. Therefore, the need for a real-time defect detection system in the assembly line production environment of printing companies is becoming increasingly urgent. Summary of the Invention
[0004] Methods for detecting defects in printed fabrics:
[0005] Acquire images of the printed fabric to be inspected and determine the height of the pattern repeat;
[0006] From the acquired images, extract an image containing n flower repetitions as a standard image, where n≥1;
[0007] The standard image is converted to the Lab color space and the L channel is extracted to obtain the first image;
[0008] The first image is segmented to obtain a first image sub-image, and the sum of the pixels in each column of the first image sub-image is counted and saved.
[0009] At least one image of the printed fabric to be detected is obtained from the acquired images; the height of the image to be detected is consistent with that of the standard image;
[0010] The image to be detected is converted to the Lab color space and the L channel is extracted to obtain a second image;
[0011] The second image is segmented to obtain a second image sub-image, and the sum of the pixels in each column of the second image sub-image is calculated.
[0012] Defects in printed fabric are detected based on the sum of the pixels in each column of the first image sub-image and the sum of the pixels in each column of the second image sub-image.
[0013] Furthermore, the height of the flower cycle is determined using a matching search and normalized coefficient matching method.
[0014] Furthermore, the conversion method includes:
[0015] Convert the image from BGR format to RGB format;
[0016] The color space is converted from RGB format to XYZ color space and then to Lab color space.
[0017] Furthermore, the method for detecting defects in printed fabric includes:
[0018] Calculate the difference values of each column of the second image sub-image. The difference value is the minimum value among the differences between the sum of the pixels in the current column of the second image sub-image and the sum of the pixels in each column of the corresponding column of the first image sub-image and the columns before and after it.
[0019] The Z-score is calculated from the difference value.
[0020] The printed fabric is deemed to have defects when the Z-score value of at least a set column is greater than a set threshold.
[0021] Furthermore, the formula for calculating the Z-score is as follows:
[0022] Where, Δ n The variance is represented by n, the image width by n, the population mean by μ, and the population standard deviation by σ. i This represents the Z-score value of the i-th column.
[0023] Furthermore, histogram calculation is performed on the acquired images. When the similarity between the histogram of the image to be detected and the histogram of the standard image is less than a set threshold, it is determined that the printed fabric has been replaced.
[0024] Furthermore, the height of each individual repeat was redefined after the printed fabric was replaced.
[0025] Furthermore, the formula for calculating the similarity is as follows: Where h 1,i and h 2,i These represent the histogram values of the standard image and the image to be detected at grayscale value i, respectively.
[0026] The beneficial effects of this invention are as follows:
[0027] This invention can adapt to images of different types and heights, enabling the entire inspection system to operate stably in various printing environments. It allows for flexible adjustment of inspection parameters to meet the specific needs of different production lines, improving overall practicality and operability. The invention employs Z-score metric, ensuring sufficient accuracy while significantly reducing program processing time. It can match the inspection requirements of real-time digital printing production lines, enabling real-time defect detection on the production line and meeting the need for immediate feedback during production. Furthermore, it effectively reduces misjudgments caused by image offset, providing more accurate defect detection results. Attached Figure Description
[0028] Figure 1 is a flowchart of the defect detection method for printed fabrics.
[0029] Figure 2 is a schematic diagram of the foreground image and an image containing a single floral repeat.
[0030] Figure 3 is a schematic diagram of the difference value calculation.
[0031] Figure 4 is a schematic diagram of the defect identification and judgment effect. Detailed Implementation
[0032] The present invention will be described in detail below with reference to the accompanying drawings and embodiments. The described embodiments are only intended to facilitate the understanding of the present invention and do not constitute any limitation thereof.
[0033] The specific process of this invention embodiment is shown in Figure 1. The detection system uses a line scan camera to continuously acquire images of the printed fabric in the production line. At the start of acquisition, the detection system needs to synchronize with the printing system running on the production line. Since the production line requires rollers for operation, the printing system drives the production line by setting the rolling speed of the rollers. Simultaneously, it can acquire the electrical signals regularly emitted by the encoder in the rollers due to the rolling. After this signal is transmitted to the detection system, the detection system can obtain the operating speed of the production line, thus matching the acquisition frequency of the line scan camera with the operating speed of the production line platform. This ensures that there is almost no vertical stretching between the acquired printed images, reducing interference factors during defect detection and improving the accuracy of defect detection.
[0034] The detection system of this invention uses the first image taken after the production line speed has stabilized after image acquisition begins as the preceding image. In printed pattern design, a "repeated pattern" refers to a repeating unit of a pattern, or a basic unit in which a complete pattern repeats on the printed fabric. Each "repeated pattern" includes all the pattern elements, and when this unit is continuously repeated on the fabric, it forms the overall printed pattern.
[0035] The image first selects a region containing multiple flower patterns from the preceding image. A 100px x 100px small image in the upper left corner is used as the search template to ensure the basic features of the flower patterns are captured. To improve matching efficiency, the search area is set to 300 pixels to the left of the standard image multiplied by the original image height. The matching degree is calculated using a normalized coefficient matching method, calculated using the following formula:
[0036] Where T(x′,y′) is the template image and I(x,y) is the search region image. After the template matching algorithm runs, it outputs a matching result matrix R(x,y), with a length and width of (W-w+1)×(H-h+1), where W and H are the width and height of the search region image, respectively, and w and h are the width and height of the template image, respectively.
[0037] If the matching result is higher than a set threshold, the matching region with the lowest vertical pixel height is selected to obtain the height of the flower return. The height of the flower return is used for unified processing in subsequent image acquisition and detection processes. The formula for calculating the height of the flower return is: Flower return height = min(h match if P match >Matching threshold, where h match For the matched height, P match The matching degree is the value of each R(x,y) in the matching result matrix.
[0038] Figure 2 shows a pre-printed image containing multiple repeats and a printed image after retaining the height of a single repeat. The area within the box in the figure represents the region of a single repeat height. Therefore, after determining this image, the detection system stores the image with the height of a single repeat as a standard image. This saves on image storage size and reduces the computational load for subsequent defect detection, improving the efficiency of the defect detection algorithm. Simultaneously, the system retains the height of a single repeat as the acquisition height for subsequent images to be detected. This allows for image acquisition based on one repeat at a time during subsequent image acquisition, ensuring that each acquired image to be detected maintains consistency with the standard image in terms of basic content, reducing detection errors and improving detection efficiency.
[0039] In this embodiment of the invention, a standard image is converted into the Lab color space, and the L channel (luminance channel) is separated from the Lab color space to obtain a first image, thereby enhancing the luminance features of the image for subsequent defect detection processing.
[0040] Convert the current standard image from BGR to RGB format: R=B,G=G,B=R
[0041] Then convert RGB to XYZ color space: X = 0.4124564·R + 0.3575761·G + 0.1804375·BY = 0.2126729·R + 0.7151522·G + 0.0721750·BZ = 0.0193339·R + 0.1191920·G + 0.9503041·B
[0042] Then convert the XYZ color space to the Lab color space:
[0043] Where X n ,Y n Z n The XYZ values are the standard white point values, and f(t) is defined as (where... ):
[0044] The first image is divided into several sub-images according to a set sub-image segmentation height. The sub-image segmentation formula is: At the same time, the width of each sub-image is the same as that of the current first image.
[0045] For each segmented first image sub-image, perform statistical analysis on the pixels in each column and calculate the sum of the pixels. Where H is the sub-image segmentation height, and I(x,y) is the pixel value in the x-th column and y-th row of the image. The pixel sum of each column of the first image sub-image is calculated and saved. Due to the different types of defects in digital printing images compared to traditional printing, they are more difficult to distinguish, and the contrast is usually lower. Uneven printing often occurs in digital printing due to the blockage of a certain color printhead. The contrast is more difficult to distinguish than the streaks in traditional printing. Moreover, since this uneven printing is often caused by more than one printhead, coupled with the variable colors of digital printing itself, such defects often do not present a significant straight line shape in the vertical direction, which easily generates more interference factors. Therefore, the detection system traverses each column of the L-channel image and calculates the sum of the image pixels in each column. This can blur the influence of pixels in a specific column and focus more on outliers in the overall statistical significance of the image.
[0046] This invention utilizes a line scan camera to acquire images of printed fabric on an assembly line, continuously obtaining images to be detected. The height of the image to be detected is equal to the height of a single pattern repeat. In other words, the acquired image is divided equally according to the height of a single pattern repeat to obtain the image to be detected. The image to be detected is converted to the Lab color space using the aforementioned conversion method to obtain a second image. The second image is then divided into second image sub-images using the aforementioned segmentation method. The height and width of the second image sub-images are the same as those of the first image sub-images. The sum of the pixels in each column of the second image sub-image is calculated using the aforementioned statistical method.
[0047] This invention utilizes a sliding window to calculate and eliminate the influence of lateral image offset values. Since defects in digital printing often do not present a significant straight line shape vertically, if only the deviation of the pixel sum of corresponding columns between the standard image and the image to be detected is considered, the presence of lateral offset could lead to even greater errors. Therefore, this study uses a sliding window to mitigate the influence of lateral image offset values. Specifically, for the pixel sum of any column in the second image sub-image, the system compares and subtracts it from the pixel sum of the corresponding column and the two columns before and after it in the first image sub-image, for a total of five columns. The smallest difference is taken as the difference value of the pixel sum of that column in the image to be detected. The correspondence in the image is shown in Figure 3. Let the second image sub-image examine the pixel sum of the nth column, and let the pixel sum of that column be Σ. n Then, it corresponds to columns n-2 to n+2 in the first image sub-image, and let their sums be Σ′. n-2 ,Σ′ n-1 ,Σ′ n ,Σ′ n+1 ,Σ′ n+2 Then, the difference value in the nth column of the second image sub-image that needs to be obtained at this time is min. n-2≤i≤n+2 {|Σ n -Σ i ′|}. By following this pattern, the difference values for all columns in the second image sub-image can be obtained.
[0048] This invention calculates the Z-score corresponding to the difference values in each column. The Z-score is a statistical measure used to describe the relative position of a specific data point within a population. Specifically, the Z-score represents the distance between a data point and the population mean, expressed in standard deviation. This helps to understand whether the data point is above or below the mean, and the degree of deviation. Therefore, the Z-score can help determine whether a pixel difference significantly deviates from the normal range of pixel variation, and is a commonly used statistical method. In the specific calculation, it is assumed that the previously obtained difference values for all columns are Δ1-Δ... nWhere n is the image width, the first step is to calculate the overall mean μ and the overall standard deviation σ of this set of data, as shown in formulas (1)-(2). Then, the Z-score of each data point can be calculated. For the i-th column, the Z-score value Z i The calculation formula is shown in formula (3).
[0049] Finally, defect assessment is performed. The Z-score Z for each column is obtained. i The system then identifies outliers to determine if the Z-score of a column is excessively biased. Generally, an absolute Z-score greater than a certain threshold (such as 2 or 3) is considered an outlier. For example, in common image comparisons, an absolute value greater than 2 indicates that the data point deviates from the mean by more than 2 standard deviations, which may be a potential outlier; an absolute value greater than 3 indicates that the data point deviates from the mean by more than 3 standard deviations, which is usually considered an outlier.
[0050] Meanwhile, as known from the previous steps, the height of the current detected image is the image height of the previously determined single pattern image. Since the threshold for Z-score outlier determination is related to image height, applying a fixed threshold to all detected images of different heights during actual detection will cause significant deviations. A threshold suitable for certain image heights might classify most detected images as defective at smaller heights (or classify most detected images as defect-free at larger heights). Through actual experiments, the system uses a certain threshold as the outlier determination threshold for the Z-score of the sub-image with height H. It should be noted that, as mentioned earlier, defects in digital printing exhibit lateral shifts. A single outlier may not necessarily represent a definite defect, and defects often exhibit lateral shifts, typically appearing consecutively in multiple columns. Therefore, the system analyzes the Z-score values of all columns. If k consecutive columns of Z-score values are outliers, a defect is determined to exist there. In actual operation, depending on the characteristics of different printed fabrics, k can be set to a number between 5 and 10. The detection results are shown in Figure 4. In most cases, defects in digital printing images can be successfully identified and judged.
[0051] In the process of detecting printing defects, this invention also compares the histogram statistics of the standard image and the current image to be detected to determine whether the printed fabric in the production line has been replaced in a short time. Histogram calculations are performed on the standard image and the image to be detected, recording the number of pixels with different grayscale or brightness values. The calculation formula is: H(i)=∑ (x,y)∈RI(x,y) = i, where H(i) represents the number of pixels with gray value i, I(x,y) is the gray value of the pixel, and R is the total number of pixels in the image.
[0052] Then, the histogram similarity metric between the current image to be detected and the standard image is calculated. Where h 1,i and h 2,i These represent the histogram values of the standard image and the current image to be detected at grayscale value i, respectively. If the calculated similarity is lower than a set threshold, the current image to be detected is determined to be different from the standard image, a new standard image is determined, and the flower return height is recalculated. The set threshold is determined based on the actual flower return pattern.
[0053] The above histograms have low computational complexity, allowing for rapid comparison through simple mathematical operations. They are also unaffected by changes in image size and position, making them suitable for rapid filtering and matching of large-scale images.
[0054] In this field, existing deep learning-based defect detection methods have an efficiency of 0.1–1 second for detecting 200*200 pixel images. The method of this invention achieves a detection efficiency of 0.2 seconds for 16384*5000 pixel images after multi-threaded processing.
[0055] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. Defect detection methods for printed fabrics: Acquire images of the printed fabric to be inspected and determine the height of the pattern repeat; From the acquired images, extract an image containing n flower repetitions as a standard image, where n≥1; The standard image is converted to the Lab color space and the L channel is extracted to obtain the first image; The first image is segmented to obtain a first image sub-image, and the sum of the pixels in each column of the first image sub-image is counted and saved. At least one image of the printed fabric to be detected is obtained from the acquired images; the height of the image to be detected is consistent with that of the standard image; The image to be detected is converted to the Lab color space and the L channel is extracted to obtain a second image; The second image is segmented to obtain a second image sub-image, and the sum of the pixels in each column of the second image sub-image is calculated. Defects in printed fabric are detected based on the sum of the pixels in each column of the first image sub-image and the sum of the pixels in each column of the second image sub-image.
2. The method of claim 1, wherein, The height of the flower cycle is determined by matching search and normalized coefficient matching method.
3. The method of claim 1, wherein, The conversion method includes: Convert the image from BGR format to RGB format; The color space is converted from RGB format to XYZ color space and then to Lab color space.
4. The method of claim 1, wherein, The method for detecting defects in printed fabrics includes: Calculate the difference values of each column of the second image sub-image. The difference value is the minimum value among the differences between the sum of the pixels in the current column of the second image sub-image and the sum of the pixels in each column of the corresponding column of the first image sub-image and the columns before and after it. The Z-score is calculated from the difference value. The printed fabric is deemed to have defects when the Z-score value of at least a set column is greater than a set threshold.
5. The method of claim 1, wherein, The formula for calculating the Z-score value is as follows: where Δ n represents the difference value, n represents the image width, μ represents the overall mean, σ represents the overall standard deviation, Z i represents the Z-score value of the i-th column.
6. The method of claim 1, wherein, Histograms are calculated on the acquired images. When the similarity between the histogram of the image to be detected and the histogram of the standard image is less than a set threshold, it is determined that the printed fabric has been replaced.
7. The method of claim 6, wherein, The height of each individual repeat was determined after the printed fabric was replaced.
8. The method of claim 6, wherein, The calculation formula of the similarity is where h 1,i and h 2,i respectively represent the histogram values of the standard image and the image to be detected at the gray value i.
9. An electronic device comprising a memory and a processor, the memory storing a computer program configured to be executed by the processor, the computer program including instructions for performing the method of any one of claims 1 to 8.
10. A storage medium storing a computer program, which, when executed by a computer, implements the method of any one of claims 1 to 8.
Citation Information
Patent Citations
Automatic eliminating method for redundant image data of capsule endoscope
CN102096917A
Automatic fabric pattern finishing method based on machine vision
CN105421012A
Automatic cloth inspection machine using contact image sensor
CN105738376A
Method, device and equipment for detecting appearance blemish of screw
CN108982540A
A rapid damage detection method for a 330kV cable porcelain insulator sleeve
CN113706455A