A method and system for inspecting the printing quality of packaging boxes based on image analysis

CN121962159BActive Publication Date: 2026-08-14DONGGUAN YONGWEI IND CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-04-03
Publication Date
2026-08-14

AI Technical Summary

Technical Problem

现有的像素差分检测方法在对该区域进行比对时,会将上述由物理变形引起的图像差异与真实的印刷缺陷混为一谈,导致折页区域的检测误判率较高

Benefits of technology

[0055]本发明利用刀模文件中物理折痕的方向信息对折页区域内疑似缺陷的局部特征位移参数进行正交分解,基于纸板沿折痕折叠时图案位移以垂直于折痕方向为主导的物理方向性特征,通过平行位移分量与垂直位移分量之间的数值约束关系实现对物理形变偏差与真实印刷缺陷的分类判定,与现有像素差分方法无法区分差异成因而将物理形变误判为缺陷相比,有效抑制了折页区域的检测误判率。同时,对判定为形变偏差的区域执行基于垂直位移分量的单向展平复核操作,在消除物理形变导致的投影缩短后进行二次差分比对,使得被形变掩盖的真实缺陷能够被重新检出,与现有技术通过放宽检测阈值或排除折页区域来规避误判的方式相比,本方案在抑制误检的同时避免了漏检,兼顾了检测的准确性与完整性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121962159B_ABST
    Figure CN121962159B_ABST
Patent Text Reader

Abstract

This invention belongs to the field of image detection technology. It discloses a method and system for inspecting the printing quality of packaging boxes based on image analysis. The method includes: obtaining initial suspected defect areas based on the alignment and comparison of real-shot images and standard template images; defining folded areas by extracting the position and direction information of physical creases from die-cutting file data; calculating local feature displacement parameters for suspected defect areas that spatially overlap with the folded areas and identifying areas with spatial displacement; orthogonally decomposing the displacement parameters using the crease direction to extract parallel and perpendicular displacement components; determining whether the difference attribute is a printing defect or deformation deviation based on the numerical constraint relationship between the two; and performing unidirectional flattening verification to generate detection results when it is a deformation deviation. This method achieves the classification and judgment of physical deformation and printing defects through orthogonal decomposition, and enables the detection of defects masked by deformation through flattening verification, thus suppressing false detections and avoiding missed detections.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image detection technology, and more specifically, to a method and system for detecting the printing quality of packaging boxes based on image analysis. Background Technology

[0002] Packaging box printing quality inspection is a crucial step in the packaging industry's production process. Image analysis-based automatic inspection methods register and align real-world images captured by production line cameras with pre-acquired standard template images, calculate the pixel differences between the two, and identify areas with difference values ​​exceeding a threshold as suspected defect areas, thus achieving automatic identification of printing quality problems. This type of method has been widely applied in scenarios such as color difference detection, registration deviation detection, and image / text omission detection for packaging boxes.

[0003] During the production of packaging boxes, die-cutting, creasing, and folding processes are required. The cardboard is physically folded along the creasing lines defined in the die-cutting file. When images of the packaging boxes are captured during production line inspection, the folded area near the crease exhibits spatial displacement relative to the standard template in the two-dimensional image due to the physical warping and bending of the cardboard. Existing pixel difference detection methods, when comparing this area, confuse the image differences caused by the physical deformation with actual printing defects, resulting in a high false positive rate for folded areas. To reduce false positives, existing technologies typically employ either relaxing the detection threshold for folded areas or directly excluding folded areas from the detection range. However, the former leads to missed detection of actual printing defects in this area, while the latter completely removes the folded area from quality monitoring; neither approach can simultaneously ensure both accuracy and completeness of the detection.

[0004] In summary, how to effectively distinguish between image differences caused by physical deformation and actual printing defects in the folded area of ​​packaging boxes, and how to suppress false detections while avoiding missed detections, is a problem that urgently needs to be solved by those skilled in the art. Summary of the Invention

[0005] To overcome the aforementioned problems in the prior art, this invention proposes a packaging box printing quality inspection method and system based on image analysis to solve the above problems.

[0006] This invention provides the following technical solution:

[0007] A method for inspecting the printing quality of packaging boxes based on image analysis, comprising:

[0008] Alignment comparison calculations are performed based on real-shot images and standard template images to obtain initial suspected defect areas; the location and direction information of physical creases are extracted by combining die-cutting file data to define the folding area;

[0009] For an initial suspected defect region that spatially overlaps with the folding area, extract a local image patch containing the initial suspected defect region and calculate the local feature displacement parameters;

[0010] The initial suspected defect region with spatial displacement is identified based on the local characteristic displacement parameters.

[0011] For the initial suspected defect area with spatial displacement, the local feature displacement parameters are orthogonally decomposed using the direction information of the physical creases to extract the parallel displacement component and the vertical displacement component.

[0012] Based on the numerical constraint relationship between the parallel displacement component and the vertical displacement component, the difference attribute of the local image block is determined to be a printing defect or deformation deviation.

[0013] When the difference attribute is printing defect, a corresponding detection result is generated; when the difference attribute is deformation deviation, a one-way flattening verification operation is performed on the initial suspected defect area, and a corresponding detection result is generated based on the verification result.

