A packaging film quality detection method and system
By calculating the gradient difference between background and film images, calculating the image entropy of transparency and film color map, the problem of inaccurate detection results of packaging film defects in the prior art is solved, and fast and accurate detection results are achieved.
Patent Information
- Application Number
- CN202510167841.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-17
- Publication Date
- 2025-04-22
- Estimated Expiration
- 2045-02-17
AI Technical Summary
In the prior art, in packaging film defect detection, a large amount of data is required to train the defect detection network, resulting in high training costs and in the case of limited data volume, accurate defect detection results cannot be obtained.
By collecting background images and film images, the gradient difference between the points in the background gradient map and the film gradient map is calculated, the transparency map is calculated, and the film color map is calculated using the image decomposition model. Finally, the film quality is judged based on the image entropy of the transparency map and the film color map.
It achieves the rapid and accurate defect detection results of packaging film, reduces data acquisition and training costs, and improves the accuracy of detection results.
Smart Images

Figure CN119624976B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to a packaging film quality detection method and system. Background Art
[0002] Packaging film refers to the film material used to protect and package products. It is usually transparent so that the items inside the package can be easily viewed. It is widely used in the packaging of food, medicine, electronic products and other commodities. In the production process of packaging film, defects such as uneven thickness and damage often occur, which affect the packaging effect. In order to ensure the packaging effect, the packaging film needs to be quality tested.
[0003] At present, the patent application document with application publication number CN116843645A discloses a method and device for detecting defects in polypropylene film for product outer packaging, wherein the method includes: obtaining sample data, wherein the sample data includes a preset image of polypropylene film and its annotation information; constructing a defect detection network; performing image preprocessing and data enhancement on the sample data to obtain a training set and a test set; training the parameters of the defect detection model through the training set, wherein the test set is used to test the performance of the defect detection model on unseen data; inputting the defect image of the polypropylene film for product outer packaging into the trained defect detection network for defect detection, and obtaining a defect image of the polypropylene film for product outer packaging with defect targets identified. The defect detection network includes a backbone feature extraction network, an enhanced feature extraction network, and a prediction head.
[0004] The above method uses the trained defect detection network to extract features from the defect image of the product outer packaging polypropylene film to obtain the defect detection result of the packaging film. However, in order to obtain accurate defect detection results, a large amount of data needs to be collected to train the defect detection network, which has a high training cost and cannot obtain accurate defect detection results when the amount of data is limited. Summary of the invention
[0005] In order to solve the technical problem of inaccurate defect detection results, the present application provides a packaging film quality detection method and system, which can quickly and accurately obtain defect detection results.
[0006] In a first aspect, the present application provides a packaging film quality detection method, the detection method comprising: collecting a background image and a background gradient map, as well as a film image and a film gradient map of a film to be detected under the background image; calculating the gradient difference of each position point in the background gradient map and the film gradient map, and calculating the transparency of each position point to obtain a transparency map; Transparency of the location points for: , is the preset coefficient, The film image The gradient difference of the position points, is an exponential function with base e; the transparency map is input into the image decomposition model to calculate the film color value of each position point to obtain a film color map, and the image decomposition model is: , The film image The pixel value of the location point, The background image The background color value of the position point, For the The film color value of each position point is obtained; the image entropy of the film color map and the transparency map is calculated respectively, and the maximum value of the image entropy and the entropy threshold are compared to obtain the quality detection result of the film to be inspected.
[0007] The transparency of each position point is calculated according to the gradient difference of each position point in the background gradient map and the film gradient map, and a transparency map is obtained. The transparency map can reflect the transparency of each position point of the film to be inspected; the image decomposition model regards the film image as the result of weighted summation of the background image and the film color map according to the transparency map. After obtaining the transparency map, the film color map can be obtained according to the image decomposition model. The film color map can reflect the self color of each position point of the film to be inspected; according to the image entropy of the transparency map and the film color map, it is judged whether the transparency and self color of the film to be inspected are uniform, thereby obtaining accurate quality inspection results.
[0008] Preferably, Gradient difference at each position satisfy: , is the background gradient image The gradient value of the position point, is the first The gradient value of a position point.
[0009] Preferably, calculating the gradient difference of each position point in the background gradient map and the film gradient map includes: marking the position point in the background gradient map whose gradient value is greater than the gradient threshold as a valid position point; calculating the gradient difference of each valid position point and the gradient difference fluctuation within the neighborhood; performing anomaly detection on the gradient difference fluctuation, and marking the valid position point with normal gradient difference fluctuation as the target position point; performing an interpolation operation on the gradient difference of the target position point to calculate the gradient difference of other position points other than the target position point, and obtaining the gradient difference of all position points in the background gradient map and the film gradient map.
[0010] Considering that the gradient value of some position points in the background gradient map is 0, or the color of the film to be inspected itself is uneven, the gradient difference caused by the transparency of the film to be inspected at these position points cannot be accurately collected, which leads to the inability to accurately calculate the transparency of each position point. Therefore, the target position point with accurate gradient difference is first located, and then the gradient difference of the target position point is interpolated to obtain the gradient difference of other position points, so as to obtain the accurate gradient difference of each position point and improve the accuracy of transparency.
[0011] Preferably, the neighborhood range is a rectangular area of a preset size centered at the effective position point; Gradient difference fluctuation within the neighborhood of valid locations satisfy: , For the The number of other valid location points in the neighborhood of a valid location point, For the The gradient difference of the valid position points is For the The first valid location point in the neighborhood other valid locations.
[0012] The effective position point is the position point where the gradient difference can be collected. The gradient difference fluctuation is calculated based on the absolute value of the gradient difference between any effective position point and other effective position points in the neighborhood range; the greater the gradient difference fluctuation, the greater the possibility that the color of the film to be inspected at the corresponding effective position point is uneven, and the gradient difference of the effective position point cannot accurately reflect the transparency of the film to be inspected, and the accuracy of the gradient difference at the effective position point is accurately quantified.
[0013] Preferably, the method for determining the preset coefficient includes: collecting a film sample image of a qualified film sample under a background image, and calculating the gradient difference of each position point in the film sample image; setting an initial coefficient to calculate the transparency of each position point, and calculating the film sample color value of each position point in the film sample image according to the image decomposition model, and taking the variance of the film sample color value of each position point as the objective function; adjusting the initial coefficient multiple times, and taking the initial coefficient corresponding to the minimum value of the objective function as the preset coefficient.
[0014] The determination of the preset coefficient is transformed into an optimization problem. The color values of the film samples at each position point in the qualified film samples should be consistent. The variance of the film sample color value is used as the objective function, and the initial coefficient is continuously adjusted to accurately determine the preset coefficient.
[0015] Preferably, Color value of the film sample at each location for:
[0016] ; is the first The pixel value of the location point, The background image The background color value of the position point, is the first The gradient difference of the position points, is the initial coefficient.
[0017] Preferably, in response to the maximum value of the image entropy being less than or equal to the entropy threshold, the quality detection result is qualified, otherwise, the quality detection result is unqualified.
[0018] Preferably, after respectively calculating the image entropies of the film color map and the transparency map, the detection method further comprises: collecting a plurality of background images and a film image of the film to be inspected under each background image, and obtaining the maximum image entropy value corresponding to each background image; in response to the average value of the maximum image entropy value being less than or equal to the entropy threshold value, the quality detection result is qualified, otherwise, the quality detection result is unqualified.
[0019] The distribution of gradient values in the background gradient map will affect the calculation of the gradient difference at each position point. The actual gradient difference cannot be accurately collected, which will lead to errors in the quality inspection results. The film images and film gradient maps of the film to be inspected under multiple background images are collected, and the maximum image entropy values corresponding to the multiple background images are combined to obtain the final quality inspection results, thereby improving the accuracy of the quality inspection results.
[0020] Preferably, the image entropy is one-dimensional image entropy or two-dimensional image entropy.
[0021] In a second aspect of the present application, a packaging film quality detection system is also provided, comprising a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, a packaging film quality detection method according to the first aspect of the present application is implemented.
[0022] The technical solution of this application has the following beneficial technical effects:
[0023] The film to be inspected is placed above the background image, and the image acquisition device is placed above the film to be inspected and the film image of the film to be inspected is acquired from a top-down perspective; a background gradient map of the background image and a film gradient map of the film image are obtained, and the transparency of each position point is calculated according to the gradient difference of each position point in the background gradient map and the film gradient map to obtain a transparency map, which can reflect the transparency of each position point of the film to be inspected; the image decomposition model regards the film image as the result of weighted summation of the background image and the film color map according to the transparency map, and after obtaining the transparency map, the film color map can be obtained according to the image decomposition model, and the film color map can reflect the self-color of each position point of the film to be inspected; the transparency and self-color of the film to be inspected are judged whether they are uniform according to the image entropy of the transparency map and the film color map, and the quality inspection result of the film to be inspected is quickly and accurately obtained from the two aspects of transparency and self-color. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] By reading the detailed description below with reference to the accompanying drawings, the above and other purposes, features and advantages of the exemplary embodiments of the present application will become easy to understand. In the accompanying drawings, several embodiments of the present application are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein:
[0025] Figure 1 is a flow chart of a packaging film quality detection method according to an embodiment of the present application;
[0026] Figure 2 It is a structural block diagram of a packaging film quality detection system according to an embodiment of the present application. DETAILED DESCRIPTION
[0027] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.
[0028] It should be understood that when the terms "first", "second", etc. are used in the claims, specification and drawings of the present application, they are only used to distinguish different objects, rather than to describe a specific order. The terms "include" and "comprise" used in the specification and claims of the present application indicate the presence of the described features, wholes, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or their collections.
[0029] According to the first aspect of the present application, the present application provides a packaging film quality inspection method for performing quality inspection on packaging films. During the quality inspection process, the film to be inspected is located above the inspection background and is in a tensioned state, a background image is displayed on the inspection background, and an image acquisition device is deployed above the film to be inspected to capture a film image of the film to be inspected from a top-down perspective. The image acquisition device may be an industrial camera or a mobile handheld terminal such as a mobile phone.
[0030] It should be noted that the packaging film has a certain degree of transparency, and packaging films of different thicknesses have different transparencies. At the same time, the packaging film itself is also colored. The image acquisition device can acquire information about the background image through the packaging film. Therefore, the film image acquired by the image acquisition device is related to the color of the packaging film itself, the transparency of the packaging film, and the background image. The film image includes multiple position points. For each location point, build an image decomposition model:
[0031] , The film image The pixel value of the location point, The background image The background color value of the position point, For the The film color value at each position, For the The transparency of each location.
[0032] The transparency value range is 0-1. When the transparency of the position point is 0, it means that The background image information cannot be collected at the position point, so the first The pixel value of the position point is equal to The film color value at the position point, i.e. The color of the film itself at the position point; on the contrary, when the When the transparency of the position point is 1, it means that The real information of the background image can be collected at the position point. The pixel value of the position point is equal to The background color value of the location point.
[0033] In other words, since the background color value of each position point is a known quantity, a film image can be decomposed into a film color map and a transparency map, wherein the film color map includes the film color value of each position point, and the transparency map includes the transparency of each position point.
[0034] Figure 1 1 is a flow chart of a packaging film quality detection method according to an embodiment of the present application. Figure 1 As shown, the packaging film quality detection method 100 includes steps S101 to S104, which are described in detail below.
[0035] S101, collecting a background image and a background gradient map, as well as a film image and a film gradient map of a film to be inspected under the background image.
[0036] In one embodiment, in the absence of a film to be inspected, a background image of the inspection background is collected, and the gradient value of each position point in the background image is calculated to obtain a background gradient map. The film to be inspected is placed at a preset position between the image acquisition device and the inspection background, a film image of the film to be inspected under the background image is collected, and the gradient value of each position point in the film image is calculated to obtain a film gradient map. The preset position is a height plane at 0.1 meters from the inspection background.
[0037] It can be understood that the background image and the film image have the same size, and the position points in the background image and the film image correspond one-to-one to the position points of the film to be inspected.
[0038] S102, calculating the gradient difference of each position point in the background gradient map and the film gradient map, and calculating the transparency of each position point to obtain a transparency map.
[0039] In one embodiment, since the film to be inspected has a certain degree of transparency, for any position point, the gradient value of the position point in the film gradient map is determined by the transparency of the position point and the gradient value of the position point in the background gradient map. For example, if the transparency of the position point is close to 1, the image information in the film image is closer to the background image, and the gradient value of the position point in the film gradient map is closer to the gradient value in the background gradient map. If the transparency of the position point is close to 0, the image information in the film image is closer to the film color map of the film itself, and the gradient value of the position point in the film gradient map is more different from the gradient value in the background gradient map; that is, the transparency of the film to be inspected will produce a gradient difference between the background gradient map and the film gradient map. In other words, the gradient difference between a position point in the background gradient map and the film gradient map can reflect the transparency of the position point.
[0040] Specifically, the gradient difference between the background gradient map and the film gradient map is calculated. Gradient difference at each position satisfy: , is the background gradient image The gradient value of the position point, is the first The gradient value of a position point.
[0041] In another embodiment, when the gradient value of some positions in the background gradient map is 0, or the color of the film to be inspected itself is uneven (i.e., when the film color map has a gradient value), the gradient difference caused by the transparency of the film to be inspected at these positions cannot be accurately collected, which leads to the inability to accurately calculate the transparency of each position point. In order to improve the accuracy of transparency, first locate the position point with accurate gradient difference, and then interpolate based on the position point with accurate gradient difference to obtain the accurate gradient difference of each position point.
[0042] Specifically, the method of calculating the gradient difference of each position point in the background gradient map and the film gradient map includes: marking the position point in the background gradient map whose gradient value is greater than the gradient threshold as a valid position point; calculating the gradient difference of each valid position point, as well as the gradient difference fluctuation within the neighborhood; performing anomaly detection on the gradient difference fluctuation, and marking the valid position point with normal gradient difference fluctuation as the target position point; performing an interpolation operation on the gradient difference of the target position point to calculate the gradient difference of other position points other than the target position point, and obtaining the gradient difference of all position points in the background gradient map and the film gradient map.
[0043] The gradient threshold is 1; the gradient difference between the effective position point and the The calculation formula for the gradient difference of each position point is the same and will not be repeated here.
[0044] The neighborhood range is a rectangular area of a preset size centered on the valid position point. Gradient difference fluctuation within the neighborhood of valid locations satisfy:
[0045] , For the The number of other valid location points in the neighborhood of a valid location point, For the The gradient difference of the valid position points is For the The first valid location point in the neighborhood The preset size is 3×3 or 5×5, which is not limited in this application. The greater the fluctuation of the gradient difference, the greater the possibility that the color of the film to be inspected at the corresponding effective position point is uneven, and the gradient difference of the effective position point cannot accurately reflect the transparency of the film to be inspected.
[0046] Among them, the LOF algorithm (Local Outlier Factor, local outlier factor detection method) or outlier detection algorithms such as isolation forest can be used to detect anomalies in the gradient difference fluctuation to obtain valid position points where the gradient difference fluctuation is normal.
[0047] The interpolation operation may be performed by using a linear interpolation algorithm or a nonlinear interpolation algorithm to calculate the gradient difference of other position points other than the target position point.
[0048] It can be understood that, affected by the transparency of the film to be inspected, the gradient value of any position point in the film gradient map will be smaller than the gradient value of the position point in the background gradient map, and thus there will be a gradient difference between the background gradient map and the film gradient map. In order to accurately obtain the gradient difference caused by the transparency of the film to be inspected, the position point with a gradient value greater than the gradient threshold is marked as a valid position point; further, considering that the uneven color of the film to be inspected itself will affect the accuracy of the gradient difference, the valid position points are screened according to the gradient difference fluctuation within the neighborhood range, and the target position point with normal gradient difference fluctuation is accurately located, and an interpolation operation is performed based on the gradient difference of the target position point to obtain the gradient difference of the valid position point with abnormal gradient difference fluctuation, thereby accurately obtaining the gradient difference of each position point caused by the transparency of the film to be inspected.
[0049] In one embodiment, after obtaining the gradient difference at each position point caused by the transparency of the film to be inspected, the transparency of each position point can be calculated. Transparency of the location points for: , is the preset coefficient, The film image The gradient difference of the position points, is an exponential function with base e.
[0050] Among them, the preset coefficient The accuracy of transparency is directly affected. The method for determining the preset coefficient includes: collecting a film sample image of a qualified film sample under a background image, and calculating the gradient difference of each position point in the film sample image; setting an initial coefficient to calculate the transparency of each position point, and calculating the film sample color value of each position point in the film sample image according to the image decomposition model, and taking the variance of the film sample color value of each position point as the objective function; adjusting the initial coefficient multiple times, and taking the initial coefficient corresponding to the minimum value of the objective function as the preset coefficient.
[0051] Among them, after setting the initial coefficient, the transparency of each position point can be calculated according to the gradient difference of each position point in the film sample image; the background image, the film sample image and the transparency of each position point are input into the image decomposition model, and the color value of the film sample at each position point can be calculated. Color value of the film sample at each location for:
[0052] ; is the first The pixel value of the location point, The background image The background color value of the position point, is the first The gradient difference of the position points, is the initial coefficient; Corresponding to The transparency of each location.
[0053] In qualified film samples, the color values of the film samples at each position point should be consistent. The initial coefficients corresponding to the film sample color values remaining consistent can be determined by adjusting the initial coefficients multiple times using an optimization algorithm, and then the preset coefficients can be determined. The optimization algorithm can be a gradient descent method or a genetic algorithm.
[0054] In this way, the transparency of each position point is accurately calculated according to the gradient difference of each position point in the background gradient map and the film gradient map.
[0055] S103, inputting the transparency map into an image decomposition model to calculate the film color value of each position point to obtain a film color map.
[0056] In one embodiment, the transparency map includes the transparency of each position point. middle, The film image The pixel value of the location point, The background image The background color value of the position point, For the The transparency of the location point, For the The film color value at each position, , and are all known quantities, , and Input the image decomposition model and get the The film color value at each position.
[0057] The film color value of each position point of the film to be inspected can be calculated according to the same method to obtain a film color map, which can reflect the inherent color of each position point of the film to be inspected.
[0058] S104, respectively calculating the image entropy of the film color map and the transparency map, and comparing the maximum value of the image entropy with the entropy threshold to obtain the quality detection result of the film to be detected.
[0059] In one embodiment, a transparency map is obtained in step S102, and the transparency map can reflect the transparency of each position point of the film to be inspected; a film color map is obtained in step S103, and the film color map can reflect the inherent color of each position point of the film to be inspected. For packaging films with qualified quality inspection results, the transparency of each position point should be evenly distributed and there should be no color difference. Therefore, the quality of the packaging film is evaluated by comprehensively considering the transparency and inherent color of the packaging film.
[0060] Specifically, the image entropy is one-dimensional image entropy or two-dimensional image entropy, the entropy threshold is 0.2, and in response to the maximum value of the image entropy being less than or equal to the entropy threshold, the quality detection result is qualified; in response to the maximum value being greater than the entropy threshold, the quality detection result is unqualified.
[0061] It can be understood that the larger the maximum value of the image entropy is, the more chaotic the transparency or the color of the film to be inspected is, the more color difference or uneven transparency exists, and the worse the quality of the film to be inspected is.
[0062] In this way, the quality of the film to be inspected is tested by comprehensively considering the transparency and film color value at each position point to obtain accurate quality test results.
[0063] In other optional embodiments, the distribution of gradient values in the background gradient map will affect the calculation of the gradient difference at each position point in step S102. For the position points where no gradient values exist in the background gradient map, an interpolation algorithm needs to be used for calculation. The true gradient difference cannot be accurately collected, which will cause errors in the quality inspection results. Therefore, the present application can collect film images and film gradient maps of the film to be inspected under multiple background images, and combine the maximum image entropy values corresponding to the multiple background images to obtain the final quality inspection results, thereby improving the accuracy of the quality inspection results.
[0064] Specifically, after respectively calculating the image entropy of the film color map and the transparency map, the detection method further includes: collecting multiple background images and the film image of the film to be detected under each background image, and obtaining the maximum image entropy corresponding to each background image; in response to the average value of the maximum image entropy being less than or equal to the entropy threshold, the quality detection result is qualified, otherwise, the quality detection result is unqualified. The entropy threshold value is 0.2.
[0065] It should be noted that the method of “obtaining the maximum image entropy value corresponding to each background image” is the same as the method of step S101 to step S104 , and will not be repeated here.
[0066] The technical principle and implementation details of the packaging film quality detection method of the present application are introduced above through specific embodiments. The film to be inspected is placed above the background image, and the image acquisition device is placed above the film to be inspected and the film image of the film to be inspected is captured from a top-down perspective; a background gradient map of the background image and a film gradient map of the film image are obtained, and the transparency of each position point is calculated according to the gradient difference of each position point in the background gradient map and the film gradient map, and a transparency map is obtained, which can reflect the transparency of each position point of the film to be inspected; the image decomposition model regards the film image as the result of weighted summation of the background image and the film color map according to the transparency map, and after obtaining the transparency map, the film color map can be obtained according to the image decomposition model, and the film color map can reflect the self-color of each position point of the film to be inspected; the transparency and self-color of the film to be inspected are judged to be uniform according to the image entropy of the transparency map and the film color map, and the quality inspection results of the film to be inspected are quickly and accurately obtained from the two aspects of transparency and self-color.
[0067] According to the second aspect of the present application, the present application also provides a packaging film quality detection system. Figure 2 is a structural block diagram of a packaging film quality detection system according to an embodiment of the present application. Figure 2 As shown, the system 50 includes a processor and a memory, the memory stores computer program instructions, and when the computer program instructions are executed by the processor, a packaging film quality detection method according to the first aspect of the present application is implemented. The system also includes other components well known to those skilled in the art, such as a communication bus and a communication interface, whose settings and functions are known in the art, and therefore will not be described in detail here.
[0068] In the present application, the aforementioned memory may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. For example, a computer-readable storage medium may be any suitable magnetic storage medium or magneto-optical storage medium, such as a resistive random access memory RRAM (Resistive Random Access Memory), a dynamic random access memory DRAM (Dynamic Random Access Memory), a static random access memory SRAM (Static Random-Access Memory), an enhanced dynamic random access memory EDRAM (Enhanced Dynamic Random Access Memory), a high-bandwidth memory HBM (High-Bandwidth Memory), a hybrid memory cube HMC (Hybrid Memory Cube), etc., or any other medium that can be used to store the required information and can be accessed by an application, a module, or both. Any such computer storage medium may be part of a device or accessible or connectable to a device. Any application or module described in this application may be implemented using computer-readable / executable instructions that may be stored or otherwise maintained by such a computer-readable medium.
[0069] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0070] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be construed as limiting the scope of the patent application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent application shall be subject to the attached claims.
Claims
1. A packaging film quality detection method, characterized in that: The detection method comprises: Collecting a background image and a background gradient map, as well as a film image and a film gradient map of the film to be inspected under the background image; Calculate the gradient difference of each position point in the background gradient map and the film gradient map, and calculate the transparency of each position point to obtain the transparency map. Transparency of the location points for: , is the preset coefficient, The first The gradient difference of the position points, is an exponential function with base e; The method for determining the preset coefficient includes: Collecting a film sample image of a qualified film sample under a background image, and calculating a gradient difference of each position point in the film sample image; Setting an initial coefficient to calculate the transparency of each position point, and calculating the film sample color value of each position point in the film sample image according to the image decomposition model, and taking the variance of the film sample color value of each position point as the objective function; adjusting the initial coefficient multiple times, and taking the initial coefficient corresponding to the minimum value of the objective function as the preset coefficient; The transparency map is input into the image decomposition model to calculate the film color value of each position point to obtain a film color map. The image decomposition model is: , The first The pixel value of the location point, The background image The background color value of the position point, For the Film color value at each position; The image entropy of the film color map and transparency map is calculated respectively, and the maximum value of the image entropy and the entropy threshold are compared to obtain the quality detection result of the film to be inspected.
2. A packaging film quality detection method according to claim 1, characterized in that: No. The gradient difference of the position point satisfy: , is the background gradient image The gradient value of the position point, is the first The gradient value of a position point.
3. A packaging film quality detection method according to claim 1, characterized in that: Calculating the gradient difference between each position point in the background gradient map and the film gradient map includes: Mark the position points in the background gradient map where the gradient value is greater than the gradient threshold as valid position points; Calculate the gradient difference of each valid position point and the gradient difference fluctuation within the neighborhood; Perform anomaly detection on gradient difference fluctuations, and mark valid position points where gradient difference fluctuations are normal as target position points; An interpolation operation is performed on the gradient difference of the target position point to calculate the gradient differences of other position points other than the target position point, and the gradient differences of all position points in the background gradient map and the film gradient map are obtained.
4. A packaging film quality detection method according to claim 3, characterized in that: The neighborhood range is a rectangular area of a preset size centered on the valid position point; Gradient difference fluctuation within the neighborhood of valid locations satisfy: , For the The number of other valid location points in the neighborhood of a valid location point, For the The gradient difference of the valid position points is For the The first valid location point in the neighborhood other valid locations.
5. A packaging film quality detection method according to claim 1, characterized in that: No. Color value of the film sample at each location for: ; is the first The pixel value of the location point, The background image The background color value of the position point, is the first The gradient difference of the position points, is the initial coefficient.
6. A packaging film quality detection method according to claim 1, characterized in that: In response to the maximum value of the image entropy being less than or equal to the entropy threshold, the quality detection result is qualified; otherwise, the quality detection result is unqualified.
7. A packaging film quality detection method according to claim 1, characterized in that: After respectively calculating the image entropies of the film color map and the transparency map, the detection method further comprises: Collect multiple background images and a film image of the film to be inspected under each background image, and obtain the maximum image entropy value corresponding to each background image; in response to the average value of the maximum image entropy value being less than or equal to the entropy threshold, the quality inspection result is qualified, otherwise, the quality inspection result is unqualified.
8. A packaging film quality detection method according to claim 6, characterized in that: The image entropy is one-dimensional image entropy or two-dimensional image entropy.
9. A packaging film quality detection system, characterized in that: The method comprises a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, a packaging film quality detection method according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Method and device for detecting defects of polypropylene film on outer package of product
CN116843645A
Image processing method, device and equipment and storage medium
CN111369581A
Plastic meal box defect detection method, device and system based on image processing
CN113947598A