A method and system for detecting carton printing defects based on visual recognition

By constructing a grayscale symbiosis and change symbiosis matrix, combining denoising, grayscale and morphological processing, the accuracy of carton printing defect detection is solved, and efficient and accurate automated detection effect is achieved.

CN119624971BActive Publication Date: 2025-07-22GUANGZHOU LIANWANG PAPER
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

In the prior art, the accuracy of carton printing defect detection is not high, especially the sensitivity to gradients and lighter colors, resulting in missed or missed inspection.

Method used

By collecting carton images, the grayscale characteristics of each pixel point are calculated and the grayscale symbiosis matrix and the change symbiosis matrix are constructed. Combined with denoising and grayscale processing, the degree of change and defects of pixel points are quantified, and the defect area is optimized using expansion and corrosion operations to achieve automated detection.

Benefits of technology

It improves the accuracy and stability of carton printing defect detection, enhances the adaptability to complex backgrounds and subtle textures, and achieves efficient and accurate defect identification and classification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119624971B_ABST
    Figure CN119624971B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of image data processing, and particularly relates to a carton printing defect detection method and system based on visual recognition, including: obtaining a carton image through an image acquisition device, calculating a gray feature quantity of each pixel point in the image based on the gray value of the pixel point and the gray difference within its neighborhood, which is used to reflect the gray change situation of the local area; calculating the change degree of the pixel point based on the gray feature quantity, where the change degree characterizes the clutter degree of the pixel point, and constructing a change degree co-occurrence matrix to describe the joint distribution characteristics between different change degrees. According to the change degree co-occurrence matrix, calculating the defect degree of each pixel point; calculating the defect degree of each pixel point, and in response, the pixel points with a defect degree greater than a set threshold are defect pixel points. The present invention solves the problem of low accuracy in carton printing defect detection.
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. More specifically, the present invention relates to a method and system for detecting carton printing defects based on visual recognition. Background Art

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

[0003] Traditional methods for detecting carton printing defects usually rely on manual inspection, that is, experienced quality inspectors visually observe the printing effect on the surface of cartons to determine whether there are defects. Although manual inspection has the advantages of flexibility and immediate adjustment, its detection results are often affected by subjective judgment, with relatively large uncertainties. At the same time, the efficiency of manual detection is low, especially in large-scale production lines, making it difficult to keep up with the fast production rhythm. In addition, long-term repetitive operations are likely to cause visual fatigue in inspectors, thereby further reducing the accuracy and consistency of detection.

[0004] The patent application document with the application publication number CN114757954A discloses a method for detecting carton printing color difference defects based on an artificial intelligence system. This 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, removing the influence of illumination and roughness on the calculation of the color difference value, thereby obtaining an accurate printing color difference value and effectively eliminating the influence of light intensity and the surface roughness of printed matter on the collected color difference.

[0005] However, although the above technical solution improves the accuracy of detecting screen color difference defects, defect detection of carton printing only based on light intensity and the surface roughness of printed matter may not be able to fully identify gradually changing and lighter-colored areas, resulting in insufficient sensitivity of the detection algorithm to such defects, leading to missed detections or false detections, and thus the problem of low accuracy of defect detection. Summary of the Invention

[0006] To solve the problem of low accuracy of defect detection proposed in the above background art, 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, including: collecting carton images; calculating the gray-scale feature of the th pixel point , where represents the gray-scale value of the th pixel point, represents the gray-scale difference between the th pixel point and the th pixel point within a set window centered on the th pixel point, is the total number of pixel points within the set window; establishing a gray-level co-occurrence matrix based on the gray-scale features of each pixel point, forming a combination of the gray-scale features of each pixel point and its right adjacent pixel point within its set window, obtaining the proportion of the data volume of each combination in the gray-level co-occurrence matrix, and the gray-scale feature difference between each pixel point and its right adjacent pixel point within its set window; calculating the degree of change of each pixel point, where the degree of change is positively correlated with the proportion of the data volume and negatively correlated with the gray-scale feature difference; establishing a change co-occurrence matrix based on the degree of change of each pixel point, and calculating the defect degree of the th pixel point ), where represents the distance of the th pixel point to the diagonal of the change co-occurrence matrix, represents the proportion of the data volume of the combination of the degree of change of the th pixel point and its right adjacent pixel point within its set window in the change co-occurrence matrix, represents the degree of change of the th pixel point, represents a normalization function, is the natural constant; in response to the pixel points with a defect degree greater than a set threshold being defect pixel points.

