Carton printing defect detection method and system based on visual identification

By using grayscale symbiosis matrix and change symbiosis matrix in carton printing defect detection, combined with the grayscale characteristics and degree of change of pixel points, the problem of low detection accuracy in the prior art is solved, and more efficient and accurate defect detection is achieved.

CN119624971AActive Publication Date: 2025-03-14GUANGZHOU LIANWANG PAPER

Patent Information

Application Number
CN202510161834.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-14
Publication Date
2025-03-14
Estimated Expiration
2045-02-14

AI Technical Summary

Technical Problem

The prior art has the problem of low detection accuracy in carton printing defect detection, especially when identifying gradients and lighter colors, the detection algorithm is insufficient to detect and miss or false detections are prone to occur.

Method used

By collecting carton images, the grayscale characteristics of each pixel point are calculated, and a grayscale symbiosis matrix and a change symbiosis matrix are established based on these features. Combining the grayscale differences and distribution relationships between pixel points, the degree of change and defects of each pixel point are accurately quantified, thereby identifying defective pixel points.

Benefits of technology

It improves the accuracy and robustness of defect detection, enhances the sensitivity to complex backgrounds and subtle texture changes, and significantly improves the feature expression ability and the efficiency of defect detection in image processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119624971A_ABST
    Figure CN119624971A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of image data processing, in particular to a carton printing defect detection method and system based on visual identification, and the method comprises the steps: obtaining a carton image through an image collection device, calculating the gray feature quantity of a pixel point based on the gray value of each pixel point in the image and the gray difference in the neighborhood of the pixel point, and calculating the gray feature quantity of the pixel point; the gray scale is used for reflecting gray scale change conditions of local areas; the change degree of the pixel points is calculated based on the gray feature quantity, the change degree represents the clutter degree of the pixel points, and a change degree co-occurrence matrix is constructed to describe the joint distribution characteristic between different change degrees. Calculating the defect degree of each pixel point according to the change degree co-occurrence matrix; the defect degree of each pixel point is calculated, and the pixel points with the defect degrees larger than a set threshold value are responded to be defective pixel points. The problem that the accuracy of carton printing defect detection is not high is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image data processing, and more specifically, to a method and system for detecting carton printing defects based on visual recognition. Background Art

[0002] In modern industrial production, cartons are a common and important packaging material. Their quality is not only directly related to the protective effect of the product, but also has an important impact on the brand image and user experience. High-quality carton printing can convey clear and accurate product information and enhance the competitiveness of goods in the market. However, in the process of printing cartons, due to factors such as aging equipment, lax process control or operational errors, various defects often occur, such as screen color difference, blurred patterns, incomplete printing, text misalignment or color deviation. These defects not only seriously affect the appearance quality of the carton, but may also lead to incomplete transmission of product information on the packaging, which in turn has an adverse impact on subsequent logistics, transportation, product display and sales.

[0003] Traditional methods of detecting defects in carton printing usually rely on manual inspection, that is, experienced quality inspectors observe the printing effect on the surface of the carton with the naked eye to determine whether there are defects. Although manual inspection has the advantages of flexibility and instant adjustment, its detection results are often affected by subjective judgment and have great uncertainty. At the same time, manual inspection is inefficient, especially in large-scale production lines, where it is difficult to keep up with the fast production pace. In addition, long-term repetitive operations can easily cause visual fatigue of inspectors, further reducing the accuracy and consistency of detection.

[0004] The patent application document with application publication number CN114757954A discloses a method for detecting color difference defects in carton printing based on an artificial intelligence system. The patent application document calculates the illumination color difference value and the roughness color difference value by fitting the illumination color difference equation and the roughness color difference equation, removes the influence of illumination and roughness on the color difference value calculation, and thus obtains accurate printing color difference values, effectively eliminating the influence of the color difference collected caused by light intensity and the surface roughness of the printed product.

[0005] However, although the above technical solution improves the accuracy of screen color difference defect detection, defect detection of carton printing based solely on light intensity and surface roughness of printed products may not be able to fully identify gradients and lighter areas, resulting in insufficient sensitivity of the detection algorithm to such defects, missed detections or false detections, and the problem of low defect detection accuracy. Summary of the invention

