A packaging defect detection method and its detection system

Through image processing and neural network training models, the packaging bag printing defects are automatically detected, which solves the problems of low efficiency and poor accuracy of traditional manual detection, and realizes efficient printing defect recognition and detection.

CN119399203BActive Publication Date: 2025-07-25CHENGDU GUIYI FOOD DEV CO LTD

Patent Information

Application Number
CN202510002718.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-02
Publication Date
2025-07-25
Estimated Expiration
2045-01-02

AI Technical Summary

Technical Problem

Traditional manual visual inspection packaging bag printing defects have large subjective differences and low efficiency, making it difficult to adapt to the needs of rapid inspection on large-scale production lines.

Method used

Image processing and neural network training models are used to obtain image feature template information, edge detection, segmentation, identification and matching are performed, and printing defects are automatically judged, including misprinting, missing printing, missing printing, etc.

Benefits of technology

It realizes automatic detection of packaging bag printing defects, reduces the labor intensity of manual inspection, improves detection accuracy, and adapts to rapid continuous inspection on large-scale production lines.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119399203B_ABST
    Figure CN119399203B_ABST
Patent Text Reader

Abstract

The present invention discloses a packaging defect detection method and its detection system, which relates to the technical field of packaging detection. The packaging defect detection method includes establishing target feature template information; obtaining a second image, detecting the edge of a second target feature, performing edge segmentation on the second target feature, identifying the second target feature segmentation image, matching the recognition result of the second target feature with the target feature template information, performing misprint judgment on the second target feature based on the recognition result matching result, and obtaining a misprint judgment result; if the misprint judgment result is no misprint, extracting the pixel points of the second target feature segmentation image, performing pixel point matching according to the second pixel point set and the target feature template information, and removing the matched second pixel points; performing defect judgment on the remaining second pixel points. It realizes the automatic detection of packaging bag printing defects, reduces the labor intensity of manual detection, and improves the detection accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of packaging detection, and particularly to a packaging defect detection method and its detection system. Background Art

[0002] The packaging bag, as an indispensable part in modern commodity circulation, not only undertakes the basic functions of protecting products, facilitating carrying and transportation, but also becomes an important means of transmitting product information and enhancing brand image through its appearance design and surface printing content.

[0003] However, in the production and processing of packaging bags, due to various factors such as technical limitations of printing equipment, operational errors, material problems, or improper post-processing, quality problems such as misprinting, missing printing, and incomplete printing often occur in the printing content on the packaging bags. These printing defects not only affect the aesthetics and professional image of the products, but may also lead to consumers' misunderstanding of product information.

[0004] Traditional detection of the printing quality of packaging bags mainly relies on manual visual inspection. Although this method is intuitive, it has significant limitations. On the one hand, manual inspection is greatly affected by subjective factors, and it is difficult to unify the inspection standards. The judgment differences between different inspectors may lead to missed inspections or misjudgments. On the other hand, manual inspection has low efficiency and is difficult to meet the rapid and continuous detection requirements of large-scale production lines. Summary of the Invention

[0005] Therefore, in order to solve the above deficiencies, the present invention detects the printing defects of packaging bags, and can detect defects such as misprinting, missing printing, and incomplete printing of the text and images on the packaging bags, realizing the automatic detection of packaging bag printing defects and reducing the labor intensity of manual detection.

[0006] On the one hand, the present invention provides a packaging defect detection method, including:

[0007] Obtain a first image, process the first image to obtain a first target feature image, and process the first target feature image to obtain target feature template information;

[0008] Obtain a second image, frame a second target area in the second image to obtain a second target area image, perform gray-scale processing on the second target area image to obtain a second target area gray-scale image, perform edge detection on the second target features in the second target area gray-scale image, perform edge segmentation based on the edge detection results of the second target features to obtain a second target feature segmentation image, and perform recognition on the second target feature segmentation image to obtain a second target feature recognition result;

[0009] Match the second target feature recognition result with the target feature template information to obtain a recognition result matching result;

[0010] Perform misprinting judgment on the second target feature based on the recognition result matching result to obtain a misprinting judgment result;

