Image calibration method and device for barcode scanner
By using the improved MIMO-UNet defuzzing model and image calibration technology on the code scanner, the original image is defuzzed and calibrated, which solves the problem of low recognition efficiency caused by QR code image blur, and achieves higher recognition accuracy and efficiency.
Patent Information
- Application Number
- CN202411919449.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-25
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2044-12-25
AI Technical Summary
In the self-service cashier system in supermarkets or retail stores, due to unstable distance between the scanning device and the QR code, equipment shaking, QR code tilting or insufficient light, the QR code image is blurred, which in turn affects the recognition efficiency.
An image calibration method for a scanner is proposed. By acquiring the original image, the improved MIMO-UNet defuzzing model is used to defuzzle to obtain the enhanced image; then the object detection and positioning of the enhanced image is performed to obtain the foreground image; finally, the foreground image is perspective calibration and size calibration are performed to obtain the front-facing image.
Through debuffering and image calibration, the image quality is improved, background interference is reduced, recognition accuracy is improved, and recognition failure rate is reduced, thereby improving recognition efficiency.
Smart Images

Figure CN119358578B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to an image calibration method and device for a barcode scanner. Background Art
[0002] Barcodes are widely used in modern retail scenarios for product identification and payment. Existing barcode recognition technologies often calibrate and recognize the original image directly. However, in the self-service checkout system of supermarkets or retail stores, the randomness of customer operations and the uncontrollability of ambient light often cause the QR code image to be blurred. The reasons for the blurry QR code are usually the following: the distance between the scanning device and the QR code is unstable, and the handheld device may shake; the QR code is tilted or the angle is not right, resulting in image deviation; insufficient light or uneven reflection increases the difficulty of recognition.
[0003] Blurred QR code images are not clear enough, making it difficult for the scanner to accurately detect the position and boundaries of the QR code, resulting in calibration failure. Secondly, blurring affects the recognizability of the data in the QR code, making it difficult for the system to accurately decode the QR code information, resulting in recognition failure. This situation reduces the efficiency of calibration and recognition, requiring users to try multiple times, slowing down the checkout process and affecting the customer experience. Summary of the invention
[0004] The purpose of the present invention is to solve the problem of low recognition efficiency caused by blur mentioned in the above background technology, and to propose an image calibration method and device for a barcode scanner.
[0005] A first aspect of the present invention provides an image calibration method for a barcode scanner, the method comprising:
[0006] Get the original image of the target barcode;
[0007] Using the original image as an input of a pre-trained deblurring model to obtain an enhanced image;
[0008] Performing target detection and positioning on the enhanced image to obtain a foreground image of the target barcode;
[0009] The foreground image is subjected to perspective calibration and size calibration to obtain a front view image of the target barcode.
[0010] Optionally, the deblurring model is an improved MIMO-UNet model; the original MIMO-UNet model includes a coding block , and , asymmetric feature fusion module and , shallow convolution module and ; Encoding block It consists of convolutional blocks and stacked residual blocks;
[0011] Specific improvements include:
[0012] According to the dense residual module and the Transformer module, a multi-scale feature extraction module is constructed, and the encoding block The stacked residual block in is replaced by the multi-scale feature extraction module to obtain a first feature extraction module;
[0013] Add a convolution branch to the shallow convolution module to obtain the second feature extraction module;
[0014] Add skip connections in the asymmetric feature fusion module to obtain a multi-feature fusion module.
[0015] Optionally, the multi-scale feature extraction module is composed of a plurality of dense residual modules, a Transformer module and Convolution module composition;
[0016] The calculation formula of the multi-scale feature extraction module is:
[0017] ,
[0018] in, , It is the intermediate feature map of the calculation process; is the output of the multi-scale feature extraction module; is the input feature map; is the output of the Transformer module; and They are the outputs of three dense residual modules; It is a channel splicing operation; yes Convolution operation.
[0019] Optionally, the calculation formula of the second feature extraction module is:
[0020] ,
[0021] in, and It is the intermediate feature map of the calculation process; is the output of the second feature extraction module; and They are Convolution operation and Convolution operation; is the input feature map; It is a channel splicing operation.
[0022] Optionally, the calculation formula of the multi-feature fusion module is:
[0023] ,
[0024] in, is the i-th input feature map; is the size adjustment operation of the i-th input feature map; is the output of the i-th input feature map after resizing; and It is the intermediate feature map of the calculation process; is the output of the multi-feature fusion module.
[0025] A second aspect of the present invention provides an image calibration device for a barcode scanner, the device comprising:
[0026] An image acquisition module is used to acquire the original image of the target barcode;
[0027] An image enhancement module, used for taking the original image as an input of a pre-trained deblurring model to obtain an enhanced image;
[0028] An image cropping module is used to perform target detection and positioning on the enhanced image to obtain a foreground image of the target barcode;
[0029] The image calibration module is used to perform perspective calibration and size calibration on the foreground image to obtain a front view image of the target barcode.
[0030] Optionally, the deblurring model is an improved MIMO-UNet model; the original MIMO-UNet model includes a coding block , and , asymmetric feature fusion module and , shallow convolution module and ; Encoding block It consists of convolutional blocks and stacked residual blocks;
[0031] Specific improvements include:
[0032] According to the dense residual module and the Transformer module, a multi-scale feature extraction module is constructed, and the encoding block The stacked residual block in is replaced by the multi-scale feature extraction module to obtain a first feature extraction module;
[0033] Add a convolution branch to the shallow convolution module to obtain the second feature extraction module;
[0034] Add skip connections in the asymmetric feature fusion module to obtain a multi-feature fusion module.
[0035] Optionally, the multi-scale feature extraction module is composed of a plurality of dense residual modules, a Transformer module and Convolution module composition;
[0036] The calculation formula of the multi-scale feature extraction module is:
[0037] ,
[0038] in, , It is the intermediate feature map of the calculation process; is the output of the multi-scale feature extraction module; is the input feature map; is the output of the Transformer module; and They are the outputs of three dense residual modules; It is a channel splicing operation; yes Convolution operation.
[0039] Optionally, the calculation formula of the second feature extraction module is:
[0040] ,
[0041] in, and It is the intermediate feature map of the calculation process; is the output of the second feature extraction module; and They are Convolution operation and Convolution operation; is the input feature map; It is a channel splicing operation.
[0042] Optionally, the calculation formula of the multi-feature fusion module is:
[0043] ,
[0044] in, is the i-th input feature map; is the size adjustment operation of the i-th input feature map; is the output of the i-th input feature map after resizing; and It is the intermediate feature map of the calculation process; is the output of the multi-feature fusion module. Beneficial effects of the present invention:
[0045] The present invention proposes an image calibration method for a barcode scanner, the method comprising: acquiring an original image of a target barcode; using the original image as an input of a pre-trained deblurring model to obtain an enhanced image; performing target detection and positioning on the enhanced image to obtain a foreground image of the target barcode; performing perspective calibration and size calibration on the foreground image to obtain a front view image of the target barcode.
[0046] By deblurring the original image, the image quality can be improved, making the edge of the barcode clearer; by separating the foreground of the image, the influence of background interference can be reduced; thus, accurate calibration can be performed to obtain a clear desired image. This can greatly reduce recognition failures caused by image problems, improve recognition accuracy, and thus improve recognition efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] The present invention will be further described below in conjunction with the accompanying drawings.
[0048] Figure 1 A flowchart of an image calibration method for a barcode scanner is provided for an embodiment of the present invention;
[0049] Figure 2 An original structural diagram of a MIMO-UNet model is provided for an embodiment of the present invention;
[0050] Figure 3 A schematic diagram of the structure of an original component is provided for an embodiment of the present invention;
[0051] Figure 4 A schematic structural diagram of an improved deblurring model is provided for an embodiment of the present invention;
[0052] Figure 5 A structural schematic diagram of a first feature extraction module is provided for an embodiment of the present invention;
[0053] Figure 6 A structural schematic diagram of a second feature extraction module is provided for an embodiment of the present invention;
[0054] Figure 7 A structural schematic diagram of a multi-feature fusion module is provided for an embodiment of the present invention;
[0055] Figure 8 A schematic structural diagram of an image calibration device for a barcode scanner is provided for an embodiment of the present invention. DETAILED DESCRIPTION
[0056] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0057] The embodiment of the present invention provides an image calibration method for a barcode scanner. Figure 1 , Figure 1 A flowchart of an image calibration method for a barcode scanner provided by an embodiment of the present invention. The method comprises the following steps:
[0058] S101, obtaining an original image of a target barcode.
[0059] S102, using the original image as input of a pre-trained deblurring model to obtain an enhanced image.
[0060] S103, performing target detection and positioning on the enhanced image to obtain a foreground image of the target barcode.
[0061] S104, performing perspective calibration and size calibration on the foreground image to obtain a front view image of the target barcode.
[0062] Based on an image calibration method for a barcode scanner provided by an embodiment of the present invention, the image quality can be improved by deblurring the original image, making the edge of the barcode clearer; the foreground of the image can be separated to reduce the influence of background interference; thus, accurate calibration can be performed to obtain a clear desired image. This can greatly reduce recognition failures caused by image problems, improve recognition accuracy, and thus improve recognition efficiency.
[0063] In one implementation, target detection and positioning of enhanced images can be performed using a deep learning-based method, such as the YOLO series of models; or a contour detection algorithm based on pixel grayscale values, such as the Canny edge detection method.
[0064] In one implementation, the perspective transformation can be achieved by four-point mapping, the coordinates of the four corners of the barcode are located and transformed into a front-view state, and the image is scaled by an interpolation algorithm to obtain a front-view image of a preset size.
[0065] In one embodiment, the deblurring model is a modified MIMO-UNet model.
[0066] See also Figure 2 , Figure 2The original structure diagram of a MIMO-UNet model is provided for an embodiment of the present invention. The original MIMO-UNet model includes a coding block , and , asymmetric feature fusion module and , shallow convolution module and , decoding block , and . B1 is the original image (size is ), B2 is the downsampled image of B1 (size is ), B3 is the downsampled image of B1 (size is ).
[0067] See also Figure 3 , Figure 3 A schematic diagram of the structure of an original component provided by an embodiment of the present invention. Figure 3 (a) in the code block It consists of a convolution block Conv and stacked residual blocks RBs. Figure 3 (b) in the figure shows the connection structure of the shallow convolutional module (SCM). Figure 3 (c) in the figure shows the connection structure of the asymmetric feature fusion module (AFF).
[0068] Specific improvements include:
[0069] According to the dense residual module and Transformer module, a multi-scale feature extraction module is constructed, and the encoding block The stacked residual blocks in are replaced by a multi-scale feature extraction module to obtain the first feature extraction module.
[0070] A convolution branch is added to the shallow convolution module to obtain the second feature extraction module.
[0071] Add skip connections in the asymmetric feature fusion module to obtain a multi-feature fusion module.
[0072] See also Figure 4 , Figure 4A schematic diagram of the structure of an improved deblurring model provided by an embodiment of the present invention. As shown in the figure, a full-size image is selected as the output. FIM (First Improvement Module) is the first feature extraction module. SIM (Second Improvement Module) is the second feature extraction module. SIM1 and SIM2 have the same structure but different weights. AFFJC (Asymmetric Feature Fusion with Jumping Connection) is a multi-feature fusion module. AFFJC1 and AFFJC2 have the same structure but different weights.
[0073] In one implementation, see Figure 5 , Figure 5 FIG. 1 is a schematic diagram of the structure of a first feature extraction module provided by an embodiment of the present invention. Figure 5 As shown in (a) of FIG. 1 , the connection structure of the first feature extraction module is shown. Figure 5 As shown in (b), the multi-scale feature extraction module MEM (Multi scale feature extraction module) consists of multiple dense residual modules, Transformer modules and Convolutional modules; the first dense residual module Dense Block1 adopts Convolution kernel, the second dense residual module Dense Block2 uses Convolution kernel, the third dense residual module Dense Block3 uses Convolution kernel; the number of layers of the three dense residual modules is 4;
[0074] The calculation formula of the multi-scale feature extraction module is:
[0075] ,
[0076] in, , It is the intermediate feature map of the calculation process; is the output of the multi-scale feature extraction module and also the output of the first feature extraction module; is the input feature map; is the output of the Transformer module; and They are the outputs of three dense residual modules; It is a channel splicing operation; yes Convolution operation.
[0077] By introducing dense residual modules and Transformer modules in the encoding block, local and global information in the image can be mined and aggregated more deeply. The dense residual module can enhance the model's memory capacity and process complex texture information; while the Transformer module is good at capturing long-distance dependencies, so it is more helpful for the accuracy and detail recovery of the deblurring task. The dual bypass structure supports information sharing between branches, allowing the model to process features of multiple scales at the same time, improving the model's global understanding of the image and making it more adaptable to various blurry situations.
[0078] In one implementation, see Figure 6 , Figure 6 A schematic diagram of the structure of a second feature extraction module provided by an embodiment of the present invention. The calculation formula of the second feature extraction module is:
[0079] ,
[0080] in, and It is the intermediate feature map of the calculation process; is the output of the second feature extraction module; and They are Convolution operation and Convolution operation; is the input feature map, k is equal to 2 or 3; It is a channel splicing operation.
[0081] By adding convolution branches to the shallow convolution module, the model can better capture the edges and details of the image when processing shallow features.
[0082] In one implementation, see Figure 7 , Figure 7 A schematic diagram of the structure of a multi-feature fusion module provided in an embodiment of the present invention. The calculation formula of the multi-feature fusion module is:
[0083] ,
[0084] in, is the i-th input feature map; is the size adjustment operation of the i-th input feature map, including upsampling or downsampling, so that the size of each feature map is consistent; is the output of the i-th input feature map after resizing; and It is the intermediate feature map of the calculation process; is the output of the multi-feature fusion module. is the output of the first feature extraction module FIM, that is ; is the output of encoding block EB2; is the output of encoding block EB3.
[0085] By adding skip connections in the asymmetric feature fusion module, a multi-feature fusion module is formed. Skip connections help transfer information between different layers, maintain the integrity of low-level details and high-level semantic information, effectively fuse features of different scales, and ensure that image restoration has a more detailed level.
[0086] The embodiment of the present invention provides an image calibration device for a barcode scanner. Figure 8 , Figure 8 A schematic diagram of the structure of an image calibration device for a barcode scanner provided by an embodiment of the present invention. The device includes:
[0087] The image acquisition module is used to acquire the original image of the target barcode.
[0088] The image enhancement module is used to take the original image as the input of the pre-trained deblurring model to obtain an enhanced image.
[0089] The image cropping module is used to detect and locate the target on the enhanced image to obtain the foreground image of the target barcode.
[0090] The image calibration module is used to perform perspective calibration and size calibration on the foreground image to obtain a front view image of the target barcode.
[0091] Based on the image calibration device for a barcode scanner provided by the embodiment of the present invention, the image quality can be improved by deblurring the original image, making the edge of the barcode clearer; the foreground of the image can be separated to reduce the influence of background interference; thus, accurate calibration can be performed to obtain a clear desired image. This can greatly reduce recognition failures caused by image problems, improve recognition accuracy, and thus improve recognition efficiency.
[0092] The above is a detailed description of an embodiment of the present invention, but the content is only a preferred embodiment of the present invention and cannot be considered to limit the scope of implementation of the present invention. All equivalent changes and improvements made within the scope of the present invention should still fall within the scope of the patent coverage of the present invention.
Claims
1. An image calibration method for a barcode scanner, characterized in that: The method comprises: Get the original image of the target barcode; Using the original image as an input of a pre-trained deblurring model to obtain an enhanced image; Performing target detection and positioning on the enhanced image to obtain a foreground image of the target barcode; Performing perspective calibration and size calibration on the foreground image to obtain a front view image of the target barcode; The deblurring model is an improved MIMO-UNet model; the original MIMO-UNet model includes a coding block , and , asymmetric feature fusion module and , shallow convolution module and ; Encoding block It consists of convolutional blocks and stacked residual blocks; the specific improvements include: According to the dense residual module and the Transformer module, a multi-scale feature extraction module is constructed, and the encoding block The stacked residual blocks in are replaced with the multi-scale feature extraction module to obtain a first feature extraction module; the multi-scale feature extraction module consists of multiple dense residual modules, Transformer modules and The convolution module is composed of: the calculation formula of the multi-scale feature extraction module is: , in, , It is the intermediate feature map of the calculation process; is the output of the multi-scale feature extraction module; is the input feature map; is the output of the Transformer module; , and They are the outputs of three dense residual modules; It is a channel splicing operation; yes Convolution operation; A convolution branch is added to the shallow convolution module to obtain a second feature extraction module; the calculation formula of the second feature extraction module is: , in, and It is the intermediate feature map of the calculation process; is the output of the second feature extraction module; and They are Convolution operation and Convolution operation; is the input feature map; It is a channel splicing operation; A skip connection is added to the asymmetric feature fusion module to obtain a multi-feature fusion module; the calculation formula of the multi-feature fusion module is: , in, is the i-th input feature map; is the size adjustment operation of the i-th input feature map; is the output of the i-th input feature map after resizing; , and It is the intermediate feature map of the calculation process; is the output of the multi-feature fusion module.
2. An image calibration device for a barcode scanner, characterized in that: The device comprises: An image acquisition module is used to acquire the original image of the target barcode; An image enhancement module, used for taking the original image as an input of a pre-trained deblurring model to obtain an enhanced image; An image cropping module is used to perform target detection and positioning on the enhanced image to obtain a foreground image of the target barcode; An image calibration module, used for performing perspective calibration and size calibration on the foreground image to obtain a front view image of the target barcode; The deblurring model is an improved MIMO-UNet model; the original MIMO-UNet model includes a coding block , and , asymmetric feature fusion module and , shallow convolution module and ; Encoding block It consists of convolutional blocks and stacked residual blocks; the specific improvements include: According to the dense residual module and the Transformer module, a multi-scale feature extraction module is constructed, and the encoding block The stacked residual blocks in are replaced with the multi-scale feature extraction module to obtain a first feature extraction module; the multi-scale feature extraction module consists of multiple dense residual modules, Transformer modules and The convolution module is composed of: the calculation formula of the multi-scale feature extraction module is: , in, , It is the intermediate feature map of the calculation process; is the output of the first feature extraction module; is the input feature map; is the output of the Transformer module; , and They are the outputs of three dense residual modules; It is a channel splicing operation; yes Convolution operation; A convolution branch is added to the shallow convolution module to obtain a second feature extraction module; the calculation formula of the second feature extraction module is: , in, and It is the intermediate feature map of the calculation process; is the output of the second feature extraction module; and They are Convolution operation and Convolution operation; is the input feature map; Is a channel splicing operation A skip connection is added to the asymmetric feature fusion module to obtain a multi-feature fusion module; the calculation formula of the multi-feature fusion module is: , in, is the i-th input feature map; is the size adjustment operation of the i-th input feature map; is the output of the i-th input feature map after resizing; , and It is the intermediate feature map of the calculation process; is the output of the multi-feature fusion module.
Citation Information
Patent Citations
Multi-stage progressive underwater image enhancement method
CN114445292A
Image deblurring method and system based on improved UNet network
CN116703786A