[0014] Preferably, the step of performing alignment comparison calculations based on the actual captured image and the standard template image to obtain the initial suspected defect area includes:

[0015] Extract feature points of a preset stable region from the captured image;

[0016] The real-shot image is globally spatially affine registered with the standard template image using the feature points of the stable region to generate an aligned real-shot image.

[0017] Calculate the global pixel difference map between the aligned real-shot image and the standard template image, and extract the connected components with a difference value greater than a preset difference threshold as the initial suspected defect region.

[0018] Preferably, the step of extracting the position and direction information of physical creases from the die-cutting file data to define the folding area includes:

[0019] The indentation line coordinate equation is parsed from the die-cutting file data, and the position coordinates and direction angle of the physical crease are obtained according to the indentation line coordinate equation as the position and direction information of the physical crease.

[0020] The folded area is divided in the standard drawing space based on the coordinates of the physical crease.

[0021] Preferably, the step of extracting local image patches containing the initial suspected defect region and calculating local feature displacement parameters includes:

[0022] Feature point matching is performed between the local image blocks corresponding to the initial suspected defect area in the real-shot image and the standard template image to obtain a set of feature point pairs.

[0023] Calculate the coordinate difference of each feature point pair on the two-dimensional plane to generate a set of two-dimensional spatial displacement vectors as the local feature displacement parameters.

[0024] Preferably, the step of identifying the initial suspected defect region with spatial displacement based on the local feature displacement parameters includes:

[0025] Calculate the average magnitude of each displacement vector in the local characteristic displacement parameters;

[0026] When the average amplitude is greater than or equal to a preset displacement threshold, it is determined that the initial suspected defect area has spatial displacement.

[0027] When the average amplitude is less than the preset displacement threshold, it is determined that there is no spatial displacement in the initial suspected defect area.

[0028] Preferably, the step of orthogonally decomposing the local feature displacement parameters using the direction information of the physical crease to extract the parallel displacement component and the perpendicular displacement component includes:

[0029] Based on the direction information of the physical crease, determine the parallel unit direction vector and the perpendicular unit direction vector;

[0030] Each displacement vector in the local feature displacement parameters is orthogonally projected onto the parallel unit direction vector and the perpendicular unit direction vector, respectively.

[0031] Obtain the amplitudes of the parallel displacement component and the vertical displacement component of the corresponding image feature points after projection.

[0032] Preferably, determining that the difference attribute of the local image patch is a printing defect or deformation deviation includes:

[0033] Calculate the statistical characteristic values ​​of the amplitude of the parallel displacement components of all image feature points to obtain the first constraint value;

[0034] Calculate the statistical characteristic values ​​of the vertical displacement component amplitudes of all image feature points to obtain the second constraint value, wherein the statistical characteristic values ​​include the sum or average value;

[0035] Calculate the ratio of the first constraint value to the second constraint value, and use it as a displacement direction characteristic parameter;

[0036] When the displacement direction characteristic parameter is greater than or equal to a predetermined ratio threshold, the difference attribute is determined to be the printing defect;

[0037] When the displacement direction characteristic parameter is less than the predetermined proportional threshold, the difference attribute is determined to be the deformation deviation.

[0038] Preferably, the step of performing a unidirectional flattening verification operation on the initial suspected defect area and generating corresponding detection results based on the verification results includes:

[0039] Calculate the mean amplitude of the vertical displacement component, and calculate the unidirectional compensation tensile coefficient based on the mean amplitude;

[0040] Keeping the pixel coordinates of the initial suspected defect area unchanged in the direction parallel to the physical crease, the pixel coordinates of the initial suspected defect area in the direction perpendicular to the physical crease are subjected to a unidirectional geometric transformation using the unidirectional compensation stretching coefficient to generate a flattened local image.

[0041] A second difference comparison is performed between the flattened local image and the local image at the corresponding position in the standard template image;

[0042] Based on the results of the secondary differential comparison, it is determined whether there are actual surface defects in the initial suspected defect area, and corresponding detection results are generated.

[0043] Preferably, the second difference comparison includes:

[0044] Calculate the secondary pixel grayscale difference between the flattened local image and the local image at the corresponding position in the standard template image;

[0045] When the area of ​​the connected region formed by the grayscale difference of the secondary pixels is less than the preset judgment threshold, the judgment detection result is that there is no real surface defect.

[0046] When the area of ​​the connected region formed by the grayscale difference of the secondary pixels is greater than or equal to the preset judgment threshold, the detection result is determined to be that there is a real surface defect.

[0047] This invention also provides an image analysis-based packaging box printing quality inspection system, used to implement an image analysis-based packaging box printing quality inspection method, including:

[0048] The image alignment and region delineation module is used to perform alignment comparison calculations based on real-shot images and standard template images to obtain initial suspected defect areas; it also combines die-cutting file data to extract the position and direction information of physical creases to delineate the folding area.

[0049] The local displacement parameter calculation module is used to extract local image blocks containing the initial suspected defect area for an initial suspected defect area that spatially overlaps with the folding area, and to calculate local feature displacement parameters.