[0006] In order to solve the problem of low defect detection accuracy mentioned in the above background technology, the present invention provides solutions in the following aspects.

[0007] In a first aspect, the present invention provides a method for detecting carton printing defects based on visual recognition, comprising: collecting a carton image; calculating a first Grayscale features of pixels , where Indicates The gray value of a pixel, Indicates the The pixel point is the center of the setting window. Pixels and The grayscale difference between pixels. is the total number of pixels in the set window; a grayscale co-occurrence matrix is ​​established based on the grayscale features of each pixel, and the grayscale features of each pixel and its neighboring pixel on the right in the set window are combined to obtain the data volume proportion of each combination in the grayscale co-occurrence matrix and the grayscale feature difference of each pixel and its neighboring pixel on the right in the set window; the transformation degree of each pixel is calculated, and the transformation degree is positively correlated with the data volume proportion and negatively correlated with the grayscale feature difference; a change co-occurrence matrix is ​​established based on the change degree of each pixel, and the first Defect level of each pixel ), where Indicates The distance from the pixel point to the diagonal of the change co-occurrence matrix, Indicates The proportion of the data volume in the change co-occurrence matrix of the combination of the change degree of the pixel point and its adjacent pixel point on the right in the set window, Indicates The degree of change of pixels, represents the normalization function, is a natural constant; a pixel point whose defect degree is greater than a set threshold is a defective pixel point.

[0008] The above technical solution collects carton images and calculates the grayscale co-occurrence matrix and the change co-occurrence matrix based on the grayscale features of each pixel. It combines the grayscale differences and distribution relationships between pixels to accurately quantify the degree of change and defect of each pixel. Then, based on the degree of defect, it accurately identifies the defective pixels in the image, thereby improving the accuracy of defect detection.

[0009] Furthermore, the degree of change is: ; In the formula, Indicates The degree of change of pixels, Indicates Pixels and The proportion of the grayscale feature combination of pixels in the grayscale co-occurrence matrix, Indicates The grayscale features of pixels, Indicates The grayscale features of pixels, Indicates the The total number of grayscale feature combinations within the set window centered at pixels.

[0010] The above technical solution can consider the spatial distribution and local differences of grayscale features when quantifying the degree of change. The data volume ratio reflects the global weight of the grayscale combination between pixels, and the exponential decay of the grayscale difference suppresses the influence of noise on the degree of change, thereby enhancing the sensitivity to subtle texture changes and adaptability to complex backgrounds, and ultimately improving the feature expression ability and defect detection accuracy in the image processing process.

[0011] Furthermore, the degree of change is: ; In the formula, Indicates The degree of change of pixels, Indicates Pixels and The proportion of the grayscale feature combination of pixels in the grayscale co-occurrence matrix, Indicates The grayscale features of pixels, Indicates The grayscale features of pixels, Indicates the The total number of grayscale feature combinations within the set window centered at pixels. represents an empirical constant.

[0012] The above technical solution introduces weight parameters to balance the proportion of grayscale feature combinations in the grayscale co-occurrence matrix and the influence of the grayscale feature difference of adjacent pixels on the degree of change. The empirical constants can be adjusted to adapt to the distribution and noise level of different image features. This design not only effectively enhances the quantification ability of significantly changed areas, but also suppresses the interference of background fluctuations and subtle noise, thereby improving the stability of change detection and adaptability to complex texture structures, providing more accurate and reliable feature expression for subsequent image analysis.

[0013] Furthermore, the gray-level co-occurrence matrix is ​​established, including: counting the frequency of gray-level feature combinations of each pixel and its adjacent pixel on the right within a set window; and normalizing the frequency into a probability value to construct the gray-level co-occurrence matrix.

[0014] Furthermore, an area array camera or a CCD camera is used to collect the carton image.

[0015] Furthermore, the method also includes denoising and grayscale processing of the carton image.