[0008] Through the above technical solution, by collecting carton images and calculating the gray-level co-occurrence matrix and the change co-occurrence matrix based on the gray-scale features of each pixel point, combining the gray-scale differences and distribution relationships between pixel points, the degree of change and defect degree of each pixel point are accurately quantified. Furthermore, based on the defect degree as the judgment basis, the defect pixel points in the image are accurately identified, thereby improving the accuracy of defect detection.

[0009] Further, the degree of change is:

[0010] ;

[0011] Where represents the degree of change of the th pixel point, represents the The proportion of the data volume of the gray - level feature combination of the th pixel and the th pixel in the gray - level co - occurrence matrix, represents the gray - level feature of the th pixel, represents the gray - level feature of the th pixel, represents the total number of gray - level feature combinations within a set window centered on the

[0012] The above - mentioned technical solution can simultaneously consider the spatial distribution and local differences of gray - level features when quantifying the degree of change. Among them, the proportion of data volume reflects the global weight of the occurrence of gray - level combinations between pixels, and the exponential decay of the gray - level difference suppresses the influence of noise on the degree of change, thereby enhancing the sensitivity to subtle texture changes and the adaptability to complex backgrounds, and ultimately improving the feature expression ability in the image - processing process and the accuracy of defect detection.

[0013] Furthermore, the degree of change is:

[0014] ;

[0015] In the formula, represents the degree of change of the th pixel, represents the proportion of the data volume of the gray - level feature combination of the th pixel and the th pixel in the gray - level co - occurrence matrix, represents the gray - level feature of the th pixel, represents the gray - level feature of the th pixel, represents the total number of gray - level feature combinations within a set window centered on the th pixel, represents an empirical constant.

[0016] The above - mentioned technical solution balances the influence of the proportion of the data volume of the gray - level feature combination in the gray - level co - occurrence matrix and the difference in the gray - level features of adjacent pixels on the degree of change by introducing a weight parameter, and can adapt to the distribution of different image features and the noise level through the adjustment of the empirical constant. This design not only effectively enhances the quantification ability for significant change regions, but also suppresses the interference of background fluctuations and subtle noises, thereby improving the stability of change detection and the adaptability to complex texture structures, and providing a more accurate and reliable feature expression for subsequent image analysis.

[0017] Further, the establishment of the gray-level co-occurrence matrix includes: statistically counting the frequency of the gray-level feature combinations of each pixel point and its adjacent pixel points on the right within a set window; normalizing the frequency into probability values to construct the gray-level co-occurrence matrix.

[0018] Further, a planar array camera or a CCD camera is used to collect the carton image.

[0019] Further, it also includes denoising and grayscale processing of the carton image.

[0020] The above technical solution effectively reduces the interference of noise and the complexity of color information in the image through denoising and grayscale processing of the carton image. The denoising process can remove random noise and background interference in the image, improving the purity of pixel features and the accuracy of texture information. The grayscale processing 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, contributing to the accuracy and efficiency of subsequent feature extraction, co-occurrence matrix construction, and defect detection, and overall improving the adaptability and robustness of the detection system to complex printed patterns.

[0021] Further, it also includes dilation and erosion operations on the defective pixel points.

[0022] The above technical solution effectively improves the connectivity and integrity of the defective area through dilation and erosion operations on the detected defective pixel points. The dilation operation can expand the boundary of the defective pixel points, fill small gaps or broken areas, making the detected defects more continuous. The erosion operation can remove the noise and pseudo-defects at the edges, eliminating misjudgments and burr phenomena during the detection process, thereby enhancing the clarity and authenticity of the defective area. This method combining morphological processing not only improves the accuracy and reliability of the detection results but also provides a more standardized and perfect defective data expression for subsequent defect classification and repair.

[0023] In a second aspect, the present invention provides a carton printing defect detection system based on visual recognition, including a memory and a processor. The memory stores computer program instructions, and when the computer program instructions are executed by the processor, the above-mentioned carton printing defect detection method based on visual recognition is implemented.

[0024] The beneficial effects of the present invention are as follows:

[0025] By collecting carton images and combining denoising and grayscale processing, the present invention improves the image quality and the accuracy of feature extraction; by calculating pixel grayscale features and constructing a gray-level co-occurrence matrix, the details and texture information in the image are extracted; further, a variation co-occurrence matrix and a calculation method for the degree of defect are introduced to accurately quantify the variation and adjacency relationship of pixel points, significantly enhancing the robustness and sensitivity of defect detection; for defect pixel points, dilation and erosion operations are performed to enhance the coherence and visual distinguishability of the defect area; realizing automated, precise, and efficient carton printing defect detection, significantly improving the quality control ability in industrial production. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] By referring to 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 drawings, several embodiments of the present invention are shown by way of example and not limitation, and like or corresponding reference numerals represent like or corresponding parts, wherein:

[0027] Figure 1 FIG. is a flowchart of a method for detecting carton printing defects based on visual recognition according to an embodiment of the present invention;

[0028] Figure 2 FIG. is a block diagram of the structure of a system for detecting carton printing defects based on visual recognition according to an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0029] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0030] The following will describe in detail the specific embodiments of the present invention with reference to the accompanying drawings.

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

[0032] As Figure 1 shown, a flowchart of a method for detecting carton printing defects based on visual recognition according to an embodiment of the present invention includes the following steps:

[0033] S1: Collect carton images.

[0034] In one embodiment, an area array camera or a CCD camera can be used to collect images of the cardboard box to ensure obtaining high-quality image data of the cardboard box surface. Due to its large-range imaging ability and excellent resolution, the area array camera can accurately capture the fine textures and local features on the cardboard box surface, and is particularly suitable for the detection of complex surface features; while the CCD camera, with its characteristics of high sensitivity and low noise, can also obtain images with high signal-to-noise ratio in low-light environments, which is particularly important for dynamic monitoring on the cardboard box production line.

[0035] In addition, for the small noise and external light interference generated on the cardboard box surface during the manufacturing, storage or transportation process, noise reduction processing needs to be carried out after the image acquisition is completed. This step can not only effectively filter out random noise, but also significantly retain the edge and texture features of the cardboard box surface, thereby improving the accuracy of subsequent feature analysis. The choice of the noise reduction algorithm can be optimized according to the characteristics of the specific cardboard box image. For example, using the median filtering method can well handle scattered point noise and avoid blurring the edges; while Gaussian filtering is more suitable for suppressing the noise of smooth surface textures.

[0036] After the noise reduction is completed, the image also needs to be grayscale processed to convert the multi-channel color image into a single-channel grayscale image. The main function of grayscale processing is to simplify the data structure, so that each pixel point of the image only contains one grayscale value, which is convenient for subsequent algorithms to analyze the brightness changes. Especially in the detection of cardboard box surface defects, grayscale processing can highlight the light intensity distribution characteristics of the target area, effectively weaken the influence of color interference on the detection results, and at the same time reduce the computational complexity and storage pressure of the algorithm. Through high-quality image acquisition, precise noise reduction processing and efficient grayscale operation, the entire preprocessing process can provide a solid data basis for the subsequent detection and classification of cardboard box surface defects, significantly improving the detection accuracy and reliability, and providing strong technical support for the automatic quality monitoring of industrial production.

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

[0038] In one embodiment, calculate the grayscale feature of the th pixel point , where represents the grayscale value of the th pixel point, represents the grayscale difference between the th pixel point and the th pixel point within the set window centered on the th pixel point, is the total number of pixel points within the set window;

[0039] The calculation of the gray-scale feature of a pixel point combines the gray-scale differences of its surrounding neighboring pixels, which can effectively extract the local texture information of the image, thereby enhancing the sensitivity to detail changes, improving the accuracy of image processing and analysis, and having significant technical advantages in tasks such as defect detection and texture recognition.

[0040] Based on the gray-scale features of each pixel point, a gray-level co-occurrence matrix is established. The gray-scale features of each pixel point and its neighboring pixel on the right form a combination, and the proportion of the data volume of each combination in the gray-level co-occurrence matrix and the difference in gray-scale features between each pixel point and its neighboring pixel on the right within a set window are obtained. If there is no neighboring pixel on the right of a pixel point, then this pixel point is not considered.

[0041] Calculate the degree of change of each pixel point.