[0050] A spatial displacement identification module is used to identify initial suspected defect areas with spatial displacement based on the local feature displacement parameters.

[0051] The displacement orthogonal decomposition module is used to orthogonally decompose the local feature displacement parameters of the initial suspected defect area with spatial displacement using the direction information of the physical crease, and extract the parallel displacement component and the vertical displacement component.

[0052] The difference attribute classification and determination module is used to perform classification calculations based on the numerical constraint relationship between the parallel displacement component and the vertical displacement component, and to determine whether the difference attribute of the local image block is a printing defect or a deformation deviation.

[0053] The flattening verification and result generation module is used to generate corresponding detection results when the difference attribute is printing defect; when the difference attribute is deformation deviation, it performs a one-way flattening verification operation on the initial suspected defect area and generates corresponding detection results based on the verification results.

[0054] This invention provides a method and system for inspecting the printing quality of packaging boxes based on image analysis, which has the following beneficial effects:

[0055] This invention utilizes the directional information of physical creases in the die-cutting file to orthogonally decompose the local feature displacement parameters of suspected defects within the folded area. Based on the physical directionality characteristic that the pattern displacement is predominantly perpendicular to the crease direction when the cardboard is folded along the crease, the numerical constraint relationship between parallel and vertical displacement components is used to classify and determine physical deformation deviations from actual printing defects. Compared with existing pixel difference methods that cannot distinguish the causes of differences and thus misjudge physical deformation as defects, this invention effectively suppresses the false detection rate of folded areas. Simultaneously, a unidirectional flattening verification operation based on the vertical displacement component is performed on areas determined to have deformation deviations. After eliminating the projection shortening caused by physical deformation, a secondary difference comparison is performed, allowing the actual defects hidden by deformation to be re-detected. Compared with existing technologies that avoid false detections by relaxing the detection threshold or excluding folded areas, this solution suppresses false detections while avoiding missed detections, balancing the accuracy and completeness of the detection. Attached Figure Description

[0056] Figure 1 This is a flowchart illustrating a packaging box printing quality inspection method based on image analysis according to the present invention.

[0057] Figure 2 This is a schematic diagram of a packaging box printing quality inspection system based on image analysis according to the present invention. Detailed Implementation

[0058] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0059] Example 1; please refer to Figure 1 In this embodiment, a packaging box printing quality inspection method based on image analysis includes:

[0060] S1. Based on the actual shot image and the standard template image, perform alignment comparison calculation to obtain the initial suspected defect area; combine the die-cutting mold file data to extract the position and direction information of the physical crease to define the folding area;

[0061] The alignment comparison calculation based on the real-shot image and the standard template image yields the following initial suspected defect areas:

[0062] Extract feature points of a preset stable region from the captured image;

[0063] The real-shot image is globally spatially affine registered with the standard template image using the feature points of the stable region to generate an aligned real-shot image.

[0064] Calculate the global pixel difference map between the aligned real-shot image and the standard template image, and extract the connected components with a difference value greater than a preset difference threshold as the initial suspected defect region.

[0065] The step of extracting the position and direction information of physical creases by combining die-cutting file data to define the folding area includes:

[0066] The indentation line coordinate equation is parsed from the die-cutting file data, and the position coordinates and direction angle of the physical crease are obtained according to the indentation line coordinate equation as the position and direction information of the physical crease.

[0067] The folded area is divided in the standard drawing space based on the coordinates of the physical crease.

[0068] In this embodiment, it should be noted that in packaging box printing quality inspection, the actual photographic image refers to the image obtained by taking pictures of the packaging boxes on the production line using an industrial camera, while the standard template image refers to a defect-free reference image generated based on the packaging box design. By aligning and comparing the two, areas in the actual photographic image that deviate from the standard can be identified. Because the packaging box undergoes creasing and folding processes during production, the paper surface near the folds usually experiences slight physical warping or bending, resulting in differences between the image in that area and the standard template. This difference is usually not a printing quality issue, but rather an image appearance change caused by the physical deformation of the cardboard. Directly classifying all differing areas as defects could easily lead to numerous false detections near the folds, reducing the reliability of the inspection system. Therefore, this solution, after obtaining the initial suspected defect areas, combines the die-cutting file data to define the folding area, and specifically analyzes the suspected defects located within the folding area to distinguish between image differences caused by physical deformation and actual printing defects.

[0069] It should be noted that the stable region is usually set as the area in the main plane of the packaging box far from the crease boundary. Since the pattern near the crease may spatially shift due to cardboard folding, including feature points in these areas in the registration calculation would cause deformation interference to the registration model, reducing the global registration accuracy. Therefore, feature points are usually selected in the main plane area where physical deformation is less likely to occur, making the registration reference more reliable. Global spatial affine registration can be achieved by solving the affine transformation matrix based on the correspondence of feature points. For example, the RANSAC algorithm can be used to select interior points and then solve the affine transformation parameters to generate aligned real-world images.

[0070] It should be noted that the value of each pixel in the global pixel difference map represents the magnitude of the grayscale or color difference between the two images at that location. Pixels with difference values ​​greater than a preset difference threshold are extracted, and connected component analysis is performed on adjacent pixels exceeding the threshold. Each connected component constitutes an initial suspected defect region. The preset difference threshold can be set according to the normal color fluctuation range allowed by the printing process, for example, a value between 15 and 30 for the grayscale difference.

