Image processing-based package box connection time correlation code data separation method and system

CN122819280APending Publication Date: 2026-09-25北京信码新创科技有限公司
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202610600552.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-04-30
Publication Date
2026-09-25

AI Technical Summary

Technical Problem

但是,上述技术方案仍然存在无相关参数校准、帧采集及数据拆分算法,无法分离连箱混合的瓶箱码数据,导致追溯失真、防窜货失效的问题

Benefits of technology

[0016]根据本发明实施例的第二方面,提供一种基于图像处理的包装箱连箱时关联码数据分离系统,包括处理器和存储器;其中,所述存储器与所述处理器耦接,用于存储计算机程序,当该计算机程序被所述处理器执行时,使处理器实现上述的包装箱连箱时关联码数据分离方法。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122819280A_ABST
    Figure CN122819280A_ABST
Patent Text Reader

Abstract

The application discloses a packaging box associated code data separation method and system based on image processing. The method comprises the following steps: adjusting the height and frame rate of the code reader according to the production line speed and packaging specifications, so that a single frame image contains at least two rows of bottle cap two-dimensional codes and adjacent frames at least overlap one row; measuring the pixel value and spacing of the bottle cap; continuously capturing images and decoding the bottle code content and coordinates, dividing the rows according to the longitudinal coordinates based on the pixel size and spacing: the longitudinal coordinate difference less than the pixel size is the same row, greater than or equal to the spacing and less than the sum of the two is the next row; identifying the overlapping rows in the continuous frames, merging and removing duplicates, and completing the unidentified codes through the overlapping rows to generate a continuous bottle code row sequence; segmenting according to the preset number of rows of a single box to obtain the bottle code data of each box; collecting the box codes and sorting, and binding with the segmented bottle codes one by one to complete the data separation and uploading. The application realizes accurate separation of associated code data in the continuous box state, and solves the information disorder problem caused by the continuous box of the production line.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a method for separating the associated code data when packaging boxes are connected, based on image processing, and also to a corresponding system for separating the associated code data when packaging boxes are connected (hereinafter referred to as the separation system), belonging to the field of image data processing technology. Background Technology

[0002] With the rapid popularization of industrial internet and artificial intelligence technologies, the level of informatization and intelligence in the fast-moving consumer goods (FMCG) industry is constantly improving. Adding QR codes to bottled products such as beer and beverages has become an industry standard. As a digital identity identifier, QR codes not only support product lifecycle traceability but also play a crucial role in anti-counterfeiting management, precision marketing, and channel control, serving as an important foundation for enterprise digital management.

[0003] In actual production, bottle codes and carton codes need to be accurately linked. By establishing a one-to-one correspondence between carton codes and the bottle codes inside the carton, functions such as barcode scanning for querying, data traceability, and early warning of cross-selling can be achieved, ensuring the accuracy of information and the effectiveness of management in the product circulation process. Under normal production conditions, packaging boxes are distributed at intervals on the conveyor belt, with obvious gaps between boxes. Photoelectric detection equipment can accurately identify individual boxes, and barcode readers can independently collect bottle and carton code data for each box, ensuring accurate association. However, due to factors such as carton sealing machine malfunctions, conveyor belt abnormalities, and workstation jams, packaging boxes are prone to a "connected box" state—that is, multiple boxes are tightly connected without gaps. In this case, photoelectric detection equipment cannot distinguish individual boxes, and barcode readers will collect bottle and carton code data from multiple boxes in a mixed manner, causing data corruption. This directly leads to distorted traceability information, ineffective cross-selling queries, and incorrect marketing data, seriously affecting the normal operation of the digital management system. Existing data collection technologies cannot effectively separate the mixed data in the connected box state, making it difficult to meet the requirements of industrial production for stability and data accuracy.

[0004] Chinese patent application No. 202411920422.0 discloses a system and method for associating small box serial numbers with large carton serial numbers. This technical solution uses a small box serial number reader to read the small box serial numbers on a small box serial number acquisition and conveying line, forming a small box serial number sequence. A PLC output signal, based on the received signal type from an automatic carton packer, groups the small box serial number sequence, generating a serial number group sequence. A host computer, based on a preset number of small box serial numbers, associates the serial number group sequence with the large carton serial number in sequence. A small box pushing mechanism is used to transport the packaged goods. A box blocking mechanism is used to feed the packaged goods into the automatic carton packer for packing. The automatic carton packer is used to automatically pack the packaged goods. However, the above technical solution still lacks relevant parameter calibration, frame acquisition, and data splitting algorithms, making it unable to separate bottle and carton code data mixed together, leading to traceability distortion and failure of anti-counterfeiting measures. Summary of the Invention

[0005] The primary technical problem to be solved by this invention is to provide a method for separating the associated code data when packaging boxes are connected based on image processing.

[0006] Another technical problem to be solved by the present invention is to provide a system for separating the associated code data when packaging boxes are connected based on image processing.

