Packaging defect detection method and detection system thereof

Through automated image processing and recognition technology, the problems of low efficiency and low accuracy of traditional manual detection are solved, and the rapid and accurate detection of packaging bag printing defects is achieved, which is suitable for large-scale production lines.

CN119399203AActive Publication Date: 2025-02-07CHENGDU GUIYI FOOD DEV CO LTD

Patent Information

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

AI Technical Summary

Technical Problem

Traditional packaging bag printing quality inspection relies on manual visual inspection, and there are subjective factors that have a great impact, difficult to unify inspection standards, low efficiency, and difficult to adapt to the fast and continuous inspection needs on large-scale production lines.

Method used

A packaging defect detection method is adopted to obtain images, pre-process, edge detection, segmentation, and identification, establish target feature template information, and realize automatic detection of packaging bag printing defects through pixel point matching and defect judgment.

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 the fast and continuous inspection needs on large-scale production lines.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119399203A_ABST
    Figure CN119399203A_ABST
Patent Text Reader

Abstract

The invention discloses a package defect detection method and a detection system thereof, and relates to the technical field of package detection, the package defect detection method comprises the following steps: establishing target feature template information; obtaining a second image, detecting the edge of a second target feature, carrying out edge segmentation on the second target feature, recognizing a second target feature segmentation image, carrying out recognition result matching according to a second target feature recognition result and target feature template information, and carrying out wrong printing judgment on the second target feature based on a recognition result matching result. Obtaining a wrong printing judgment result; if the wrong printing judgment result is that wrong printing is not carried out, extracting pixel points of a second target feature segmentation image, carrying out pixel point matching according to a second pixel point set and the target feature template information, and rejecting the matched second pixel points; and performing defect judgment on the reserved second pixel points. Automatic detection of packaging bag printing defects is realized, the labor intensity of manual detection is reduced, and the detection precision is improved.
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 in particular to a packaging defect detection method and a detection system thereof. Background Art

[0002] As an indispensable part of modern commodity circulation, packaging bags not only bear the basic functions of protecting products and facilitating carrying and transportation, but also become an important means of conveying product information and enhancing brand image through their appearance design and surface printing content.

[0003] However, during the production and processing of packaging bags, due to various factors such as technical limitations of printing equipment, operating errors, material problems or improper post-processing, the printed content on the packaging bags often has quality problems such as misprinting, missing printing and lack of printing. These printing defects not only affect the aesthetics and professional image of the product, but are also likely to cause consumers to misunderstand product information.

[0004] Traditional packaging bag printing quality inspection 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, it is difficult to unify inspection standards, and differences in judgment between different inspectors may lead to missed inspections or misjudgments; on the other hand, manual inspection is inefficient and difficult to adapt to the needs of fast and continuous inspection on large-scale production lines. Summary of the invention

[0005] Therefore, in order to solve the above-mentioned shortcomings, the present invention detects 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 automated detection of printing defects of packaging bags and reducing the labor intensity of manual detection.

[0006] In one aspect, the present invention provides a packaging defect detection method, comprising: 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, position detection is performed on the features 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; Defect judgment is performed on the retained unmatched second pixel point to obtain a defect judgment result.

[0007] 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.

[0008] 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: 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; 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.

[0009] 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: 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; 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; 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.

[0010] Furthermore, the position error calculation is calculated as follows: ; ; 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.

[0011] Furthermore, the calibration calculation is performed as follows: ; in, , are the horizontal coordinate and vertical coordinate of the second pixel point after calibration respectively; , are the horizontal coordinate and the vertical coordinate of the second pixel point extracted respectively; is the number of the second pixel points, ≥1, take the integer.

[0012] Furthermore, performing defect judgment on the retained unmatched second pixel point to obtain a defect judgment result includes: Perform continuity judgment on the retained calibration pixels, determine the boundary pixels according to the continuity judgment result, fit the boundary pixels to obtain a closed fitting area, calculate the area of ​​the fitting area, calculate the missing ratio according to the area of ​​the fitting area and the first target feature area in the target feature template information, and obtain the missing ratio calculation result; Defect judgment is performed based on the missing ratio calculation result and the preset missing ratio to obtain the defect judgment result.

