Packaging box image reliable acquisition and archiving method and system based on multi-camera cooperation
Patent Information
- Application Number
- CN202611123844.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-28
- Publication Date
- 2026-09-29
AI Technical Summary
[0006]上述技术分别能够提供多摄像头校准、图像质量评价、场景文字识别、文件崩溃一致性或版本审计能力,但未形成适用于包装箱现场作业的连续技术链,尤其没有同时解决包装阶段顺序约束、时钟漂移与曝光区间一致性、场景专用双层质量门控、文件与记录的跨对象事务状态、有效版本选择、箱级根摘要历史以及异常后的幂等恢复问题
1. 通过同时采集组和顺序采集组以及包装阶段状态机,防止封箱前、封箱后照片被错误配置为同一时刻采集,并验证阶段先后关系。
Smart Images

Figure CN122842129A_ABST
Abstract
Description
[Technical Field] This invention relates to the field of industrial image acquisition and reliable archiving technology, and in particular to a reliable acquisition and archiving method and system for packaging box images based on multi-camera collaboration. [Background Technology] Images of packaging boxes, outer cartons, and their sealed states are typically used for production documentation, quality traceability, warehousing handover, and customs declaration document preparation. Taking the documentation of exported lithium battery product packaging as an example, a single carton number usually requires multiple types of photos, including the front of the carton, the back of the carton, its state before sealing, and its state after sealing. Traditionally, this process involves using mobile phones, ordinary USB cameras, industrial camera software, shared folders, or simple scripts to capture images. Operators then manually determine the photo category, enter the work order number and carton number, modify the file name, and move the images to a designated directory.
[0001] In the above method, camera image capture, packaging stage judgment, work object confirmation, photo quality judgment, file naming, version tracking, integrity check, and anomaly recovery are separated from each other. The device clocks of multiple cameras may also have fixed deviations and frequency drifts, and the host receiving time includes transmission and thread scheduling delays, which means that although the combined photos are triggered simultaneously on the interface, the actual exposure times are not consistent; simply checking whether the current frame exists cannot rule out out-of-focus, motion blur, overexposure, underexposure, or reflections obstructing key areas.
[0002] Existing patented technologies already cover multi-camera acquisition, camera synchronization, box number recognition, and document classification. For example: 1. Chinese invention patent application CN116074616A discloses a container image acquisition system, which uses front and back camera groups, side camera groups and supplementary lights to acquire images of different surfaces of the container, mainly solving the problems of camera arrangement, supplementary lighting isolation and shooting position control.
[0003] 2. Chinese invention patent application CN111770269A discloses a parallel acquisition and control method and system based on multiple high-speed cameras, which controls the acquisition of multiple high-speed cameras through time synchronization correction or time alternation correction, mainly targeting the timing and sampling rate of high-speed cameras.
[0004] 3. Chinese invention patent application CN106067023A discloses a container number and truck number recognition system and method based on image processing, which uses camera images to recognize container numbers or truck numbers.
[0005] 4. Chinese invention patent application CN104636469A discloses an automatic document classification and management method and system, which names and stores documents to be classified according to classification codes and archiving rules.
[0006] The aforementioned technologies can provide multi-camera calibration, image quality evaluation, scene text recognition, file crash consistency or version auditing capabilities, but they do not form a continuous technology chain applicable to on-site packaging operations. In particular, they do not simultaneously solve problems such as packaging stage sequence constraints, clock drift and exposure interval consistency, scene-specific dual-layer quality gating, cross-object transaction status of files and records, effective version selection, box-level root summary history, and idempotent recovery after anomalies. [Summary of the Invention] To overcome the above problems, this invention proposes a reliable acquisition and archiving method and system for packaging box images based on multi-camera collaboration, which can effectively solve the above problems.
[0007] The present invention provides a technical solution to the above-mentioned technical problems: a method for reliable acquisition and archiving of packaging box images based on multi-camera collaboration, applied to a client communicating with multiple cameras, comprising: Read the local configuration, which includes at least the set of required photo types, the binding relationship between photo types and camera devices, packaging stage rules, time mapping parameters from each camera to a unified reference timeline, quality configuration of each photo type, shooting button scheme, naming template, box number rules, and archiving parameters. Establish a mapping between photo type and camera device based on the camera stabilization device identifier, and maintain a frame buffer for each camera that includes image data, original timestamp, exposure time range, host reception time and calibration version; Obtain and confirm the current operation information, including the work order number and box number, and establish the current packaging stage status; In response to the shooting command, the set of target photo types and the target shooting time that are allowed to be collected are determined according to the shooting button scheme and the current packaging stage status, and the current operation information is temporarily locked. The original timestamps in the frame buffers of each target camera are mapped to the unified reference time axis using the time mapping parameters. Image frames corresponding to the shooting time of the target and whose exposure time meets the batch consistency condition are selected from the frame buffers of each target camera, and an immutable image snapshot of the selected image frame is established. A two-layer image quality gating is performed on all immutable image snapshots. The first layer includes at least several deterministic quality checks, such as decodeability, image size, edge sharpness, overexposure ratio, underexposure ratio, and reflection occlusion in key areas. The second layer includes generating scene-adaptive no-reference quality scores based on local normalized brightness statistical features and judging whether the quality is qualified according to the quality configuration of the corresponding photo type. If any immutable image snapshot fails the batch consistency condition or the two-layer image quality gate, the current shooting will be terminated and the temporary lock status will be released. After all immutable image snapshots pass verification, obtain the version allocation lock corresponding to the current work order number, box number and target photo type, establish a batch save list with a unique transaction identifier, allocate the next file version number that is not occupied to each target photo type, generate temporary original image path, final original image path, temporary thumbnail path and final thumbnail path, and perform batch uniqueness verification on all final paths. Write each temporary original image and temporary thumbnail according to the batch save list, perform persistent refresh, readability verification and content summary calculation on the temporary files, and write the file preparation mark after all temporary files have passed the verification. Each temporary file is migrated to its corresponding final path using single-file atomic renaming or atomic replacement. The photo record, version node record, and archive task record are written to a state of pending submission. After writing the transaction commit flag, the photo record, version node record, and archive task record are uniformly converted to a committed state. The current version node summary is generated based on the original image content summary, normalized photo metadata, transaction identifier, and the latest valid previous version node summary in the same photo type. According to the fixed photo type order, the current version node summary corresponding to each required photo type of the current container number is aggregated into a container-level integrity root summary, and a container-level root summary record containing the previous container-level integrity root summary is formed. The photo integrity status of the current container number is refreshed based on the set of required photo types, packaging stage order, submitted photo records, current valid version, actual existence status of the original image file, original image readable status, consistency between the recalculated content digest and the record content digest, version node continuity, and container-level integrity root digest verification results. Only when all required photo types are valid and the packaging stage sequence verification passes, will the current job be permanently locked and the next box number be allowed to be switched; When the client starts and detects an unfinished transaction, it performs idempotent commit or rollback based on the batch save list, file preparation flag, transaction commit flag, record status, existence status of temporary files and final files and content summary, so that uncommitted or rolled-back files and records do not participate in the photo integrity determination, and rescans the original image file and recalculates the bin-level integrity root summary after the recovery is completed.
[0008] Preferably, the set of required photo types includes at least front photos, back photos, pre-sealing photos, and post-sealing photos; the packaging stage rules divide photo types into simultaneous acquisition groups that are allowed to be acquired in the same shooting event and sequential acquisition groups that must be acquired according to the order of packaging processes. The front photos and back photos can belong to the same simultaneous acquisition group, while the pre-sealing photos and post-sealing photos belong to different sequential acquisition stages.
[0009] Preferably, the current packaging stage status includes at least the non-started state, the pre-sealing confirmed state, the sealing completed state, and the archiving completed state; after the pre-sealing photos are validly submitted, the non-started state is allowed to enter the pre-sealing confirmed state, and after receiving a stage switching signal confirmed by the operator or generated by the sealing equipment, the sealing completed state is allowed to be entered, and the sealing completed state is only allowed to collect photos after sealing in the sealing completed state.
[0010] Preferably, before the current job information is established, preview recognition frames are allowed to be selected from the frame buffer of the preset OCR source camera to generate candidate box numbers. The preview recognition frames are not used as formal archived photos, are not assigned photo version numbers, and are not used to establish a save transaction. The current job information is established after the operator confirms the candidate box number.
[0011] Preferably, the temporary lock state is established when the shooting instruction is received and is released when the shooting is terminated due to batch consistency verification failure, quality gating failure, or save transaction rollback; after the first photo transaction of the current job is completed and the state transition is completed, the current job information is converted to a persistent lock state, which is only released when the integrity verification of the current box is passed or the reversal operation verified by the authorization is completed.
[0012] Preferably, the time mapping parameters include a scaling parameter and an offset parameter, which are obtained by fitting the observation time pairs of multiple common time events in the target camera and the reference camera, and the original timestamps of each camera are mapped to a unified reference time axis according to the formula: unified reference time = scaling parameter × original timestamp + offset parameter.
[0013] Preferably, when fitting the proportional parameters and offset parameters, abnormal observation time pairs are eliminated and calibration residuals are calculated; when the calibration residuals exceed the residual threshold, the camera is reconnected, the calibration validity period expires, or the cumulative running time reaches the update condition, the time mapping parameters are redefined, and the calibration version and calibration time used are written into the photo metadata.
[0014] Preferably, the batch consistency conditions include: the difference between the reference time and the target shooting time of each immutable image snapshot does not exceed the freshness threshold, and the time difference between the exposure midpoints of any two immutable image snapshots does not exceed the synchronization threshold; in the dynamic packaging stage, it is also required that the exposure time intervals of each immutable image snapshot have a common overlap interval of not less than a preset overlap ratio.
[0015] Preferably, establishing the immutable image snapshot includes copying the image data of the selected image frame, or locking the corresponding frame cache item and incrementing the reference count, so that the selected image frame is not overwritten or reclaimed by the acquisition thread before the saving transaction is completed or terminated.
[0016] Preferably, the quality configuration includes at least a valid scoring direction, a no-reference quality scoring threshold, a lower limit for edge sharpness, an upper limit for overexposure ratio, an upper limit for underexposure ratio, an upper limit for reflection occlusion, a quality model identifier, and a quality configuration version; different photo types and different cameras have corresponding quality configurations.
[0017] Preferably, the scene-adaptive no-reference quality score is obtained by training with qualified and unqualified samples of the packaging box scene, and the quality configuration is determined based on the false acceptance rate and false rejection rate of the verification samples; after the quality model or quality configuration is updated, the updated model identifier and configuration version are written into the newly generated photo record without changing the original judgment result corresponding to the historical photo record.
[0018] Preferably, generating candidate box numbers includes: generating multiple candidate regions and multiple image variants for the preview recognition frame, performing scene text sequence recognition to obtain character sequences and character-level confidence scores respectively; normalizing the character-level confidence scores, candidate region position scores, image quality scores, and box number rule matching scores to the same numerical range to generate a candidate comprehensive score; using upper limit fusion for multiple related image variants from the same original region, performing restricted enhancement for independent recognition results from different regions or different frames, and prohibiting automatic confirmation when candidate ambiguity exceeds a threshold.
[0019] Preferably, before allocating the next file version number, a version allocation lock with work order number, box number and photo type as granularity is acquired, and the unoccupied next file version number is determined by combining the submitted photo record, the pending photo record, the version reservation record and the occupied file name in the target directory; the version allocation lock is released after the transaction completes the committed state transition or completes the rollback.
[0020] Preferably, the next file version number and the previous version node are determined separately; the next file version number is determined based on the version number of the file already in use, and the previous version node is selected only from the latest version node with the same work order number, box number and photo type, whose status is submitted, not revoked and whose integrity verification is valid. Orphaned files, pending submission records and rolled-back records are not used as the predecessor of the version node.
[0021] Preferably, the record status of the photo record, version node record, and archive task record includes at least four states: pending submission, submitted, rolled back, content abnormal, and revoked; only records with the status of submitted and that have passed content verification participate in the selection of the current valid version, version chain calculation, and box-level integrity root digest calculation.
[0022] Preferably, the batch save list records at least the planned status, temporary file written status, temporary file verified status, final path migrated status, record pending commit status, record committed status, and rollback status for each file; after the file preparation mark is written, single-file atomic migration is performed on each temporary file respectively, and multiple files logically constitute the same save batch through the batch save list and transaction commit mark.
[0023] Preferably, when a file preparation marker exists but a transaction commit marker does not exist: if all final files exist and their file length and content digest are consistent with the batch save list, then the missing pending commit records, transaction commit markers, and committed state transitions are added; if only some final files exist or their content digests are inconsistent, then the corresponding pending commit records are converted to a rolled-back state and the temporary files and final files generated by this transaction are cleared; when a transaction commit marker exists but the record is still in a pending commit state, a committed state transition is performed.
[0024] Preferably, in the local file system, the temporary path and the final path are located on the same file system volume and the file refresh and atomic rename interfaces provided by the operating system are called; when the network shared directory or object storage is used as the archive target, the save transaction is completed in the local file system first, and then the data is transferred to the network shared directory or object storage through the upload queue.
[0025] Preferably, before generating the current version node summary, the photo metadata is converted into a normalized metadata sequence according to a fixed field order, unified character encoding, unified time format, fixed numerical precision, normalized relative path, unified null value marker, and preset serialization version; the version node record stores the summary algorithm identifier and serialization version.
[0026] Preferably, the bin-level root summary record includes at least the root summary version number, the current valid version corresponding to each required photo type, the root summary generation time, the generation transaction identifier, the previous bin-level integrity root summary, and the current status; when the current valid version of any photo type changes, a new bin-level root summary record is generated without overwriting the original bin-level root summary record.
[0027] Preferably, the current valid version is one that has been committed, not revoked, has an original image that is readable, has a consistent content summary, has consecutive version nodes, and has the latest commit time. When the latest version has content anomalies, it does not automatically revert to an earlier version. Instead, the corresponding photo type is marked as anomaly, and an audit record is generated after the operator confirms the restoration of the earlier version or reshoots the photo.
[0028] Preferably, the container-level integrity root digest is digitally signed with the device's private key, or the container-level integrity root digest is sent to an independent archiving service and the server-side confirmation digest is saved; the digital signature or server-side confirmation digest is further verified when the photo integrity status is refreshed.
[0029] Preferably, if the valid submission time of the post-sealing photo is later than the valid submission time of the pre-sealing photo, and there is a packaging stage switch record between the two, the sealing order verification is deemed successful; if there is no packaging stage switch record or the time order is not met, a valid box-level integrity root digest is not generated.
[0030] Preferably, the idempotency identifier in the upload queue is generated based on at least the work order number, box number, photo type, file version number, and original image content summary; the server confirmation summary is generated based on the file content actually saved on the server and key archived metadata, and the client verifies the consistency between the server confirmation summary and the local original image content summary and version node summary after successful upload.
[0031] This invention also provides a reliable image acquisition and archiving system for packaging boxes based on multi-camera collaboration, comprising: The Photo Type and Packaging Stage module is used to maintain the set of required photo types, simultaneous acquisition groups, sequential acquisition groups, and the current packaging stage status. The camera binding and frame buffer module is used to match the camera according to the camera stabilization device identifier and maintain a frame buffer containing the exposure time range; The time calibration and batch frame selection module is used to map the camera timestamp to a unified reference time axis according to the scaling parameter and offset parameter, and select an immutable image snapshot that meets the condition of consistent exposure time. A dual-layer image quality gating module is used to perform deterministic quality verification and scene-adaptive no-reference quality scoring verification; The current job locking module is used to establish a temporary lock during the shooting process and to establish a persistent lock after the first photo transaction is submitted; The transactional archiving module is used to create a batch save list, write and verify temporary files, atomically migrate each file, write pending records and transaction commit flags, and convert pending records to a committed state. The version and bin-level integrity module is used to generate a current version node summary based on normalized metadata and the previous version node, generate bin-level root summary records with sequential relationships, and determine the integrity of the current bin based on the current valid version and the packaging stage order. The queue and recovery module is used to perform either continue commit or rollback based on the file preparation flag, transaction commit flag, record status, and content summary idempotent. Each module is configured to execute the method described.
[0032] Preferably, the system further includes an OCR box number assistance module and an external trusted anchor module; the OCR box number assistance module generates candidate box numbers after normalization scoring and rule filtering using the preview recognition frame before the current job is established, and the external trusted anchor module is used to digitally sign the box-level integrity root digest or obtain the confirmation digest of the independent archiving service.
[0033] The present invention also provides an electronic device, including a processor, a memory, a camera interface for communicating with multiple cameras, and a file storage interface. The memory stores a computer program, and when the computer program is executed by the processor, the electronic device performs the method described thereon.
[0034] The present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the method described herein.
[0035] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the method described herein.
[0036] Compared with existing technologies, the reliable acquisition and archiving method and system for packaging box images based on multi-camera collaboration of the present invention has the following beneficial effects: 1. By using simultaneous acquisition groups, sequential acquisition groups, and a packaging stage state machine, we prevent photos before and after sealing from being incorrectly configured to be acquired at the same time, and verify the stage sequence relationship.
[0037] 2. By using a unified time mapping that includes scaling and offset parameters, as well as exposure interval overlap verification, the mismatch of on-site conditions caused by clock drift and exposure time difference is reduced.
[0038] 3. By using a dual-layer gating system of deterministic hard indicators and a packaging box scene quality model, we can reduce misjudgments in general natural scene scoring for low-texture cardboard boxes, reflective tape, and other similar scenarios.
[0039] 4. Use temporary locks and persistent locks to distinguish between shooting failures and job status after the first transaction commit, allowing for input correction after a failure, while preventing archived photos from being assigned to different bins.
[0040] 5. Establish cross-object transactions between files, photo records, version nodes, and upload tasks by recording statuses such as PENDING, COMMITTED, and ROLLED_BACK, as well as preparing and committing markers.
[0041] 6. By determining the file version number and the predecessor of the valid version node separately, the version chain is prevented from being disrupted by orphaned files and rolled-back records.
[0042] 7. By using the bin-level root digest history and external trusted anchors, the complete state before and after the retake is preserved, and the root digest can be verified as not being replaced by local synchronization when needed.
[0043] 8. By separating the preview recognition frame and the formal archive frame, the logical loop between OCR-assisted recognition and the current job setup is avoided. [Attached Image Description] Figure 1 This is a flowchart illustrating the overall process of the method of the present invention. Figure 2 This is a flowchart of the dual-layer image quality gating process of the present invention; Figure 3 This is a flowchart of the cross-object transactional archiving process of the present invention.
Detailed Implementation Methods
[0044] It should be noted that in the embodiments of the present invention, all directional indications (such as up, down, left, right, front, back, etc.) are limited to relative positions on the specified view, rather than absolute positions.
[0045] Furthermore, in this invention, descriptions involving "first," "second," etc., are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this invention, "a plurality of" means at least two, such as two, three, etc., unless otherwise explicitly specified.
[0046] This invention aims to provide a reliable acquisition and archiving method and system for packaging box images based on multi-camera collaboration. Taking the current packaging stage of the box and the same shooting transaction as the basic control unit, it uniformly maps exposure time consistency, image quality, file persistence status, record submission status, version relationship and box-level integrity into a verifiable and recoverable batch status.
[0047] Please see Figures 1 to 3 The present invention provides a reliable method for acquiring and archiving images of packaging boxes based on multi-camera collaboration, comprising the following steps: Step S1: Read configuration and restore index. Read photo type, simultaneous acquisition group, sequential acquisition group, packaging stage rules, camera binding, time mapping parameters, quality configuration, naming template, current job, transaction index, and queue records.
[0048] Step S2: Establish camera mapping and frame buffer. Match the camera according to the stable device identifier, and save the original timestamp, exposure time range, host reception time, calibration version, and frame status for each frame.
[0049] Step S3: Preview OCR and establish the current job. Before the current job is established, candidate box numbers can be generated using the preview recognition frame; after the operator confirms the work order number and box number, the current job and initial packaging stage are established.
[0050] Step S4, Packaging Stage Constraints and Temporary Lock. Based on the current packaging stage, determine the set of allowed photo types to be captured. Upon receiving a shooting instruction, temporarily lock the current operation.
[0051] Step S5, Affine Time Calibration and Batch Frame Selection. Using scaling and offset parameters, the time of each camera is mapped to a unified reference time axis. Frames that meet the conditions of freshness, midpoint difference in exposure, and overlapping exposure intervals during dynamic phases are selected and formed into an immutable snapshot.
[0052] Step S6, dual-layer quality gating. First, deterministic checks are performed on decodability, size, sharpness, exposure, and reflections in key areas. Then, a scene quality model corresponding to the photo type and camera is called for scoring.
[0053] Step S7: Version Reservation and Transaction List. After all images are qualified, acquire the version allocation lock, determine the version number of the unused file and the latest valid previous version node, establish a transaction list, and perform path uniqueness verification.
[0054] Step S8, File Preparation. Write the temporary original image and thumbnail, perform persistent refresh, re-decode, verify file length and content digest, and then write the file preparation marker.
[0055] Step S9, Logical Commit. Perform atomic migrations file by file, write PENDING photo records, version nodes, and upload tasks, and then convert all entries to COMMITTED after writing the transaction commit flag.
[0056] Step S10, Version and Box-Level Integrity. Generate version node digests according to normalized serialization rules, forming a box-level root digest chain that does not overwrite historical records, and can be digitally signed or server-side anchored.
[0057] Step S11, Current Box Verification. Verify that the photo types are complete, the packaging stage order is correct, the current valid version is valid, the original image is present and readable, the content summary is valid, the version chain is valid, the box-level root summary is valid, and external confirmation is valid.
[0058] Step S12, anomaly recovery. Based on the preparation flag, commit flag, PENDING record, and file digest, perform idempotent continuation or rollback to ensure that non-COMMITTED records are not involved in integrity determination.
[0059] The present invention also provides a system, electronic device, computer-readable storage medium, and computer program product for implementing the above method.
[0060] A reliable image acquisition and archiving system for packaging boxes based on multi-camera collaboration includes: The Photo Type and Packaging Stage module is used to maintain the set of required photo types, simultaneous acquisition groups, sequential acquisition groups, and the current packaging stage status. The camera binding and frame buffer module is used to match the camera according to the camera stabilization device identifier and maintain a frame buffer containing the exposure time range; The time calibration and batch frame selection module is used to map the camera timestamp to a unified reference time axis according to the scaling parameter and offset parameter, and select an immutable image snapshot that meets the condition of consistent exposure time. A dual-layer image quality gating module is used to perform deterministic quality verification and scene-adaptive no-reference quality scoring verification; The current job locking module is used to establish a temporary lock during the shooting process and to establish a persistent lock after the first photo transaction is submitted; The transactional archiving module is used to create a batch save list, write and verify temporary files, atomically migrate each file, write pending records and transaction commit flags, and convert pending records to a committed state. The version and bin-level integrity module is used to generate a current version node summary based on normalized metadata and the previous version node, generate bin-level root summary records with sequential relationships, and determine the integrity of the current bin based on the current valid version and the packaging stage order. The queue and recovery module is used to perform either continue commit or rollback based on the file preparation flag, transaction commit flag, record status, and content summary idempotent.
[0061] Specifically, the system structure and data objects include: a photo type and packaging stage module, a camera binding and frame caching module, an OCR box number assistance module, a time calibration and batch frame selection module, a two-layer image quality gating module, a current job two-layer locking module, a transactional archiving module, a version and box-level integrity module, a queue and recovery module, and an optional external trusted anchor module.
[0062] The system is preferably deployed on a local persistent file system on Windows workstations. When network shared directories or object storage are used for centralized archiving, the field clients first complete file and record transactions locally, and then transmit them asynchronously through the upload queue. This avoids directly using the uncertain renaming and refresh semantics of the network file system as conditions for committing field transactions.
[0063] ; Photo type, packaging stage, and double-layer operation lock: An example of photo type configuration is: 01 Front, 02 Back, 03 Before sealing, and 04 After sealing. Front and Back can be configured to be in the same simultaneous acquisition group; Before sealing and After sealing belong to different sequential acquisition stages, and they cannot be configured to be in the same combination shooting button.
[0064] The current packaging stage includes at least the following states: not started, pre-sealing confirmed, sealing completed, and archiving completed. After the pre-sealing photo transaction is converted to COMMITTED, the system allows entry into the pre-sealing confirmed state. Upon operator confirmation of sealing completion, the sealing equipment outputting a completion signal, or other configured process events, the system records the stage switching event and enters the sealing completed state. Taking photos after sealing is only permitted in the sealing completed state.
[0065] The current operation uses temporary and persistent locks. A temporary lock is established upon receiving a photo instruction. This temporary lock is released if quality gating fails, batch consistency fails, or a transaction rollback occurs, allowing the operator to correct work order numbers or box numbers that have not yet been validly archived. A persistent lock is established after the first photo transaction is converted to COMMITTED. This persistent lock must not be released until the current box integrity is verified or the authorized reversal process is completed.
[0066] The valid submission time of photos after bin sealing must be later than the valid submission time of photos before bin sealing, and there must be a phase transition record between the two. If a phase transition record is missing or the time order is incorrect, a valid bin-level root digest will not be generated, even if all four types of files exist.
[0067] Previewing OCR and establishing the current job: The system allows reading preview frames from the OCR source camera before establishing the current job. Preview recognition frames are not used as archived original images, are not assigned version numbers, and are not saved, thus avoiding the logical loop of "no box number, no shooting; no image, no box number recognition".
[0068] The system generates a central region, an expanded region, and a complete image from the preview recognition frame, and generates image variants such as grayscale enhancement, automatic binarying, inverse binarying, and local binarying. After the recognizer outputs the character sequence and character-level confidence score, it calculates the recognition confidence score, region location, image quality, and rule matching score, and normalizes them to 0 to 1.
[0069] Different image variants of the same original region are highly correlated and are fused using a maximum value or an upper limit, without repeated accumulation; independent results from different regions or different preview frames can be enhanced according to a preset maximum gain. If the combined score difference between the first and second candidates is less than the ambiguity threshold, both are displayed and automatic confirmation is disabled. The box number is written to the current job only after operator confirmation.
[0070] Affine time calibration and exposure interval consistency: After system deployment, camera replacement, or reconnection, multiple cameras jointly acquire common time events such as periodic flickering light sources, encoder plate changes, or synchronous motion markers. The system obtains the observation time pairs of each common event in the reference camera and the target camera, and after removing outlier observation points, fits the scaling parameter a_i and the offset parameter b_i.
[0071] The target camera time mapping is t_ref = a_i × t_i + b_i. Here, a_i compensates for drift caused by differences in device clock frequencies, and b_i compensates for fixed biases. The system calculates the fitting residual and saves the parameters, residuals, calibration time, and calibration version together. Recalibration is performed when the residual exceeds a threshold, the camera is reconnected, or the calibration validity period expires. When hardware synchronization is available, a_i can be set to 1, and b_i uses the hardware calibration value.
[0072] Each frame's buffer entry records the exposure start time and exposure end time. For static scenes, the main comparisons are the difference between the exposure midpoint of candidate frames and the target shooting time, as well as the maximum difference between the exposure midpoints of multiple candidate frames. Dynamic stages, such as box sealing actions, also require that the exposure time intervals have a preset proportion of overlapping portions.
[0073] Once a candidate frame is determined, the system either copies the image data to create an immutable snapshot, or locks the cached entry and increments the reference count. The acquisition thread must not overwrite or reclaim the image data before the save transaction is completed or terminated.
[0074] Dual-layer image quality gating: The first layer is deterministic quality verification, which checks at least whether the image can be decoded, whether the size meets requirements, whether the edge sharpness meets the lower limit, whether the proportion of overexposed and underexposed areas is below the upper limit, and whether critical areas are obscured by highly reflective areas. Critical areas can be configured according to film type, such as the box number area in the previous photo, the opening area in the photo before sealing, and the tape edge area in the photo after sealing.
[0075] The second layer is scene-adaptive, reference-free quality assessment. The system calculates the local normalized brightness coefficient and its distribution parameters for the products of horizontal, vertical, and diagonal adjacent components, and generates a quality score using a regression or classification model trained on qualified and unqualified samples of the packaging box scene.
[0076] The quality configuration clearly records the scoring direction, quality threshold, thresholds for each hard metric, camera identifier, photo type, model identifier, and configuration version. Thresholds can be determined based on the false acceptance and false rejection rates of the validation samples. Model updates only affect newly generated photo records and do not retroactively change historical judgments. If any target snapshot fails, the entire combined shooting session is not saved, and a reshoot prompt is given based on the failure metric.
[0077] Version reservation and retention plan: After all snapshots pass quality gating, the system acquires version allocation locks at the granularity of work order number, box number, and photo type. The system queries COMMITTED records, PENDING records, version reservation records, and occupied filenames in the target directory, and allocates an unoccupied next file version number.
[0078] The file version number is used to prevent overwriting. The predecessor of the version node is only selected from the latest version node of the same photo type that is COMMITTED, has not been revoked, and has valid integrity verification. If a manually copied V5 file exists in the directory, and the latest valid version node is V3, the new file can use V6, but the new version node will still be the predecessor of the previous valid node V3.
[0079] The batch save list should at least record the transaction identifier, target photo type, file version number, previous version node, temporary and final paths, file status, expected records, file length, and content summary. The final path is absolute, relative fragment elimination is performed, and file system case compliance is enforced; duplicate paths within the same batch are rejected from being written.
[0080] Cross-object transactional archiving: The system first writes temporary original images and thumbnails, refreshes the file data and reopens the decoded file, confirms file readability, calculates file length and content summary, and writes them to the transaction list. After all temporary files have passed verification, they are persistently written to the file preparation mark.
[0081] The system performs single-file atomic renaming or atomic replacement on each temporary file and records the migration status of that file in the transaction list. After all target files have been migrated, the system writes the photo record, version node record, and upload task record with a PENDING status, and then writes the transaction commit flag. After the transaction commit flag is successfully persisted, all PENDING records for this transaction are uniformly converted to COMMITTED.
[0082] Record statuses include at least PENDING, COMMITTED, ROLLED_BACK, INVALID, and REVOKED. PENDING and ROLLED_BACK records are not included in version chaining, current valid version, or bin-level root digest calculations. If a transaction fails, the system converts the PENDING record related to this transaction to ROLLED_BACK and deletes temporary and final files that can be safely deleted; even if deletion cannot be completed immediately upon failure, some files will not be marked as valid archive batches.
[0083] If photo records, version nodes, and upload tasks are stored in a database, the same database transaction can be used to complete the PENDING write and COMMITTED state transition; if they are stored in a structured file, equivalent idempotent processing can be achieved using transaction logs and atomic state file updates.
[0084] Anomaly recovery state machine: After client startup, it scans for unfinished transactions and PENDING records. If no file preparation marker exists, it deletes residual temporary files and converts the corresponding PENDING record to ROLLED_BACK.
[0085] If a prepare flag exists but a commit flag is missing, verify each final file item by item. If all final files exist and their length and content digest match the transaction list, then add the missing PENDING records and transaction commit flags, and then convert them all to COMMITTED. If only part of the final file exists or the digest is inconsistent, then convert it to ROLLED_BACK and clear the current transaction file.
[0086] If a transaction commit flag exists but the record is still PENDING, it means the commit flag has been successfully set but the state transition is not yet complete. The system performs the COMMITTED transition. After completing all unfinished transaction processing, the original graph is rescanned, the content digest is verified, and the version node and bin-level root digest are recalculated. All recovery operations are idempotent; repeated execution will not generate additional versions or duplicate upload tasks.
[0087] Normalized version chain and current valid version: The input of the version node digest is normalized and serialized according to a fixed field order, including uniformly using UTF-8 encoding, converting time to UTC with fixed precision, using fixed decimal places for numerical values, converting paths to normalized relative paths, using a unified marker for null values, and recording the serialization version and digest algorithm identifier.
[0088] The version node summary should at least cover the work order number, box number, photo type, file version number, shooting time, calibration version, quality model version, original image content summary, normalized metadata summary, transaction identifier, and the previous valid version node summary.
[0089] The current valid version must simultaneously meet the following conditions: COMMITTED, not revoked, original image exists and is readable, content summary is consistent, version nodes are consecutive, and the commit time is latest. When the latest version has content anomalies, the system does not automatically revert to the old version, but marks it as an anomaly; the operator must explicitly choose to restore the old version or retake the image before a new audit record is generated.
[0090] Box-level root digest chain and external trusted anchor: The system aggregates the digests of each currently valid version node in a fixed photo type numbering order to generate a box-level integrity root digest. Each box-level root digest record includes the root digest version number, the currently valid version for each photo type, the generation time, the generation transaction identifier, the previous box-level root digest, and the current status. A new root digest record is generated when any currently valid version changes, without overwriting historical root digests.
[0091] Local root digests can detect asynchronous changes and occasional corruption of files and records. To resist complete local state replacement, the device security module can sign the root digest using a private key, or the root digest can be sent to a separate archiving service and a server-side confirmation digest can be saved. Integrity updates simultaneously verify either the digital signature or the server-side confirmation digest.
[0092] Only when all required photo types are complete, the order before and after sealing is valid, the content of each currently valid version is verified, the version chain is continuous, the box-level root summary is correct, and the external confirmation required by the configuration is passed, will the current box enter the archiving completion state and allow the next box to proceed.
[0093] Upload queue and centralized archiving: The stable idempotency identifier for upload tasks is generated based on the work order number, box number, photo type, file version number, and original image content summary, and does not rely solely on the local transaction identifier. Even after an anomaly recovery and the transaction context is recreated, the same idempotency identifier is still obtained for the same business version and the same content.
[0094] The server receives the original image, a stable idempotency identifier, a content digest, a version node digest, and a bin-level root digest. If the server has already saved the same idempotency identifier, it returns the original archive object, avoiding the generation of duplicate files. The server confirms that the digest is generated based on the actual saved file content and key archive metadata; after client verification, the task is marked as successful.
[0095] In local mode, the current bin can be completed once the local content and root summary are verified. In centralized archiving mode, all required photos must be uploaded successfully and the server must confirm that the summary has been verified.
[0096] Example of continuous operation: The operator processes box number BX001 under work order WO20260727. When the current job is not established, the client identifies the candidate BX001 from the preview frame of the front camera. After the operator confirms, the current job is established, and the packaging stage is not started.
[0097] The operator clicks the combined front and back buttons, and the system establishes a temporary lock, mapping the timestamps and exposure ranges of the two cameras to a unified reference timeline based on the latest calibration version. If the difference between the two exposures is 35 milliseconds and the overlap ratio of the exposure ranges meets the requirements, the system copies the image to create an immutable snapshot.
[0098] Both snapshots passed deterministic quality checks and the scene quality model. The system acquires version locks for both photo types, establishes transaction T001, writes temporary files and prepares a flag, migrates file by file, writes PENDING records and commit flags, and then converts them to COMMITTED. The current job is then converted from a temporary lock to a persistent lock.
[0099] The operator takes a photo before sealing the box; after the transaction is committed, the system enters the pre-sealing confirmed state. After sealing and confirming the phase switch, the system enters the sealing completed state, allowing the taking of photos after sealing. Transactions committed after sealing are later than those committed before sealing, and the phases proceed in sequence.
[0100] The system generates version nodes and bin-level root digests R1 for four types of photos, and sends R1 to the archiving service to obtain a confirmation digest. After all verifications are successful, the system enters the archiving complete state and releases the persistent lock. If the system loses power after file migration, upon restart, it will complete the continuation or rollback based on the preparation flag, file digest, and PENDING record, and will not treat incomplete sets of files as valid bin archives.
[0101] Optional transformations: Required photo types can include top, side, label close-up, weighing display, or seal number photos. Adding new photo types requires specifying their simultaneous acquisition group, sequential acquisition stage, camera binding, and quality configuration in the settings.
[0102] For global shutter cameras, the start and end times of exposure can be used directly; for rolling shutter cameras, frame-level exposure intervals can be recorded or the exposure interval can be expanded according to the line exposure sequence, and more stringent overlap conditions are used in the dynamic stage.
[0103] The quality model can employ a natural scene statistical regression model, a lightweight neural network, or a combination of both, but it should output metrics comparable to the quality configuration and save the model version. The hashing algorithm can be any cryptographic hashing algorithm capable of recognizing content variations.
[0104] The above embodiments have provided specific descriptions of the packaging stage state machine, double-layer lock, preview OCR, affine time calibration, exposure interval frame selection, immutable snapshot, double-layer quality gating, version allocation lock, cross-object transaction state, anomaly recovery, normalized version chain, bin-level root digest chain, external trusted anchor, and idempotent upload involved in the claims. Those skilled in the art can implement these embodiments without any inventive effort.
[0105] The above description is only a preferred embodiment of the present invention and does not limit the patent scope of the present invention. Any modifications, equivalent substitutions and improvements made within the concept of the present invention should be included within the patent protection scope of the present invention.
Claims
1. A reliable image acquisition and archiving method for packaging boxes based on multi-camera collaboration, applied to a client communicating with multiple cameras, characterized in that: include: Read the local configuration, which includes at least the set of required photo types, the binding relationship between photo types and camera devices, packaging stage rules, time mapping parameters from each camera to a unified reference timeline, quality configuration of each photo type, shooting button scheme, naming template, box number rules, and archiving parameters. Establish a mapping between photo type and camera device based on the camera stabilization device identifier, and maintain a frame buffer for each camera that includes image data, original timestamp, exposure time range, host reception time and calibration version; Obtain and confirm the current operation information, including the work order number and box number, and establish the current packaging stage status; In response to the shooting command, the set of target photo types and the target shooting time that are allowed to be collected are determined according to the shooting button scheme and the current packaging stage status, and the current operation information is temporarily locked. The original timestamps in the frame buffers of each target camera are mapped to the unified reference time axis using the time mapping parameters. Image frames corresponding to the shooting time of the target and whose exposure time meets the batch consistency condition are selected from the frame buffers of each target camera, and an immutable image snapshot of the selected image frame is established. A two-layer image quality gating is performed on all immutable image snapshots. The first layer includes at least several deterministic quality checks, such as decodeability, image size, edge sharpness, overexposure ratio, underexposure ratio, and reflection occlusion in key areas. The second layer includes generating scene-adaptive no-reference quality scores based on local normalized brightness statistical features and judging whether the quality is qualified according to the quality configuration of the corresponding photo type. If any immutable image snapshot fails the batch consistency condition or the two-layer image quality gate, the current shooting will be terminated and the temporary lock status will be released. After all immutable image snapshots pass verification, obtain the version allocation lock corresponding to the current work order number, box number and target photo type, establish a batch save list with a unique transaction identifier, allocate the next file version number that is not occupied to each target photo type, generate temporary original image path, final original image path, temporary thumbnail path and final thumbnail path, and perform batch uniqueness verification on all final paths. Write each temporary original image and temporary thumbnail according to the batch save list, perform persistent refresh, readability verification and content summary calculation on the temporary files, and write the file preparation mark after all temporary files have passed the verification. Each temporary file is migrated to its corresponding final path using single-file atomic renaming or atomic replacement. The photo record, version node record, and archive task record are written to a state of pending submission. After writing the transaction commit flag, the photo record, version node record, and archive task record are uniformly converted to a committed state. The current version node summary is generated based on the original image content summary, normalized photo metadata, transaction identifier, and the latest valid previous version node summary in the same photo type. According to the fixed photo type order, the current version node summary corresponding to each required photo type of the current container number is aggregated into a container-level integrity root summary, and a container-level root summary record containing the previous container-level integrity root summary is formed. The photo integrity status of the current container number is refreshed based on the set of required photo types, packaging stage order, submitted photo records, current valid version, actual existence status of the original image file, original image readable status, consistency between the recalculated content digest and the record content digest, version node continuity, and container-level integrity root digest verification results. Only when all required photo types are valid and the packaging stage sequence verification passes, will the current job be permanently locked and the next box number be allowed to be switched; When the client starts and detects an unfinished transaction, it performs idempotent commit or rollback based on the batch save list, file preparation flag, transaction commit flag, record status, existence status of temporary files and final files and content summary, so that uncommitted or rolled-back files and records do not participate in the photo integrity determination, and rescans the original image file and recalculates the bin-level integrity root summary after the recovery is completed.
2. The method according to claim 1, characterized in that, The set of required photo types includes at least front photos, back photos, photos before sealing, and photos after sealing; the packaging stage rules divide photo types into simultaneous acquisition groups that are allowed to be captured in the same shooting event and sequential acquisition groups that must be captured according to the order of packaging processes. The front photos and back photos can belong to the same simultaneous acquisition group, while the photos before sealing and the photos after sealing belong to different sequential acquisition stages.
3. The method according to claim 2, characterized in that, The current packaging stage status includes at least the non-started state, the pre-sealing confirmed state, the sealing completed state, and the archiving completed state. After the pre-sealing photos are successfully submitted, the packaging stage is allowed to enter the pre-sealing confirmed state from the non-started state. After receiving a stage switching signal confirmed by the operator or generated by the sealing equipment, the packaging stage is allowed to enter the sealing completed state. Only in the sealing completed state is it allowed to collect photos after sealing.
4. The method according to claim 1, characterized in that, Before the current job information is established, preview recognition frames can be selected from the frame buffer of the preset OCR source camera to generate candidate box numbers. The preview recognition frames are not used as formal archived photos, are not assigned photo version numbers, and are not saved. The current job information is established after the operator confirms the candidate box number.
5. The method according to claim 1, characterized in that, The temporary lock state is established when the shooting instruction is received and is released when the shooting is terminated due to batch consistency verification failure, quality gating failure, or save transaction rollback. After the first photo transaction of the current job is completed and the state transition is completed, the current job information is converted to a persistent lock state. The persistent lock state is only released after the integrity verification of the current box is passed or the reversal operation verified by the authorization is completed.
6. The method according to claim 1, characterized in that, The time mapping parameters include a scaling parameter and an offset parameter, which are obtained by fitting the observation time pairs of multiple common time events in the target camera and the reference camera. The original timestamps of each camera are mapped to a unified reference time axis according to the formula: unified reference time = scaling parameter × original timestamp + offset parameter.
7. The method according to claim 6, characterized in that, When fitting the proportional and offset parameters, abnormal observation time pairs are eliminated and calibration residuals are calculated. When the calibration residuals exceed the residual threshold, the camera is reconnected, the calibration validity period expires, or the cumulative running time reaches the update condition, the time mapping parameters are redefined, and the calibration version and calibration time used are written into the photo metadata.
8. The method according to claim 1, characterized in that, The batch consistency conditions include: the difference between the reference time and the target shooting time of each immutable image snapshot does not exceed the freshness threshold, and the time difference between the exposure midpoints of any two immutable image snapshots does not exceed the synchronization threshold; in the dynamic packaging stage, it is also required that the exposure time intervals of each immutable image snapshot have a common overlap interval of not less than a preset overlap ratio.
9. The method according to claim 1, characterized in that, Establishing the immutable image snapshot includes copying the image data of the selected image frame, or locking the corresponding frame cache entry and incrementing the reference count, so that the selected image frame is not overwritten or reclaimed by the acquisition thread before the save transaction is completed or terminated.
10. A reliable image acquisition and archiving system for packaging boxes based on multi-camera collaboration, characterized in that, include: The Photo Type and Packaging Stage module is used to maintain the set of required photo types, simultaneous acquisition groups, sequential acquisition groups, and the current packaging stage status. The camera binding and frame buffer module is used to match the camera according to the camera stabilization device identifier and maintain a frame buffer containing the exposure time range; The time calibration and batch frame selection module is used to map the camera timestamp to a unified reference time axis according to the scaling parameter and offset parameter, and select an immutable image snapshot that meets the condition of consistent exposure time. A dual-layer image quality gating module is used to perform deterministic quality verification and scene-adaptive no-reference quality scoring verification; The current job locking module is used to establish a temporary lock during the shooting process and to establish a persistent lock after the first photo transaction is submitted; The transactional archiving module is used to create a batch save list, write and verify temporary files, atomically migrate each file, write pending records and transaction commit flags, and convert pending records to a committed state. The version and bin-level integrity module is used to generate a current version node summary based on normalized metadata and the previous version node, generate bin-level root summary records with sequential relationships, and determine the integrity of the current bin based on the current valid version and the packaging stage order. The queue and recovery module is used to perform either continue commit or rollback based on the file preparation flag, transaction commit flag, record status, and content summary idempotently.
Citation Information
Patent Citations
Automatic file classification management method and system
CN104636469A
Container number and container lorry number identification system based on image processing and container number and container lorry number identification method thereof
CN106067023A
Parallel acquisition management and control method and system based on multiple high-speed cameras
CN111770269A
Container image acquisition system
CN116074616A
Transdermal therapeutic system containing agomelatine
WO2020260727A1