[0042] In one embodiment, the degree of change is:

[0043] ;

[0044] In the formula, represents the degree of change of the th pixel point, represents the proportion of the data volume of the gray-scale feature combination of the th pixel point and the th pixel point in the gray-level co-occurrence matrix, represents the gray-scale feature of the th pixel point, represents the gray-scale feature of the th pixel point, represents the total number of gray-scale feature combinations within a set window centered on the th pixel point.

[0045] By combining the proportion of the data volume of the gray-scale feature combination of adjacent pixel points in the gray-level co-occurrence matrix and the exponential decay effect of the gray-scale feature difference, the degree of change of each pixel point is accurately quantified, significantly enhancing the sensitivity to local texture changes and edge details in the image, thereby providing stronger discrimination ability and reliability for defect detection, texture analysis, and pattern recognition in complex images.

[0046] In another embodiment, the degree of change is:

[0047] ;

[0048] In the formula, represents the degree of change of the th pixel point, represents the th pixel point and the The proportion of the data volume of the gray - level feature combination of a pixel in the gray - level co - occurrence matrix denotes the gray - level feature of the th pixel gray - level feature of the th pixel denotes the total number of gray - level feature combinations within a set window centered on the th pixel

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

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

[0051] In one embodiment, establishing the gray - level co - occurrence matrix is specifically as follows:

[0052] First, by calculating the gray - level features of each pixel in the image, the change characteristics of the local area are quantitatively reflected, thereby highlighting the possible texture differences or structural features in the image.

[0053] Count the frequencies of the gray - level feature combinations of each pixel and its right - hand adjacent pixel within the set window; normalize the frequencies to probability values to construct the gray - level co - occurrence matrix. The generation process of this matrix can significantly reduce the dimension of the original image data while retaining the key feature information, providing an efficient and reliable input data basis for subsequent pattern analysis, defect detection, and texture classification tasks, thereby greatly improving the robustness and adaptability of the image - processing system.

[0054] In one embodiment, calculating the degree of defect of the th pixel ), where denotes the distance of the th pixel to the diagonal of the change co - occurrence matrix denotes the proportion of the data volume of the change - degree combination of the th pixel and its right - hand adjacent pixel within the set window in the change co - occurrence matrix denotes the change degree of the th pixel denotes the normalization function is the natural constant.

[0055] The said spacing can reflect the relative positional relationship between the pixel points and the overall image pattern, helping to identify abnormal points deviating from the diagonal; the data volume ratio characterizes the change characteristics of the pixel points in the local space and their importance in the overall pattern, enhancing the capture of change details; the degree of change provides information on the intensity of the change in the local area of the pixel point. Combining these factors can more accurately evaluate the significance of the defective area, thereby improving the recognition ability of complex structures or abnormal patterns in the image, enabling the solution to still maintain efficient and accurate defect detection effects when processing images with large change amplitudes or complex backgrounds.

[0056] S4: Responding that the pixel points with the defective degree greater than the set threshold are defective pixel points.

[0057] The value of the above set threshold can be 0.8. Of course, it can also be determined according to the actual situation.

[0058] In one embodiment, after determining the defective pixel points, in order to further optimize the detection results, morphological dilation and erosion operations are used to process the defective area. Specifically, the dilation operation can fill isolated small gaps by expanding the boundaries of the defective pixel points, thereby connecting the broken defective areas and making their shapes 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 enhances the connectivity of the defective area while significantly improving the clarity and accuracy of the detection results, providing a more reliable data basis for subsequent defect classification and repair. Through this process, it can more comprehensively and accurately reflect the real defective situation in the image, thereby enhancing the applicability and stability of the algorithm in actual industrial detection scenarios.

[0059] The solution of the present invention systematically realizes the precise detection of carton printing defects by combining gray feature extraction, the construction of gray-level co-occurrence matrix and change co-occurrence matrix, and the calculation of defective degree based on a mathematical model; by introducing denoising and grayscale preprocessing, the quality and analysis efficiency of the image are improved; based on the quantization of the degree of change and the normalization processing of the defective degree, the sensitivity to different defect types and the accuracy of determination are enhanced; finally, by using dilation and erosion operations to optimize the boundary integrity and consistency of the defect detection results, the adaptability of the detection system to complex printing scenarios is effectively improved, and the overall high-precision and high-robustness visual recognition detection effect is achieved, providing an intelligent solution for carton quality control in the industrial field.