[0013] Furthermore, the area of ​​the fitting region is calculated as follows; ; in, is the area of ​​the fitting region, in square millimeters; is the pixel area in square millimeters; is the number of pixels in the fitting area.

[0014] Furthermore, the missing ratio is calculated as follows: ; in, is the first target characteristic area, in square millimeters; is the missing ratio, 0< ≤1.

[0015] On the other hand, the present invention provides a packaging defect detection system, which is used to perform the above-mentioned packaging defect detection method, and the packaging defect detection system includes: A template establishing unit, used for acquiring a 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; an image recognition unit, configured to 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; A recognition result matching unit, used to match the recognition result with the target feature template information according to the second target feature recognition result to obtain a recognition result matching result; A misprint judgment unit, used to perform misprint judgment on the second target feature based on the recognition result and matching result to obtain a misprint judgment result; A position detection unit, used to perform position detection on a second target feature in the grayscale image of the second target area to obtain position information of the second target feature; A pixel point extraction unit, used to extract pixel points of the second target feature segmentation image to obtain a second pixel point set; A pixel matching unit, used for performing pixel matching according to the second pixel set and the target feature template information, and removing the matched second pixel points in the second pixel set; The defect judgment unit performs defect judgment on the retained unmatched second pixel point to obtain a defect judgment result.

[0016] The present invention has the following advantages: 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. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 It is a flow chart of a packaging defect detection method; Figure 2 It is a logical structure diagram of the packaging defect detection system; In the figure: 100, template establishment unit; 200, image recognition unit; 300, recognition result matching unit; 400, misprint judgment unit; 500, position detection unit; 600, pixel extraction unit; 700, pixel matching unit; 800, defect judgment unit. DETAILED DESCRIPTION

[0018] Embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present application, and should not be construed as limiting the present application.

[0019] In this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprises", or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or apparatus that includes a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article, or apparatus.

[0020] As mentioned in the background technology, traditional packaging bag printing quality inspection 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, it is difficult to unify the inspection standards, and the differences in judgment between different inspectors may lead to missed inspections or misjudgments; on the other hand, manual inspection is inefficient and difficult to adapt to the needs of fast and continuous inspection on large-scale production lines.

[0021] Based on the above reasons, the present invention provides the following embodiments.

[0022] Embodiment 1: like Figure 1 As shown, this embodiment provides a packaging defect detection method, including: S100: 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; Specifically, the first image is a qualified packaging bag image. This embodiment uses a high-resolution camera or image acquisition device to shoot food packaging (such as hot pot base packaging) from multiple angles and in all directions to ensure that the shooting environment has sufficient and uniform lighting and avoid the influence of shadows and reflections on the image quality.

[0023] In a possible implementation, acquiring a 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; further comprising: S110: Acquire a first image, grayscale process 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, segment the first target feature region from the first grayscale image, and obtain a first target feature region image; specifically, preprocess the collected basic packaging image, including grayscale, denoising, contrast enhancement and other operations, for example, grayscale the first image using a weighted average method, and denoise the first image using a Gaussian filter image denoising method to improve the noise reduction effect while retaining more details. Apply a linear grayscale transformation method to enhance the contrast of the first grayscale image. This embodiment also segments the preprocessed image by applying an image segmentation algorithm (such as a region segmentation method, an edge detection segmentation method, etc.) to extract a target feature region image.

[0024] 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 the position data information for determining each target of other images, and the first target feature position in the image to be detected is determined by the target feature position registration information. In this embodiment, bilinear interpolation and rigid transformation are used to complete rough registration according to the centroid offset value and deflection angle of the outer contour of the image to be registered; based on the prior information provided by the rough registration, a Hough transform search line with restricted dynamic parameters is performed in the ROI, and the intersection points of multiple first images are paired using the specific area method, and bilinear interpolation and affine transformation are used to complete fine registration according to the paired points, thereby obtaining target feature position registration information and forming a first target feature position, which includes several registered position points.

