Carton cigarette detection method, device, equipment and medium for cigarette packaging production line
Patent Information
- Application Number
- CN202611351711.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-02
- Publication Date
- 2026-11-03
AI Technical Summary
In existing technologies, the reflectivity of transparent packaging films leads to unclear imaging during the detection of cartons of cigarettes on the cigarette packaging production line, resulting in insufficient detection stability and difficulty in effectively identifying missing cartons.
A dual-light source time-division imaging method is adopted, which uses first and second illumination units with different illumination angles to acquire first and second images of the stack of boxed cigarettes respectively. By synthesizing the images, region detection is performed to solve the problem of unclear imaging caused by the reflection of transparent packaging film.
This improved the efficiency and reliability of missing strip detection in cigarette packaging production lines, ensuring the accuracy and stability of the detection results.
Smart Images

Figure CN123025982A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of quality inspection technology in cigarette packaging production lines, and particularly to methods, devices, equipment and media for inspecting cartons of cigarettes in cigarette packaging production lines. Background Technology
[0002] On the cigarette packaging production line, the carton sealing machine automatically packages cigarette cartons into cardboard boxes. Although the probability of missing cartons is very low, if it does occur, it can cause unnecessary disputes and losses for cigarette manufacturers, retailers, or consumers. Therefore, the carton sealing machine needs to inspect the stacks of carton-packaged cigarettes before they enter the carton or inside the carton to confirm whether any cartons are missing.
[0003] In existing technologies, single-shot imaging under single illumination conditions, single-shot imaging under multi-camera networks, or simultaneous dual-light source illumination combined with image recognition technology are commonly used to detect missing cigarette packs. However, single-shot imaging under single illumination conditions suffers from problems such as localized glare and unclear edges due to the transparent packaging film on the outer surface of the cigarette pack, significant reflectivity of the film, and large angular differences between different columns and the camera and light source. A single illumination or single photograph is insufficient to ensure all areas are simultaneously clear, leading to issues like localized glare and unclear edges, resulting in insufficient detection stability. Single-shot imaging under multi-camera networks employs a multi-camera architecture, resulting in system complexity, and also suffers from the limitations of single-shot imaging. Simultaneous dual-light source illumination methods, with light sources arranged laterally at intervals on the cigarette pack frame, aim to illuminate the edges of the gaps between cigarette packs, but do not solve the problem of unclear imaging caused by localized glare.
[0004] Therefore, how to solve the problem of unclear imaging caused by the reflection of transparent packaging film and improve the efficiency and reliability of the detection of missing strips in cigarette packaging production lines is an urgent problem to be solved. Summary of the Invention
[0005] This invention provides a method, apparatus, equipment, and medium for detecting carton cigarettes in a cigarette packaging production line, which can solve the problem of unclear imaging caused by reflection from transparent packaging film.
[0006] According to one aspect of the present invention, a method for detecting cartons of cigarettes in a cigarette packaging production line is provided, comprising: Acquire a trigger signal; wherein the trigger signal is used to indicate that the target boxed cigarette stack has reached the detection station, the boxed cigarette stack contains a plurality of cigarette units arranged in an array, and the outer surface of each cigarette unit has a transparent packaging film; Based on the trigger signal, the first lighting unit is controlled to provide first illumination to the target boxed cigarette stack at a first illumination angle, and a first image of the target boxed cigarette stack is acquired under the first illumination. Based on the completion time of the acquisition of the first image, the second illumination unit is controlled to provide second illumination to the target boxed cigarette stack at a second illumination angle, and a second image of the target boxed cigarette stack is acquired under the second illumination; wherein, the first illumination angle is different from the second illumination angle; First image data corresponding to the first side region of the target boxed cigarette stack is extracted from the first image, and second image data corresponding to the second side region of the target boxed cigarette stack is extracted from the second image; A composite image is obtained based on the first image data and the second image data, and region detection is performed on the composite image to obtain the detection result of the boxed cigarettes corresponding to the target boxed cigarette stack.
[0007] According to another aspect of the present invention, a detection device for carton cigarettes in a cigarette packaging production line is provided, comprising: A signal acquisition module is used to acquire a trigger signal; wherein the trigger signal is used to indicate that the target boxed cigarette stack has reached the detection station, the boxed cigarette stack contains a plurality of cigarette units arranged in an array, and the outer surface of each cigarette unit has a transparent packaging film; The first lighting module is used to control the first lighting unit to provide first lighting to the target boxed cigarette stack at a first illumination angle based on the trigger signal, and to acquire a first image of the target boxed cigarette stack under the first lighting; The second lighting module is used to control the second lighting unit to provide second lighting to the target boxed cigarette stack at a second lighting angle based on the acquisition completion time of the first image, and to acquire a second image of the target boxed cigarette stack under the second lighting; wherein, the first lighting angle is different from the second lighting angle; The image acquisition module is used to extract first image data corresponding to the first side area of the target boxed cigarette stack from the first image, and to extract second image data corresponding to the second side area of the target boxed cigarette stack from the second image; The cigarette pack detection module is used to obtain a composite image based on the first image data and the second image data, and to perform region detection on the composite image to obtain the detection result of the cigarette packs corresponding to the target stack of cigarette packs.
[0008] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, which enables the at least one processor to perform the method for detecting carton cigarettes in a cigarette packaging production line according to any embodiment of the present invention.
[0009] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions, the computer instructions being configured to cause a processor to execute and implement the method for detecting carton cigarettes in a cigarette packaging production line according to any embodiment of the present invention.
[0010] According to another aspect of the present invention, a computer program product is provided, comprising a computer program that, when executed by a processor, implements the method for detecting cartons of cigarettes in a cigarette packaging production line as described in any embodiment of the present invention.
[0011] The technical solution of this invention involves acquiring a trigger signal, which indicates that a target boxed cigarette stack has reached the detection station. The boxed cigarette stack contains multiple cigarette units arranged in an array, each cigarette unit having a transparent packaging film on its outer surface. Then, based on the trigger signal, a first illumination unit is controlled to provide first illumination to the target boxed cigarette stack at a first illumination angle, and a first image of the target boxed cigarette stack is acquired under the first illumination. Furthermore, based on the completion time of the first image acquisition, a second illumination unit is controlled to provide second illumination to the target boxed cigarette stack at a second illumination angle, and a second image of the target boxed cigarette stack is acquired under the second illumination; wherein the first illumination angle is different from the second illumination angle. Further, first image data corresponding to a first side region of the target boxed cigarette stack is extracted from the first image, and second image data corresponding to a second side region of the target boxed cigarette stack is extracted from the second image. Finally, a composite image is obtained based on the first image data and the second image data, and region detection is performed on the composite image to obtain the boxed cigarette detection result corresponding to the target boxed cigarette stack. By using dual-light source time-division imaging and region-based optimal synthesis to obtain clear images of the carton of cigarettes in each region, and then accurately determining the status of missing cartons through region detection, the problem of unclear imaging caused by reflection from the transparent packaging film is solved, thus improving the efficiency and reliability of missing carton detection in the cigarette packaging production line.
[0012] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0013] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0014] Figure 1 This is a flowchart of a method for detecting cartons of cigarettes in a cigarette packaging production line according to Embodiment 1 of the present invention; Figure 2 This is a flowchart of a method for detecting cartons of cigarettes in a cigarette packaging production line according to Embodiment 2 of the present invention; Figure 3 This is a schematic diagram of a synthesized image provided according to Embodiment 2 of the present invention; Figure 4 This is a flowchart of an optional cigarette packaging production line inspection method for cartons of cigarettes according to Embodiment 2 of the present invention; Figure 5 This is a schematic diagram of the structure of a carton cigarette detection device for a cigarette packaging production line according to Embodiment 3 of the present invention; Figure 6 This is a schematic diagram of the structure of an electronic device for implementing the cigarette packaging production line inspection method for cigarettes in this embodiment of the invention. Detailed Implementation
[0015] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0016] It should be noted that the terms "first," "second," "target," etc., used in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0017] Example 1 Figure 1 This is a flowchart of a method for detecting missing cartons of cigarettes in a cigarette packaging production line according to Embodiment 1 of the present invention. This embodiment is applicable to the detection of missing cartons in stacked cartons of cigarettes on a cigarette packaging production line. This method can be executed by a carton detection device on the cigarette packaging production line, which can be implemented in hardware and / or software and can be configured in an electronic device. Figure 1 As shown, the method includes: S110. Obtain a trigger signal; wherein the trigger signal is used to indicate that the target boxed cigarette stack has reached the detection station, the boxed cigarette stack contains a plurality of cigarette units arranged in an array, and the outer surface of each cigarette unit has a transparent packaging film.
[0018] In this context, an inspection station refers to a pre-defined fixed position on the cigarette packaging production line used for visual inspection of stacks of cartons of cigarettes. Typically, the inspection station is located on the cigarette carton conveying path of the carton sealing machine. A camera and lighting unit are fixedly installed at the corresponding position of this station. When the stack of cartons of cigarettes is pushed to this position and stops, a trigger signal is sent, initiating the inspection process. A carton of cigarettes refers to a single carton of cigarettes. For example, a carton of cigarettes can be a strip-shaped package consisting of multiple packs of cigarettes, serving as the basic unit constituting a stack of cartons of cigarettes. A stack of cartons of cigarettes can refer to an assembly of cartons of cigarettes arranged in an array, ready to be packed into a carton or already inside a carton. Typically, the cartons of cigarettes in a stack of cartons of cigarettes are arranged in a certain number of rows and columns, forming a regular array structure. The target stack of cartons of cigarettes can refer to the specific stack of cartons of cigarettes currently undergoing the inspection process.
[0019] S120. Based on the trigger signal, control the first lighting unit to provide first illumination to the target boxed cigarette stack at a first illumination angle, and acquire a first image of the target boxed cigarette stack under the first illumination.
[0020] The illumination unit can refer to a device used to provide illumination to a stack of boxed cigarette cartons. Typically, the illumination unit emits light to enable the surface features of the stacked cigarette cartons to be clearly imaged by an image acquisition device. For example, the illumination unit can be a light-emitting diode (LED) strip light source. The first illumination unit can refer to an illumination unit disposed on one side of the stacked cigarette cartons. For example, the first illumination unit can be an illumination unit disposed on the left side of the stacked cigarette cartons. The first illumination angle can refer to the angle of inclination or incident direction of the light emission direction of the first illumination unit relative to the surface of the stacked cigarette cartons. The first illumination can refer to the illumination conditions when the first illumination unit is lit. The first image can refer to the original image of the stacked cigarette cartons captured by the image acquisition device under the first illumination.
[0021] S130. Based on the completion time of the acquisition of the first image, control the second illumination unit to provide second illumination to the target boxed cigarette stack at a second illumination angle, and acquire a second image of the target boxed cigarette stack under the second illumination; wherein, the first illumination angle is different from the second illumination angle.
[0022] The acquisition completion time can refer to the moment when the image acquisition device completes the exposure and reading of the first image. The second illumination unit can refer to an illumination unit located on the other side of the stack of boxed cigarettes. For example, continuing the above example, the second illumination unit can be an illumination unit located on the right side of the stack of boxed cigarettes. The second illumination angle can refer to the angle of inclination or incident direction of the light emitted from the second illumination unit relative to the surface of the stack of boxed cigarettes. The second illumination can refer to the illumination conditions when the second illumination unit is lit. The second image can refer to the original image of the stack of boxed cigarettes acquired by the image acquisition device under the second illumination.
[0023] S140. Extract first image data corresponding to the first side region of the target boxed cigarette stack from the first image, and extract second image data corresponding to the second side region of the target boxed cigarette stack from the second image.
[0024] The first side region can refer to one spatial side of the target boxed cigarette stack in the image. For example, continuing the previous example, if the first lighting unit is located on the left side of the boxed cigarette stack, then the first side region can be the right side of the boxed cigarette stack. The first image data can refer to image data extracted from the first image corresponding to the first side region. The second side region can refer to another spatial side of the target boxed cigarette stack in the image. For example, continuing the previous example, if the second lighting unit is located on the right side of the boxed cigarette stack, then the second side region can be the left side of the boxed cigarette stack. The second image data can refer to image data extracted from the second image corresponding to the second side region.
[0025] In an optional implementation, the image clarity of the first side region under the first illumination is better than that under the second illumination, and the image clarity of the second side region under the second illumination is better than that under the first illumination.
[0026] S150. A composite image is obtained based on the first image data and the second image data, and region detection is performed on the composite image to obtain the detection result of the boxed cigarettes corresponding to the target boxed cigarette stack.
[0027] The synthesized image can refer to an image generated based on the first and second image data, used for subsequent region detection. Region detection refers to the operation of performing region analysis on the synthesized image to determine whether a cigarette pack exists at each cigarette unit location. The boxed cigarette detection result refers to the final judgment output of detecting missing cigarettes in the target boxed cigarette stack.
[0028] In an optional embodiment, the method further comprises: performing two-dimensional code positioning on the two-dimensional code identification region in the composite image to obtain a two-dimensional code image; and performing data decoding on the two-dimensional code image to obtain a two-dimensional code recognition result corresponding to the target boxed cigarette stack. The two-dimensional code identification region may refer to a specific region where the two-dimensional code is disposed on each cigarette unit. The two-dimensional code image may refer to image data that is positioned and extracted from the two-dimensional code identification region in the composite image and contains a complete two-dimensional code pattern. Generally, the number of the two-dimensional code images is consistent with the number of the cigarette units in the target boxed cigarette stack. The data decoding may refer to a process of converting graphic information composed of black and white modules in the two-dimensional code image into readable text data or structured data. The two-dimensional code recognition result may refer to readable information obtained after data decoding is performed on the two-dimensional code image. For example, the two-dimensional code recognition result may include a product serial number, a production batch number, a traceability code, and the like. Specifically, after the composite image is obtained, first, prior position information of the two-dimensional code identification region corresponding to each cigarette unit in the target boxed cigarette stack is acquired, and the position information may be a fixed coordinate range of a two-dimensional code sticker region on the outer side surface of the cigarette unit at a detection station, or may be a preset Region of Interest (ROI) position of a two-dimensional code label region on the surface of the cigarette unit in the composite image. It is worth noting that the position of the two-dimensional code identification region in the composite image may be known in advance, so that there is no need to perform global search on the entire composite image, and positioning only needs to be performed in the preset region. Then, two-dimensional code positioning is performed in the two-dimensional code identification region, a positioning algorithm based on position detection patterns is adopted to identify a unique "concentric square" shaped position detection pattern of the two-dimensional code, the accurate position and boundary of the two-dimensional code in the composite image are determined, and image data of the region is extracted as the two-dimensional code image. Then, data decoding processing is performed on the extracted two-dimensional code image. First, binarization processing is performed on the two-dimensional code image to convert black and white modules in the image into binary to form an information matrix; secondly, an error correction algorithm is adopted to perform error correction and verification on the binary data, so as to repair error codes caused by image contamination or uneven illumination; finally, the error-corrected data is decoded according to the coding rule of the two-dimensional code, and the original data content carried by the two-dimensional code is restored. Finally, after the data decoding is completed, the two-dimensional code recognition result corresponding to the target boxed cigarette stack is output.
[0029] In an optional implementation, the method further includes: associating and storing the QR code recognition results and the boxed cigarette inspection results. Specifically, after completing the QR code recognition and boxed cigarette missing item detection, a correspondence is established between the QR code recognition results and the boxed cigarette inspection results. Optionally, the QR code recognition results are used as index keys, and the boxed cigarette inspection results are used as data records associated with these index keys. Optionally, auxiliary information such as inspection time, inspection station number, and equipment number can also be included in the associated data records. This associated storage can be stored locally as database records, data table entries, log files, or structured data files, or it can be uploaded to the server of a manufacturing execution system or enterprise resource planning system via a network interface for centralized storage and management. Through this associated storage, the QR code recognition results and the boxed cigarette inspection results form a unified quality traceability record. When a quality problem is subsequently discovered in a box of cigarettes, the operator can scan the QR code of the box to retrieve and access all associated information in the storage system, including the boxed cigarette missing item inspection results, inspection time, and equipment parameters, facilitating quality traceability, anomaly analysis, and equipment debugging. Meanwhile, the unified associated storage records also provide a data foundation for big data analysis, which can be used to statistically analyze the occurrence rate of missing strips, analyze the patterns and causes of missing strips, and thus provide a basis for decision-making to optimize the production process.
[0030] The technical solution of this invention involves acquiring a trigger signal, which indicates that a target boxed cigarette stack has reached the detection station. The boxed cigarette stack contains multiple cigarette units arranged in an array, each cigarette unit having a transparent packaging film on its outer surface. Then, based on the trigger signal, a first illumination unit is controlled to provide first illumination to the target boxed cigarette stack at a first illumination angle, and a first image of the target boxed cigarette stack is acquired under the first illumination. Furthermore, based on the completion time of the first image acquisition, a second illumination unit is controlled to provide second illumination to the target boxed cigarette stack at a second illumination angle, and a second image of the target boxed cigarette stack is acquired under the second illumination; wherein the first illumination angle is different from the second illumination angle. Further, first image data corresponding to a first side region of the target boxed cigarette stack is extracted from the first image, and second image data corresponding to a second side region of the target boxed cigarette stack is extracted from the second image. Finally, a composite image is obtained based on the first image data and the second image data, and region detection is performed on the composite image to obtain the boxed cigarette detection result corresponding to the target boxed cigarette stack. By using dual-light source time-division imaging and region-based optimal synthesis to obtain clear images of the carton of cigarettes in each region, and then accurately determining the status of missing cartons through region detection, the problem of unclear imaging caused by reflection from the transparent packaging film is solved, thus improving the efficiency and reliability of missing carton detection in the cigarette packaging production line.
[0031] Example 2 Figure 2 This is a flowchart of a method for detecting cartons of cigarettes in a cigarette packaging production line according to Embodiment 2 of the present invention. This embodiment is a refinement based on the above embodiment. Specifically, this embodiment refines the step of "controlling a second lighting unit to provide second illumination to the target carton of cigarettes at a second illumination angle based on the acquisition completion time of the first image, and acquiring a second image of the target carton of cigarettes under the second illumination." Specifically, this may include: determining the illumination time point corresponding to the second lighting unit based on the acquisition completion time of the first image and a preset delay; controlling the second lighting unit to provide second illumination to the target carton of cigarettes at a second illumination angle based on the illumination time point; and controlling an image acquisition device to acquire a second image of the target carton of cigarettes under the second illumination based on the illumination time point. Figure 2 As shown, the method includes: S210. Obtain a trigger signal; wherein the trigger signal is used to indicate that the target boxed cigarette stack has reached the detection station, the boxed cigarette stack contains a plurality of cigarette units arranged in an array, and the outer surface of each cigarette unit has a transparent packaging film.
[0032] Specifically, on the cigarette packaging production line, the target carton of cigarettes moves along the conveying direction under the action of a conveyor belt or a cigarette pushing mechanism. A position detection sensor, such as a photoelectric sensor, proximity switch, or limit switch, is pre-installed at the inspection station. The detection area of this sensor corresponds to the stop position of the inspection station. When the target carton of cigarettes reaches the inspection station under the push of a pushing mechanism, such as a cigarette pusher, the target carton of cigarettes triggers the position detection sensor, which generates a position signal in response. This position signal is sent to the programmable logic controller (PLC) of the carton sealing machine. After receiving the position signal, the PLC confirms that the target carton of cigarettes has reached the inspection station and is in a stopped state. It then generates a trigger signal and sends it to the camera controller or light source controller of the vision inspection system to initiate the subsequent image acquisition process. The camera controller controls the start of the image acquisition equipment, and the light source controller controls the start of the lighting unit.
[0033] It should be noted that the above-described method of generating the trigger signal is merely an illustrative example. Those skilled in the art can generate the trigger signal in other ways, such as directly sending the trigger signal from the position detection sensor to the vision detection system, all of which fall within the protection scope of this invention.
[0034] S220. Based on the trigger signal, control the first lighting unit to provide first illumination to the target boxed cigarette stack at a first illumination angle, and acquire a first image of the target boxed cigarette stack under the first illumination.
[0035] S230. Determine the lighting time point corresponding to the second lighting unit based on the acquisition completion time of the first image and the preset delay.
[0036] The preset delay refers to a pre-set time interval between the completion of the first image acquisition and the start of the second illumination unit providing the second illumination. Typically, the value of the preset delay can be determined in advance based on factors such as hardware response characteristics and light source stabilization time. For example, the preset delay can be set to 40ms. The illumination time point refers to the specific time at which the second illumination unit begins providing the second illumination. For example, the illumination time point can be determined by adding the preset delay to the completion time of the first image acquisition.
[0037] S240. Based on the lighting time point, control the second lighting unit to provide second lighting to the target boxed cigarette stack at a second illumination angle.
[0038] S250. Based on the lighting time point, control the image acquisition device to acquire a second image of the target boxed cigarette stack under the second lighting.
[0039] The image acquisition device can refer to a hardware device used to acquire images of stacked cartons of cigarettes. For example, the image acquisition device can be an industrial camera.
[0040] Specifically, after acquiring the first image, the image acquisition device or camera controller records the acquisition completion time. Then, a pre-set delay is obtained, and the acquisition completion time of the first image is added to the pre-set delay to calculate the illumination time point corresponding to the second illumination unit. When the system clock reaches this illumination time point, two control actions are executed synchronously: firstly, a lighting command is sent to the second illumination unit through the light source controller, controlling the second illumination unit to provide second illumination to the target stack of cigarette cartons at a second illumination angle; secondly, a trigger signal is sent to the image acquisition device, controlling the image acquisition device to begin exposure under the second illumination, acquiring the second image of the target stack of cigarette cartons. Thus, by setting the pre-set delay, a fixed time interval is maintained between the second illumination and the completion of the first image acquisition. Furthermore, the lighting of the second illumination unit and the exposure of the image acquisition device are both controlled based on the same illumination time point, thereby ensuring precise synchronization of "the camera exposure exactly when the light is on." This synchronization mechanism avoids inconsistent image brightness or blurring caused by asynchrony between illumination and acquisition, ensuring the quality of the second image.
[0041] It is worth noting that, in this embodiment of the invention, the first lighting unit, the second lighting unit, and the image acquisition device are all fixedly installed and do not need to be moved. The first lighting unit and the second lighting unit are symmetrically installed on both sides of the image acquisition device and are fixed together with the image acquisition device on the same bracket.
[0042] S260. Extract first image data corresponding to the first side region of the target boxed cigarette stack from the first image, and extract second image data corresponding to the second side region of the target boxed cigarette stack from the second image.
[0043] S270. The first image data is used as the image data corresponding to the first side region in the composite image, and the second image data is used as the image data corresponding to the second side region in the composite image, and the composite image is obtained by stitching them together.
[0044] Figure 3The diagram illustrates a composite image provided by an embodiment of the present invention. Specifically, taking a 5×5 array arrangement of a box of cigarettes as an example, the 25 cigarettes are divided into multiple ROI detection areas in 5 columns, labeled ROI1, ROI2, ROI3, ROI4, and ROI5 from left to right. First, a preset region allocation strategy is obtained, which is determined based on the sharpness distribution of dual-light source time-division imaging. When the first illumination unit, such as the right LED strip light source, is lit, the light illuminates the box of cigarettes from the right, resulting in less reflection and clearer imaging of the transparent packaging film on the left side of the stack. Therefore, the image data of the left side region in the first image, i.e., ROI1 to ROI3, is determined as the image data of the first side region for composite image. When the second illumination unit, such as the left LED strip light source, is lit, the light illuminates the box of cigarettes from the left, resulting in less reflection and clearer imaging of the transparent packaging film on the right side of the stack. Therefore, the image data of the right side region in the second image, i.e., ROI4 to ROI5, is determined as the image data of the second side region for composite image. Image data corresponding to ROI1 to ROI3 is cropped from the first image to form the first image data, and image data corresponding to ROI4 to ROI5 is cropped from the second image to form the second image data. Then, according to the physical position of each ROI in the stack of cigarette cartons (ROI1 to ROI5 arranged from left to right), the first image data (ROI1 to ROI3) and the second image data (ROI4 to ROI5) are stitched together, so that ROI1 to ROI3 uses the first image data and ROI4 to ROI5 uses the second image data. After stitching, a complete composite image is obtained. In this composite image, the left-side regions ROI1 to ROI3 originate from the first image, and the right-side regions ROI4 to ROI5 originate from the second image. Both sides are the clearest regions under their respective lighting conditions, and all regions in the entire composite image have good image clarity.
[0045] It should be noted that the above division method using a 5×5 array, with the left region designated as ROI1 to ROI3 and the right region as ROI4 to ROI5, is merely an illustrative example. In practical applications, the boundary between the first and second side regions can be adjusted based on factors such as the installation position of the light source, the illumination angle, and the arrangement of the smoke strips. For example, when the light source arrangement or illumination angle changes, the boundary between the first and second side regions can be a combination of ROI1 to ROI2 and ROI3 to ROI5, or any other reasonable region division method. The region allocation strategy is determined based on ensuring that each region uses the clearer image data of that region for synthesis. If the image clarity of a certain side region under the first illumination is better than that under the second illumination, that side region uses the first image data; conversely, if the image clarity of a certain side region under the second illumination is better than that under the first illumination, that side region uses the second image data. All region allocation strategies fall within the protection scope of this invention.
[0046] S280. Based on the number of cigarettes in the vertical direction and the number of cigarettes in the horizontal direction corresponding to the target boxed cigarette stack, the synthesized image is divided into regions to obtain a set of regions of interest corresponding to the target boxed cigarette stack.
[0047] The vertical number of cigarette packs refers to the number of rows of cigarette pack units arranged in a stack of cigarette packs. The horizontal number of cigarette packs refers to the number of columns of cigarette pack units arranged in a stack of cigarette packs. For example, if the cigarette packs in the target stack of cigarette packs are arranged in 5 rows × 5 columns, then the vertical number of cigarette packs is 5 and the horizontal number of cigarette packs is 5. A region of interest (ROI) refers to a local image region in the composite image that corresponds to the position of a single cigarette pack unit. Typically, each ROI covers the position range of one cigarette pack unit in the image. A set of ROIs refers to the overall set of all ROIs. Typically, a set of ROIs can contain the vertical number of cigarette packs × the horizontal number of cigarette packs.
[0048] S290. Perform grayscale processing on the target region of interest in the set of regions of interest to obtain the binarized image corresponding to the target region of interest.
[0049] The target region of interest (ROI) can refer to the local image region corresponding to the currently processed smoke unit position within the ROI set. The binarized image can refer to the black-and-white image obtained by binarizing the grayscale image of the ROI.
[0050] S2100. Calculate the area of the region corresponding to the target region in the binarized image, and perform a threshold judgment on the area of the region based on a preset area threshold to obtain the threshold judgment result.
[0051] In this context, the target region refers to the white pixel area in the binarized image corresponding to the actual cigarette smoke. Typically, the set of pixels in the target region represents the outline and area of the cigarette smoke in the image, serving as the core basis for determining its presence. The region area refers to the number of pixels contained within the target region in the binarized image. The preset area threshold refers to a pre-set area benchmark value used to determine the presence of cigarette smoke. Typically, the preset area threshold can be a single lower limit value (i.e., when the area is below this value, it is considered missing), or it can be a combination of a lower limit and an upper limit value. The threshold judgment result refers to the judgment output obtained by comparing the statistically obtained region area with the preset area threshold. For example, if the region area meets the preset area threshold (e.g., the area is greater than or equal to the lower threshold and less than or equal to the upper threshold), the judgment result is that a cigarette smoke is present at that location; if the region area does not meet the preset area threshold (e.g., the area is less than the lower threshold), the judgment result is that a cigarette smoke is missing at that location.
[0052] S2110. Based on the threshold judgment result, determine the missing carton detection status corresponding to the target carton of cigarettes stack, and use the missing carton detection status as the carton of cigarettes detection result.
[0053] The missing bar detection status can refer to the overall missing bar determination output of the target box of cigarettes stack, obtained by summarizing the threshold judgment results of all regions of interest. For example, the missing bar detection status can include: when all regions of interest are determined to contain cigarettes, the detection status is qualified; when any region of interest is determined to be missing a bar, the detection status is unqualified, and the missing bar location information is provided at the same time.
[0054] Specifically, after the synthetic image is obtained, first, the array arrangement parameters of the target stacked carton of cigarette packs are acquired, that is, the number of cigarette packs in the longitudinal direction and the number of cigarette packs in the transverse direction. For example, taking a standard cigarette carton arranged in a 5×5 pattern as an example, the number of cigarette packs in the longitudinal direction is 5, and the number of cigarette packs in the transverse direction is 5. Afterwards, according to the arrangement parameters, a total of 25 regions of interest arranged in 5×5 are divided in the synthetic image, each region of interest corresponds to the image range of one cigarette pack unit position, and all regions of interest form a region of interest set. During region division, a fixed coordinate division method based on prior knowledge may be adopted, that is, the coordinate range of each cigarette pack position in the synthetic image is pre-calibrated, and the division is performed directly according to the calibration parameters; or, the boundary of the stacked carton of cigarette packs is first determined by an edge detection algorithm or a template matching algorithm, and then each region of interest is generated by equal division according to the boundary and the arrangement parameters. Then, each region of interest is taken out one by one from the region of interest set as a target region of interest for detection. For the current target region of interest, the region is first subjected to grayscale processing, converting the color image into a 256-level grayscale image, so as to eliminate the interference of color information and reduce the calculation amount. Next, a preset binarization threshold is used to perform binarization processing on the grayscale image, converting the grayscale image into a binarized image containing only black and white pixels. In the binarized image, the white pixel region corresponding to the solid part of the cigarette pack is the target region. Subsequently, the number of pixel points contained in the target region is counted to obtain a region area value. The counted region area value is compared with a preset area threshold to obtain a threshold judgment result. The preset area threshold includes a lower area limit value and an upper area limit value, wherein the lower area limit value is used to determine whether there is a missing cigarette pack: if the region area value is less than the lower area limit value, it indicates that the cigarette pack at this position is missing; the upper area limit value is used to determine whether there is overlapping cigarette packs or foreign matter: if the region area value is greater than the upper area limit value, it indicates that overlapping cigarette packs or foreign matter may exist at this position. When the region area is within the normal range between the lower area limit value and the upper area limit value, it is determined that the cigarette pack at this position exists. Finally, the threshold judgment results of all regions of interest are summarized to determine the missing cigarette pack detection state of the target stacked carton of cigarette packs. When all 25 regions of interest are determined to have cigarette packs, the missing cigarette pack detection state of the carton is qualified, and a qualified signal is output to allow the cigarette carton to enter the carton sealing process; when any region of interest is determined to have a missing cigarette pack, the missing cigarette pack detection state of the carton is unqualified, an unqualified signal is output to trigger an alarm or a rejecting mechanism, and the missing cigarette pack position information is fed back to a PLC or an operation interface. The missing cigarette pack detection state of the carton is output as the detection result of the carton of cigarette packs for subsequent production control and quality traceability.
[0055] The technical solution of this invention involves acquiring a trigger signal; wherein the trigger signal indicates that the target boxed cigarette stack has reached the detection station, the boxed cigarette stack contains multiple cigarette units arranged in an array, and the outer surface of each cigarette unit has a transparent packaging film. Then, based on the trigger signal, a first illumination unit is controlled to provide first illumination to the target boxed cigarette stack at a first illumination angle, and a first image of the target boxed cigarette stack is acquired under the first illumination. Furthermore, the illumination time point corresponding to the second illumination unit is determined based on the acquisition completion time of the first image and a preset delay. Based on the illumination time point, the second illumination unit is controlled to provide second illumination to the target boxed cigarette stack at a second illumination angle. Based on the illumination time point, an image acquisition device is controlled to acquire a second image of the target boxed cigarette stack under the second illumination. Further, first image data corresponding to the first side region of the target boxed cigarette stack is extracted from the first image, and second image data corresponding to the second side region of the target boxed cigarette stack is extracted from the second image. Finally, the first image data is used as the image data corresponding to the first side region in the synthesized image, and the second image data is used as the image data corresponding to the second side region in the synthesized image, and the images are stitched together to obtain the synthesized image. Based on the number of cigarettes in the vertical and horizontal directions corresponding to the target carton of cigarettes, the synthesized image is divided into regions to obtain a set of regions of interest corresponding to the target carton of cigarettes. The target regions of interest in the set of regions of interest are grayscaled to obtain a binarized image corresponding to the target regions of interest. The area of the target region in the binarized image is counted, and a threshold judgment is made on the area based on a preset area threshold to obtain the threshold judgment result. Based on the threshold judgment result, the missing carton detection status corresponding to the target carton of cigarettes is determined, and the missing carton detection status is used as the carton of cigarettes detection result. Since the carton of cigarettes with clear images in each region is obtained by dual-light source time-division imaging and region-based optimal synthesis, and the missing carton status is accurately determined by region detection, the problem of unclear imaging caused by reflection of transparent packaging film is solved, and the efficiency and reliability of missing carton detection in cigarette packaging production line are improved.
[0056] Figure 4The diagram shows a flowchart of an optional cigarette packaging production line inspection method for cartons of cigarettes according to an embodiment of the present invention. Specifically, the entire inspection control process includes a triggering stage, an acquisition stage, a processing stage, and an output stage. Triggering stage: When the sealing machine pushes a stack of 25 cartons of cigarettes (i.e., a 5×5 array) into the inspection station, the sealing machine PLC detects the pusher's arrival signal or the cigarette box's arrival signal, and then sends a trigger signal to the camera controller and light source controller of the vision inspection system to start the inspection process. Acquisition stage: The vision inspection system adopts a dual-light source time-division imaging method with two supplementary lighting sessions and two image captures. Specifically, during the first supplementary lighting session, the right-side LED light source is turned on, illuminating the stack of cartons of cigarettes at the first illumination angle, and the camera captures the first image under this illumination condition. At this time, because the light is coming from the right, the transparent packaging film on the left side of the stack of cartons of cigarettes reflects less light, resulting in a clearer image, while the right side may have an unclear image due to direct reflection. Subsequently, after a preset delay, the left LED light source is turned on, illuminating the stack of cigarette cartons at a second illumination angle. The camera then captures a second image under this lighting condition. At this time, the transparent packaging film on the right side of the stack has less reflection, resulting in a clearer image, while the left side may be unclear. Processing stage: After obtaining two clear images of their respective regions, image selection and fusion processing is performed. Specifically, the image data corresponding to the left side of the stack from the first image is stitched together with the image data corresponding to the right side from the second image to create a complete composite image where all regions are clear. This composite image is used for both missing carton detection and QR code recognition. In missing carton detection, the composite image undergoes ROI region detection to determine if any of the 25 cigarette carton units are missing. In QR code recognition, the QR code identification area in the composite image is located and decoded to obtain the QR code data for each cigarette unit or carton. Output Stage: The QR code recognition results are output to the QR code system or PLC to link the cigarette cartons with the cigarette cases. Simultaneously, the missing label detection results are output to the PLC for production line control. Furthermore, the QR code recognition results, missing label detection results, missing label location information, and the original or processed images can be uniformly saved to form a complete quality traceability record. Thus, by using dual-light source time-division imaging technology to obtain clear composite images of each area, and based on these composite images, QR code recognition and missing label detection are performed in parallel on the same vision inspection platform, achieving integrated control of image acquisition, image processing, QR code recognition, missing label detection, and data storage.
[0057] Example 3 Figure 5 This is a schematic diagram of a carton cigarette inspection device for a cigarette packaging production line according to Embodiment 3 of the present invention. Figure 5As shown, the device includes: a signal acquisition module 310, a first illumination module 320, a second illumination module 330, an image acquisition module 340, and a cigarette detection module 350; The signal acquisition module 310 is used to acquire a trigger signal; wherein the trigger signal is used to indicate that the target boxed cigarette stack has reached the detection station, the boxed cigarette stack includes multiple cigarette units arranged in an array, and the outer surface of each cigarette unit has a transparent packaging film; The first lighting module 320 is used to control the first lighting unit to provide first lighting to the target boxed cigarette stack at a first illumination angle based on the trigger signal, and to acquire a first image of the target boxed cigarette stack under the first lighting. The second lighting module 330 is used to control the second lighting unit to provide second lighting to the target boxed cigarette stack at a second lighting angle based on the acquisition completion time of the first image, and to acquire a second image of the target boxed cigarette stack under the second lighting; wherein, the first lighting angle is different from the second lighting angle; Image acquisition module 340 is used to extract first image data corresponding to the first side area of the target boxed cigarette stack from the first image, and to extract second image data corresponding to the second side area of the target boxed cigarette stack from the second image; The cigarette pack detection module 350 is used to obtain a composite image based on the first image data and the second image data, and to perform region detection on the composite image to obtain the detection result of the cigarette packs corresponding to the target stack of cigarette packs.
[0058] The technical solution of this invention involves acquiring a trigger signal, which indicates that a target boxed cigarette stack has reached the detection station. The boxed cigarette stack contains multiple cigarette units arranged in an array, each cigarette unit having a transparent packaging film on its outer surface. Then, based on the trigger signal, a first illumination unit is controlled to provide first illumination to the target boxed cigarette stack at a first illumination angle, and a first image of the target boxed cigarette stack is acquired under the first illumination. Furthermore, based on the completion time of the first image acquisition, a second illumination unit is controlled to provide second illumination to the target boxed cigarette stack at a second illumination angle, and a second image of the target boxed cigarette stack is acquired under the second illumination; wherein the first illumination angle is different from the second illumination angle. Further, first image data corresponding to a first side region of the target boxed cigarette stack is extracted from the first image, and second image data corresponding to a second side region of the target boxed cigarette stack is extracted from the second image. Finally, a composite image is obtained based on the first image data and the second image data, and region detection is performed on the composite image to obtain the boxed cigarette detection result corresponding to the target boxed cigarette stack. By using dual-light source time-division imaging and region-based optimal synthesis to obtain clear images of the carton of cigarettes in each region, and then accurately determining the status of missing cartons through region detection, the problem of unclear imaging caused by reflection from the transparent packaging film is solved, thus improving the efficiency and reliability of missing carton detection in the cigarette packaging production line.
[0059] Optionally, the second lighting module 330 can be used to: determine the lighting time point corresponding to the second lighting unit based on the acquisition completion time of the first image and a preset delay; control the second lighting unit to provide second lighting to the target boxed cigarette stack at a second illumination angle based on the lighting time point; and control the image acquisition device to acquire a second image of the target boxed cigarette stack under the second lighting based on the lighting time point.
[0060] Optionally, the imaging clarity of the first side region under the first illumination is better than that under the second illumination, and the imaging clarity of the second side region under the second illumination is better than that under the first illumination.
[0061] Optionally, the cigarette detection module 350 can be used to: use the first image data as the image data corresponding to the first side region in the composite image, and use the second image data as the image data corresponding to the second side region in the composite image, and stitch them together to obtain a composite image.
[0062] Optionally, the cigarette pack detection module 350 can be specifically used to: divide the synthesized image into regions based on the vertical and horizontal number of cigarette packs corresponding to the target boxed cigarette pack stack, to obtain a set of regions of interest corresponding to the target boxed cigarette pack stack; perform grayscale processing on the target regions of interest in the set of regions of interest to obtain a binarized image corresponding to the target regions of interest; count the area of the region corresponding to the target region in the binarized image, and perform threshold judgment on the area of the region based on a preset area threshold to obtain a threshold judgment result; determine the box missing cigarette detection state corresponding to the target boxed cigarette pack stack based on the threshold judgment result, and use the box missing cigarette detection state as the boxed cigarette pack detection result.
[0063] Optionally, the cigarette packaging production line's boxed cigarette detection device may further include: a QR code recognition module, used to locate the QR code in the QR code identification area of the synthesized image to obtain a QR code image; and to decode the QR code image to obtain the QR code recognition result corresponding to the target boxed cigarette stack.
[0064] Optionally, the cigarette pack detection device in the cigarette packaging production line may further include: an association storage module for associating and storing the QR code recognition result and the cigarette pack detection result.
[0065] The cigarette packaging production line detection device provided in this embodiment of the invention can execute the cigarette packaging production line detection method provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the method.
[0066] Example 4 Figure 6 A schematic diagram of an electronic device 410 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0067] like Figure 6As shown, the electronic device 410 includes at least one processor 420 and a memory, such as a read-only memory (ROM) 430 or a random access memory (RAM) 440, communicatively connected to the at least one processor 420. The memory stores computer programs executable by the at least one processor. The processor 420 can perform various appropriate actions and processes based on the computer program stored in the ROM 430 or loaded into the RAM 440 from storage unit 490. The RAM 440 may also store various programs and data required for the operation of the electronic device 410. The processor 420, ROM 430, and RAM 440 are interconnected via a bus 450. An input / output (I / O) interface 460 is also connected to the bus 450.
[0068] Multiple components in electronic device 410 are connected to I / O interface 460, including: input unit 470, such as keyboard, mouse, etc.; output unit 480, such as various types of monitors, speakers, etc.; storage unit 490, such as disk, optical disk, etc.; and communication unit 4100, such as network card, modem, wireless transceiver, etc. Communication unit 4100 allows electronic device 410 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0069] Processor 420 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 420 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 420 performs the various methods and processes described above, such as the method for detecting cartons of cigarettes in a cigarette packaging production line.
[0070] The method includes: Acquire a trigger signal; wherein the trigger signal is used to indicate that the target boxed cigarette stack has reached the detection station, the boxed cigarette stack contains a plurality of cigarette units arranged in an array, and the outer surface of each cigarette unit has a transparent packaging film; Based on the trigger signal, the first lighting unit is controlled to provide first illumination to the target boxed cigarette stack at a first illumination angle, and a first image of the target boxed cigarette stack is acquired under the first illumination. Based on the completion time of the acquisition of the first image, the second illumination unit is controlled to provide second illumination to the target boxed cigarette stack at a second illumination angle, and a second image of the target boxed cigarette stack is acquired under the second illumination; wherein, the first illumination angle is different from the second illumination angle; First image data corresponding to the first side region of the target boxed cigarette stack is extracted from the first image, and second image data corresponding to the second side region of the target boxed cigarette stack is extracted from the second image; A composite image is obtained based on the first image data and the second image data, and region detection is performed on the composite image to obtain the detection result of the boxed cigarettes corresponding to the target boxed cigarette stack.
[0071] In some embodiments, the method for detecting cartons of cigarettes in a cigarette packaging production line can be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 490. In some embodiments, part or all of the computer program can be loaded and / or installed on electronic device 410 via ROM 430 and / or communication unit 4100. When the computer program is loaded into RAM 440 and executed by processor 420, one or more steps of the method for detecting cartons of cigarettes in a cigarette packaging production line described above can be performed. Alternatively, in other embodiments, processor 420 can be configured to perform the method for detecting cartons of cigarettes in a cigarette packaging production line by any other suitable means (e.g., by means of firmware).
[0072] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), system-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0073] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0074] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0075] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0076] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0077] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0078] This application also discloses a computer program product, which includes a computer program that, when executed by a processor, implements the method for detecting cartons of cigarettes in a cigarette packaging production line provided in any embodiment of this application. This program product shares the same inventive concept as the method for detecting cartons of cigarettes in a cigarette packaging production line disclosed in the embodiments of this application, and therefore will not be described in detail here.
[0079] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0080] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A method for detecting cartons of cigarettes in a cigarette packaging production line, characterized in that, include: Acquire a trigger signal; wherein the trigger signal is used to indicate that the target boxed cigarette stack has reached the detection station, the boxed cigarette stack contains a plurality of cigarette units arranged in an array, and the outer surface of each cigarette unit has a transparent packaging film; Based on the trigger signal, the first lighting unit is controlled to provide first illumination to the target boxed cigarette stack at a first illumination angle, and a first image of the target boxed cigarette stack is acquired under the first illumination. Based on the completion time of the acquisition of the first image, the second illumination unit is controlled to provide second illumination to the target boxed cigarette stack at a second illumination angle, and a second image of the target boxed cigarette stack is acquired under the second illumination; wherein, the first illumination angle is different from the second illumination angle; First image data corresponding to the first side region of the target boxed cigarette stack is extracted from the first image, and second image data corresponding to the second side region of the target boxed cigarette stack is extracted from the second image; A composite image is obtained based on the first image data and the second image data, and region detection is performed on the composite image to obtain the detection result of the boxed cigarettes corresponding to the target boxed cigarette stack.
2. The method according to claim 1, characterized in that, The second illumination unit, based on the acquisition completion time of the first image, provides second illumination to the target boxed cigarette stack at a second illumination angle, and acquires a second image of the target boxed cigarette stack under the second illumination, including: The illumination time point corresponding to the second illumination unit is determined based on the acquisition completion time of the first image and the preset delay. Based on the lighting time point, the second lighting unit is controlled to provide second lighting to the target stack of boxed cigarettes at a second illumination angle; Based on the lighting time point, the image acquisition device is controlled to acquire a second image of the target boxed cigarette stack under the second lighting.
3. The method according to claim 1, characterized in that, The image clarity of the first side region under the first illumination is better than that under the second illumination, and the image clarity of the second side region under the second illumination is better than that under the first illumination.
4. The method according to claim 1, characterized in that, The process of obtaining a synthesized image based on the first image data and the second image data includes: The first image data is used as the image data corresponding to the first side region in the composite image, and the second image data is used as the image data corresponding to the second side region in the composite image. The composite image is then stitched together to obtain the composite image.
5. The method according to claim 1, characterized in that, The step of performing region detection on the synthesized image to obtain the detection result of the boxed cigarettes corresponding to the target boxed cigarette stack includes: Based on the vertical and horizontal number of cigarette packs corresponding to the target boxed cigarette pack stack, the composite image is divided into regions to obtain a set of regions of interest corresponding to the target boxed cigarette pack stack. The target region of interest in the set of regions of interest is converted to grayscale to obtain a binarized image corresponding to the target region of interest. The area of the target region in the binarized image is statistically analyzed, and a threshold judgment is made on the area of the region based on a preset area threshold to obtain the threshold judgment result. Based on the threshold judgment result, the missing carton detection status corresponding to the target carton of cigarettes is determined, and the missing carton detection status is used as the detection result of the carton of cigarettes.
6. The method according to claim 1, characterized in that, The method further includes: The QR code identification area in the synthesized image is located to obtain a QR code image; The QR code image is decoded to obtain the QR code recognition result corresponding to the stack of target boxed cigarettes.
7. The method according to claim 6, characterized in that, The method further includes: The QR code recognition results and the detection results of the boxed cigarettes are stored together.
8. A detection device for cartons of cigarettes in a cigarette packaging production line, characterized in that, include: A signal acquisition module is used to acquire a trigger signal; wherein the trigger signal is used to indicate that the target boxed cigarette stack has reached the detection station, the boxed cigarette stack contains a plurality of cigarette units arranged in an array, and the outer surface of each cigarette unit has a transparent packaging film; The first lighting module is used to control the first lighting unit to provide first lighting to the target boxed cigarette stack at a first illumination angle based on the trigger signal, and to acquire a first image of the target boxed cigarette stack under the first lighting; The second lighting module is used to control the second lighting unit to provide second lighting to the target boxed cigarette stack at a second lighting angle based on the acquisition completion time of the first image, and to acquire a second image of the target boxed cigarette stack under the second lighting; wherein, the first lighting angle is different from the second lighting angle; The image acquisition module is used to extract first image data corresponding to the first side area of the target boxed cigarette stack from the first image, and to extract second image data corresponding to the second side area of the target boxed cigarette stack from the second image; The cigarette pack detection module is used to obtain a composite image based on the first image data and the second image data, and to perform region detection on the composite image to obtain the detection result of the cigarette packs corresponding to the target stack of cigarette packs.
9. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the method for detecting carton cigarettes in a cigarette packaging production line according to any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that, when executed by a processor, implement the method for detecting carton cigarettes in a cigarette packaging production line according to any one of claims 1-7.