[0071] It should be noted that die-cutting files are process design files used to guide die-cutting and creasing in packaging box production. They are usually stored in vector formats such as DXF or CF2 and contain precise geometric information about the cutting lines and creasing lines. Crease lines are the positions of the creases when the packaging box is folded. After parsing the coordinate equations of the creasing lines from the die-cutting file, the position coordinates and direction angle of each crease can be obtained. The folding area is a strip-shaped area extending to both sides of the crease. The width of the area can be set according to the cardboard material and folding process, for example, extending 5 to 15 millimeters to each side of the crease center line.

[0072] S2. For an initial suspected defect area that spatially overlaps with the folding area, extract a local image patch containing the initial suspected defect area and calculate the local feature displacement parameters.

[0073] S3. Identify the initial suspected defect area with spatial displacement based on the local feature displacement parameters;

[0074] The step of extracting local image patches containing the initial suspected defect region and calculating local feature displacement parameters includes:

[0075] Feature point matching is performed between the local image blocks corresponding to the initial suspected defect area in the real-shot image and the standard template image to obtain a set of feature point pairs.

[0076] Calculate the coordinate difference of each feature point pair on the two-dimensional plane to generate a set of two-dimensional spatial displacement vectors as the local feature displacement parameters.

[0077] The step of identifying the initial suspected defect region with spatial displacement based on the local feature displacement parameters includes:

[0078] Calculate the average magnitude of each displacement vector in the local characteristic displacement parameters;

[0079] When the average amplitude is greater than or equal to a preset displacement threshold, it is determined that the initial suspected defect area has spatial displacement.

[0080] When the average amplitude is less than the preset displacement threshold, it is determined that there is no spatial displacement in the initial suspected defect area.

[0081] In this embodiment, it should be noted that determining whether the initial suspected defect area and the folded area have spatial overlap can be achieved by calculating the intersection of their pixel coordinate sets. For the initial suspected defect area that does not have spatial overlap with the folded area, this area is located on the main plane away from the fold and is not affected by the deformation of the cardboard fold. Its image difference can be directly determined as a real printing defect, and a corresponding detection result can be generated.

[0082] It should be noted that for initial suspected defect areas that spatially overlap with the folded area, the image differences may originate from actual printing defects or from pattern displacement caused by physical deformation of the cardboard, requiring further analysis to distinguish them. The extraction range of local image patches is typically expanded outward from the initial suspected defect area by a certain pixel margin, for example, 20 to 50 pixels in each direction, to include sufficient pattern texture for subsequent feature point matching. Local image patches at corresponding locations are extracted from the actual photographed image and the standard template image, respectively.

[0083] It should be noted that feature point matching between two local image patches can be performed using feature description and matching methods such as SIFT and ORB to obtain a set of feature point pairs. Each feature point pair contains the coordinate positions of the same pattern element in the real-world local image patch and the standard template local image patch. The coordinate difference of each feature point pair in the two-dimensional plane is calculated to generate a set of two-dimensional spatial displacement vectors, which serve as local feature displacement parameters.

[0084] It should be noted that the local feature displacement parameter reflects the spatial offset distribution of the pattern relative to the standard template within that region. The feature point matching algorithm performs matching and localization based on the gradient direction distribution characteristics of the pattern texture. Different types of image differences exhibit different behavior patterns at the feature point matching level. When the difference is caused by pattern spatial offset, whether it is physical deformation or printing deviation, the texture structure of the pattern itself is completely preserved; only the overall position has been translated. The feature point matching algorithm can find a corresponding point at the offset position that matches the texture gradient distribution in the standard template. The match is successful, and the displacement vector has a clear non-zero amplitude, the magnitude of which reflects the offset distance. When the difference is caused by surface attachments such as dirt or scratches, the attachments cover the original pattern. Although they change the grayscale or color values ​​of local pixels and are thus detected in the difference map, the underlying texture structure of the original pattern usually does not disappear or shift. The gradient direction histogram extracted by the feature point matching algorithm is mainly determined by the edges and texture of the pattern itself. Surface attachments only cause superposition interference to the local gradient values ​​and generally do not change the overall spatial distribution of the texture. Therefore, the matching algorithm can still find the correct corresponding point near the original position. The match is successful, and the displacement vector amplitude is close to zero. When the discrepancy is caused by printing defects, the pattern texture in the local area is completely missing. The feature point matching algorithm cannot extract effective texture features in this area or cannot find matching points corresponding to the standard template, resulting in feature point matching failure or a significant reduction in the number of matching points. In this embodiment, when the number of successfully matched feature point pairs in a local image block is lower than a preset minimum matching threshold (e.g., 3 pairs), the area can be directly identified as a real surface defect and a corresponding detection result can be generated.