[0011] If the misprinting judgment result is no misprinting, position detection is performed on the features in the grayscale image of the second target area to obtain the second target feature position information;

[0012] Extracting second pixel points from the second target feature segmentation image to form a second pixel point set;

[0013] Perform pixel matching based on the second pixel point set and the target feature template information, and remove the second pixel points matched in the second pixel point set;

[0014] Defect judgment is performed on the retained unmatched second pixel point to obtain a defect judgment result.

[0015] The present invention is aimed at detecting printing defects of packaging bags, and can detect defects such as misprinting, missing printing, and lack of printing of text and images on packaging bags, thereby realizing automatic detection of printing defects of packaging bags, reducing the labor intensity of manual detection, improving detection accuracy, and being able to meet the needs of fast and continuous detection on large-scale production lines.

[0016] Further, acquiring the first image, processing the first image to obtain a first target feature image, and processing the first target feature image to obtain target feature template information include:

[0017] Acquire a first image, perform grayscale processing on the first image to obtain a first grayscale image, perform preprocessing on the first grayscale image, detect a first target feature region in the first grayscale image, segment the first target feature region from the first grayscale image, and obtain a first target feature region image;

[0018] Performing registration processing on the first target feature region image to obtain first target feature position registration information;

[0019] Performing edge detection on the first target feature in the first target feature region image, performing edge segmentation on the first target feature according to the edge detection result, extracting the first target feature image, recognizing the first target feature image, and obtaining a first target feature image recognition result;

[0020] Establishing a pixel coordinate system based on the first target feature position registration information, extracting pixel points of the first target feature image based on the pixel coordinate system, and obtaining a first pixel point set;

[0021] Counting the number of pixels in the first pixel point set and calculating the first target feature area;

[0022] The first target feature position registration information, the first pixel point set, the first target feature area and the first target feature image recognition result are input into the neural network training model for training to obtain a training data set, and the training data set is fused to form target feature template information.

[0023] Further, pixel matching is performed according to the second pixel point set and the target feature template information, and the matched second pixel points in the second pixel point set are eliminated, including:

[0024] Performing position error calculation based on the second target feature position information and the target feature template information to obtain a position error calculation result;

[0025] Perform calibration calculation on the coordinates of each pixel point in the second pixel point set according to the error calculation result, obtain the second pixel point coordinate calibration calculation result, obtain the second pixel point calibration coordinates, and form a calibration pixel point set;

[0026] Pixel matching is performed based on the calibration pixel set and the target feature template information, the calibration pixels that match the target feature template information are eliminated, and the calibration pixels that do not match the target feature template information are retained.

[0027] Furthermore, the position error calculation is calculated as follows:

[0028] ;

[0029] ;

[0030] in, is the horizontal coordinate error of the second target feature position point; is the ordinate error of the second target feature position point; is the weight; , are the horizontal and vertical coordinates of the first target feature position point respectively; , are the horizontal and vertical coordinates of the second landmark feature position point respectively; are the numbers of the first target feature position point and the second target feature position point, ≥1, take the integer.

[0031] Furthermore, the calibration calculation is performed as follows:

[0032] ;

[0033] in, , are the horizontal coordinate and vertical coordinate of the second pixel point after calibration respectively; , are respectively the abscissa and ordinate of the second pixel points obtained by extraction; is the number of the second pixel points, ≥1, taking an integer.

[0034] Further, the defective judgment on the remaining unmatched second pixel points to obtain a defective judgment result includes:

[0035] Judging the continuity of the remaining calibrated pixel points, determining boundary pixel points according to the continuity judgment result, fitting the boundary pixel points to obtain a closed fitting area, calculating the area of the fitting area, and calculating a missing ratio according to the area of the fitting area and the first target feature area in the target feature template information to obtain a missing ratio calculation result;

[0036] Performing defective judgment according to the missing ratio calculation result and a preset missing ratio to obtain a defective judgment result.

[0037] Further, the calculation method of the area of the fitting area is as follows;

[0038] ;

[0039] Wherein, is the area of the fitting area, with the unit of square millimeter; is the area of a pixel point, with the unit of square millimeter; is the number of pixel points within the fitting area.

[0040] Further, the calculation of the missing ratio is as follows:

[0041] ;

[0042] Wherein, is the first target feature area, with the unit of square millimeter; is the missing ratio, 0 < ≤1.

[0043] On the other hand, the present invention provides a packaging defect detection system here. The packaging defect detection system is used to execute the above-mentioned packaging defect detection method. The packaging defect detection system includes:

[0044] A template establishment unit, configured to obtain a first image, process the first image to obtain a first target feature image, and process the first target feature image to obtain target feature template information;

[0045] An image recognition unit, configured to obtain a second image, frame a second target area in the second image to obtain a second target area image, perform grayscale processing on the second target area image to obtain a second target area grayscale image, perform edge detection on a second target feature in the second target area grayscale image, perform edge segmentation based on the edge detection result of the second target feature to obtain a second target feature segmentation image, and perform recognition on the second target feature segmentation image to obtain a second target feature recognition result;

[0046] A recognition result matching unit, configured to perform recognition result matching according to the second target feature recognition result and target feature template information to obtain a recognition result matching result;

[0047] A misprint judgment unit, configured to perform misprint judgment on the second target feature based on the recognition result matching result to obtain a misprint judgment result;

[0048] A position detection unit, configured to perform position detection on a second target feature in the second target area grayscale image to obtain second target feature position information;

[0049] A pixel point extraction unit, configured to extract pixel points of the second target feature segmentation image to obtain a second pixel point set;

[0050] A pixel point matching unit, configured to perform pixel point matching according to the second pixel point set and target feature template information, and eliminate the matched second pixel points in the second pixel point set;

[0051] A defect judgment unit, configured to perform defect judgment on the remaining unmatched second pixel points to obtain a defect judgment result.

[0052] The present invention has the following advantages:

[0053] The present invention is directed to detecting printing defects of packaging bags, and can detect defects such as misprinting, missing printing, and incomplete printing of text and images on packaging bags, realizing automatic detection of printing defects of packaging bags, reducing the labor intensity of manual detection, improving the detection accuracy, and meeting the requirements of fast and continuous detection on large-scale production lines. Description of the Drawings

[0054] Figure 1 is a schematic flowchart of a packaging defect detection method;

[0055] Figure 2 is a schematic logical structure diagram of a packaging defect detection system;

[0056] In the figure:

[0057] 100. Template establishment unit; 200. Image recognition unit; 300. Recognition result matching unit; 400. Misprint judgment unit; 500. Position detection unit; 600. Pixel point extraction unit; 700. Pixel point matching unit; 800. Defect judgment unit. Detailed implementation manners

[0058] The embodiments of the present application will be described in detail below. The examples of the embodiments are shown in the drawings, where the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the drawings are exemplary and are intended to explain the present application, and should not be construed as limiting the present application.

[0059] In this document, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variation thereof is intended to cover a non-exclusive inclusion, such that a process, method, article or device comprising a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or device.

[0060] As described in the background art, the traditional inspection of the printing quality of packaging bags mainly relies on manual visual inspection. Although this method is intuitive, it has significant limitations. On the one hand, manual inspection is greatly affected by subjective factors, and it is difficult to unify the inspection standards. The judgment differences between different inspectors may lead to missed inspections or misjudgments. On the other hand, manual inspection is inefficient and difficult to meet the rapid and continuous inspection requirements of large-scale production lines.

[0061] For the above reasons, the present invention provides the following embodiments.

[0062] Embodiment 1:

[0063] As Figure 1 shown, this embodiment provides a packaging defect detection method herein, including:

[0064] S100: Obtain a first image, process the first image to obtain a first target feature image, and process the first target feature image to obtain target feature template information;

[0065] Specifically, the first image is an image of a qualified packaging bag. In this embodiment, a high-resolution camera or image acquisition device is used to take multi-angle and all-round pictures of food packaging (such as hot pot base packaging), ensuring that the shooting environment has sufficient and uniform light, and avoiding the influence of shadows and reflections on the image quality.

[0066] In a possible implementation, a first image is obtained, the first image is processed to obtain a first target feature image, and the first target feature image is processed to obtain target feature template information; further comprising:

[0067] S110: Obtain a first image, perform grayscale processing on the first image to obtain a first grayscale image, preprocess the first grayscale image, detect a first target feature region in the first grayscale image, and segment the first target feature region from the first grayscale image to obtain a first target feature region image; specifically, preprocessing the collected basic packaging image includes operations such as grayscale conversion, denoising, and contrast enhancement. For example, the first image is grayscaled using the weighted average method, and the first image is denoised using the Gaussian filter image denoising method to improve the denoising effect while retaining more details. The linear grayscale transformation method is applied to enhance the contrast of the first grayscale image. In this embodiment, the preprocessed image is also segmented by applying an image segmentation algorithm (such as region segmentation method, edge detection segmentation method, etc.) to extract the target feature region image.

[0068] S120: Perform registration processing on the first target feature region image to obtain first target feature position registration information; specifically, the registration template image is to determine the position data information of each target in other images, and the first target feature position in the image to be detected is determined through this target feature position registration information. In this embodiment, according to the centroid offset value and deflection angle of the outer contour of the image to be registered, bilinear interpolation and rigid transformation are used to complete rough registration; according to the prior information provided by the rough registration, a Hough transform for restricting dynamic parameters is searched for straight lines in the ROI, the intersection points of multiple first images are paired using the specific region method, and bilinear interpolation and affine transformation are used to complete fine registration according to the paired points, so as to obtain the target feature position registration information and form a first target feature position, and the first target feature position includes several registered position points.

[0069] S130: Perform edge detection on the first target feature in the first target feature region image, perform edge segmentation on the first target feature according to the edge detection result, extract the first target feature image, and perform recognition on the first target feature image to obtain a first target feature image recognition result; specifically, the first target feature image recognition result includes text content information, pattern information, etc. The printed text content and pattern on the packaging bag are recognized through a feature recognition algorithm (such as CNN, RNN, OCR, etc.) to obtain the text content and image on the packaging bag;

[0070] S140: Establish a pixel coordinate system based on the first target feature position registration information, extract the pixel points of the first target feature image based on the pixel coordinate system, and obtain a first pixel point set;

[0071] S150: Count the number of pixels in the first pixel point set and calculate the first target feature area;

[0072] S160: Input the first target feature position registration information, the first pixel point set, the first target feature area, and the first target feature image recognition result into the neural network training model for training to obtain a training data set, and perform data fusion on the training data set to form target feature template information. Specifically, by inputting multiple first target feature position registration information, the first pixel point set, and the first target feature image recognition result into the training model, the training model uses an image recognition algorithm (such as a deep learning algorithm, a machine learning algorithm, etc.) as the model framework, trains the model through an iterative optimization algorithm (such as the gradient descent method), uses a validation set to evaluate the performance of the trained model, and finally forms template information. The template information includes template parameters such as the first target feature position, the first pixel point set, the first target feature recognition result, and the first target feature area.

[0073] S200: Obtain a second image, frame a second target area in the second image to obtain a second target area image, perform grayscale processing on the second target area image to obtain a second target area grayscale image, perform edge detection on the second target feature in the second target area grayscale image, perform edge segmentation based on the edge detection result of the second target feature to obtain a second target feature segmentation image, and perform recognition on the second target feature segmentation image to obtain a second target feature recognition result; the second image is an image of a packaging bag to be detected.

[0074] S300: Match the second target feature recognition result with the target feature template information to obtain a recognition result matching result. Specifically, the recognition result is the text or pattern shape represented by the second target feature. Match the second target feature recognition result with the first target feature recognition result in the target feature template information to determine whether the identification, text, and pattern of the packaging bag to be detected are the same as those in the template.

[0075] S400: Based on the recognition result matching result, perform a misprint judgment on the second target feature to obtain a misprint judgment result. Specifically, if the second target feature recognition result does not match the target feature recognition result template in the target feature recognition result template, it is determined that the second target feature is a misprint.

[0076] S500: If the misprint judgment result is no misprint, perform position detection on the second target feature in the second target area grayscale image to obtain the second target feature position information;

[0077] S600: Extract the second pixel points from the image segmented by the second target feature to form a second pixel point set;