[0016] The above technical solution effectively reduces the interference of noise and the complexity of color information in the image by denoising and grayscale processing the carton image. The denoising process can remove random noise and background interference in the image, improve the purity of pixel features and the accuracy of texture information, while the grayscale process simplifies the multi-channel color image into a single-channel grayscale image, which not only reduces the computational complexity but also retains the brightness and edge features of the image, which helps the accuracy and efficiency of subsequent feature extraction, co-occurrence matrix construction and defect detection, and overall improves the adaptability and robustness of the detection system to complex printed patterns.

[0017] Furthermore, the method also includes performing expansion and corrosion operations on the defective pixel points.

[0018] The above technical solution effectively improves the connectivity and integrity of the defective area by dilating and corroding the detected defective pixels; the dilation operation can expand the boundaries of the defective pixels, fill small gaps or broken areas, and make the detected defects more continuous, while the corrosion operation can remove noise and pseudo-defects at the edges, eliminate misjudgments and burrs during the detection process, and thus enhance the clarity and authenticity of the defective area. This method combined with morphological processing not only improves the accuracy and reliability of the detection results, but also provides a more standardized and complete defect data expression for subsequent defect classification and repair.

[0019] In a second aspect, the present invention provides a carton printing defect detection system based on visual recognition, comprising a memory and a processor, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, any one of the above-described carton printing defect detection methods based on visual recognition is implemented.

[0020] The beneficial effects of the present invention are: The present invention improves the image quality and the accuracy of feature extraction by collecting carton images and combining denoising and grayscale processing; extracts details and texture information in the image by calculating pixel grayscale features and constructing a grayscale co-occurrence matrix; further introduces a calculation method for a change co-occurrence matrix and a defect degree to accurately quantify the change and adjacency of pixel points, thereby significantly enhancing the robustness and sensitivity of defect detection; performs expansion and corrosion operations on defective pixels to enhance the coherence and visual discernibility of the defective area; realizes automated, precise and efficient carton printing defect detection, significantly improving the quality control capability in industrial production. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] By reading the following detailed description with reference to the accompanying drawings, the above and other objects, features and advantages of the exemplary embodiments of the present invention will become readily understood. In the accompanying drawings, several embodiments of the present invention are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein: Figure 1 is a flowchart schematically showing a method for detecting carton printing defects based on visual recognition according to an embodiment of the present invention; Figure 2 It is a structural block diagram schematically showing a carton printing defect detection system based on visual recognition according to an embodiment of the present invention. DETAILED DESCRIPTION

[0022] 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 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 those skilled in the art without creative work are within the scope of protection of the present invention.

[0023] The specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.

[0024] An embodiment of a method for detecting carton printing defects based on visual recognition.

[0025] like Figure 1 As shown, a flow chart of a method for detecting carton printing defects based on visual recognition according to an embodiment of the present invention comprises the following steps: S1: Collect carton images.

[0026] In one embodiment, an area array camera or a CCD camera can be used to capture images of cartons to ensure that high-quality image data of the carton surface is obtained. The area array camera can accurately capture the subtle texture and local features of the carton surface due to its large-range imaging capability and excellent resolution, and is particularly suitable for the detection of complex surface features; while the CCD camera can also obtain images with a high signal-to-noise ratio in a weak light environment due to its high sensitivity and low noise characteristics, which is particularly important for dynamic monitoring on the carton production line.

[0027] In addition, for the tiny noise points and external light interference generated on the carton surface during manufacturing, storage or transportation, denoising is required after image acquisition. This step can not only effectively filter out random noise, but also significantly retain the edge and texture features of the carton surface, thereby improving the accuracy of subsequent feature analysis. The choice of denoising algorithm can be optimized according to the characteristics of the specific carton image. For example, the median filter method can handle scattered noise well while avoiding blurring the edges; while Gaussian filtering is more suitable for noise suppression of smooth surface textures.