[0025] 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, recognize the first target feature image, and obtain the 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 by a feature recognition algorithm (such as CNN, RNN, OCR, etc.), so as to obtain the text content and image on the packaging bag; S140: 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; S150: Counting the number of pixels in the first pixel point set and calculating the first target feature area; 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, obtain a training data set, perform data fusion on the training data set, and form target feature template information. Specifically, by inputting a plurality of 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 a model framework, trains the model through an iterative optimization algorithm (such as a gradient descent method), uses a validation set to evaluate the performance of the trained model, and finally forms template information, which includes: the first target feature position, the first pixel point set, the first target feature recognition result, the first target feature area, and other template parameters.

[0026] S200: 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, identify the second target feature segmentation image, and obtain a second target feature recognition result; the second image is an image of a packaging bag to be detected.

[0027] S300: Match the recognition result according to 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. The second target feature recognition result is matched with the first target feature recognition result in the target feature template information to determine whether the logo, text, or pattern of the packaging bag to be inspected is the same as that in the template.

[0028] S400: Perform misprint judgment on the second target feature based on the recognition result matching result 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, the second target feature is judged to be misprinted.

[0029] S500: If the misprinting judgment result is no misprinting, position detection is performed on the second target feature in the grayscale image of the second target area to obtain position information of the second target feature; S600: extracting second pixel points from the second target feature segmentation image to form a second pixel point set; S700: Pixel matching is performed according to the second pixel point set and the target feature template information, and the second pixel points that match in the second pixel point set are eliminated; 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.

[0030] In a possible implementation, performing pixel matching according to the second pixel point set and the target feature template information, and removing the matched second pixel points in the second pixel point set, includes: S710: Calculate the position error according to the second target feature position information and the target feature template information. The position error calculation method is as follows: ; ; 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. (For example, when =1, is the horizontal coordinate of the second target feature position point numbered 1, and so on).

[0031] The position error calculation result is obtained through the above calculation method.

[0032] S720: performing calibration calculation on the coordinates of each pixel point in the second pixel point set according to the error calculation result, wherein the calibration calculation is performed in the following manner; ; in, , are the horizontal coordinate and vertical coordinate of the second pixel point after calibration respectively; , are the horizontal coordinate and the vertical coordinate of the second pixel point extracted respectively; is the number of the second pixel points, ≥1, take the integer; Obtain the second pixel point coordinate calibration calculation result by the above calculation method, obtain the second pixel point calibration coordinates, and form a calibration pixel point set; S730: Perform pixel matching based on the calibration pixel set and the target feature template information, remove the calibration pixel points that match the target feature template information, and retain the calibration pixel points that do not match the target feature template information; specifically, the calibration pixel set is matched with the first target feature pixel set in the target feature template information.

[0033] S800: Perform defect judgment on the retained unmatched second pixel point to obtain a defect judgment result.

[0034] In a possible implementation, performing defect judgment on the retained unmatched second pixel point to obtain a defect judgment result includes: S810: Perform continuity judgment on the retained calibration pixel points, determine the boundary pixel points according to the continuity judgment result, fit the boundary pixel points to obtain a closed fitting area, calculate the area of ​​the fitting area, calculate the missing ratio according to the area of ​​the fitting area and the first target feature area in the target feature template information, and obtain the missing ratio calculation result; specifically, the continuity between adjacent pixel points is judged by calculating the distance between adjacent pixel points, for example, adjacent pixel points X , Y The distance between L , the continuity threshold is I ,like L Greater than I , then determine the pixel X , Y Not continuous; if L Less than I , then determine the pixel X , Y Continuous, when X , Y When it is discontinuous, X , Y are the boundary pixels of different fitting areas. After the boundary pixels are determined in the above manner, the edge line is fitted by a pixel fitting algorithm (such as straight line fitting, curve fitting), the edge line and the area within the edge line are extracted, and the pixel points of the edge line and the area within the edge line are counted to calculate the area of ​​the area, that is, the area of ​​the fitting area. Finally, the calculated area of ​​the fitting area is compared with the target feature template information to obtain the missing ratio calculation result.