[0085] It should be noted that the mean amplitude of each displacement vector in the local feature displacement parameters is calculated and compared with a preset displacement threshold. The mean amplitude is chosen as the criterion because it comprehensively reflects the overall offset level of all feature points, achieving a good balance between statistical stability and sensitivity. The preset displacement threshold can be set according to the registration accuracy and normal matching error range, for example, 1 to 3 pixels. When the mean amplitude is less than the preset displacement threshold, it is determined that there is no spatial displacement. In this case, the anomaly detected by differential comparison is not caused by pattern offset, but by image differences caused by real surface defects such as dirt and scratches, and the corresponding detection result can be directly generated. When the mean amplitude is greater than or equal to the preset displacement threshold, it is determined that there is spatial displacement. In this case, the pattern has indeed undergone spatial offset, but the cause of the offset may be physical deformation of the cardboard or pattern position deviation during the printing process, requiring further steps to distinguish.

[0086] S4. For the initial suspected defect area with spatial displacement, the local feature displacement parameters are orthogonally decomposed using the direction information of the physical creases to extract the parallel displacement component and the vertical displacement component.

[0087] S5. Based on the numerical constraint relationship between the parallel displacement component and the vertical displacement component, perform classification calculations to determine whether the difference attribute of the local image block is a printing defect or a deformation deviation.

[0088] The step of orthogonally decomposing the local feature displacement parameters using the directional information of the physical creases to extract parallel and perpendicular displacement components includes:

[0089] Based on the direction information of the physical crease, determine the parallel unit direction vector and the perpendicular unit direction vector;

[0090] Each displacement vector in the local feature displacement parameters is orthogonally projected onto the parallel unit direction vector and the perpendicular unit direction vector, respectively.

[0091] Obtain the amplitudes of the parallel displacement component and the vertical displacement component of the corresponding image feature points after projection.

[0092] The determination that the difference attribute of the local image block is a printing defect or deformation deviation includes:

[0093] Calculate the statistical characteristic values ​​of the amplitude of the parallel displacement components of all image feature points to obtain the first constraint value;

[0094] Calculate the statistical characteristic values ​​of the vertical displacement component amplitudes of all image feature points to obtain the second constraint value, wherein the statistical characteristic values ​​include the sum or average value;

[0095] Calculate the ratio of the first constraint value to the second constraint value, and use it as a displacement direction characteristic parameter;

[0096] When the displacement direction characteristic parameter is greater than or equal to a predetermined ratio threshold, the difference attribute is determined to be the printing defect;

[0097] When the displacement direction characteristic parameter is less than the predetermined proportional threshold, the difference attribute is determined to be the deformation deviation.

[0098] In this embodiment, it should be noted that the parallel unit direction vector and the perpendicular unit direction vector are determined based on the direction information of the physical crease. For example, if the direction angle of a crease is θ, then the parallel unit direction vector can be (cosθ, sinθ), and the perpendicular unit direction vector can be (-sinθ, cosθ). Each displacement vector in the local feature displacement parameters is orthogonally projected onto the parallel unit direction vector and the perpendicular unit direction vector, respectively. The magnitudes of the parallel displacement component and the perpendicular displacement component corresponding to each feature point are obtained through vector dot product operations. The magnitude of the parallel displacement component represents the magnitude of the pattern's offset along the crease direction, and the magnitude of the perpendicular displacement component represents the magnitude of the pattern's offset along the direction perpendicular to the crease.

[0099] It should be noted that after orthogonally decomposing the displacement vector along the crease direction, the relative magnitude of the two directional components can reveal the physical cause of the displacement. This distinction is based on the essential difference between physical folding deformation and printing position deviation in the spatial displacement direction. When cardboard is folded or warped along the crease, the paper surfaces on both sides of the crease rotate about the crease as an axis of rotation, around an axis parallel to the crease. The rotated paper surface is no longer completely flat on the shooting plane, but forms an angle with it. Observed from a top-down shooting angle perpendicular to the paper surface, this rotation causes the pattern on the paper surface to have a projected shortening effect in the direction perpendicular to the crease. The length of the pattern originally spread vertically on the paper surface appears as a shortened projected length in the photographed image. In the direction parallel to the crease, the length of the paper surface does not change with the folding angle, and the parallel dimension of the pattern remains essentially unchanged. Therefore, the apparent displacement of the image caused by physical folding deformation has significant directional characteristics: the displacement component perpendicular to the crease is significant, while the displacement component parallel to the crease is close to zero. Pattern position deviations during the printing process originate from factors such as printing plate installation errors, mechanical positioning deviations of the printing cylinder, or paper feed offsets of the substrate. The direction of these deviations is determined by the mechanical state of the printing equipment and has no physical correlation with the direction of the crease lines on the unfolded packaging box. Therefore, the displacement direction caused by printing deviations is random relative to the crease direction, and a significant displacement component is usually observed in the direction parallel to the crease. Based on the above directional differences, the ratio of the parallel displacement component to the perpendicular displacement component can be used as a classification criterion.