[0060] An embodiment of a carton printing defect detection system based on visual recognition:

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

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

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

[0064] In the present invention, the foregoing memory may be any tangible medium that contains or stores a program, and this program 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 suitable magnetic storage medium or magneto-optical storage medium. For instance, resistive random access memory (RRAM), dynamic random access memory (DRAM), static random access memory (SRAM), enhanced dynamic random access memory (EDRAM), high-bandwidth memory (HBM), hybrid memory cube (HMC), etc., or any other medium that can be used to store the required information and can be accessed by an application, module, or both. Any such computer storage medium may be part of the device or accessible or connectable to the device. Any application or module described in the present invention can be implemented using computer-readable / executable instructions that can be stored or otherwise held by such a computer-readable medium.

[0065] In the description of this specification, the meanings of "a plurality" and "several" are at least two, such as two, three, or more, unless otherwise specifically defined.

[0066] Although this specification has shown and described multiple 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. Many variations, modifications, and alternative means will occur to those skilled in the art without departing from the spirit and scope of the present invention. It should be understood that various alternatives to the embodiments of the present invention described herein may be employed in practicing the present invention.

Claims

1. A carton printing defect detection method based on visual recognition, characterized in that, Including: Collecting a cardboard box image; Calculate the gray feature of the pixel point , where represents the gray value of the th pixel point, represents the gray difference between the th pixel point and the th pixel point within a set window centered on the th pixel point, is the total number of pixel points within the said set window; Counting the frequency of the gray - level feature combinations of each pixel point and its adjacent pixel points on the right within a set window; normalizing the frequency to a probability value to construct a gray - level co - occurrence matrix, forming a combination of the gray - level features of each pixel point and its adjacent pixel points on the right within the set window, obtaining the proportion of the data volume of each combination in the gray - level co - occurrence matrix, and the difference in gray - level features between each pixel point and its adjacent pixel points on the right within the set window; calculating the degree of change of each pixel point, where the degree of change is positively correlated with the proportion of the data volume and negatively correlated with the difference in gray - level features; Establish a change co-occurrence matrix based on the degree of change of each pixel, and calculate the defect degree of the th pixel , where represents the distance from the th pixel to the diagonal of the change co-occurrence matrix, represents the proportion of the data volume of the change degree combination of the th pixel and its adjacent pixel on the right within the set window in the change co-occurrence matrix, represents the change degree of the th pixel, represents a normalization function, is the natural constant; Responding that the pixel points with a defect degree greater than a set threshold are defect pixel points.

2. The method for detecting carton printing defects based on visual recognition according to claim 1, wherein, The degree of change is: ; In the formula, represents the degree of change of the th pixel point, represents the proportion of the data volume of the gray feature combination of the th pixel point and the th pixel point in the gray-level co-occurrence matrix, represents the gray feature of the th pixel point, represents the gray feature of the th pixel point, represents the total number of gray feature combinations within a set window centered on the th pixel point.

3. A carton printing defect detection method based on visual recognition according to claim 1, characterized in that The degree of change is: ; Wherein, represents the degree of change of the th pixel point, represents the proportion of the data volume of the gray - level feature combination of the th pixel point and the th pixel point in the gray - level co - occurrence matrix, represents the gray - level feature of the th pixel point, represents the gray - level feature of the th pixel point, represents the total number of gray - level feature combinations within a set window centered on the th pixel point, represents an empirical constant.

4. A method for detecting carton printing defects based on visual recognition according to claim 1, characterized in that Collecting a cardboard box image using an area array camera or a CCD camera.

5. A carton printing defect detection method based on visual recognition according to claim 1, characterized in that, Further including denoising and grayscale processing of the cardboard box image.

6. A method for detecting carton printing defects based on visual recognition according to claim 1, characterized in that, Further including performing dilation and erosion operations on the defect pixel points.

7. A carton printing defect detection system based on visual recognition, characterized in that, Including a memory and a processor, where computer program instructions are stored in the memory, and when the computer program instructions are executed by the processor, a method for detecting cardboard box printing defects based on visual recognition according to any one of claims 1 - 6 is implemented.

Citation Information

Patent Citations

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

    CN114757954A

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

    CN115082467A