[0028] After denoising, the image needs to be grayscaled to convert the multi-channel color image into a single-channel grayscale image. The main function of grayscale is to simplify the data structure so that each pixel of the image contains only one grayscale value, which is convenient for the subsequent algorithm to analyze the brightness change. Especially in the detection of carton surface defects, grayscale processing can highlight the light intensity distribution characteristics of the target area, effectively weaken the impact of color interference on the detection results, and reduce the computational complexity and storage pressure of the algorithm. Through high-quality image acquisition, precise denoising and efficient grayscale operation, the entire pre-processing process can provide a solid data foundation for the subsequent detection and classification of carton surface defects, significantly improve the detection accuracy and reliability, and provide strong technical support for the automated quality monitoring of industrial production.

[0029] S2: Calculate the grayscale features of each pixel, establish a grayscale co-occurrence matrix based on the grayscale features of each pixel, and calculate the degree of change of each pixel.

[0030] In one embodiment, the calculation Grayscale features of pixels , where Indicates The gray value of a pixel, Indicates the The pixel point is the center of the setting window. Pixels and The grayscale difference between pixels. is the total number of pixels in the setting window; The calculation of the grayscale features of a pixel combines the grayscale differences of its surrounding neighborhood pixels, which can effectively extract local texture information of the image, thereby enhancing sensitivity to detail changes and improving the accuracy of image processing and analysis. It has significant technical advantages in tasks such as defect detection and texture recognition.

[0031] A grayscale co-occurrence matrix is ​​established based on the grayscale features of each pixel, and the grayscale features of each pixel and its adjacent pixel on the right are combined to obtain the data volume proportion of each combination in the grayscale co-occurrence matrix and the grayscale feature difference between each pixel and its adjacent pixel on the right within a set window; if there is no adjacent pixel on the right side of the pixel, the pixel is not considered; Calculate the degree of change of each pixel; In one embodiment, the degree of change is: ; In the formula, Indicates The degree of change of pixels, Indicates Pixels and The proportion of the grayscale feature combination of pixels in the grayscale co-occurrence matrix, Indicates The grayscale features of pixels, Indicates The grayscale features of pixels, Indicates the The total number of grayscale feature combinations within the set window centered at pixels.

[0032] By combining the data proportion of the grayscale feature combination of adjacent pixels in the grayscale co-occurrence matrix and the exponential decay effect of the grayscale feature difference, the degree of change of each pixel is accurately quantified, which significantly improves the sensitivity to local texture changes and edge details of the image, thereby providing stronger differentiation ability and reliability for defect detection, texture analysis and pattern recognition in complex images.

[0033] In another embodiment, the degree of change is: ; In the formula, Indicates The degree of change of pixels, Indicates Pixels and The proportion of the grayscale feature combination of pixels in the grayscale co-occurrence matrix, Indicates The grayscale features of pixels, Indicates The grayscale features of pixels, Indicates the The total number of grayscale feature combinations within the set window centered at pixels. represents an empirical constant.

[0034] By combining the data proportion and grayscale feature difference of the grayscale feature combination of the adjacent pixels on the right in the grayscale co-occurrence matrix, and introducing empirical constants to adjust the relative influence of the data proportion and difference on the degree of change, it is possible to flexibly balance the contribution of the global distribution characteristics and the local detail changes to the degree of change, thereby achieving accurate quantification of the pixel change characteristics and effectively improving the adaptability and accuracy of texture analysis and anomaly detection in complex images.

[0035] S3: Establish a change co-occurrence matrix based on the change degree of each pixel point, and calculate the defect degree of each pixel point.

[0036] In one embodiment, a gray level co-occurrence matrix is ​​established, specifically: First, the grayscale features of each pixel in the image are calculated to quantitatively reflect the change characteristics of the local area, thereby highlighting the texture differences or structural features that may be contained in the image.

[0037] The frequency of grayscale feature combinations of each pixel and its neighboring pixel on the right within the set window is counted; the frequency is normalized into a probability value to construct a grayscale co-occurrence matrix. The generation process of this matrix can significantly reduce the dimension of the original image data while retaining key feature information, providing an efficient and reliable input data basis for subsequent pattern analysis, defect detection, texture classification and other tasks, thereby greatly improving the robustness and adaptability of the image processing system.