[0100] It should be noted that the statistical characteristic values ​​of the parallel displacement component amplitude and the vertical displacement component amplitude of all image feature points are calculated separately to obtain the first constraint value and the second constraint value. The statistical characteristic values ​​can be the sum or average. The ratio of the first constraint value to the second constraint value is calculated as the displacement direction characteristic parameter. The ratio form is used instead of the difference form because the ratio form can eliminate the influence of the absolute magnitude of the displacement, focusing only on the relative proportional relationship between the two directional components. Different suspected defect areas may have large differences in the overall displacement amplitude due to different folding angles. The ratio form normalizes the judgment standard into a dimensionless directional characteristic parameter, and only a uniform proportional threshold needs to be set to apply to different amplitude levels. The physical meaning of this ratio is the relative proportion of the parallel direction displacement to the vertical direction displacement. During physical folding deformation, this ratio approaches zero, and during printing deviation, this ratio approaches 1 or is greater than 1.

[0101] It should be noted that when the displacement direction characteristic parameter is greater than or equal to the predetermined proportion threshold, it indicates that the displacement component parallel to the crease direction accounts for a significant proportion of the overall displacement. The displacement direction does not conform to the directional characteristics of physical deformation, and the difference attribute is determined to be a printing defect. The corresponding packaging box is then identified as a defective product, and a corresponding inspection result is generated. The predetermined proportion threshold can be set according to the typical directional distribution of physical deformation in production, for example, a value between 0.3 and 0.5. When the displacement direction characteristic parameter is less than the predetermined proportion threshold, it indicates that the displacement is dominated by the direction perpendicular to the crease, which conforms to the directional characteristics of cardboard physical deformation. The difference attribute is determined to be a deformation deviation, and the subsequent unidirectional flattening verification operation continues.

[0102] S6. When the difference attribute is printing defect, generate the corresponding detection result; when the difference attribute is deformation deviation, perform a one-way flattening verification operation on the initial suspected defect area, and generate the corresponding detection result based on the verification result.

[0103] The step of performing a unidirectional flattening and verification operation on the initial suspected defect area, and generating corresponding detection results based on the verification results, includes:

[0104] Calculate the mean amplitude of the vertical displacement component, and calculate the unidirectional compensation tensile coefficient based on the mean amplitude;

[0105] Keeping the pixel coordinates of the initial suspected defect area unchanged in the direction parallel to the physical crease, the pixel coordinates of the initial suspected defect area in the direction perpendicular to the physical crease are subjected to a unidirectional geometric transformation using the unidirectional compensation stretching coefficient to generate a flattened local image.

[0106] A second difference comparison is performed between the flattened local image and the local image at the corresponding position in the standard template image;

[0107] Based on the results of the secondary differential comparison, it is determined whether there are actual surface defects in the initial suspected defect area, and corresponding detection results are generated.

[0108] The second-order difference comparison includes:

[0109] Calculate the secondary pixel grayscale difference between the flattened local image and the local image at the corresponding position in the standard template image;

[0110] When the area of ​​the connected region formed by the grayscale difference of the secondary pixels is less than the preset judgment threshold, the judgment detection result is that there is no real surface defect.

[0111] When the area of ​​the connected region formed by the grayscale difference of the secondary pixels is greater than or equal to the preset judgment threshold, the detection result is determined to be that there is a real surface defect.

[0112] In this embodiment, it should be noted that after the difference attribute is determined to be a deformation deviation, the spatial displacement of the known pattern is mainly caused by the physical deformation of the cardboard. However, real printing defects or surface defects may still exist within the area of ​​physical deformation. The apparent displacement caused by deformation will mix these defects with the deformation difference, making them impossible to distinguish directly through the aforementioned differential comparison. Therefore, it is necessary to first eliminate the influence of physical deformation and then perform a second comparison to determine whether there are real defects that are hidden by deformation.

[0113] It should be noted that the basic principle of the unidirectional flattening verification operation is as follows: When the cardboard is folded or curled along the crease, the printed pattern on the paper surface itself does not change; only the paper surface is no longer completely flat on the shooting plane, resulting in a projected shortening of the pattern in the direction perpendicular to the crease when photographed from a top angle. This projected shortening is approximately uniform linear shortening within a small folding angle range, meaning that the pixel spacing in the vertical direction is compressed proportionally, while the pixel spacing in the parallel direction remains unchanged. Typically, the folding and curling angle of the packaging box is within 0° to 15°, and the error of linear approximation is small within this angle range. Based on this approximately linear geometric relationship, by applying a reverse linear stretch in the direction perpendicular to the crease, the shortened pattern can be approximately restored to the spatial distribution state when the paper surface is completely flat. If the restored pattern is consistent with the standard template, it means that the difference is entirely caused by physical deformation and there is no real defect; if the difference still exists after restoration, it means that in addition to physical deformation, there are also real printing defects or surface defects superimposed.

[0114] It should be noted that the mean amplitude of the vertical displacement component is calculated, and the unidirectional compensation stretching coefficient is calculated based on the mean amplitude. The unidirectional compensation stretching coefficient can be calculated by the ratio of the pixel size of the local image patch in the direction perpendicular to the crease to the difference between that size and the mean amplitude of the vertical displacement component. For example, if the pixel size of the local image patch in the vertical direction is 200 pixels and the mean amplitude of the vertical displacement component is 6 pixels, then the unidirectional compensation stretching coefficient is approximately 200 / (200-6)≈1.031, which means that it needs to be stretched by about 3.1% in the vertical direction to compensate for the projected shortening caused by physical deformation.