[0007] To achieve the above-mentioned technical objectives, the present invention adopts the following technical solution: According to a first aspect of the present invention, a method for separating association code data when packaging boxes are connected based on image processing is provided, comprising the following steps: S1: Combine the production line operating speed and product packaging specifications, adjust the installation height of the barcode reader camera and configure the acquisition frame rate, measure the bottle cap pixel value m and the interval pixel value n between adjacent bottle caps in the acquired image, and establish an image recognition benchmark. S2: Detect the arrival signal of the packaging box and trigger the barcode reader to continuously acquire images, decode and extract the content of the bottle cap QR code and the corresponding two-dimensional pixel coordinates in the image, and divide the bottle code in a single frame image into rows according to the vertical coordinate based on the bottle cap pixel value m and the interval pixel value n; the specific rules for dividing the bottle code in a single frame into rows are as follows: any two bottle caps in the same frame image are determined to be in the same row if the difference in vertical coordinate is less than m, and are determined to be in the next row if the difference in vertical coordinate is greater than or equal to n and less than m + n. S3: Overlapping row recognition is performed on the continuously acquired multi-frame image data. Rows with the same bottle code are identified as overlapping rows. Overlapping rows are merged and duplicate data is removed to generate a continuous and ordered sequence of bottle code rows. The row sequence is segmented according to the preset number of bottle code rows per box to obtain the bottle code data corresponding to each independent box. If there is an unrecognized bottle cap QR code in a single frame image, the missing bottle code information is completed by using the overlapping row data in the next frame image. S4: Collect all box code data in the connected box state and sort them according to the collection order. Bind the segmented bottle code data to the sorted box code one by one to complete the separation of associated code data when connected boxes, and at the same time complete data verification and uploading.

[0008] Preferably, in step S1, the single-frame image collected by the barcode reader includes at least two rows of bottle cap QR code data, and there is an overlapping area between two consecutively collected adjacent frames that includes at least one row of bottle cap QR codes.

[0009] In a preferred embodiment, when measuring the pixel value m of the bottle cap and the interval pixel value n, multiple sets of bottle cap images at different locations and under different lighting conditions are selected as samples to calculate the average value, so as to control the measurement error.

[0010] Preferably, in step S3, when merging overlapping rows, all valid bottle code data in both rows are retained. If one row has a missing bottle code, the complete data from the other row is used to cover and supplement it.

[0011] Preferably, in step S4, when binding the segmented bottle code data with the box code one by one, a quantity verification mechanism is set up. If the number of box codes collected is inconsistent with the number of segments of the bottle code data, an alarm is issued and the upload of erroneous data is prohibited.

[0012] Preferably, in step S1, when configuring the acquisition frame rate, the frame rate is calculated based on the production line running speed, so that the overlapping area of ​​two adjacent frames in the conveyor belt running direction covers at least the physical distance of a row of bottle caps.

[0013] Preferably, in step S3, the number of bottle code rows preset for a single box is determined according to the product packaging specifications, wherein 12 bottles / box corresponds to 3 rows of bottle codes, and 24 bottles / box corresponds to 4 rows of bottle codes.

[0014] Preferably, in step S4, when the data upload is completed, the uploaded information includes at least: box code, bottle code, associated time, production line number, product specifications, and box status identifier.

[0015] Preferably, in step S2, before decoding and extracting the bottle cap QR code, the acquired original image is preprocessed. The preprocessing includes at least one of brightness adjustment, contrast enhancement, distortion correction, and noise reduction filtering.

[0016] According to a second aspect of the present invention, a system for separating associated code data when packaging boxes are connected based on image processing is provided, comprising a processor and a memory; wherein the memory is coupled to the processor and is used to store a computer program, which, when executed by the processor, enables the processor to implement the above-described method for separating associated code data when packaging boxes are connected.

[0017] Compared with existing technologies, this invention fully utilizes the spatial overlap between continuously acquired image frames and the mapping characteristics between pixel coordinates and physical bottle caps. Through a complete image processing algorithm, it achieves automated separation of bottle codes and box codes associated data in a connected-box state. Specifically, this invention does not rely on any external box boundary detection signals; it directly completes data separation within the image space simply by analyzing pixel coordinates, dividing rows, merging overlapping frames, and segmenting sequences. This technical solution significantly improves the accuracy and robustness of data separation in connected-box conditions, effectively solving the technical problems of photoelectric detection failure, associated data corruption, and the inability of traceability and anti-counterfeiting functions to operate normally in fast-moving consumer goods production lines due to equipment malfunctions. Attached Figure Description

[0018] Figure 1 This is a flowchart of a method for separating association code data when packaging boxes are connected based on image processing, as shown in the first embodiment of the present invention. Figure 2 This is a schematic diagram illustrating the measurement of bottle cap size and the spacing between bottle caps in the first embodiment of the present invention; Figure 3 This is a schematic diagram of a system for separating associated code data when packaging boxes are connected, based on image processing, in the second embodiment of the present invention. Detailed Implementation

[0019] The technical content of the present invention will now be described in detail with reference to the accompanying drawings and specific embodiments.