[0078] S700: Perform pixel point matching based on the second pixel point set and the target feature template information, and eliminate the matching second pixel points in the second pixel point set; specifically, the second pixel point set is matched with the first target feature pixel point set in the target feature template information, and the second pixel points that match the target feature pixel points in the first target feature pixel point set are eliminated, while those that do not match are retained.

[0079] In a possible implementation manner, performing pixel point matching based on the second pixel point set and the target feature template information, and eliminating the matching second pixel points in the second pixel point set includes:

[0080] S710: Calculate the position error according to the second target feature position information and the target feature template information, and the method of calculating the position error is as follows:

[0081] ;

[0082] ;

[0083] Wherein, is the horizontal coordinate error of the second target feature position point; is the vertical coordinate error of the second target feature position point; is the weight; 、 are the horizontal coordinate and vertical coordinate of the first target feature position point respectively; 、 are the horizontal coordinate and vertical coordinate of the second target feature position point respectively; is the number of the first target feature position point and the second target feature position point, ≥1, taking an integer. (For example, when =1, is the horizontal coordinate of the second target feature position point numbered 1, and so on).

[0084] Obtain the position error calculation result through the above calculation method.

[0085] S720: Perform calibration calculation on the coordinate of each pixel point in the second pixel point set according to the error calculation result, and the method of calibration calculation is as follows;

[0086] ;

[0087] Wherein, 、 are the horizontal coordinate and vertical coordinate after calibration of the second pixel point respectively; , They are respectively the abscissa and ordinate of the second pixel points obtained by extraction; is the number of the second pixel points, ≥1, taking an integer;

[0088] Through the above calculation method, the coordinate calibration calculation result of the second pixel points is obtained, the calibrated coordinates of the second pixel points are obtained, and a calibrated pixel point set is formed;

[0089] S730: Perform pixel point matching according to the calibrated pixel point set and the target feature template information, eliminate the calibrated pixel points that match the target feature template information, and retain the calibrated pixel points that do not match the target feature template information; Specifically, the calibrated pixel point set is matched with the first target feature pixel point set in the target feature template information.

[0090] S800: Perform defect judgment on the remaining unmatched second pixel points to obtain a defect judgment result.

[0091] In a possible implementation manner, the performing defect judgment on the remaining unmatched second pixel points to obtain a defect judgment result includes:

[0092] S810: Perform continuity judgment on the remaining calibrated pixel points, determine boundary pixel points according to the continuity judgment result, fit the boundary pixel points to obtain a closed fitting region, calculate the area of the fitting region, and calculate a missing ratio according to the area of the fitting region and the first target feature area in the target feature template information to obtain a missing ratio calculation result; Specifically, the continuity between adjacent pixel points is judged by calculating the distance between adjacent pixel points. For example, the distance between adjacent pixel points X , Y is L , the continuity threshold is I , if L is greater than I , then it is judged that the pixel points X , Y are discontinuous; if L is less than I , then it is judged that the pixel points X , Y are continuous. When X , Y are discontinuous, then X , YThey are the boundary pixel points of different fitting regions respectively. After determining the boundary pixel points in the above manner, the edge line is fitted through a pixel point fitting algorithm (such as line fitting, curve fitting), the edge line and the region within the edge line are extracted, and the area of the region is calculated by counting the pixel points on the edge line and within the region of the edge line, that is, the fitting region area. Finally, the ratio of the calculated fitting region area to the target feature template information is calculated to obtain the missing ratio calculation result.

[0093] The calculation method of the fitting region area is as follows:

[0094] ;

[0095] Wherein, is the fitting region area, with the unit of square millimeter; is the pixel point area, with the unit of square millimeter; is the number of pixel points within the fitting region (including the number of pixel points on the edge line and within the edge line of the fitting region).

[0096] The fitting region area is obtained through the above calculation method, and the ratio of the fitting region area to the first target feature area is calculated. The calculation method is as follows:

[0097] ;

[0098] Wherein, is the first target feature area, with the unit of square millimeter; is the missing ratio, 0 < ≤1.

