Cigarette two-dimensional code acquisition method, code printing device, control device and storage medium
By using cyclic supplementary lighting and neural network model recognition, combined with grayscale conversion processing, the end of cigarette packs and the location of the QR code are automatically identified, solving the problem of difficult QR code recognition and achieving efficient automatic coding.
Patent Information
- Application Number
- CN202510886363.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-30
- Publication Date
- 2025-10-17
AI Technical Summary
In existing technologies, the QR codes on cigarette packs are easily damaged during the marking process, making recognition difficult. Furthermore, traditional automatic coding machines are affected by supplementary lighting when recognizing QR codes, making it impossible to effectively distinguish between black and white blocks, requiring manual intervention.
The system employs an image acquisition module and a control module. By cyclically executing image acquisition with different colors of supplementary lighting, multiple images are fused together, and a neural network model is used to identify the position of the cigarette tip and the QR code. Combined with grayscale conversion processing, the influence of supplementary lighting is eliminated, and the QR code position is automatically identified.
It improves the recognition accuracy and automatic coding efficiency of cigarette QR codes, reduces labor costs, and achieves automated coding.
Smart Images

Figure CN120808105A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of intelligent devices, and particularly relates to a method for collecting a two-dimensional code of a carton cigarette, a code printing device, a control device and a storage medium. BACKGROUND
[0002] A traditional process of printing a code on a carton cigarette is completed by a worker. An existing automatic code printing machine can capture image information of stacked carton cigarettes, and then control a laser code printing machine to print a code on an end of a carton cigarette according to a position of the end of each carton cigarette.
[0003] However, there are many types of carton cigarettes, such as a confiscated cigarette. A two-dimensional code is present on an end of the confiscated cigarette. If the laser code printing machine is controlled to print a code only according to position information of the end of the carton cigarette, the position of the code and the two-dimensional code may overlap, which can damage the two-dimensional code, and a worker cannot scan the two-dimensional code to obtain identity information of the confiscated cigarette.
[0004] Since a packaging surface of the carton cigarette has complex colors, is relatively smooth and has many laser reflection patterns, the carton cigarette can be subjected to light compensation during image information capturing. A two-dimensional code image is a black and white pattern. A method for identifying the two-dimensional code image is based on identification of a black color block and a white color block, and then analysis of identification data. Light compensation has little effect on the black color block, but can make the white color block develop color, which can make it difficult for a control module to distinguish the black color block and the white color block. Although light compensation is beneficial to the control module to analyze the position of the end of each carton cigarette from the image information, it is not conducive to analysis of the two-dimensional code image, and a printing process of the confiscated cigarette still needs to be completed by a worker. SUMMARY
[0005] The present application aims to at least solve one of the technical problems in the prior art. To this end, the present application provides a method for collecting a two-dimensional code of a carton cigarette, a code printing device, a control device and a storage medium. The position of an end of a carton cigarette and the position of a two-dimensional code are automatically identified to provide a possibility of automatic code printing, improve processing efficiency and reduce labor costs.
[0006] According to the cigarette two-dimensional code acquisition method of the first aspect of the present application, the method is applied to a coding device, the coding device comprises an image acquisition module and a control module, the image acquisition module comprises a camera unit and a color adjusting and light supplementing unit, the camera unit is used to shoot image information of a marking surface of a cigarette group, wherein the cigarette group comprises a plurality of cigarettes stacked and arranged, and the end portions of the plurality of cigarettes form the marking surface, the control module is connected with the camera unit and the color adjusting and light supplementing unit respectively, the control module executes the cigarette two-dimensional code acquisition method, the cigarette two-dimensional code acquisition method comprises: cyclically executing a light supplementing and image shooting step, in the light supplementing and image shooting step, the color adjusting and light supplementing unit is controlled to emit light supplementing light, and the camera unit acquires a unit image of the marking surface, wherein the color parameters of the light supplementing light in the light supplementing and image shooting step are different in multiple times, and the color parameters corresponding to each unit image are recorded; a plurality of unit images are fused into a composite image; the composite image is recognized by a neural network model to analyze the cigarette end portion position information of each cigarette in the marking surface; an arbitrary unit image is selected, and the unit image is divided into a plurality of cigarette end portion images corresponding to each cigarette one by one according to the cigarette end portion position information; the cigarette end portion image is subjected to gray scale conversion processing by using the color parameter corresponding to the unit image to obtain an end portion gray scale image; and the end portion gray scale image is recognized to obtain the two-dimensional code position information of the two-dimensional code located at the end portion of the cigarette.
[0007] According to the cigarette two-dimensional code acquisition method of the present application, at least the following beneficial effects are achieved:
[0008] The cigarette two-dimensional code acquisition method of the present application uses the cyclically executed light supplementing and image shooting step to shoot a plurality of unit images under different color light supplementing, and then fuses the plurality of unit images to form a composite image, which can make the feature of the end portion of the cigarette more distinct, facilitate the recognition and analysis of the cigarette end portion position information of each cigarette in the marking surface by the neural network model, and then use the cigarette end portion position information to divide an arbitrary unit image into a plurality of cigarette end portion images corresponding to each cigarette one by one, and the unit image corresponds to the color parameter, the corresponding color parameter is used to perform gray scale conversion processing on the cigarette end portion image to obtain an end portion gray scale image, which can basically eliminate the influence of the light supplementing light on the white blocks in the two-dimensional code, and then recognize the end portion gray scale image to obtain the two-dimensional code position information of the two-dimensional code located at the end portion of the cigarette, thereby optimizing the recognition accuracy, automatically recognizing the cigarette end portion position and the two-dimensional code position to provide the possibility of automatic coding, improving the processing efficiency, and reducing the labor cost.
[0009] According to some embodiments of the present application, the gray-scale conversion processing of the cigarette end image by using the color parameter corresponding to the unit image to obtain the end gray-scale image comprises: calculating the gray-scale value of each pixel point in the cigarette end image by using the color parameter based on a gray-scale conversion model; and generating a corresponding gray-scale color rendering according to the gray-scale value of each pixel point to form the end gray-scale image.
[0010] According to some embodiments of the present application, the color parameter comprises a red light output value, a green light output value and a blue light output value, and the gray-scale conversion model comprises:
[0011] Gray=a r *R+a g *G+a b *B;
[0012] Gray is the gray-scale value of the pixel point, a r is a correction coefficient corresponding to the red light output value, a g is a correction coefficient corresponding to the green light output value, a b is a correction coefficient corresponding to the blue light output value, R is the red light contribution value of the pixel point, G is the green light contribution value of the pixel point, and B is the blue light contribution value of the pixel point, wherein the red light output value and a r are inversely proportional, the green light output value and a g are inversely proportional, and the blue light output value and a b are inversely proportional.
[0013] According to some embodiments of the present application, the two-dimensional code is rectangular, and a position detection pattern is arranged at at least three corners of the two-dimensional code, the position detection pattern comprises a rectangular identification element and two identification rings, the two identification rings are sequentially sleeved, and the inner identification ring is sleeved on the rectangular identification element, and the adjacent two identification rings or the adjacent identification ring and the identification element are different in color, the width ratio of the two identification rings from outside to inside and the identification element in the position detection pattern is k1:k2:k3, and the two-dimensional code position information of the two-dimensional code located at the end of the cigarette in the identification of the end gray-scale image comprises: finding each position detection pattern in the end gray-scale image according to the pattern width characteristics, wherein the pattern width characteristics are that a plurality of adjacent pattern width ratios are sequentially k1:k2:k3:k2:k1; obtaining the contour position of the two-dimensional code according to the distance between the plurality of position detection patterns, obtaining the deflection angle of the two-dimensional code according to the offset angle between the plurality of position detection patterns, and the contour position of the two-dimensional code and the deflection angle of the two-dimensional code form the two-dimensional code position information.
[0014] According to some embodiments of the present application, in the step of fusing the plurality of unit images into a composite image, the following steps are included: performing differential amplification processing on each unit image; fusing the plurality of unit images, in the image fusion process, establishing a blank image layer, and making the pixel points at the same position in the plurality of unit images and the blank image layer correspond to each other; and for each position of the pixel points in the blank image layer, selecting the pixel point with the highest contrast in the corresponding position of the plurality of unit images to replace it, so that the blank image layer is filled to form a composite image.
[0015] According to some embodiments of the present application, in the step of identifying the composite image by using the neural network model to analyze the position information of the cigarette end of each cigarette in the marking surface, the following steps are included: using a plurality of bounding boxes with different sizes to match the edge contour of the cigarette group in the composite image by using the feature of the neural network model; separating the cigarette group image and the background image in the composite image according to the edge contour of the cigarette group to extract the cigarette group image; segmenting the cigarette group image to form a plurality of cigarette end images, and obtaining the position information of the cigarette end according to the position of the cigarette end image in the composite image.
[0016] According to the coding device of the second aspect of the present application, the coding device comprises an image acquisition module and a control module, the image acquisition module comprises a camera unit and a color adjustment and light supplement unit, the camera unit is used to shoot image information of the marking surface of the cigarette group, and the control module is connected with the camera unit and the color adjustment and light supplement unit respectively, and the control module executes the cigarette two-dimensional code acquisition method disclosed in any of the embodiments.
[0017] According to the coding device of the second aspect of the present application, the coding device comprises an image acquisition module and a control module, the image acquisition module comprises a camera unit and a color adjustment and light supplement unit, the camera unit is used to shoot image information of the marking surface of the cigarette group, and the control module is connected with the camera unit and the color adjustment and light supplement unit respectively, and the control module executes the cigarette two-dimensional code acquisition method disclosed in any of the embodiments.
[0018] The coding device of the present application executes the cigarette two-dimensional code acquisition method disclosed in any of the embodiments, automatically identifies the position of the cigarette end and the position of the two-dimensional code, provides the possibility for automatic coding, improves the processing efficiency, and reduces the labor cost.
[0019] According to some embodiments of the present application, the coding device further comprises: a base frame; a cigarette guide module for placing the cigarette group, the cigarette guide module being arranged on the base frame, and the cigarette guide module being used to guide the movement of the plurality of cigarettes so that the ends of at least two cigarettes are approximately flush with the marking surface; a shielding cover arranged on the base frame, the shielding cover being provided with a light path protection cavity, the shielding cover being capable of blocking the light, the shielding cover being provided with a material input port and a working port, the cigarette guide module being located in the light path protection cavity or being capable of driving the cigarette group to enter the light path protection cavity from the material input port, the image acquisition module being used to shoot the image information towards the working port; and a marking module movably arranged on the base frame, the control module being connected with the marking module to control the marking module to mark the cigarettes according to the position information of the cigarette end and the position information of the two-dimensional code, and the label and the two-dimensional code formed by the marking being located at different positions.
[0020] The control device according to the third aspect of the present application comprises a memory and a processor, the memory stores a computer program, and the processor implements the cigarette two-dimensional code acquisition method disclosed in any of the above embodiments when executing the computer program.
[0021] The computer readable storage medium according to the fourth aspect of the present application stores a computer program, and the computer program implements the cigarette two-dimensional code acquisition method disclosed in any of the above embodiments when executed by a processor.
[0022] Additional aspects and advantages of the present application will be made apparent from the following description of embodiments, which will be given by way of example only, and with reference to the accompanying drawings. BRIEF DESCRIPTION OF DRAWINGS
[0023] The above and / or additional aspects and advantages of the present application will become apparent and be readily appreciated from the following description, including the accompanying drawings, wherein:
[0024] Figure 1 A perspective view of one embodiment of the coding device of the present application;
[0025] Figure 2 A schematic view of one embodiment of the two-dimensional code image;
[0026] Figure 3 A flowchart of one embodiment of the cigarette two-dimensional code acquisition method of the present application;
[0027] Figure 4 A principle structure block diagram of the control device of the present application.
[0028] REFERENCE NUMERALS
[0029] Base frame 110; smoke guide module 120; shielding cover 130; marking module 140; image acquisition module 200; camera unit 210; color adjustment and light supplement unit 220; control module 300; cigarette group 410; cigarette 420; processor 610; memory 620; input / output interface 630; communication interface 640; bus 650. DETAILED DESCRIPTION
[0030] Embodiments of the present application are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals represent the same or similar elements or elements having the same or similar functions throughout. The embodiments described below by reference to the accompanying drawings are exemplary and are only used to explain the present application, and cannot be understood as limiting the present application.
[0031] In the description of the present invention, it should be understood that descriptions involving orientations, such as the orientations or positional relationships indicated by terms such as "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside" and "outside", are based on the orientations or positional relationships shown in the accompanying drawings and are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present invention.
[0032] In the description of the present invention, "several" means one or more, "many" means more than two, "greater than," "less than," and "exceed" are understood to exclude the number itself, while "above," "below," and "within" are understood to include the number itself. The use of "first" and "second" in the description is solely for the purpose of distinguishing technical features and should not be construed as indicating or implying relative importance, implicitly specifying the number of the indicated technical features, or implicitly specifying the order of the indicated technical features.
[0033] In the description of the present invention, it should be noted that, unless otherwise expressly specified or limited, the terms "mounted," "connected," and "connected" should be understood broadly. For example, they may refer to fixed, detachable, or integral connections; mechanical or electrical connections; direct or indirect connections through an intermediary; and internal communication between two components. Those skilled in the art will understand the specific meanings of the above terms in the present invention based on the specific circumstances.
[0034] like Figures 1 to 3 As shown, a method for collecting QR codes of cigarette strips 420 according to an embodiment of the first aspect of the present invention is applied to a coding device, wherein the coding device includes an image acquisition module 200 and a control module 300, wherein the image acquisition module 200 includes a camera unit 210 and a color adjustment and fill light unit 220, and the camera unit 210 is used to capture image information of the marking surface of the cigarette group 410, wherein the cigarette group 410 includes a plurality of cigarette strips 420 stacked and arranged, and the ends of the plurality of cigarette strips 420 form a marking surface, and the control module 300 is respectively connected to the camera unit 210 and the color adjustment and fill light unit 220.
[0035] Among them, the control module 300 can include a processor such as MCU or CPU and its auxiliary circuits, and the color adjustment and fill light unit 220 can emit light of different colors to illuminate the packaging box of the cigarette 420. When illuminated by light of different colors, the contrast at different positions on the packaging box of the cigarette 420 will be different. The camera unit 210 will capture a unit image every time the light color changes.
[0036] In some embodiments of the present application, the color adjusting light supplement unit 220 comprises an RGB light source unit, which can emit red light, blue light and green light, and can also use any two or three of the red light, blue light and green light to form light of various colors.
[0037] The control module executes the cigarette two-dimensional code acquisition method, and the cigarette two-dimensional code acquisition method comprises:
[0038] S510, a light supplement and image acquisition step is repeatedly executed, in which the color adjusting light supplement unit emits light for supplementing light, and the camera unit acquires a unit image of the marking surface, wherein the color parameters of the light for supplementing light in the light supplement and image acquisition step are different in multiple times, and the color parameters corresponding to each unit image are recorded;
[0039] S520, multiple unit images are fused into a composite image;
[0040] S530, the composite image is identified by a neural network model to analyze the cigarette end position information of each cigarette in the marking surface;
[0041] S540, one unit image is selected at random, and the unit image is divided into multiple cigarette end images corresponding to each cigarette according to the cigarette end position information;
[0042] S550, the cigarette end image is processed by gray scale conversion using the color parameter corresponding to the unit image to obtain an end gray scale image;
[0043] S560, the end gray scale image is identified to obtain two-dimensional code position information of the two-dimensional code located at the cigarette end.
[0044] It can be understood that the camera unit takes a unit image every time the color of the light is changed, and then multiple unit images are fused to form a composite image. The pixel points at the same position in the multiple unit images with the highest contrast are used to fill the pixel points at the same position in the composite image, so that the features at each position in the composite image are more distinct, which is more conducive to distinguishing the ends of different cigarettes in the identification process of the control module, and more accurate cigarette end position information is obtained.
[0045] Since the shooting position of the camera unit is fixed when multiple unit images are shot, the cigarette end image can be obtained by randomly selecting any one unit image and segmenting according to the cigarette end position information, and then analyzing the two-dimensional code position in each cigarette end image. It can be understood that, due to the light compensation processing, the white blocks in the two-dimensional code will reflect the color of the light compensation light, which will affect the recognition of the two-dimensional code by the control module. Therefore, since the color parameter of the light compensation light when shooting the unit image is known, the color parameter can be used to deduce that the color of the cigarette end image is eliminated by using the gray scale conversion processing according to the color parameter. For example, when the light compensation color is composed of more green and red light, the elimination amount of the intensity value of green and red in the image is increased according to the color parameter during the gray scale conversion processing, so that the pixel intensity value of the position of the white block in the two-dimensional code tends to recover to the intensity value representing white, so as to facilitate the recognition of the control module to the white block and the black block.
[0046] The cigarette two-dimensional code acquisition method of the present application uses the light compensation and image shooting step to shoot multiple unit images under different color light compensation, and then fuses the multiple unit images to form a composite image. This way can make the feature of the cigarette end more distinct, facilitate the recognition and analysis of the cigarette end position information of each cigarette in the marking surface by the neural network model, and then use the cigarette end position information to segment any one unit image into multiple cigarette end images corresponding to each cigarette. The unit image corresponds to the color parameter, and the corresponding color parameter is used for gray scale conversion processing of the cigarette end image to obtain an end gray scale image, which can eliminate the influence of the light compensation light on the white block in the two-dimensional code. The two-dimensional code position information of the two-dimensional code located at the cigarette end is obtained by recognizing the end gray scale image, which optimizes the recognition accuracy. The design automatically identifies the cigarette end position and the two-dimensional code position to provide the possibility of automatic coding, improves the processing efficiency, and reduces the labor cost.
[0047] In some embodiments of the present application, in the gray scale conversion processing of the cigarette end image using the color parameter corresponding to the unit image to obtain an end gray scale image, it includes:
[0048] Based on the gray scale conversion model, the gray scale value of each pixel point in the cigarette end image is calculated using the color parameter;
[0049] The corresponding gray scale color rendering is generated according to the gray scale value of each pixel point to form an end gray scale image.
[0050] It is understandable that the image of the end of a cigarette is composed of various pixels, each of which has its own color and its own color intensity value. For example, the RGB intensity value is between 0 and 225 to correspond to different colors. According to the color parameters of the fill light, the grayscale conversion processing can perform color attenuation processing on the intensity value of the color of each pixel, calculate the grayscale value, and then use the calculated grayscale value to perform grayscale color rendering to form an end grayscale image. It is understandable that when the red output value in the fill light is higher, it is necessary to increase the attenuation of the red intensity value when performing color attenuation processing.
[0051] Specifically, the color parameters include a red light output value, a green light output value, and a blue light output value, and the grayscale conversion model includes:
[0052] Gray=a r *R+a g *G+a b *B;
[0053] Gray is the gray value of the pixel, a r is the correction coefficient corresponding to the red light output value, a g is the correction coefficient corresponding to the green light output value, a b is the correction coefficient corresponding to the blue light output value, R is the red light contribution value of the pixel point, G is the green light contribution value of the pixel point, and B is the blue light contribution value of the pixel point, where the red light output value and a r Inversely proportional, the green light output value and a g Inversely proportional, the blue light output value and a b Inversely proportional.
[0054] It can be understood that the color of a pixel is a mixture of one or more of red, green, and blue light, and the red light contribution value, green light contribution value, and blue light contribution value reflect the proportion or contribution of red, green, and blue light in the color of the pixel. The red light output value, green light output value, and blue light output value are the proportions of red, green, and blue light in the fill light, and a r It is calculated by the red light inverse function and the red light output value, that is, the higher the red light output value, the higher the a r The smaller it is, the smaller the red light output value is. r The larger the a g It is calculated by the green light inverse function and the green light output value, a b It is calculated by the blue light inverse function and the blue light output value. Specifically, the red light inverse function, the green light inverse function and the blue light inverse function can be adjusted by the designer according to actual conditions.
[0055] In some embodiments of the present invention, Figure 2As shown, the two-dimensional code is rectangular, usually square, and position detection patterns are arranged at at least three corners of the two-dimensional code, the position detection pattern comprises a rectangular marker and two marker rings, the two marker rings are sequentially sleeved, and the inner marker ring is sleeved on the rectangular marker, and the adjacent two marker rings or the adjacent marker ring and the marker are different in color, the width ratio of the two marker rings from outside to inside and the marker in the position detection pattern is k1:k2:k3.
[0056] The two-dimensional code usually further has a positioning pattern, a correction pattern, a content pattern and the like, the detection patterns are usually three and are located in three corners of the square, and the positioning image and the correction pattern are located at the edge position, and the content pattern is located in the middle of the square, and the control module can recognize the content data and the link data and the like by recognizing the content pattern.
[0057] In the recognition of the end gray-scale image to obtain the two-dimensional code position information of the two-dimensional code located at the end of the cigarette, the two-dimensional code position information comprises:
[0058] According to the graphic width characteristics, each position detection pattern is found out in the end gray-scale image, wherein the graphic width characteristics are that the width ratios of the plurality of adjacent graphics are k1:k2:k3:k2:k1 in sequence;
[0059] The contour position of the two-dimensional code is obtained according to the distance between the plurality of position detection patterns, the deflection angle of the two-dimensional code is obtained according to the offset angle between the plurality of position detection patterns, and the contour position of the two-dimensional code and the deflection angle of the two-dimensional code form the two-dimensional code position information.
[0060] It can be understood that the control module can perform scanning processing on the end gray-scale image, when the width ratios of the several color block graphics arranged in sequence meet k1:k2:k3:k2:k1, it can be considered that the positions of these graphics are the positions of the position detection patterns, and since the plurality of position detection patterns are located at the corners of the two-dimensional code, the side length of the two-dimensional code is obtained according to the distance between the position detection patterns, and since the two-dimensional code is rectangular or square, the contour position of the two-dimensional code can be obtained, in addition, the position detection patterns are connected, and then the connection line is compared with the horizontal line to obtain the offset angle between the position detection patterns, and the deflection angle of the two-dimensional code is obtained according to the offset angle between the position detection patterns, in the coding process, the control module can control the coding module to avoid the area where the two-dimensional code is located to code, so as to protect the integrity of the two-dimensional code.
[0061] In some embodiments of the present application, in the step of fusing a plurality of unit images into a composite image, the step comprises:
[0062] Each unit image is subjected to differential amplification processing;
[0063] The plurality of unit images are fused, and in the image fusion process, a blank layer is established, and the pixel points at the same positions in the plurality of unit images and the blank layer are one-to-one corresponding;
[0064] For each position of the pixel points in the blank layer, the pixel point with the highest contrast in the corresponding position of the plurality of unit images is selected to replace, so that the blank layer is filled to form a composite image.
[0065] Among them, the contrast layer is formed according to the fixed features in the plurality of unit images, and each unit image is differentially amplified based on the contrast layer, so that the features on each unit image are highlighted.
[0066] And for the fusion of the plurality of unit images, it can be understood that, for example, the intensity value of each pixel point in the unit image is 0-255, and when the composite image is fused, the filling of the pixel points on the blank layer is to select the pixel point with the highest channel value in the pixel points at the same position in the plurality of unit images, and the pixel points on the blank layer are filled and replaced, so that the pixel points at each position in the composite image have full contrast, compared with a single unit image, the fused composite image can comprehensively reflect the information of the plurality of unit images, so as to obtain a clear and correct image description.
[0067] After the composite image is fused, light balance processing can also be performed, that is, by adjusting the gray scale distribution of the image to achieve the purpose of light balance, while realizing the image light balance and maintaining the original image, the gray scale distribution is adjusted again by analyzing the histogram of a plurality of local areas, so as to achieve the purpose of improving the contrast of the image. And the composite image can be processed by CLAHE to improve the image effect, the image contrast of the edge part can be increased to distinguish the background.
[0068] In order to be able to filter out noise while maintaining the image edge, a bilateral filtering algorithm can also be used, which can consider spatial proximity and pixel gray value similarity in the filtering window, and also consider spatial information and gray similarity, so as to avoid image distortion caused by too many irrelevant pixels participating in filtering.
[0069] In addition, the unit image can also be processed by two-dimensional wavelet transform, and the unit image is decomposed into a low-frequency component and three high-frequency components, and the three high-frequency components are respectively a horizontal direction high-frequency component, a vertical direction high-frequency component and a diagonal direction high-frequency component. The low-frequency component describes the overall structure of the image, and the high-frequency component is the edge and detail of the image. The low-frequency information contains the main content of the signal. The obtained low-frequency component and high-frequency component are fused according to different fusion rules. The fused low-frequency component and high-frequency component are reconstructed to obtain a composite image, so that multiple unit images can be efficiently fused, and the image fusion effect is greatly improved. The image processed by image fusion contains complete information.
[0070] In some embodiments of the present application, in the process of identifying the composite image by the neural network model to analyze the position information of the cigarette end of each cigarette in the marking surface, the following steps are included:
[0071] The edge contour of the cigarette group is matched by the neural network model in the composite image by using multiple bounding boxes of different sizes;
[0072] The cigarette group image and the background image in the composite image are separated according to the edge contour of the cigarette group to extract the cigarette group image;
[0073] The cigarette group image is segmented to form multiple cigarette end images, and the position information of the cigarette end is obtained according to the position of the cigarette end image in the composite image.
[0074] It can be understood that multiple bounding boxes of different sizes can be set in the training library of the neural network model, and the edge contour of the cigarette group is matched by using the bounding boxes of different sizes, so that the cigarette group image and the background image are first separated, and then the cigarette group image is analyzed after noise reduction. Since the position of the camera unit is known, that is, the position of the composite image is known, the position of each cigarette end in the cigarette group image is obtained after analyzing the cigarette group image, and then the cigarette group image is segmented into multiple cigarette end images, and the actual position of each cigarette end can also be known by using the position relationship of the cigarette end image in the composite image, so that the control module can control the marking module to mark the corresponding position.
[0075] According to the second aspect of the present application, the marking device comprises an image acquisition module 200 and a control module 300. The image acquisition module 200 comprises a camera unit 210 and a color adjustment and light supplement unit 220. The camera unit 210 is used to shoot image information of the marking surface of the cigarette group 410. The control module 300 is connected with the camera unit 210 and the color adjustment and light supplement unit 220 respectively. The control module 300 executes the two-dimensional code acquisition method of the cigarette 420 disclosed in any of the above embodiments.
[0076] The code marking device executes the two-dimensional code collection method of any one of the embodiments disclosed above, automatically identifies the end position of the cigarette 420 and the two-dimensional code position, provides the possibility of automatic code marking, improves the processing efficiency, and reduces the labor cost.
[0077] In some embodiments of the present application, the code marking device further comprises a base frame 110, a smoke guide module 120, a shielding cover 130, and a marking module 140. The smoke guide module 120 is used to place the smoke group 410, and the smoke guide module 120 is arranged on the base frame 110. The smoke guide module 120 is used to guide the movement of the plurality of cigarettes 420 so that the ends of at least two cigarettes 420 are approximately flush with the marking surface. The shielding cover 130 is arranged on the base frame 110, and the shielding cover 130 is provided with a light path protection cavity. The shielding cover 130 can block the light from passing through. The shielding cover 130 is provided with a material input port and a work opening. The smoke guide module 120 is located in the light path protection cavity or can drive the smoke group 410 to enter the light path protection cavity from the material input port. The image collection module 200 is used to face the work opening to shoot image information. The marking module 140 is movably arranged on the base frame 110. The control module 300 is connected with the marking module 140 to control the marking module 140 to mark the cigarettes 420 according to the cigarette end position information and the two-dimensional code position information, and make the labels and two-dimensional codes formed by marking located at different positions.
[0078] The base frame 110 can be built by alloy rods, sheet metal parts, etc. The shielding cover 130 can be surrounded by light-proof plate parts made of resin materials or alloys. Specifically, the material input port can be located at one end of the light path protection cavity, and the work opening is located at the other end of the light path protection cavity. The smoke guide module 120 can be located in the light path protection cavity. The worker places the cigarettes 420 on the smoke guide module 120 to stack into the smoke group 410, or it can be arranged outside the light path protection cavity. The worker first places the cigarettes 420 on the smoke guide module 120 to stack into the smoke group 410. A conveyor belt is arranged in the light path protection cavity to dock with the smoke guide module 120. Then the conveyor belt drives the smoke group 410 to enter the light path protection cavity from the material input port.
[0079] The marking module 140 can adopt a conventional laser marker. The laser marker outputs laser to irradiate on the surface of the cigarette 420 package for marking. A displacement driving assembly can be arranged on the base frame 110 to simultaneously drive the image collection module 200 and the marking module 140. Independent displacement driving assemblies can also be arranged to correspondingly drive the image collection module 200 and the marking module 140, respectively. The displacement driving assembly can be a conventional universal robot, an XYZ multi-axis translation driving mechanism, etc.
[0080] The smoke guide module 120 includes a material table and a smoke shield. The smoke shield can be detachably arranged at the head end of the material table. The material table is movably arranged on the base frame 110 so that the tail end of the material table is raised and higher than the head end of the material table. Multiple cigarette strips 420 can be placed on the material table and the cigarette strips 420 can be moved on the material table so that the ends of the cigarette strips 420 are against the smoke shield.
[0081] It can be understood that the cigarette strips 420 are stacked and arranged on the material table. When the tail end of the material table is raised and higher than the head end of the material table, the cigarette strips 420 will slide along the bottom surface of the material table due to gravity, so that the end faces of multiple cigarette strips 420 are relatively neatly against the smoke barrier plate, and then the material table is restored to a state where the head and tail ends are flush. The staff will remove and separate the smoke barrier plate from the material table, and can obtain multiple cigarette strips 420 with end faces that are close to flush with the marking surface.
[0082] Specifically, the material table is rotatably disposed on the base frame 110 , and the material table rotates relative to the base frame 110 so that the rear end of the material table is lifted and higher than the front end of the material table.
[0083] According to the control device of the third embodiment of the present invention, the control device includes a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, the cigarette QR code collection method disclosed in any of the above embodiments is implemented.
[0084] like Figure 4 As shown, Figure 4 The hardware structure of the control device of another embodiment is also illustrated. The control device includes:
[0085] The processor 610 may be implemented as a general-purpose central processing unit (CPU), a microprocessor (MCU), an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is configured to execute relevant programs to implement the technical solutions provided in the embodiments of the present application.
[0086] The memory 620 can be implemented in the form of a read-only memory 620 (ROM), a static storage device, a dynamic storage device, or a random access memory 620 (RAM). The memory 620 can store an operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 620 and is called by the processor 610 to execute the cigarette QR code collection method of the embodiments of this application;
[0087] The input / output interface 630 is configured to realize information input and output.
[0088] The communication interface 640 is configured to realize communication interaction between the device and other devices. The communication can be realized in a wired manner (for example, a USB, a network cable, or the like) or in a wireless manner (for example, a mobile network, WIFI, Bluetooth, or the like).
[0089] The bus 650 is configured to transmit information between various components (for example, the processor 610, the memory 620, the input / output interface 630, and the communication interface 640) of the device.
[0090] The processor 610, the memory 620, the input / output interface 630, and the communication interface 640 are communicatively connected to each other in the device through the bus 650.
[0091] The computer readable storage medium according to the fourth aspect of the present application stores a computer program, and the computer program is executed by the processor 610 to realize the cigarette two-dimensional code acquisition method disclosed in any of the above embodiments.
[0092] The memory 620 is a non-transitory computer readable storage medium, and can be used to store non-transitory software programs and non-transitory computer executable programs. In addition, the memory can include a high-speed random access memory, and can also include a non-transitory memory, for example, at least one magnetic disk storage device, a flash memory device, or other non-transitory solid-state memory device. In some embodiments, the memory 620 can optionally include a memory remotely arranged relative to the processor, and the remote memory can be connected to the processor through a network. Examples of the network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.
[0093] The embodiments described in the embodiments of the present application are used to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. Those skilled in the art can know that, with the evolution of technology and the appearance of new application scenarios, the technical solutions provided by the embodiments of the present application are also applicable to similar technical problems.
[0094] Those skilled in the art can understand that the technical solutions shown in the drawings do not constitute a limitation on the embodiments of the present application, and can include more or fewer steps than the drawings, or combine certain steps or different steps.
[0095] The apparatus embodiments described above are merely illustrative, and units described as separate units can or can not be physically separate, i.e., can be located in one place, or can be distributed over multiple network units. Part or all of the modules can be selected according to actual needs to achieve the purposes of the embodiments.
[0096] Those skilled in the art can understand that all or some of the steps in the method disclosed above, the functional modules / units in the system and the device can be implemented by software, firmware, hardware, or a suitable combination thereof.
[0097] The terms "first", "second", "third", "fourth" and the like in the description of the specification and the above drawings, if any, are used to distinguish similar objects, and do not necessarily indicate a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "comprise" and "have" and any variations thereof, are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device that includes a series of steps or units does not have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0098] The preferred embodiments of the application are described above with reference to the accompanying drawings, and are not limited to the scope of the application. Any modifications, equivalent replacements and improvements made by those skilled in the art without departing from the scope and essence of the application shall be within the scope of the application.
Claims
1. A method for collecting QR codes on cigarette strips, applied to a coding device, wherein the coding device comprises an image acquisition module and a control module, wherein the image acquisition module comprises a camera unit and a color adjustment and fill light unit, wherein the camera unit is used to capture image information of the marking surface of the cigarette group, wherein: The cigarette group includes a plurality of stacked cigarettes, the ends of which form a marking surface. The control module is connected to the camera unit and the color adjustment and fill light unit respectively. It is characterized in that the control module executes the cigarette QR code collection method, which includes: The fill light image acquisition step is executed cyclically. In the fill light image acquisition step, the color adjustment fill light unit is controlled to emit fill light, and the camera unit acquires unit images of the marking surface. The color parameters of the fill light in the fill light image acquisition step are different for multiple times, and the color parameters corresponding to each unit image are recorded. Fusing multiple unit images into a composite image; The composite image is recognized by a neural network model to analyze the position information of the end of each cigarette on the marking surface; Randomly select a unit image, and divide the unit image into a plurality of cigarette end images corresponding to each cigarette according to the position information of each cigarette end; Performing grayscale conversion processing on the cigarette end image using the color parameters corresponding to the unit image to obtain an end grayscale image; The end grayscale image is recognized to obtain the QR code position information of the QR code located at the end of the cigarette.
2. The method for collecting cigarette QR codes according to claim 1, characterized in that: The grayscale conversion process of the cigarette end image using the color parameters corresponding to the unit image to obtain the end grayscale image includes: Based on the grayscale conversion model, the grayscale value of each pixel in the cigarette end image is calculated using the color parameter; The corresponding grayscale color rendering is generated according to the grayscale value of each pixel to form an end grayscale image.
3. The method for collecting cigarette QR codes according to claim 2, characterized in that: The color parameters include a red light output value, a green light output value, and a blue light output value, and the grayscale conversion model includes: Gray=a r *R+a g *G+a b *B; Gray is the gray value of the pixel, a r is the correction coefficient corresponding to the red light output value, a g is the correction coefficient corresponding to the green light output value, a b is the correction coefficient corresponding to the blue light output value, R is the red light contribution value of the pixel point, G is the green light contribution value of the pixel point, and B is the blue light contribution value of the pixel point, where the red light output value and a r Inversely proportional, the green light output value and a g Inversely proportional, the blue light output value and a b Inversely proportional.
4. The method for collecting cigarette QR codes according to claim 1, wherein: The QR code is rectangular, and position detection patterns are provided at at least three corners of the QR code. The position detection pattern includes a rectangular identification member and two identification rings. The two identification rings are sequentially sleeved, and the inner identification ring is sleeved on the rectangular identification member. The two adjacent identification rings or adjacent identification rings and identification members are of different colors. The width ratio of the two identification rings and the identification member from the outside to the inside in the position detection pattern is k1:k2:k3. The QR code position information of the QR code located at the end of the cigarette obtained by the end grayscale image recognition includes: Find each position detection pattern in the end grayscale image according to the pattern width feature, wherein the pattern width feature is a plurality of adjacent pattern width ratios of k1:k2:k3:k2:k1 in sequence; The contour position of the QR code is obtained based on the distance between multiple position detection patterns, and the deflection angle of the QR code is obtained based on the offset angle between multiple position detection patterns. The contour position of the QR code and the deflection angle of the QR code form the QR code position information.
5. The method for collecting cigarette QR codes according to claim 1, characterized in that: The step of fusing the plurality of unit images into a composite image includes: Perform differential amplification processing on each unit image; Fusing multiple unit images, creating a blank layer during the image fusion process, and making one-to-one correspondence between the pixels at the same position in the multiple unit images and the blank layer; For each pixel point in the blank layer, the pixel point with the highest contrast in the corresponding position of multiple unit images is selected to replace it, so that the blank layer is filled to form a composite image.
6. The method for collecting cigarette QR codes according to claim 1, characterized in that: The process of using the neural network model to identify the composite image to analyze the position information of the cigarette ends of each cigarette on the marking surface includes: Using multiple bounding boxes of different sizes to match the edge contours of the smoke group in the composite image through the features of the neural network model; Separating the smoke group image from the background image in the composite image according to the edge contour of the smoke group to extract the smoke group image; The cigarette group image is segmented to form a plurality of cigarette rod end images, and cigarette rod end position information is obtained based on the positions of the cigarette rod end images in the composite image.
7. A coding device, characterized in that: It includes an image acquisition module and a control module. The image acquisition module includes a camera unit and a color adjustment and fill light unit. The camera unit is used to capture image information of the marked surface of the cigarette group. The control module is connected to the camera unit and the color adjustment and fill light unit respectively. The control module executes the cigarette QR code acquisition method according to any one of claims 1 to 6.
8. A coding device according to claim 7, characterized in that: Also includes: scaffolding; A cigarette guide module, used for placing the cigarette group, the cigarette guide module is arranged on the base frame, and is used to guide the movement of multiple cigarette strips so that the ends of at least two cigarette strips are close to the marking surface; A shielding cover is provided on the base frame, wherein a light path protection cavity is provided in the shielding cover, the shielding cover can block the passage of light, the shielding cover is provided with a material input port and an operation port, the smoke guide module is located in the light path protection cavity or can drive the smoke group from the material input port into the light path protection cavity, and the image acquisition module is used to capture image information toward the operation port; The marking module is movably arranged on the base frame, and the control module is connected to the marking module to control the marking module to mark the cigarette according to the end position information of the cigarette and the QR code position information and make the label and QR code formed by marking be located at different positions.
9. A control device, characterized in that: The control device includes a memory and a processor, the memory stores a computer program, and the processor implements the cigarette QR code collection method according to any one of claims 1 to 6 when executing the computer program.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method for collecting cigarette QR codes according to any one of claims 1 to 6 is implemented.