[0020] To address the "chain-linking" situation in fast-moving consumer goods (FMCG) production lines caused by equipment malfunctions, this invention provides an image processing-based technical solution. In existing technologies, conventional QR code acquisition systems rely on photoelectric triggering for single-box acquisition based on the gaps between boxes. However, once chain-linking occurs (i.e., multiple boxes tightly connected without gaps), conventional photoelectric triggering systems cannot identify box boundaries, leading to confusion between bottle and box code data. This invention is not a simple improvement to a conventional system, but rather, by actively setting reader parameters, it ensures physical overlap between continuously acquired image frames. Furthermore, it performs image data processing operations such as pixel coordinate analysis, row segmentation, and overlapping frame merging on the continuous image frames, ultimately achieving accurate separation of bottle code data in the chain-linking situation.

[0021] First Embodiment like Figure 1 As shown, the first embodiment of the present invention provides a method for separating the association code data of packaging boxes when they are connected based on image processing, which includes at least the following steps: S1: Combine the production line operating speed and product packaging specifications, adjust the installation height of the barcode reader camera and configure the acquisition frame rate, measure the bottle cap pixel value m and the interval pixel value n between adjacent bottle caps in the acquired image, and establish an image recognition benchmark. S2: Detect the arrival signal of the packaging box and trigger the barcode reader to continuously acquire images, decode and extract the content of the bottle cap QR code and the corresponding two-dimensional pixel coordinates in the image, and divide the bottle code in a single frame image into rows according to the vertical coordinate based on the bottle cap pixel value m and the interval pixel value n; the specific rules for dividing the bottle code in a single frame into rows are as follows: any two bottle caps in the same frame image are determined to be in the same row if the difference in vertical coordinate is less than m, and are determined to be in the next row if the difference in vertical coordinate is greater than or equal to n and less than m + n. S3: Overlapping row recognition is performed on the continuously acquired multi-frame image data. Rows with the same bottle code are identified as overlapping rows. Overlapping rows are merged and duplicate data is removed to generate a continuous and ordered sequence of bottle code rows. The row sequence is segmented according to the preset number of bottle code rows per box to obtain the bottle code data corresponding to each independent box. If there is an unrecognized bottle cap QR code in a single frame image, the missing bottle code information is completed by using the overlapping row data in the next frame image. S4: Collect all box code data in the connected box state and sort them according to the collection order. Bind the segmented bottle code data to the sorted box code one by one to complete the separation of associated code data when connected boxes, and at the same time complete data verification and uploading.

[0022] The following is a detailed explanation of the specific implementation process for each of the above steps: In step S1, the installation height of the barcode reader camera is precisely adjusted based on the actual operating speed of the production line and the product packaging specifications (12 bottles / box, 24 bottles / box, etc.). The image acquisition frame rate of the barcode reader is configured synchronously to ensure that a single frame image can stably acquire at least two rows of product bottle cap QR code data. Moreover, there is at least one row of overlapping bottle cap data between two consecutively acquired adjacent frames, providing a basic guarantee for subsequent data separation.

[0023] In practice, it is first necessary to collect real-time operating parameters of the production line, including the stable operating speed, acceleration, and start / stop response time of the conveyor belt. Simultaneously, the packaging specifications of the products must be clearly defined. For example, in the beer industry, different specifications are commonly used, such as 12 bottles per case, 24 bottles per case, 330ml bottles, and 500ml bottles. Different specifications correspond to different cap sizes, case sizes, and arrangement methods. The installation height of the barcode reader must precisely match these parameters. If the installation height is too high, the single-frame image acquisition range will be too large, resulting in small, unreadable QR codes on the bottle caps. If the installation height is too low, the single-frame image acquisition range will be insufficient, failing to meet the requirement of acquiring at least two rows of bottle caps. Therefore, multiple on-site adjustments are needed to determine the optimal installation height, ensuring that the barcode reader lens's focal length, depth of field, and field of view completely cover the bottle cap area above the conveyor belt. This guarantees that each frame image clearly captures the complete bottle cap QR code without blurring, missing parts, distortion, or other issues.

[0024] After completing the reader height calibration, the image acquisition frame rate is configured synchronously. The frame rate setting needs to be linked to the conveyor belt speed; the faster the speed, the higher the frame rate needs to be. Specifically, it should be ensured that the overlapping area of ​​two adjacent frames in the conveyor belt running direction covers at least the physical distance of one row of bottle caps. For example, if the physical width (including gaps) of one row of bottle caps is L, and the conveyor belt speed is v, then the frame rate f should satisfy v / f ≤ single-frame field of view length - L to ensure that the overlapping area is at least L. Through this calculation method, it is possible to accurately ensure that there is at least one row of overlapping data between consecutive frames, avoiding situations where there is no overlap due to a frame rate that is too low, or data redundancy and stuttering due to a frame rate that is too high. After repeated testing, the frame rate was adjusted to the optimal value to ensure the continuity of acquisition and the validity of data.

[0025] It should be noted that the settings for the reader's installation height and frame rate in this embodiment of the invention are fundamentally different from those for conventional reader debugging. Conventional debugging aims merely to "ensure the QR code can be clearly read," while this embodiment aims to further achieve the specific constraint that "each frame contains at least two rows of bottle caps, and adjacent frames overlap by at least one row." This constraint is not a conventional choice for those skilled in the art when encountering issues with multiple bottles. Instead, based on the traditional technical bias of "avoiding data duplication," those skilled in the art typically try to avoid overlap between image frames to prevent the same bottle code from being read multiple times. This embodiment of the invention takes the opposite approach, actively introducing and quantifying the control of inter-frame overlap, and using the overlapped data for subsequent row recognition, completion, and merging.