[0038] In one embodiment, the calculation Defect level of each pixel ), where Indicates The distance from the pixel point to the diagonal of the change co-occurrence matrix, Indicates The proportion of the data volume in the change co-occurrence matrix of the combination of the change degree of the pixel point and its adjacent pixel point on the right in the set window, Indicates The degree of change of pixels, represents the normalization function, is a natural constant.

[0039] The spacing can reflect the relative positional relationship between the pixel and the overall image pattern, helping to identify abnormal points that deviate from the diagonal; the data volume ratio characterizes the change characteristics of the pixel in the local space and its importance in the overall pattern, enhancing the capture of the change details; the degree of change provides information about the intensity of the change in the local area of ​​the pixel. Combining these factors can more accurately evaluate the significance of the defect area, thereby improving the ability to recognize complex structures or abnormal patterns in the image, so that the solution can still maintain efficient and accurate defect detection when processing images with large changes or complex backgrounds.

[0040] S4: In response, a pixel whose defect degree is greater than a set threshold is defined as a defective pixel.

[0041] The above threshold value may be set to 0.8, and of course, it may be determined according to actual conditions.

[0042] In one embodiment, after the defective pixels are determined, morphological dilation and erosion operations are used to process the defective areas to further optimize the detection results. Specifically, the dilation operation can fill isolated small gaps by expanding the boundaries of the defective pixels, thereby connecting the broken defective areas and making their morphology more complete; while the erosion operation is used to remove noise points and burrs on the edges, eliminating small pseudo-defects caused by detection errors. This combined operation significantly improves the clarity and accuracy of the detection results while enhancing the connectivity of the defective areas, providing a more reliable data basis for subsequent defect classification and repair. Through this process, the real defect situation in the image can be reflected more comprehensively and accurately, thereby improving the applicability and stability of the algorithm in actual industrial detection scenarios.

[0043] The scheme of the present invention systematically realizes the accurate detection of carton printing defects by combining grayscale feature extraction, the construction of grayscale co-occurrence matrix and variation co-occurrence matrix, and the defect degree calculation based on mathematical model; by introducing denoising and grayscale preprocessing, the image quality and analysis efficiency are improved; based on the quantification of variation degree and normalization of defect degree, the sensitivity to different defect types and the accuracy of judgment are enhanced; finally, the boundary integrity and consistency of defect detection results are optimized through expansion and corrosion operations, which effectively improves the adaptability of the detection system to complex printing scenes, and realizes high-precision and high-robustness visual recognition detection effect as a whole, providing an intelligent solution for carton quality control in the industrial field.

[0044] An embodiment of a carton printing defect detection system based on visual recognition: like Figure 2 As shown, a structural block diagram of a carton printing defect detection system based on visual recognition in an embodiment of the present invention includes a processor and a memory.

[0045] The present invention also provides a carton printing defect detection system based on visual recognition. Figure 2 As shown, the system includes a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, a carton printing defect detection method based on visual recognition according to the present invention is implemented.

[0046] The carton printing defect detection system based on visual recognition also includes other components familiar to those skilled in the art, such as a communication interface, and its settings and functions are known in the art, so they will not be described in detail here.

[0047] In the present invention, the aforementioned memory may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, apparatus or device. For example, a computer-readable storage medium may be any appropriate magnetic storage medium or magneto-optical storage medium, such as a resistive random access memory RRAM (Resistive Random Access Memory), a dynamic random access memory DRAM (Dynamic Random Access Memory), a static random access memory SRAM (Static Random-Access Memory), an enhanced dynamic random access memory EDRAM (Enhanced Dynamic Random Access Memory), a high-bandwidth memory HBM (High-Bandwidth Memory), a hybrid memory cube HMC (Hybrid Memory Cube), etc., or any other medium that can be used to store the required information and can be accessed by an application, a module, or both. Any such computer storage medium may be part of a device or accessible or connectable to a device. Any application or module described in the present invention may be implemented using computer-readable / executable instructions that may be stored or otherwise maintained by such a computer-readable medium.

[0048] In the description of this specification, "plurality" or "several" means at least two, such as two, three or more, etc., unless otherwise clearly and specifically defined.

