A method and device for quality inspection of cigarette packaging
Through the use of preset angles in cigarette packaging detection and seeing the perspective transformation method, the problem of reflector affecting the detection error of the diaphragm is solved, and the accurate quality testing of cigarette packaging is realized.
Patent Information
- Application Number
- CN202411564178.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-05
- Publication Date
- 2025-01-28
- Estimated Expiration
- 2044-11-05
AI Technical Summary
When using machine vision to detect finished products after coating the cigarette packaging, it is susceptible to phenomena such as reflection of the coating, resulting in detection errors.
Based on the image features of cigarette packaging at the preset angle, select the benchmark point set based on the graphic features of cigarette packaging, calculate the perspective transformation matrix, convert the image to be recognized to a positive view, and then compare the characteristics of the image template to identify the identification The defect of cigarette packaging.
Effectively avoid errors caused by the reflection of the membrane during the visual detection of the machine, and the precise quality testing of cigarette packaging is achieved.
Smart Images

Figure CN119067978B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of product quality inspection, and in particular to a method and device for inspecting the quality of cigarette packaging. Background Art
[0002] The quality inspection of cigarette packaging is crucial to ensure the safety of cigarette products and the consumer experience. By inspecting the packaging, we can effectively prevent the volatilization of the ingredients in cigarettes and maintain the flavor and quality of cigarettes. In addition, since cigarette imitations are emerging in an endless stream, ensuring the quality of cigarette packaging can effectively distinguish products from counterfeit goods and eliminate imitations.
[0003] When using machine vision to inspect finished cigarette packaging after film coating, it is easy to be affected by phenomena such as film reflection, which may lead to detection errors. Summary of the invention
[0004] Based on this, it is necessary to provide a cigarette packaging quality inspection method and device to address the above technical issues.
[0005] In a first aspect, the present application provides a method for quality inspection of cigarette packaging, which is applied to finished cigarette packaging after lamination; the method comprises:
[0006] Acquire an image of a cigarette package to be identified photographed at a first preset angle; the first preset angle is set based on a photographing position that avoids reflection of the film;
[0007] Selecting a first reference point set based on the graphic features of the cigarette package, and converting the image to be recognized into a front view of the cigarette package by calculating a perspective transformation matrix according to the first reference point set;
[0008] The front view of the cigarette package is compared with the image template in terms of features, and the defects of the cigarette package are identified based on the results of the feature comparison.
[0009] In one embodiment, the process of cigarette packaging includes a printing process; the steps of comparing the front view of the cigarette packaging with the image template and identifying the defects of the cigarette packaging according to the result of the feature comparison include:
[0010] Delineating local features of the cigarette package according to the image template, selecting a second reference point set on each local feature according to a preset rule, and determining a first absolute distance from each reference point in the second reference point set to each edge of the image template;
[0011] The front view of the cigarette package is converted into the image template size in proportion to obtain the target image, and local features in the target image are extracted respectively;
[0012] Extracting an image edge of the target image, and projecting a second reference point set onto the target image according to the first absolute distance and the image edge of the target image;
[0013] Selecting a third reference point set on the target image according to a preset rule, and determining a first degree of coincidence between the third reference point set and the second reference point set;
[0014] In response to the first overlap being less than the first preset threshold, a prompt message indicating that the printing quality is qualified is output.
[0015] In one embodiment, the process of cigarette packaging further includes a laminating process; an anti-counterfeiting mark parallel to the wire drawing line is printed on the wire drawing line of the cigarette packaging; and the method further includes:
[0016] Extracting features of the anti-counterfeiting mark in the target image to obtain anti-counterfeiting mark features, and selecting a fourth reference point set on the anti-counterfeiting mark features; the fourth reference point set includes at least two reference points separated by a first preset distance;
[0017] Determine a second absolute distance between each reference point in the fourth reference point set and the upper edge of the target image;
[0018] In response to the fact that the difference between the distance from each reference point to the upper edge of the target image in the second absolute distance and the second preset distance does not exceed the preset percentage, a prompt message indicating that the lamination quality is qualified is output.
[0019] In one embodiment, the process of cigarette packaging further includes a die-cutting process; and the method further includes:
[0020] In response to the first overlap being greater than the first preset threshold, outputting first process inspection prompt information; the first process inspection prompt information is used to call equipment parameters for the printing process and the die-cutting process respectively;
[0021] In response to the difference between the distance from any reference point in the second absolute distance to the upper edge of the target image and the second preset distance exceeding a preset percentage, a second process inspection prompt information is output; the second process inspection prompt information is used to inspect the lamination process.
[0022] In one embodiment, the method further comprises:
[0023] In response to the second step inspection prompt information, image texture recognition is performed on each local feature of the image template and each local feature of the target image;
[0024] Overlapping the image texture of each local feature of the recognized image template and the image texture of each local feature of the target image, and determining a second degree of overlap;
[0025] If the second overlap degree is less than the second preset threshold, a prompt message for checking the die-cutting process is output.
[0026] In one embodiment, the method further comprises:
[0027] Acquire image data of cigarette packages taken at multiple preset angles at preset time intervals;
[0028] Performing grayscale preprocessing on the image data of each cigarette package to obtain a corresponding grayscale image, and determining a highlight area in each grayscale image based on the grayscale value of each grayscale image;
[0029] In response to a grayscale value of a highlight area in any grayscale image being less than a third preset threshold, the corresponding preset angle is determined as the first preset angle.
[0030] In one embodiment, the method further comprises:
[0031] Respectively obtain the camera movement step length between each preset angle and the first preset angle;
[0032] Constructing a moving step length recognition model, and substituting the camera moving step length, the grayscale value of each grayscale image at a preset time interval, and the preset angle corresponding to the grayscale value into the moving step length recognition model for training, to obtain a trained moving step length recognition model;
[0033] The grayscale value and time information corresponding to the grayscale image obtained after preprocessing the image data of the first cigarette package taken are input into the trained moving step recognition model to obtain the moving step of the camera;
[0034] Control the camera to move based on the moving step length.
[0035] In one embodiment, the method further comprises:
[0036] If there are multiple preset angles that can be used as alternatives to the first preset angle, counting the alternative preset angles at each time interval;
[0037] In response to the grayscale value of the highlight area of the grayscale image corresponding to the image data of the cigarette package currently captured by the camera being less than a third preset threshold;
[0038] Determine the moving step length of the current camera's shooting angle from each candidate preset angle, and control the camera to move with the shortest moving step length as the goal.
[0039] In a second aspect, the present application provides a quality inspection device for cigarette packaging, which is applied to finished cigarette packaging after lamination; the device comprises:
[0040] An acquisition module, used to acquire an image of a cigarette package to be identified photographed at a first preset angle; the first preset angle is set based on a shooting position to avoid reflection of the film;
[0041] A conversion module, used for selecting a first reference point set based on the graphic features of the cigarette package, and converting the image to be recognized into a front view of the cigarette package by calculating a perspective transformation matrix according to the first reference point set;
[0042] The comparison module is used to perform feature comparison between the front view of the cigarette package and the image template, and identify defects of the cigarette package according to the result of the feature comparison.
[0043] In a third aspect, the present application provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of the method provided in the first aspect of the present application are implemented.
[0044] The above-mentioned quality inspection method and device for cigarette packaging can shoot the finished cigarette packaging after film coating at a preset shooting position to avoid film reflection, and obtain an image to be identified. In order to prevent the image features in the image to be identified from changing in size relative to the front view due to shooting from a certain inclined side at a first preset angle, the image to be identified shot at the first preset angle is converted into a front view by calculating the perspective transformation matrix, and then accurately compared with the image template, so as to effectively identify the characteristic defects of the cigarette packaging after film coating, and avoid the problem of detection error caused by the influence of phenomena such as film reflection during machine vision inspection. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0046] Figure 1 A flowchart of the overall steps of identifying cigarette packaging defects in one embodiment;
[0047] Figure 2 A flowchart of the steps of judging the printing quality by the distance from the local feature to the edge of the image template in one embodiment;
[0048] Figure 3 A flowchart of the steps of judging the lamination quality by the distance from the anti-counterfeiting mark to the upper edge of the image in one embodiment;
[0049] Figure 4A flowchart of steps for checking corresponding processes based on the finished product quality of cigarette packaging in one embodiment;
[0050] Figure 5 A flowchart of the steps of judging whether the printing quality is qualified according to the texture features in one embodiment;
[0051] Figure 6 A flowchart of the steps of judging the reflection position based on the gray value in one embodiment;
[0052] Figure 7 A flowchart of steps for controlling camera actions in one embodiment;
[0053] Figure 8 A flowchart of steps for selecting an alternative preset angle in one embodiment;
[0054] Fig. 9 The figure is a frame structure diagram of a cigarette packaging quality inspection device in one embodiment. DETAILED DESCRIPTION
[0055] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0056] In the description of the present application, it should be understood that the terms "center", "longitudinal", "lateral", "length", "width", "thickness", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", "clockwise", "counterclockwise", "axial", "radial", "circumferential" and the like indicate orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present application and simplifying the description, and do not indicate or imply that the referred device or element must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as a limitation on the present application.
[0057] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of this application, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
[0058] In an exemplary embodiment, a quality inspection method for cigarette packaging is provided, which is applied to finished cigarette packaging after lamination; Figure 1As shown, the method includes the following steps S102 to S106. Among them:
[0059] S102, obtaining an image of a cigarette package to be identified photographed at a first preset angle; the first preset angle is set based on a photographing position to avoid reflection of the coating.
[0060] Specifically, the finished product images of the cigarette packaging after film coating can be photographed in advance at multiple angles, and the shooting position that can avoid the reflection of the film coating is selected as the first preset angle.
[0061] S104, selecting a first reference point set based on the graphic features of the cigarette package, and converting the image to be recognized into a front view of the cigarette package by calculating a perspective transformation matrix according to the first reference point set.
[0062] Specifically, the first reference point set includes four corner points of the edge of the image to be identified, and may also include a plurality of edge points selected according to a preset distance along the edge of each element in the graphic feature.
[0063] Further elements include advertising graphics, advertising slogans and bar codes.
[0064] Specifically, perspective transformation can be performed through the cv2.warpPerspective function in the OpenCV library.
[0065] S106, performing feature comparison between the front view of the cigarette package and the image template, and identifying defects of the cigarette package according to the result of the feature comparison.
[0066] Specifically, the feature comparison may be to compare the positional relationship between the elements in the image template and the elements in the front view and the coincidence degree of each edge point.
[0067] Furthermore, after the cigarette package quality inspection of the front view is completed, the cigarette package can be turned over, and the side and bottom positions of the cigarette package can be inspected according to the method for inspecting the front view in this embodiment.
[0068] The embodiments of the present application aim to provide a method and device for quality inspection of cigarette packaging, which can photograph the finished cigarette packaging after coating at a preset shooting position to avoid reflection of the coating, and obtain an image to be identified. In order to prevent the image features in the image to be identified from changing in size relative to the front view due to shooting from a certain inclined side at a first preset angle, the image to be identified shot at the first preset angle is converted into a front view by calculating the perspective transformation matrix, and then accurately compared with the image template, so as to effectively identify the characteristic defects of the cigarette packaging after coating, and avoid the problem of detection error caused by the influence of phenomena such as reflection of the coating during machine vision inspection.
[0069] In an exemplary embodiment, the process of cigarette packaging includes a printing process; Figure 2 As shown, the steps of performing feature comparison between the front view of the cigarette package and the image template and identifying defects of the cigarette package according to the result of the feature comparison include the following steps S1062 to S1066. Among them:
[0070] S1062, delineating local features of the cigarette package according to the image template, selecting a second reference point set on each local feature according to a preset rule, and determining a first absolute distance from each reference point in the second reference point set to each edge of the image template.
[0071] Specifically, each local feature may be a feature of each element on the cigarette package.
[0072] Furthermore, the second reference point set selected on each local feature according to preset rules may be reference points selected on the local features in the image template for describing the style of the element; the reference points may be selected based on standards that can fully describe the element style information during the specific implementation process, and no specific restrictions are made here.
[0073] Specifically, the first absolute distance may be the distance from each reference point in the second reference point set to each edge of the image template, and is used to describe the position of each reference point in the image template.
[0074] S1064, converting the front view of the cigarette package into an image template size in proportion to obtain a target image, and extracting local features in the target image respectively.
[0075] Specifically, in the process of calculating the perspective transformation matrix, the size of the front view may be different from that of the image template. In different cases, the size conversion is performed to ensure that the sizes are exactly the same to increase the degree of contrast refinement.
[0076] S1066, extracting the image edge of the target image, and projecting the second reference point set onto the target image according to the first absolute distance and the image edge of the target image.
[0077] S1068: Select a third reference point set on the target image according to a preset rule, and determine a first degree of coincidence between the third reference point set and the second reference point set.
[0078] Specifically, when the image template and the target image have the same size and the first absolute distance of each reference point in the second reference point set is determined, after projection, each reference point in the second reference point set on the target image should have exactly the same position as in the image template.
[0079] Furthermore, in the process of selecting the third reference point set on the target image by the same preset rule, the third reference point set should completely overlap with each reference point in the second reference point set, and thus whether the printing is qualified is determined by calculating the first overlap degree.
[0080] S1070: In response to the first overlap being less than a first preset threshold, outputting prompt information indicating that the printing quality is qualified.
[0081] Specifically, the first preset threshold value can be set according to the printing fineness requirement in the specific implementation process, and again no specific limitation is made.
[0082] In an exemplary embodiment, the process of cigarette packaging further includes a laminating process; an anti-counterfeiting mark parallel to the wire drawing line is printed on the wire drawing line of the cigarette packaging; Figure 3 As shown, the method further includes the following steps S202 to S206. Among them:
[0083] S202, extracting features of the anti-counterfeiting mark in the target image to obtain anti-counterfeiting mark features, and selecting a fourth reference point set on the anti-counterfeiting mark features; the fourth reference point set includes at least two reference points separated by a first preset distance.
[0084] Specifically, an anti-counterfeiting mark parallel to the edge of the wire drawing mark can be printed on the wire drawing mark. In the process of packaging and laminating the wire drawing mark, the position of the anti-counterfeiting mark can be used to indicate the position of the wire drawing mark.
[0085] Furthermore, the wire drawing marking line may be parallel to the upper edge of the cigarette package.
[0086] Furthermore, specific position information of the wire drawing marking line on the cigarette package can be determined by at least two reference points.
[0087] S204: Determine a second absolute distance between each reference point in the fourth reference point set and the upper edge of the target image.
[0088] Specifically, the second absolute distance includes the distance from each reference point in the fourth reference point set to the upper edge of the target image of the cigarette package, that is, the distance from two reference points on the wire drawing mark line to the upper edge of the cigarette package.
[0089] S206: In response to the difference between the distance from each reference point to the upper edge of the target image in the second absolute distance and the second preset distance not exceeding a preset percentage, outputting prompt information indicating that the lamination quality is qualified.
[0090] Specifically, the distances from two reference points on the wire drawing marking line to the upper edge of the cigarette package do not exceed a second preset distance and a preset percentage for indicating that the wire drawing marking line is visually parallel to the upper edge of the cigarette package.
[0091] Further, in the case where the wire drawing marking is used to package the coating, the parallelism of the wire drawing marking and the upper edge of the cigarette package indicates that the packaging effect of the coating on the cigarette rod / box is as expected.
[0092] In an exemplary embodiment, the process of cigarette packaging further includes a die-cutting process; Figure 4 As shown, the method further includes the following steps S302 to S304. Among them:
[0093] S302, in response to the first overlap being greater than the first preset threshold, outputting first process inspection prompt information; the first process inspection prompt information is used to call equipment parameters for the printing process and the die-cutting process respectively.
[0094] Specifically, since the first overlap degree of the folded cigarette packages after the printing position offset or the die-cutting position offset is greater than the first preset threshold, when the first overlap degree is greater than the first preset threshold, the first process inspection prompt information is output, and the equipment of the die-cutting process and the printing process are inspected separately.
[0095] S304, in response to the difference between the distance from any reference point in the second absolute distance to the upper edge of the target image and the second preset distance exceeding a preset percentage, outputting second process inspection prompt information; the second process inspection prompt information is used to inspect the lamination process.
[0096] Specifically, if the difference between the distance from any reference point in the second absolute distance to the upper edge of the target image and the second preset distance exceeds a preset percentage, it means that the position of the wire drawing mark line has changed, the position of the upper edge of the cigarette package is not parallel, or the relative distance exceeds expectations.
[0097] Specifically, the second preset distance includes the distance from each reference point in the fourth reference point set to the upper edge of the image of the target image.
[0098] In an exemplary embodiment, Figure 5 As shown, the method further includes the following steps S402 to S406. Among them:
[0099] S402 , in response to the second step inspection prompt information, performing image texture recognition on each local feature of the image template and each local feature of the target image.
[0100] Specifically, image texture recognition is used to determine whether the printed pattern of each local feature is complete.
[0101] S404: Overlap the image texture of each local feature of the recognized image template and the image texture of each local feature of the target image, and determine a second degree of overlap.
[0102] Specifically, the printing quality is judged by comparing the image texture between the target image and the image template.
[0103] S406: If the second overlap degree is less than the second preset threshold, output a prompt message for checking the die-cutting process.
[0104] Specifically, if the printing quality is judged to be qualified by the second overlap being less than the second preset threshold, the die-cutting process is checked.
[0105] In an exemplary embodiment, Figure 6 As shown, the method further includes the following steps S502 to S506. Among them:
[0106] S502, acquiring image data of cigarette packages at a plurality of preset angles photographed at preset time intervals.
[0107] Specifically, since the position of sunlight is different in different time periods, the position of the first preset angle for avoiding reflection is also different. Therefore, the correspondence between the time period and the first preset angle is determined by acquiring image data of different shooting angles in each time period of the preset time interval.
[0108] S504, performing grayscale preprocessing on the image data of each cigarette package to obtain a corresponding grayscale image, and determining a highlight area in each grayscale image based on the grayscale value of each grayscale image.
[0109] Specifically, the highlighted area is used to indicate where the reflection occurs.
[0110] S506: In response to a grayscale value of a highlight area in any grayscale image being less than a third preset threshold, determining the corresponding preset angle as a first preset angle.
[0111] Specifically, if the grayscale value of the highlight position in the grayscale image is less than the third preset threshold, it indicates that the brightness of the highlight area is within the range capable of identifying image features, that is, reflection can be avoided.
[0112] Specifically, the grayscale value of the highlight area in each grayscale image is smaller than a preset angle corresponding to the third preset threshold, corresponding to a time series according to a preset time interval.
[0113] In an exemplary embodiment, Figure 7 As shown, the method further includes the following steps S602 to S608. Among them:
[0114] S602: Obtain camera movement steps between each preset angle and the first preset angle respectively.
[0115] Specifically, the moving step length is used to instruct the camera to move according to a preset moving direction and moving distance.
[0116] S604, constructing a moving step length recognition model, and substituting the camera moving step length between each preset angle, the grayscale value of each grayscale image at a preset time interval, and the preset angle corresponding to the grayscale value into the moving step length recognition model for training, to obtain a trained moving step length recognition model.
[0117] Specifically, the input of the moving step length recognition model is the grayscale value of each grayscale image in a time series of preset time intervals, the camera moving step length between each preset angle and the first preset angle, and the preset angle corresponding to the grayscale value, and the output of the moving step length recognition model is the camera moving step length required to move the camera to the first preset angle.
[0118] S606, inputting the grayscale value corresponding to the grayscale image obtained by preprocessing the image data of the first cigarette package and the time information into the trained moving step recognition model to obtain the moving step of the camera.
[0119] S608, controlling the camera to move based on the moving step length.
[0120] Specifically, this embodiment can reduce the number of camera action steps and the number of photos taken, so that only the image information and time information of the first cigarette package are input into the moving step recognition model, and the position of the first preset angle of the camera under the time information corresponding to the time series can be found, and then the current position of the camera can be judged by the position of the highlighted area under the current time information, and the moving step of the camera from the current position to the first preset angle position can be calculated.
[0121] In an exemplary embodiment, Figure 8 As shown, the method further includes the following steps S702 to S706. Among them:
[0122] S702: If there are multiple preset angles that can be candidates for the first preset angle, count the candidate preset angles at each time interval.
[0123] Specifically, in each of the time intervals, as the day ends, the intensity of sunlight will gradually decrease, so the number of preset angles that can be used as alternatives to the first preset angle will increase, and the alternative preset angles corresponding to each time interval can be counted on a time basis.
[0124] S704: In response to the grayscale value of the highlight area of the grayscale image corresponding to the image data of the cigarette package captured by the current camera being less than a third preset threshold.
[0125] S706, determining the moving step length of the shooting angle of the current camera from each candidate preset angle, and controlling the camera to move with the shortest moving step length as the goal.
[0126] In the case where there are multiple candidate preset angles, in order to improve the efficiency of image recognition, the candidate shooting angle that requires the shortest step length of camera movement may be selected as the first preset angle.
[0127] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0128] Based on the same inventive concept, the embodiment of the present application also provides a quality inspection device for a cigarette package for implementing the quality inspection method for a cigarette package involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in the embodiments of one or more quality inspection devices for a cigarette package provided below can refer to the limitations of the quality inspection method for a cigarette package above, and will not be repeated here.
[0129] Second, as Fig. 9 As shown, the present application provides a cigarette packaging quality inspection device 900, the device comprising:
[0130] The acquisition module 901 is used to acquire the image of the cigarette package to be identified photographed at a first preset angle; the first preset angle is set based on the shooting position to avoid reflection of the film;
[0131] A conversion module 902 is used to select a first reference point set based on the graphic features of the cigarette package, and convert the image to be recognized into a front view of the cigarette package by calculating a perspective transformation matrix according to the first reference point set;
[0132] The comparison module 903 is used to perform feature comparison between the front view of the cigarette package and the image template, and identify defects of the cigarette package according to the result of the feature comparison.
[0133] Each module in the above-mentioned cigarette package quality inspection device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the corresponding operations of each module.
[0134] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the remote update method of the above application when executing the computer program.
[0135] In a fourth aspect, the present application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the automatic deployment and recovery method of the buoy as described above.
[0136] In a fifth aspect, the present application provides a computer program product, comprising a computer program, which, when executed by a processor, implements the steps of the automatic deployment and recovery method of the buoy as described above.
[0137] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0138] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above 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.
[0139] 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 understood as limiting the scope of the present 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 present application shall be subject to the attached claims.
Claims
1. A method for detecting the quality of cigarette packaging, characterized in that: Applied to the finished cigarette packaging product after film coating; the method comprises: Acquire the image of the cigarette package to be identified photographed at a first preset angle; the first preset angle is set based on a shooting position that avoids reflection of the film; Selecting a first reference point set based on the graphic features of the cigarette package, and converting the image to be identified into a front view of the cigarette package by calculating a perspective transformation matrix according to the first reference point set; Performing feature comparison between the front view of the cigarette package and the image template, and identifying defects of the cigarette package according to the result of the feature comparison; Acquire image data of the cigarette package at a plurality of preset angles taken at preset time intervals; Performing grayscale preprocessing on the image data of each cigarette package to obtain a corresponding grayscale image, and determining a highlight area in each grayscale image based on the grayscale value of each grayscale image; In response to a grayscale value of a highlight area in any of the grayscale images being less than a third preset threshold, determining the preset angle corresponding thereto as the first preset angle; Respectively obtaining the camera movement step length between each of the preset angles and the first preset angle; Constructing a moving step length recognition model, and substituting the camera moving step length, the grayscale value of each grayscale image at the preset time interval, and the preset angle corresponding to the grayscale value into the moving step length recognition model for training, to obtain a trained moving step length recognition model; Inputting the grayscale value and time information corresponding to the grayscale image obtained by preprocessing the image data of the first cigarette package taken into the trained moving step recognition model to obtain the moving step of the camera; Controlling the camera to move based on the moving step length; If there are multiple preset angles that can be used as alternatives to the first preset angle, counting each of the alternative preset angles at each of the time intervals; In response to the grayscale value of the highlight area of the grayscale image corresponding to the image data of the cigarette package currently captured by the camera being less than the third preset threshold; The moving step length of the current shooting angle of the camera from each of the candidate preset angles is determined, and the camera is controlled to move with the shortest moving step length as the goal.
2. The method according to claim 1, characterized in that The process of the cigarette packaging includes a printing process; the step of performing feature comparison between the front view of the cigarette packaging and the image template and identifying defects of the cigarette packaging according to the result of the feature comparison includes: Delineating local features of the cigarette package according to the image template, selecting a second reference point set on each local feature according to a preset rule, and determining a first absolute distance from each reference point in the second reference point set to each edge of the image template; Converting the front view of the cigarette package into the size of the image template in proportion to obtain a target image, and extracting local features in the target image respectively; extracting an image edge of the target image, and projecting the second reference point set onto the target image according to the first absolute distance and the image edge of the target image; Selecting a third reference point set on the target image according to the preset rule, and determining a first degree of coincidence between the third reference point set and the second reference point set; In response to the first overlap being less than a first preset threshold, a prompt message indicating that the printing quality is qualified is output.
3. The method according to claim 2, characterized in that The process of the cigarette packaging further includes a laminating process; an anti-counterfeiting mark parallel to the wire drawing line is printed on the wire drawing line of the cigarette packaging; the method further includes: Extracting features of the anti-counterfeiting mark in the target image to obtain anti-counterfeiting mark features, and selecting a fourth reference point set on the anti-counterfeiting mark features; the fourth reference point set includes at least two reference points separated by a first preset distance; Determine a second absolute distance between each reference point in the fourth reference point set and an upper edge of the target image; In response to the fact that the difference between the distance from each reference point in the second absolute distance to the upper edge of the target image and the second preset distance does not exceed a preset percentage, a prompt message indicating that the lamination quality is qualified is output.
4. The method according to claim 3, characterized in that The process of cigarette packaging also includes a die-cutting process; the method also includes: In response to the first overlap being greater than the first preset threshold, outputting first process inspection prompt information; the first process inspection prompt information is used to call equipment parameters for the printing process and the die-cutting process respectively; In response to the difference between the distance from any reference point in the second absolute distance to the upper edge of the target image and the second preset distance exceeding a preset percentage, a second process inspection prompt information is output; the second process inspection prompt information is used to inspect the lamination process.
5. The method according to claim 4, characterized in that The method further comprises: In response to the second process inspection prompt information, performing image texture recognition on each local feature of the image template and each local feature of the target image; Overlapping the image texture of each local feature of the image template after recognition with the image texture of each local feature of the target image, and determining a second degree of overlap; If the second overlap degree is less than a second preset threshold, a prompt message for checking the die-cutting process is output.
6. A cigarette packaging quality inspection device, characterized in that: The method according to any one of claims 1 to 5 is applied to the finished cigarette packaging product after film coating; the device comprises: An acquisition module, used for acquiring the image to be identified of the cigarette package photographed at a first preset angle; the first preset angle is set based on a shooting position to avoid reflection of the coating; A conversion module, used for selecting a first reference point set based on the graphic features of the cigarette package, and converting the image to be identified into a front view of the cigarette package by calculating a perspective transformation matrix according to the first reference point set; The comparison module is used to perform feature comparison between the front view of the cigarette package and the image template, and identify defects of the cigarette package according to the result of the feature comparison.
7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Cigarette strip surface defect detection method and device
CN114359260A
Earphone charging seat detection method, system and equipment
CN118858298A