[0026] like Figure 2As shown, the pixel size of a single bottle cap in the acquired image is determined using image recognition technology. This value is set as the baseline bottle cap pixel value *m*. Simultaneously, the pixel value corresponding to the interval distance between adjacent bottle caps is determined and set as the interval pixel value *n*, establishing a pixel baseline system for image recognition. The measurement process requires standardized image analysis tools to perform pixel-level measurements on the acquired high-definition images. Multiple bottle caps at different positions and angles are selected as samples, and their average pixel width and height are calculated. After removing outliers, a stable baseline bottle cap pixel value *m* is obtained. This value represents the core size characteristics of a single bottle cap in the image and is a key basis for subsequent row segmentation. At the same time, the interval pixel values ​​*n* between adjacent bottle caps in the horizontal and vertical directions are measured, including the blank gaps between bottle caps and the gaps at the edges of the container, ensuring that the interval pixel value *n* accurately reflects the arrangement spacing of the bottle caps. During parameter calibration, it is necessary to test the acquisition effect under different production line speeds, different box positions, and different lighting conditions multiple times to ensure that the acquisition range and frame rate of each frame image match the conveyor belt running speed. This avoids data loss due to acquisition that is too fast or data redundancy due to acquisition that is too slow. At the same time, it is necessary to ensure that the measurement error between the reference cap pixel value m and the interval pixel value n of a single cap is controlled within the allowable range, so as to provide an accurate judgment basis for subsequent row-by-row data arrangement.

[0027] The parameter setting process is adaptable to different packaging box and bottle cap sizes, possessing versatility and adjustability. Operators can quickly modify parameter values ​​according to production line changes and product switching needs, without requiring system redevelopment or hardware replacement, thus meeting the personalized needs of different production lines. Furthermore, after measuring the bottle cap pixel value *m* and the interval pixel value *n*, the separation system automatically saves the measurement results to non-volatile memory. When the production line restarts or recalibrates after changing product specifications, the separation system automatically recalls the saved parameters as the initial baseline, eliminating the need to repeatedly measure parameters for the same product specifications, significantly improving changeover efficiency. This automatic saving and recall function reduces human intervention errors and enhances the intelligence level of the separation system.

[0028] To further improve the accuracy of parameter measurement, an error control mechanism can be introduced in this embodiment of the invention: At least 10 sample images from different locations, with different light intensities, and different bottle cap rotation angles are selected. The pixel size of the bottle cap in each sample is measured, and outliers deviating from the mean by more than ±2σ are removed before calculating the final average. Similarly, the measurement of the interval pixel value n needs to consider the fluctuation of the spacing between the bottle caps and uses the same statistical method. When the lighting conditions on the production line change dynamically, the separation system can be set to perform timed self-calibration or adaptive adjustment based on the image brightness histogram to ensure that m and n always maintain an accurate mapping to the current operating conditions.

[0029] In step S2, when the conveyor belt is running and the photoelectric detection device recognizes that the packaging box has arrived at the collection area, the barcode reader camera starts the continuous image acquisition mode, takes pictures at a preset frame rate and decodes them in real time, and extracts the text content and corresponding pixel coordinate information of all bottle cap QR codes in each image.

[0030] The photoelectric detection device, acting as a trigger, is installed at the front end of the barcode reader. When a box blocks the photoelectric signal, it immediately sends a trigger signal to the reader, ensuring precise and synchronized acquisition without premature or delayed acquisition. Even when multiple boxes are connected, the photoelectric device can continuously trigger acquisition, ensuring uninterrupted data collection. In the unlikely event of a connected box configuration, multiple tightly linked boxes will not experience signal gaps due to continuous blocking of the photoelectric signal. Conventional systems would suffer from data confusion as a result, but this invention utilizes this characteristic: while the photoelectric signal remains valid, the barcode reader maintains continuous acquisition mode, thereby obtaining a continuous image sequence containing the barcodes of all connected boxes. This continuous acquisition mode is independent of the gaps between boxes and can stably output data even in a completely gapless connected box configuration, providing complete raw information for subsequent row segmentation and data separation.

[0031] During image acquisition, the barcode reader performs real-time preprocessing on each frame of the image, including brightness adjustment, contrast enhancement, distortion correction, and noise reduction filtering, to improve the success rate of QR code recognition. Especially in complex environments such as uneven lighting on the production line, bottle cap reflection, and dirt obscuring the image, the preprocessing steps can effectively improve the decoding accuracy.

[0032] After decoding, the separation system will automatically extract the string content of each bottle cap QR code and its two-dimensional pixel coordinates (x, y) in the image. The x coordinate represents the horizontal position and the y coordinate represents the vertical position. The y coordinate is the core basis for subsequent row division. All data will be stored in real time in a temporary buffer area and arranged in order by frame number to avoid data confusion and loss.