[0035] The calculation method of the fitting area is as follows: ; in, is the area of ​​the fitting region, in square millimeters; is the pixel area in square millimeters; is the number of pixels in the fitting area (including the edge line of the fitting area and the number of pixels in the edge line).

[0036] The area of ​​the fitting region is obtained by the above calculation method, and the ratio of the area of ​​the fitting region to the first target feature area is calculated as follows: ; in, is the first target characteristic area, in square millimeters; is the missing ratio, 0< ≤1.

[0037] S820: Defect judgment is performed according to the missing ratio calculation result and the preset missing ratio to obtain a defect judgment result. Specifically, the missing ratio is compared with the preset missing ratio, and the preset missing ratio includes a missing print ratio and a missing print ratio. For example, the missing print ratio is b , the missing ratio is c ,0< b < c ≤1, if < b , then the target feature is judged to be complete, if b < ≤ c , then the target feature is judged to be missing. If c < , then it is judged that the target feature is missed.

[0038] This embodiment can automatically detect printing defects of packaging bags in the above manner, and automatically identify defects such as misprinting, missing printing, and omitted printing of logos, patterns, and texts on packaging bags, thereby realizing automatic detection of printing defects of packaging bags, reducing labor intensity, and improving detection accuracy, and is suitable for large-scale production packaging bag detection.

[0039] Embodiment 2: This embodiment provides a packaging defect detection system, through which the packaging defect detection method described in Embodiment 1 is executed. Figure 2 As shown, the packaging defect detection system includes: The template establishing unit 100 is used to 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; The image recognition unit 200 is used to 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, recognize the second target feature segmentation image, and obtain a second target feature recognition result; The recognition result matching unit 300 is used to match the recognition result with the target feature template information according to the second target feature recognition result to obtain a recognition result matching result; The misprinting judgment unit 400 is used to perform misprinting judgment on the second target feature based on the recognition result and matching result to obtain a misprinting judgment result; The position detection unit 500 is used to perform position detection on the second target feature in the grayscale image of the second target area to obtain the position information of the second target feature; A pixel point extraction unit 600 is used to extract pixel points of the second target feature segmentation image to obtain a second pixel point set; A pixel matching unit 700 is used to perform pixel matching based on the second pixel set and the target feature template information, and remove the matched second pixel points in the second pixel set; The defect judgment unit 800 performs defect judgment on the retained unmatched second pixel points to obtain a defect judgment result.

[0040] In this embodiment, the template creation unit may further include: An image processing module, wherein the first image processing module acquires a first image, performs grayscale processing on the first image to obtain a first grayscale image, performs preprocessing on 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; An image registration module performs registration processing on the first target feature region image to obtain first target feature position registration information; An edge detection module 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, recognizes the first target feature image, and obtains a first target feature image recognition result; A pixel point extraction module, which counts the number of pixels in the first pixel point set and calculates the first target feature area; The template training module inputs 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, obtains the training data set, and performs data fusion on the training data set to form the target feature template information.

[0041] The pixel matching unit may include: The position error calculation module performs position error calculation based on the second target feature position information and the target feature template information to obtain a position error calculation result. The position error calculation method is as follows: ; ; 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.

[0042] The pixel calibration module performs calibration calculation on the coordinates of each pixel 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 calibration pixel point set; the calibration calculation method is as follows; ; in, , are the horizontal coordinate and vertical coordinate of the second pixel point after calibration respectively; , are the horizontal coordinate and the vertical coordinate of the second pixel point extracted respectively; is the number of the second pixel points, ≥1, take the integer.

[0043] The pixel matching module performs pixel matching based on the calibration pixel set and the target feature template information, removes the calibration pixel points that match the target feature template information, and retains the calibration pixel points that do not match the target feature template information.