[0099] S820: Defect judgment is performed based on the missing ratio calculation result and the preset missing ratio to obtain the defect judgment result. Specifically, the missing ratio is compared with the preset missing ratio. The preset missing ratio has a missing printing missing ratio and a missing printing omission ratio. For example, the missing printing missing ratio is b , and the missing printing omission ratio is c , 0 < b < c ≤1. If < b , it is determined that the target feature is complete. If b < ≤ c , it is determined that the target feature is missing printing. If c < , it is determined that the target feature is missing printing omission.

[0100] Through the above method, this embodiment can automatically detect the printing defects of the packaging bag, and automatically identify the defects such as misprinting, missing printing, and leakage printing of the marks, patterns, and texts on the packaging bag, realizing the automatic detection of the printing defects of the packaging bag, reducing the labor intensity, improving the detection accuracy, and being applicable to the detection of packaging bags in large-scale production.

[0101] Embodiment 2:

[0102] This embodiment provides a packaging defect detection system here. By executing the packaging defect detection method described in Embodiment 1 through this packaging defect detection system, as Figure 2 shown, the packaging defect detection system includes:

[0103] A template establishment unit 100, configured to obtain a first image, process the first image to obtain a first target feature image, and process the first target feature image to obtain target feature template information;

[0104] An image recognition unit 200, configured to obtain a second image, frame a second target area in the second image to obtain a second target area image, perform gray processing on the second target area image to obtain a second target area gray image, perform edge detection on the second target feature in the second target area gray image, perform edge segmentation based on the edge detection result of the second target feature to obtain a second target feature segmentation image, and perform recognition on the second target feature segmentation image to obtain a second target feature recognition result;

[0105] A recognition result matching unit 300, configured to perform recognition result matching according to the second target feature recognition result and the target feature template information to obtain a recognition result matching result;

[0106] A misprint judgment unit 400, configured to perform misprint judgment on the second target feature based on the recognition result matching result to obtain a misprint judgment result;

[0107] A position detection unit 500, configured to perform position detection on the second target feature in the second target area gray image to obtain second target feature position information;

[0108] A pixel point extraction unit 600, configured to extract the pixel points of the second target feature segmentation image to obtain a second pixel point set;

[0109] A pixel point matching unit 700, configured to perform pixel point matching according to the second pixel point set and the target feature template information, and eliminate the second pixel points that match in the second pixel point set;

[0110] A defect judgment unit 800, configured to perform defect judgment on the remaining unmatched second pixel points to obtain a defect judgment result.

[0111] In this embodiment, the template creation unit may further include:

[0112] An image processing module that acquires a first image, performs grayscale processing on the first image to obtain a first grayscale image, preprocesses the first grayscale image, detects a first target feature region in the first grayscale image, and segments the first target feature region from the first grayscale image to obtain a first target feature region image;

[0113] An image registration module that performs registration processing on the first target feature region image to obtain first target feature position registration information;

[0114] An edge detection module that performs edge detection on the first target feature in the first target feature region image, performs edge segmentation on the first target feature according to the edge detection result, extracts the first target feature image, and performs recognition on the first target feature image to obtain a first target feature image recognition result;

[0115] A pixel point extraction module that counts the number of pixel points in the first pixel point set and calculates the area of the first target feature;

[0116] A template training module that inputs the first target feature position registration information, the first pixel point set, the area of the first target feature, and the first target feature image recognition result into a neural network training model for training to obtain a training data set, and performs data fusion on the training data set to form target feature template information.

[0117] The pixel point matching unit may include:

[0118] A position error calculation module that calculates a position error according to the second target feature position information and the target feature template information to obtain a position error calculation result. The method of calculating the position error is as follows:

[0119] ;

[0120] ;

[0121] Where is the horizontal coordinate error of the second target feature position point; is the vertical coordinate error of the second target feature position point; is the weight; , are respectively the horizontal and vertical coordinates of the first target feature position point; , are respectively the horizontal and vertical coordinates of the second target feature position point; is the number of the first target feature position point and the second target feature position point, ≥1, taking an integer.

[0122] The pixel point calibration module performs calibration calculations on the coordinates of each pixel point in the second pixel point set according to the error calculation result, obtains the second pixel point coordinate calibration calculation result, obtains the second pixel point calibration coordinates, and forms a calibrated pixel point set; the calibration calculation method is as follows;

[0123] ;