[0115] It should be noted that, keeping the pixel coordinates of the initial suspected defect area unchanged in the direction parallel to the physical crease, a unidirectional geometric transformation is performed on the pixel coordinates perpendicular to the physical crease using a unidirectional compensation stretching coefficient to generate a flattened local image. Since the image shortening caused by physical deformation mainly occurs in the direction perpendicular to the crease, with almost no impact on the parallel direction, unidirectional stretching compensation in the vertical direction can basically eliminate the image differences caused by deformation. When the folding angle is large, such as exceeding 20°, the projected shortening is no longer strictly linear, and the accuracy of unidirectional stretching compensation will decrease. In practical applications, this error can be accommodated by appropriately relaxing the preset judgment threshold in the secondary difference comparison.

[0116] It should be noted that a secondary difference comparison is performed using local images of corresponding positions in the flattened local image and the standard template image. The secondary pixel grayscale difference between the two is calculated, and connected component analysis is performed on the secondary grayscale difference. When the area of ​​the connected component is less than the preset judgment threshold, it indicates that the difference between this region and the standard template has been eliminated after flattening compensation, and the original difference is mainly caused by physical deformation. There is no real defect in this region, and the detection result is that there is no real surface defect. When the area of ​​the connected component is greater than or equal to the preset judgment threshold, it indicates that there is still a significant difference between this region and the standard template after eliminating the influence of physical deformation. This indicates that in addition to physical deformation, there is also a real printing defect or surface defect superimposed, and the detection result is that there is a real surface defect. The preset judgment threshold can be set according to the detection accuracy requirements, for example, set to an area of ​​3 to 10 pixels.

[0117] Example 2; please refer to Figure 2 This invention provides a packaging box printing quality inspection system based on image analysis, used to implement a packaging box printing quality inspection method based on image analysis, including:

[0118] The image alignment and region delineation module is used to perform alignment comparison calculations based on real-shot images and standard template images to obtain initial suspected defect areas; it also combines die-cutting file data to extract the position and direction information of physical creases to delineate the folding area.

[0119] The local displacement parameter calculation module is used to extract local image blocks containing the initial suspected defect area for an initial suspected defect area that spatially overlaps with the folding area, and to calculate local feature displacement parameters.

[0120] A spatial displacement identification module is used to identify initial suspected defect areas with spatial displacement based on the local feature displacement parameters.

[0121] The displacement orthogonal decomposition module is used to orthogonally decompose the local feature displacement parameters of the initial suspected defect area with spatial displacement using the direction information of the physical crease, and extract the parallel displacement component and the vertical displacement component.

[0122] The difference attribute classification and determination module is used to perform classification calculations based on the numerical constraint relationship between the parallel displacement component and the vertical displacement component, and to determine whether the difference attribute of the local image block is a printing defect or a deformation deviation.

[0123] The flattening verification and result generation module is used to generate corresponding detection results when the difference attribute is printing defect; when the difference attribute is deformation deviation, it performs a one-way flattening verification operation on the initial suspected defect area and generates corresponding detection results based on the verification results.

[0124] In the several embodiments provided by this invention, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only one method, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0125] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.

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

Claims

1. A method for inspecting the printing quality of packaging boxes based on image analysis, characterized in that, include: Based on the alignment comparison calculation between the real-shot image and the standard template image, the initial suspected defect area is obtained; The location and direction information of physical creases are extracted by combining the die-cutting file data to define the folding area; For an initial suspected defect region that spatially overlaps with the folding area, extract a local image patch containing the initial suspected defect region and calculate the local feature displacement parameters; Based on the local feature displacement parameters, initial suspected defect areas with spatial displacement are identified; For the initial suspected defect area with spatial displacement, the local feature displacement parameters are orthogonally decomposed using the direction information of the physical creases to extract the parallel displacement component and the vertical displacement component. Based on the numerical constraint relationship between the parallel displacement component and the vertical displacement component, the difference attribute of the local image block is determined to be a printing defect or deformation deviation. When the difference attribute is printing defect, a corresponding detection result is generated; when the difference attribute is deformation deviation, a one-way flattening verification operation is performed on the initial suspected defect area, and a corresponding detection result is generated based on the verification result. The determination that the difference attribute of the local image block is a printing defect or deformation deviation includes: Calculate the statistical characteristic values ​​of the parallel displacement component amplitudes of all image feature points to obtain the first constraint value; Calculate the statistical characteristic values ​​of the vertical displacement component amplitudes of all image feature points to obtain the second constraint value. The statistical characteristic values ​​include the sum or average value. Calculate the ratio of the first constraint value to the second constraint value, and use it as a displacement direction characteristic parameter; When the displacement direction characteristic parameter is greater than or equal to a predetermined ratio threshold, the difference attribute is determined to be the printing defect; When the displacement direction characteristic parameter is less than the predetermined proportional threshold, the difference attribute is determined to be the deformation deviation; The step of performing a unidirectional flattening and verification operation on the initial suspected defect area, and generating corresponding detection results based on the verification results, includes: Calculate the mean amplitude of the vertical displacement component, and calculate the unidirectional compensation tensile coefficient based on the mean amplitude; Keeping the pixel coordinates of the initial suspected defect area unchanged in the direction parallel to the physical crease, the pixel coordinates of the initial suspected defect area in the direction perpendicular to the physical crease are subjected to a unidirectional geometric transformation using the unidirectional compensation stretching coefficient to generate a flattened local image. A second difference comparison is performed between the flattened local image and the local image at the corresponding position in the standard template image; Based on the results of the secondary differential comparison, it is determined whether there are actual surface defects in the initial suspected defect area, and corresponding detection results are generated.