[0033] Coordinate analysis is performed on all bottle cap data within a single frame image. Rows are divided based on the baseline bottle cap pixel value *m* and the interval pixel value *n*. The rule is as follows: bottle caps with a ordinate difference less than *m* are considered to be in the same row; those with a ordinate difference greater than or equal to *n* but less than *m+n* are considered to be in the next row. Bottle codes within a single frame image are then arranged in an orderly row-by-row according to this rule. This rule, based on the actual physical arrangement and pixel characteristics of the bottle caps, accurately distinguishes bottle caps from different rows, avoiding row division errors caused by coordinate deviations.

[0034] The above row division rule utilizes the mapping relationship between the actual physical arrangement characteristics of the bottle caps and the image pixel coordinates. Conventional image row division often employs clustering algorithms (such as K-means) or is based on fixed pixel thresholds. These methods are either computationally complex or difficult to adapt to changes in bottle cap size and spacing. This embodiment of the invention directly uses pre-determined bottle cap pixel values ​​and spacing as the judgment threshold, resulting in a simple rule, low computational cost, and the ability to resist slight coordinate drift caused by conveyor belt vibration.

[0035] In a single frame image, bottle caps in the same row are close in vertical position and have a small difference in vertical coordinate, which is less than the pixel value m of a single bottle cap. However, there is a gap between the bottle caps in the next row and the previous row, and the difference in vertical coordinate will be greater than or equal to the gap pixel value n, while being less than the sum of m and n. This mathematical logic can be used to achieve automatic row division without manual intervention.

[0036] Considering that bottle caps may have slight tilting, camera installation angle deviations, or vertical coordinate measurement errors caused by conveyor belt vibration in actual production lines, a tolerance deviation δ can be introduced into the row partitioning rules. Specifically, when the vertical coordinate difference Δy satisfies |Δy|<m+δ, it is still determined to be in the same row, where δ is a preset tolerance value (e.g., 10% of m). When Δy satisfies n-δ≤Δy<m+n+δ, it is determined to be in the next row. This tolerance mechanism effectively improves the robustness of row partitioning and avoids row misalignment caused by slight coordinate drift.

[0037] After sorting the single-frame data, the continuously acquired multi-frame images are analyzed frame by frame, recording the row number, bottle code data, and coordinate information corresponding to each frame. The overlapping area of ​​adjacent frames is used to achieve data complementarity. If there is an unrecognized bottle code in a certain frame image, it may be due to reasons such as bottle cap tilt, stains, or reflections. In this case, it can be completed by the complete data of the overlapping row in the next frame. Because there is at least one row of overlapping data in adjacent frames, the bottle code information in the overlapping rows is consistent, and the missing bottle code can be obtained from another frame, which greatly improves the success rate of bottle code recognition and data integrity.

[0038] This process requires real-time processing of image data with a processing delay of no more than 100ms to ensure the synchronization of acquisition, decoding, sorting, and completion, avoiding data delay or loss. It is also adapted to scenarios where multiple boxes are continuously acquired in a connected state without interrupting the data acquisition process. Even in cases where 3, 4, or even more boxes are connected, data can be continuously and stably acquired, providing complete raw information for subsequent data separation.

[0039] In step S3, the main operations include data deduplication, merging, and splitting. Multiple consecutively acquired frames are matched row by row for overlap detection. The criterion is: if any two rows contain the same bottle code, they are considered overlapping rows. The bottle code data of the overlapping rows are merged, and duplicate data is removed to form a complete row of data without redundancy. In extreme cases, if all bottle codes in both rows fail to be successfully identified due to damage, obstruction, or other reasons (e.g., no bottle codes are detected in a frame), overlapping rows cannot be determined by bottle code comparison. In this case, coordinate matching can be used as an auxiliary determination method: calculate the average ordinate of the bottle caps in the two rows. If the difference between the average ordinates is less than m / 2, and the horizontal coordinate distribution of the bottle caps in the two rows is similar (i.e., the horizontal relative positions of the bottle caps in the same row are basically consistent), then they can still be determined as overlapping rows. This auxiliary mechanism improves the fault tolerance of this invention under harsh recognition conditions.

[0040] Since there is at least one row of overlapping data between adjacent frames, the overlapping rows correspond to the same row of bottle caps, and the bottle codes are completely identical. Therefore, overlapping rows can be accurately identified by the same bottle code. This judgment logic is simple, efficient, and highly accurate, and will not result in misjudgment.

[0041] During the merging process, the separation system compares all bottle codes in the two rows of data, retains complete data, and removes duplicate entries. If one row has missing data and the other row is complete, the complete data shall prevail, ensuring that the merged row data contains the QR code information of all bottle caps in that row, without any missing or duplicate entries.

[0042] Following the above rules, all consecutive frame data are merged line by line to generate a complete sequence of bottle code rows arranged in order. Each row of data corresponds to the bottle code information of a row of bottle caps inside the packaging box. The total length of the row sequence directly corresponds to the number of connected boxes and the number of bottle code rows per box. For example, if a single box contains 4 rows of bottle codes, then 4 connected boxes will generate 16 consecutive rows of bottle code data. The row sequence is arranged from front to back according to the order in which the boxes were moved, consistent with the actual physical location.