[0124] Among them, 、 are the abscissa and ordinate of the second pixel point after calibration respectively; 、 are the abscissa and ordinate of the second pixel point extracted respectively; is the number of second pixel points, ≥1, taking an integer.

[0125] The pixel point matching module performs pixel point matching according to the calibrated pixel point set and the target feature template information, eliminates the calibrated pixel points that match the target feature template information, and retains the calibrated pixel points that do not match the target feature template information.

[0126] The defect judgment unit includes:

[0127] The pixel point fitting module judges the continuity of the remaining calibrated pixel points, determines the boundary pixel points according to the continuity judgment result, fits the boundary pixel points, obtains a closed fitting area, calculates the area of the fitting area, and calculates the missing ratio according to the area of the fitting area and the first target feature area in the target feature template information, and obtains the missing ratio calculation result;

[0128] The calculation method of the area of the fitting area is as follows:

[0129] ;

[0130] Among them, is the area of the fitting area, in square millimeters; is the area of a pixel point, in square millimeters; is the number of pixel points in the fitting area. (Including the number of pixel points on the edge line of the fitting area and inside the edge line);

[0131] The calculation method of the missing ratio is as follows:

[0132] ;

[0133] Among them, is the first target feature area, in square millimeters; is the missing ratio, 0< ≤1;

[0134] A missing judgment module judges defects based on the result of calculating the missing ratio and a preset missing ratio, and obtains a defect judgment result.

[0135] Although the present application makes various references to certain modules in the system according to the embodiments of the present application, however, any number of different modules can be used and run on the user terminal and / or the server. The included individual units and modules are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be achieved; in addition, the specific names of the respective functional units are only for the convenience of mutual distinction and do not limit the protection scope of the present invention.

[0136] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be obvious to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to these embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for detecting packaging defects, characterized in that, include: Acquire a first image, process the first image to obtain a first target feature image, and process the first target feature image to obtain target feature template information; Acquire a second image, select a second target area in the second image, obtain a second target area image, perform grayscale processing on the second target area image, obtain a second target area grayscale image, perform edge detection on a second target feature in the second target area grayscale image, perform edge segmentation based on the edge detection result of the second target feature, obtain a second target feature segmentation image, and recognize the second target feature segmentation image to obtain a second target feature recognition result; Matching the recognition result with the target feature template information according to the second target feature recognition result to obtain a recognition result matching result; Perform misprinting judgment on the second target feature based on the recognition result matching result to obtain a misprinting judgment result; If the misprinting judgment result is no misprinting, performing position detection on the second target feature in the grayscale image of the second target area to obtain the second target feature position information; Extracting second pixel points from the second target feature segmentation image to form a second pixel point set; Perform pixel matching based on the second pixel point set and the target feature template information, and remove the second pixel points matched in the second pixel point set; Performing defect judgment on the retained unmatched second pixel point to obtain a defect judgment result; Acquiring a first image, processing the first image, obtaining a first target feature image, and processing the first target feature image to obtain target feature template information include: Acquire a first image, perform grayscale processing on the first image to obtain a first grayscale image, perform preprocessing on the first grayscale image, detect a first target feature region in the first grayscale image, segment the first target feature region from the first grayscale image, and obtain a first target feature region image; Performing registration processing on the first target feature region image to obtain first target feature position registration information; Performing edge detection on the first target feature in the first target feature region image, performing edge segmentation on the first target feature according to the edge detection result, extracting the first target feature image, recognizing the first target feature image, and obtaining a first target feature image recognition result; Establishing a pixel coordinate system based on the first target feature position registration information, extracting pixel points of the first target feature image based on the pixel coordinate system, and obtaining a first pixel point set; Counting the number of pixels in the first pixel point set and calculating the first target feature area; Inputting the first target feature position registration information, the first pixel point set, the first target feature area and the first target feature image recognition result into a neural network training model for training to obtain a training data set, and performing data fusion on the training data set to form target feature template information; Perform pixel matching according to the second pixel point set and the target feature template information, and remove the second pixel points matched in the second pixel point set; including: Performing position error calculation based on the second target feature position information and the target feature template information to obtain a position error calculation result; According to the error calculation result, perform calibration calculation on the coordinates of each pixel point in the second pixel point set to obtain the second pixel point coordinate calibration calculation result, obtain the second pixel point calibration coordinates, and form a calibrated pixel point set; Match the calibrated pixel point set with the target feature template information, eliminate the calibrated pixel points that match the target feature template information, and retain the calibrated pixel points that do not match the target feature template information; Perform defect judgment on the remaining unmatched second pixel points to obtain a defect judgment result, including: Perform continuity judgment on the remaining calibrated pixel points, determine boundary pixel points according to the continuity judgment result, fit the boundary pixel points to obtain a closed fitted area, calculate the area of the fitted area, and calculate the missing ratio according to the area of the fitted area and the first target feature area in the target feature template information to obtain the missing ratio calculation result; Perform defect judgment according to the missing ratio calculation result and the preset missing ratio to obtain a defect judgment result; The determining boundary pixel points according to the continuity judgment result, fitting the boundary pixel points to obtain a closed fitted area, and calculating the area of the fitted area include: Calculate the distance between adjacent calibrated pixel points, judge boundary pixel points according to the distance between adjacent calibrated pixel points, and fit the edge lines of the boundary pixel points belonging to the same area; Extract the edge line and the area within the edge line, and calculate the area of the fitted area by counting the pixel points of the edge line and the area within the edge line.