[0049] Although this specification has shown and described a number of embodiments of the present invention, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Those skilled in the art will conceive of many modifications, changes and alternatives without departing from the ideas and spirit of the present invention. It should be understood that in the practice of the present invention, various alternatives to the embodiments of the present invention described herein may be employed.

Claims

1. A carton printing defect detection method based on visual recognition, characterized in that: include: Collect carton images; Calculate the Grayscale features of pixels , where Indicates The gray value of a pixel, Indicates the The pixel point is the center of the setting window. Pixels and The grayscale difference between pixels. is the total number of pixels in the setting window; A grayscale co-occurrence matrix is ​​established based on the grayscale features of each pixel, and the grayscale features of each pixel and its neighboring pixel on the right in the set window are combined to obtain the data volume proportion of each combination in the grayscale co-occurrence matrix and the grayscale feature difference of each pixel and its neighboring pixel on the right in the set window; the transformation degree of each pixel is calculated, and the transformation degree is positively correlated with the data volume proportion and negatively correlated with the grayscale feature difference; Based on the degree of change of each pixel point, a change co-occurrence matrix is ​​established to calculate the Defect level of each pixel ), where Indicates The distance from the pixel point to the diagonal of the change co-occurrence matrix, Indicates The proportion of the data volume in the change co-occurrence matrix of the combination of the change degree of the pixel point and its adjacent pixel point on the right in the set window, Indicates The degree of change of pixels, represents the normalization function, is a natural constant; A pixel point whose defect degree is greater than a set threshold is a defective pixel point.

2. According to the method for detecting carton printing defects based on visual recognition according to claim 1, it is characterized in that: The degree of change is: ; In the formula, Indicates The degree of change of pixels, Indicates Pixels and The proportion of the grayscale feature combination of pixels in the grayscale co-occurrence matrix, Indicates The grayscale features of pixels, Indicates The grayscale features of pixels, Indicates the The total number of grayscale feature combinations within the set window centered at pixels.

3. According to the method for detecting carton printing defects based on visual recognition according to claim 1, it is characterized in that: The degree of change is: ; In the formula, Indicates The degree of change of pixels, Indicates Pixels and The proportion of the grayscale feature combination of pixels in the grayscale co-occurrence matrix, Indicates The grayscale features of pixels, Indicates The grayscale features of pixels, Indicates the The total number of grayscale feature combinations within the set window centered at pixels. represents an empirical constant.

4. The method for detecting carton printing defects based on visual recognition according to claim 1, characterized in that: The step of establishing a gray level co-occurrence matrix comprises: Count the frequency of grayscale feature combinations of each pixel and its adjacent pixel on the right within the set window; The frequencies were normalized to probability values ​​to construct the gray-level co-occurrence matrix.

5. The method for detecting carton printing defects based on visual recognition according to claim 1, characterized in that: Use area array camera or CCD camera to capture carton images.

6. The method for detecting carton printing defects based on visual recognition according to claim 1, characterized in that: The method also includes denoising and gray-scaling the carton image.

7. The method for detecting carton printing defects based on visual recognition according to claim 1, characterized in that: The method also includes performing expansion and corrosion operations on the defective pixel points.

8. A carton printing defect detection system based on visual recognition, characterized in that: It comprises a memory and a processor, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, a carton printing defect detection method based on visual recognition as described in any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Paper box printing color difference defect detection method based on artificial intelligence system

    CN114757954A

  • Cloth defect marking method and system based on machine vision

    CN114529549A

  • Building material welding surface defect detection method based on computer vision

    CN115082467A

  • Detection of Textural Defects Using a One Class Support Vector Machine

    US20110026804A1

Cited By

  • Method and system for detecting defects of thermosensitive coating of thermosensitive paper

    CN120411105A

  • Carton printing defect detection method and system based on visual identification

    CN120510113A

  • A carton printing defect detection method and system based on visual recognition

    CN120510113B

  • Keel bending and hollowness identification method and system based on vision

    CN120747089A

  • 3D printing defect monitoring method

    CN121033015A