[0043] This invention not only removes duplicates by processing overlapping rows, but more importantly, it completes the replacement of unidentified codes by utilizing the physical overlap between consecutive frames. Conventional multi-frame acquisition deduplication techniques typically only retain the best frame or remove duplicate data, but do not utilize overlapping areas for data repair. This invention significantly improves the bottle code recognition rate (especially under adverse conditions such as damaged bottle caps or glare) by cross-checking and supplementing overlapping row data from consecutive frames. This technical effect is unattainable by conventional deduplication techniques.

[0044] Furthermore, the core step in this invention to separate connected box data is to evenly segment the continuous row sequence according to a preset number of rows per box. Existing technologies rely on external trigger signals or preset grouping numbers, while this invention directly utilizes the physical order of the row sequence and the inherent pattern of the number of rows per box for segmentation, without requiring any external box boundary signals. This segmentation logic cleverly utilizes the inherent constraint of the "fixed number of rows of bottle caps within the box," directly mapping the image processing results to the box boundaries, avoiding complex object detection or box segmentation algorithms.

[0045] After data integration, the number of bottle code rows per carton is determined based on the single-carton packaging specifications. This number of rows can be preset according to product specifications; for example, for a 12-bottle / carton specification, the bottle codes are arranged in 3 rows per carton (e.g., 3×4); for a 24-bottle / carton specification, the bottle codes are arranged in 4 rows per carton (e.g., 4×6), and so on. The separation system automatically reads the preset row number threshold and evenly splits the integrated continuous row sequence according to the number of rows per carton. Each split segment corresponds to the complete bottle code data of an independent packaging carton, achieving accurate separation of bottle code data across cartons. The splitting process is strictly executed in sequence: the first few rows correspond to the first carton, the next few rows correspond to the second carton, and so on, with clear splitting boundaries, preventing cross-carton data confusion.

[0046] After generating a complete bottle code row sequence, the separation system can automatically calculate the total number of rows in the sequence and infer the number of connected boxes based on the preset number of rows per box: Number of connected boxes = Total number of rows / Number of rows per box. This calculation requires no external input, and the separation system can adaptively adjust the number of segments based on the row sequence length. If the total number of rows is not divisible by the number of rows per box (e.g., due to insufficient rows caused by missing data), the separation system will trigger an alarm and pause data upload, prompting operators to check the equipment status. This adaptive segmentation mechanism allows this solution to flexibly handle scenarios with 2, 3, 4 boxes, and any number of connected boxes without modifying configuration parameters.

[0047] Therefore, the above process can automatically adapt to scenarios with different numbers of boxes (2, 3, 4, etc.) without manual intervention. The separation system can automatically identify the length of the boxes and complete the splitting. The bottle code data after splitting is complete, orderly, and error-free, ensuring the accuracy and independence of the bottle code data for each box. At the same time, the data integration process generates log records, including the number of merged rows, the number of splits, and abnormal data, which facilitates subsequent traceability and maintenance. If data anomalies occur, the logs can be used to quickly locate the problem, improving system stability.

[0048] In actual operation, if there are no overlapping lines between two consecutive frames due to sudden changes in conveyor belt speed or abnormal reader frame rate, the separation system will be unable to generate a continuous line sequence through overlapping and merging. To address this anomaly, this embodiment of the invention can set an overlapping frame monitoring counter: if no overlapping line with the previous frame is detected for N consecutive frames (N can be set according to the frame rate, for example, 3 frames), the separation system determines that the acquisition parameters are mismatched or the production line speed is abnormal, immediately stops associated acquisition, issues an audible and visual alarm, and saves the current cached data for analysis. Operators can recalibrate the reader parameters or check the conveyor belt operating status based on the alarm information. This anomaly recovery mechanism ensures the controllability and maintainability of the separation system under unexpected operating conditions.

[0049] In step S4, accurate association between carton code and bottle code is achieved. Multiple carton code data are collected by a barcode reader on the side of the production line when the cartons are connected. This barcode reader is specifically designed to collect the QR code on the side of the carton. Its installation position works in conjunction with the bottle cap barcode reader to ensure that the carton code of each carton can be successfully collected when the cartons are connected, without any missed collection.

[0050] After the box codes are collected, the multiple box codes are sorted and numbered according to the collection order to form an ordered box code sequence. The sorting rule is consistent with the order in which the boxes pass through the collection area, ensuring that the box code sequence corresponds completely with the bottle code row sequence.

[0051] The bottle code data segments separated in step S3 are then sequentially bound to the ordered bottle code sequence, one-to-one. That is, the first bottle code is associated with the first segment of bottle code data, the second bottle code with the second segment, and so on, until all bottle codes are associated with their corresponding bottle codes. The binding process uses a one-to-one mapping relationship, ensuring that each bottle code uniquely corresponds to a set of bottle code data, and each set of bottle code data uniquely corresponds to one bottle code. This avoids duplicate or incorrect bindings and guarantees accurate association.