[0044] The defect judgment unit comprises: The pixel fitting module performs continuity judgment on the retained calibration pixels, determines the boundary pixels according to the continuity judgment result, fits the boundary pixels to obtain a closed fitting area, calculates the area of ​​the fitting area, 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; The calculation method of the fitting area is as follows: ; in, is the area of ​​the fitting region, in square millimeters; is the pixel area in square millimeters; is the number of pixels in the fitting area. (including the edge line of the fitting area and the number of pixels in the edge line); The missing ratio is calculated as follows: ; in, is the first target characteristic area, in square millimeters; is the missing ratio, 0< ≤1; The missing judgment module performs defect judgment according to the missing ratio calculation result and the preset missing ratio to obtain the defect judgment result.

[0045] Although the present application makes various references to certain modules in the system according to the embodiments of the present application, any number of different modules may be used and run on the user terminal and / or server, and the various units and modules included 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 functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.

[0046] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may 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 the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A packaging defect detection method, 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; Defect judgment is performed on the retained unmatched second pixel point to obtain a defect judgment result.

2. A packaging defect detection method according to claim 1, characterized in that: 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; 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.

3. A packaging defect detection method according to claim 2, characterized in that: 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; 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; According to the matching of the calibration pixel set with the target feature template information, the calibration pixel points that match the target feature template information are eliminated, and the calibration pixel points that do not match the target feature template information are retained.

4. A packaging defect detection method according to claim 3, characterized in that: The position error calculation is calculated as follows: ; ; 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.

5. A packaging defect detection method according to claim 4, characterized in that: The calibration calculation method is as follows: ; in, , are the horizontal coordinate and vertical coordinate of the second pixel point after calibration respectively; , are the horizontal coordinate and the vertical coordinate of the second pixel point extracted respectively; is the number of the second pixel points, ≥1, take the integer.

6. A packaging defect detection method according to claim 3, characterized in that: The step of performing defect judgment on the retained unmatched second pixel point to obtain a defect judgment result includes: Perform continuity judgment on the retained calibration pixels, determine the boundary pixels according to the continuity judgment result, fit the boundary pixels to obtain a closed fitting area, calculate the area of ​​the fitting area, calculate the missing ratio according to the area of ​​the fitting area and the first target feature area in the target feature template information, and obtain the missing ratio calculation result; Defect judgment is performed based on the missing ratio calculation result and the preset missing ratio to obtain the defect judgment result.

7. A packaging defect detection method according to claim 6, characterized in that: The area of ​​the fitted region is calculated as follows; ; in, is the area of ​​the fitting region, in square millimeters; is the pixel area in square millimeters; is the number of pixels in the fitting area.

8. A packaging defect detection method according to claim 7, characterized in that: The missingness ratio is calculated as follows: ; in, is the first target characteristic area, in square millimeters; is the missing ratio, 0< ≤1.

9. A packaging defect detection system, characterized in that: The packaging defect detection system is used to execute a packaging defect detection method according to any one of claims 1 to 8 above, and the packaging defect detection system comprises: A template establishing unit, used for acquiring a 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; an image recognition unit, configured to 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; A recognition result matching unit, used to match the recognition result with the target feature template information according to the second target feature recognition result to obtain a recognition result matching result; A misprint judgment unit, 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, used to perform position detection on a second target feature in the grayscale image of the second target area to obtain position information of the second target feature; A pixel point extraction unit, used to extract pixel points of the second target feature segmentation image to obtain a second pixel point set; A pixel matching unit, used for performing pixel matching according to the second pixel set and the target feature template information, and removing the matched second pixel points in the second pixel set; The defect judgment unit performs defect judgment on the retained unmatched second pixel point to obtain a defect judgment result.

Citation Information

Patent Citations

  • Printed matter detecting method, device and equipment, and storage medium

    CN108469438A

  • Vision-based image-text defect detection method

    CN111650220A

  • Appearance quality detection method based on machine vision

    CN114549504A

  • Label defect detection method based on machine vision

    CN117474924A

  • Printing defect detection method and system and electronic equipment

    CN117611577A

Cited By

  • Double-outlet square bag zippered bag making detection method and system based on image detection

    CN120765551A

  • Card packaging quality visual online detection and defect classification method and system

    CN121981997A

  • Food additive packaging defect detection system based on machine vision

    CN122023373A