2. The packaging defect detection method according to claim 1, wherein The calculation method of the position error calculation is as follows: ; ; Among them, is the abscissa error of the second target feature position point; is the ordinate error of the second target feature position point; is the weight; , are the abscissa and ordinate of the first target feature position point respectively; , are the abscissa and ordinate of the second target feature position point respectively; is the number of the first target feature position point and the second target feature position point, ≥1, taking an integer.

3. The packaging defect detection method according to claim 2, wherein The method of the calibration calculation is as follows; ; Among them, and are the abscissa and ordinate of the second pixel point after calibration, respectively; and are the abscissa and ordinate of the second pixel point extracted, respectively; is the number of second pixel points, ≥1, taking an integer.

4. The packaging defect detection method according to claim 1, wherein The calculation method of the fitted area is as follows; ; Among them, is the area of the fitting region, with the unit of square millimeters; is the area of a pixel point, with the unit of square millimeters; is the number of pixel points within the fitting region.

5. A method for detecting packaging defects according to claim 4, characterized in that, The calculation of the missing ratio is as follows: ; wherein, is the first target feature area, in square millimeters; is the missing ratio, 0 < ≤ 1.

6. A packaging defect detection system, characterized in that, This packaging defect detection system is used to execute a packaging defect detection method described in any one of claims 1 to 5 above. This packaging defect detection system includes: A template establishment unit, which is used to obtain a first image, process the first image to obtain a first target feature image, and process the first target feature image to obtain target feature template information; An image recognition unit, which is used to obtain a second image, frame a second target area in the second image to obtain a second target area image, perform gray processing on the second target area image to obtain a second target area gray image, perform edge detection on the second target feature in the second target area gray image, perform edge segmentation based on the edge detection result of the second target feature to obtain a second target feature segmentation image, and perform recognition on the second target feature segmentation image to obtain a second target feature recognition result; A recognition result matching unit, which is used to match the second target feature recognition result with the target feature template information to obtain a recognition result matching result; A misprint judgment unit, which is used to perform misprint judgment on the second target feature based on the recognition result matching result to obtain a misprint judgment result; A position detection unit, which is used to perform position detection on the second target feature in the second target area gray image to obtain second target feature position information; A pixel point extraction unit, which is used to extract the pixel points of the second target feature segmentation image to obtain a second pixel point set; A pixel point matching unit, which is used to perform pixel point matching according to the second pixel point set and the target feature template information, and eliminate the matched second pixel points in the second pixel point set; A defect judgment unit, which judges the defects of the remaining unmatched second pixel points to obtain a defect judgment result.

Citation Information

Patent Citations

  • Appearance quality detection method based on machine vision

    CN114549504A

  • Label defect detection method based on machine vision

    CN117474924A

Cited By

  • Deep learning-based printed defect automatic detection system and method

    CN122617842A