[0052] After the association is completed, the data is uploaded to the digital management system, including box code, bottle code, association time, production line number, product specifications, and box status. The digital management system automatically stores and indexes the data, supporting subsequent functions such as barcode scanning, traceability analysis, cross-selling alerts, and marketing activities, achieving complete separation and effective application of associated code data in the box status.

[0053] The above binding process accurately matches the collection sequence. Relying on the high reliability of front-end collection and data processing, it fundamentally avoids the problem of mismatch between box codes and bottle codes. At the same time, it is compatible with the data format of existing digital management systems. There is no need to modify the original system, replace hardware or adjust software interfaces. Enterprises can directly deploy the application, which greatly reduces the transformation cost and implementation difficulty.

[0054] This invention sequentially binds the segmented bottle code sequence with the box code sequence collected by the side barcode reader, leveraging the inherent characteristic that "the physical order of the boxes matches the collection order" in a connected-box scenario. Unlike existing technologies that often rely on PLC signals for grouping, this invention requires no modifications to the production line (such as adding a box pusher mechanism, a box stop mechanism, or changing the logic of the box packer). The association can be completed solely through an algorithm, resulting in lower implementation costs and greater versatility.

[0055] Furthermore, the quantity verification mechanism established in this invention (alarming and prohibiting uploading when the number of box codes and bottle code segments are inconsistent) is a key safeguard to ensure data accuracy. In the case of connected boxes, since box codes or bottle codes may be missing due to recognition failures, quantity verification effectively prevents erroneously associated data from entering the digital management system. This mechanism, working in conjunction with the aforementioned segmentation algorithm, forms a closed loop of "collection-processing-verification," further enhancing robustness and industrial applicability.

[0056] Furthermore, this step also includes a quantity verification mechanism: if the number of box codes collected does not match the number of bottle code segments, the separation system will automatically alarm and prompt the operator to check, preventing erroneous data from entering the digital management system, greatly improving the stability and fault tolerance of production line data collection, and ensuring the smooth operation of the enterprise's digital management system.

[0057] In addition to the quantity verification mechanism, this embodiment of the invention also supports a content verification mechanism: before binding, the format of the bottle code string is verified (e.g., whether it conforms to the preset URL pattern, whether it contains legal characters), the verification bits of the box code are verified, and the integrity of the logical relationship between the associated bottle code data and the box code is checked (e.g., ensuring that the number of bottle codes in the same box equals the packaging specifications). If a verification anomaly is found, the separation system automatically records the error log and prohibits the upload of erroneous data to the digital management system, ensuring the accuracy of the inbound data.

[0058] In summary, the beneficial effects of this invention are as follows: it ensures the accuracy of data acquisition through parameter calibration, completes data by using continuous frame overlap, divides rows by pixel benchmark, integrates data by overlapping and merging, and finally completes the splitting and association binding of connected carton data. It can solve the problem of code data disorder caused by connected cartons without modifying production equipment. The data separation is accurate, the recognition rate is high, and the adaptability is strong. It is suitable for various bottled fast-moving consumer goods production lines and effectively improves the reliability of product traceability and anti-counterfeiting management.

[0059] The following example illustrates the production line for 24 bottles / case of beer, with the specific steps as follows: S1: For a beer production line with 24 bottles / case, set the production line speed to 1.2m / s, adjust the barcode reader installation height to 1.5m, set the acquisition frame rate to 15 frames / second, ensure that each frame acquires 2 rows of bottle caps, and that adjacent frames overlap by 1 row; measure the bottle cap pixel value m=80, and the spacing pixel value n=240.

[0060] S2: When the photoelectric sensor detects the box, it starts data acquisition, decodes the bottle code and coordinates frame by frame, divides the data into rows according to the difference in the vertical coordinate, arranges the single frame data by row, and records the continuous frame data frame by frame.

[0061] S3: Identify overlapping rows and merge them to remove duplicates, generate a continuous row sequence, split the data into 4 rows per box, generate 16 rows of data from 4 boxes, and split them into 4 segments of 4 rows each.

[0062] S4: Collect and sort 4 consecutive box codes, bind the 4 bottle code data segments to the box codes one by one, complete the separation of associated data, and upload them to the digital management system.

[0063] Second Embodiment Based on the above method, a second embodiment of the present invention provides a system for separating associated code data when packaging boxes are connected, based on image processing. For example... Figure 3 As shown, the separation system includes one or more processors and a memory. The memory stores one or more programs, which, when executed by the processor, can implement the method for separating the association code data when packaging boxes are connected as described in the above embodiments.

[0064] The processor controls the overall operation of the discrete system to complete all or part of the steps described above. The processor can be a central processing unit (CPU), graphics processing unit (GPU), field-programmable gate array (FPGA), application-specific integrated circuit (ASIC), digital signal processing (DSP) chip, etc. The memory stores various types of data to support the operation of the discrete system. This data may include, for example, instructions for any application or method operating on the discrete system, as well as application-related data. The memory can be implemented using any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, etc.

[0065] In one exemplary embodiment, the separation system may be implemented by a computer chip or physical entity, or by a product with certain functions, for performing the methods described above and achieving the same technical effects as those methods described above. A typical embodiment is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, an in-vehicle human-machine interface device, a cellular phone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or any combination of these devices.