2. The packaging box printing quality inspection method based on image analysis according to claim 1, characterized in that, The alignment comparison calculation based on the real-shot image and the standard template image yields the following initial suspected defect areas: Extract feature points of a preset stable region from the captured image; The real-shot image is globally spatially affine registered with the standard template image using the feature points of the stable region to generate an aligned real-shot image. Calculate the global pixel difference map between the aligned real-shot image and the standard template image, and extract the connected components with a difference value greater than a preset difference threshold as the initial suspected defect region.

3. The packaging box printing quality inspection method based on image analysis according to claim 1, characterized in that, The step of extracting the position and direction information of physical creases by combining die-cutting file data to define the folding area includes: The indentation line coordinate equation is parsed from the die-cutting file data, and the position coordinates and direction angle of the physical crease are obtained according to the indentation line coordinate equation as the position and direction information of the physical crease. The folded area is divided in the standard drawing space based on the coordinates of the physical crease.

4. The packaging box printing quality inspection method based on image analysis according to claim 1, characterized in that, The step of extracting local image patches containing the initial suspected defect region and calculating local feature displacement parameters includes: Feature point matching is performed between the local image blocks corresponding to the initial suspected defect area in the real-shot image and the standard template image to obtain a set of feature point pairs. Calculate the coordinate difference of each feature point pair on the two-dimensional plane to generate a set of two-dimensional spatial displacement vectors as the local feature displacement parameters.

5. The packaging box printing quality inspection method based on image analysis according to claim 4, characterized in that, The step of identifying the initial suspected defect region with spatial displacement based on the local feature displacement parameters includes: Calculate the average magnitude of each displacement vector in the local characteristic displacement parameters; When the average amplitude is greater than or equal to a preset displacement threshold, it is determined that the initial suspected defect area has spatial displacement. When the average amplitude is less than the preset displacement threshold, it is determined that there is no spatial displacement in the initial suspected defect area.

6. The packaging box printing quality inspection method based on image analysis according to claim 1, characterized in that, The step of orthogonally decomposing the local feature displacement parameters using the directional information of the physical creases to extract parallel and perpendicular displacement components includes: Based on the direction information of the physical crease, determine the parallel unit direction vector and the perpendicular unit direction vector; Each displacement vector in the local feature displacement parameters is orthogonally projected onto the parallel unit direction vector and the perpendicular unit direction vector, respectively. Obtain the amplitudes of the parallel displacement component and the vertical displacement component of the corresponding image feature points after projection.

7. The packaging box printing quality inspection method based on image analysis according to claim 1, characterized in that, The second-order difference comparison includes: Calculate the secondary pixel grayscale difference between the flattened local image and the local image at the corresponding position in the standard template image; When the area of ​​the connected region formed by the grayscale difference of the secondary pixels is less than the preset judgment threshold, the judgment detection result is that there is no real surface defect. When the area of ​​the connected region formed by the grayscale difference of the secondary pixels is greater than or equal to the preset judgment threshold, the detection result is determined to be that there is a real surface defect.

8. A packaging box printing quality inspection system based on image analysis, used to implement the packaging box printing quality inspection method based on image analysis as described in any one of claims 1-7, characterized in that, include: The image alignment and region delineation module is used to perform alignment comparison calculations based on real-shot images and standard template images to obtain initial suspected defect regions. The location and direction information of physical creases are extracted by combining the die-cutting file data to define the folding area; The local displacement parameter calculation module is used to extract local image blocks containing the initial suspected defect area for an initial suspected defect area that spatially overlaps with the folding area, and to calculate local feature displacement parameters. A spatial displacement identification module is used to identify initial suspected defect areas with spatial displacement based on the local feature displacement parameters. The displacement orthogonal decomposition module is used to orthogonally decompose the local feature displacement parameters of the initial suspected defect area with spatial displacement using the direction information of the physical crease, and extract the parallel displacement component and the vertical displacement component. The difference attribute classification and determination module is used to perform classification calculations based on the numerical constraint relationship between the parallel displacement component and the vertical displacement component, and to determine whether the difference attribute of the local image block is a printing defect or a deformation deviation. The flattening verification and result generation module is used to generate corresponding detection results when the difference attribute is printing defect; When the difference attribute is deformation deviation, a one-way flattening verification operation is performed on the initial suspected defect area, and a corresponding detection result is generated based on the verification result.

Citation Information

Patent Citations

  • Image preprocessing data processing method and system for small defects on surface of semiconductor equipment component

    CN121599983A

  • System and method of measuring distances related to an object

    US20140314276A1