[0066] In another exemplary embodiment, the present invention also provides a computer-readable storage medium including program instructions that, when executed by a processor, implement the steps of the method in any of the above embodiments. For example, the computer-readable storage medium may be the memory including the program instructions described above, which can be executed by a processor to complete the above-described method for separating association code data when packaging boxes are connected, and achieve the same technical effects as the methods described above.

[0067] It should be noted that the above embodiments are merely illustrative examples. The technical solutions of each embodiment can be combined, and all are within the protection scope of this invention.

[0068] The foregoing has provided a detailed description of the image processing-based method and system for separating associated code data when packaging boxes are connected. Any obvious modifications made by those skilled in the art without departing from the essence of this invention will constitute an infringement of the patent rights of this invention and will incur corresponding legal liability.

Claims

1. A method for separating association code data when packaging boxes are connected based on image processing, characterized in that... include: S1: Combine the production line operating speed and product packaging specifications, adjust the installation height of the barcode reader camera and configure the acquisition frame rate, measure the bottle cap pixel value m and the interval pixel value n between adjacent bottle caps in the acquired image, and establish an image recognition benchmark. S2: Detect the arrival signal of the packaging box and trigger the barcode reader to continuously acquire images, decode and extract the content of the bottle cap QR code and the corresponding two-dimensional pixel coordinates in the image, and divide the bottle code in a single frame image into rows according to the vertical coordinate based on the bottle cap pixel value m and the interval pixel value n; the specific rules for dividing the bottle code in a single frame into rows are as follows: any two bottle caps in the same frame image are determined to be in the same row if the difference in vertical coordinate is less than m, and are determined to be in the next row if the difference in vertical coordinate is greater than or equal to n and less than m + n. S3: Overlapping row recognition is performed on the continuously acquired multi-frame image data. Rows with the same bottle code are identified as overlapping rows. Overlapping rows are merged and duplicate data is removed to generate a continuous and ordered sequence of bottle code rows. The row sequence is segmented according to the preset number of bottle code rows per box to obtain the bottle code data corresponding to each independent box. If there is an unrecognized bottle cap QR code in a single frame image, the missing bottle code information is completed by using the overlapping row data in the next frame image. S4: Collect all box code data in the connected box state and sort them according to the collection order. Bind the segmented bottle code data to the sorted box code one by one to complete the separation of associated code data when connected boxes, and at the same time complete data verification and uploading.

2. The method for separating the associated code data when packaging boxes are connected as described in claim 1, characterized in that... In step S1, the single-frame image collected by the barcode reader is adjusted to include at least two rows of bottle cap QR code data, and there is an overlapping area between two consecutively collected adjacent frames that includes at least one row of bottle cap QR codes.

3. The method for separating the associated code data when packaging boxes are connected as described in claim 1, characterized in that... When measuring the pixel value m of the bottle cap and the pixel value n of the interval, multiple sets of bottle cap images at different locations and under different lighting conditions are selected as samples to calculate the average value in order to control the measurement error.

4. The method for separating the associated code data when packaging boxes are connected as described in claim 1, characterized in that... In step S3, when merging overlapping rows, all valid bottle code data in both rows are retained. If one row has missing bottle codes, the complete data from the other row is used to cover and supplement it.

5. The method for separating the associated code data when packaging boxes are connected as described in claim 1, characterized in that... In step S4, when binding the segmented bottle code data with the box code one by one, a quantity verification mechanism is set up. If the number of box codes collected is inconsistent with the number of segments of the bottle code data, an alarm is issued and the upload of erroneous data is prohibited.

6. The method for separating the associated code data when packaging boxes are connected as described in claim 1, characterized in that... In step S1, when configuring the acquisition frame rate, the frame rate is calculated based on the production line running speed, so that the overlapping area of ​​two adjacent frames in the conveyor belt running direction covers at least the physical distance of a row of bottle caps.

7. The method for separating the associated code data when packaging boxes are connected as described in claim 1, characterized in that... In step S3, the number of bottle code rows preset for a single box is determined according to the product packaging specifications, wherein 12 bottles / box corresponds to 3 rows of bottle codes, and 24 bottles / box corresponds to 4 rows of bottle codes.

8. The method for separating the associated code data when packaging boxes are connected as described in claim 1, characterized in that... In step S4, when data upload is completed, the uploaded information includes at least: box code, bottle code, associated time, production line number, product specifications, and box status indicator.

9. The method for separating the associated code data when packaging boxes are connected as described in claim 1, characterized in that... In step S2, before decoding and extracting the bottle cap QR code, the acquired original image is preprocessed. The preprocessing includes at least one of brightness adjustment, contrast enhancement, distortion correction, and noise reduction filtering.

10. A system for separating the associated code data when packaging boxes are connected based on image processing, characterized in that... It includes a processor and a memory; wherein the memory is coupled to the processor and is used to store a computer program, which, when executed by the processor, causes the processor to implement the method for separating the associated code data when the packaging boxes are connected as described in any one of claims 1 to 9.

Citation Information

Patent Citations

  • Small box sequence code and large box sequence code association system and method

    CN120039455A