A code scanning image optimization method for a flat camera
By acquiring color and depth images from a flat-panel camera, performing registration and distortion correction, and optimizing the barcode image, the problems of dynamic blurring and high computational complexity in barcode recognition by flat-panel cameras are solved, thereby improving recognition accuracy and efficiency.
Patent Information
- Application Number
- CN202511078270.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-01
- Publication Date
- 2026-02-17
- Estimated Expiration
- 2045-08-01
AI Technical Summary
In existing technologies, flat panel cameras suffer from dynamic blurring during barcode recognition, resulting in low recognition accuracy and efficiency, as well as high computational complexity.
By acquiring the original color image and depth image based on the initial scanning parameters, determining the registration depth image, extracting key pixel regions and edge features, performing distortion correction and image optimization, and selecting appropriate optimization methods to improve the accuracy and efficiency of barcode recognition.
It improves the accuracy and efficiency of barcode recognition, reduces the impact of blur and noise, and ensures image quality and robustness of recognition.
Smart Images

Figure CN120976058B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and in particular to a method for optimizing barcode images scanned by a flat panel camera. Background Technology
[0002] In logistics, warehousing, and industrial automation, barcode recognition is a crucial means of achieving rapid information acquisition and management. Tablet devices, as handheld terminals, are widely used for barcode scanning. Compared to mobile phone cameras, tablet cameras offer advantages such as a wider field of view and higher resolution, but they also have some limitations in practical applications. For example, the image quality of tablet cameras differs from that of mobile phone cameras, making it difficult for existing barcode scanning software to correctly recognize barcodes. Furthermore, in pursuit of a slim design, tablet camera lenses have smaller apertures and larger depths of field, leading to blurring at barcode edges during imaging. Traditional image interpolation algorithms (such as bicubic interpolation) calculate weights based solely on pixel distance, exacerbating blurring in edge areas due to the "smoothing assumption," reducing bar-to-space contrast, and decreasing the accuracy and efficiency of barcode recognition.
[0003] Chinese Patent Publication No. CN120298268A discloses a method and system for processing blurred barcode images with fusion super-resolution restoration. The method involves acquiring a barcode image containing dynamic blur, detecting blurred regions formed by superimposed motion trajectories in the barcode image based on the spatiotemporal continuity characteristics of dynamic blur, extracting the edge diffusion direction of the blurred regions, generating multi-scale detail layers based on the edge diffusion direction, inputting the multi-scale detail layers into a fusion restoration module, and generating a restored high-resolution barcode image by alternately performing local high-frequency information-guided super-resolution reconstruction and morphological restoration between modules. Finally, the high-resolution barcode image undergoes edge sharpening and noise suppression to output a clear image conforming to barcode decoding standards.
[0004] The existing technology has the following problems: it only considers the impact of dynamic blur caused by the movement of the barcode during scanning, and it is difficult to guarantee the accuracy of blur region detection based on the spatiotemporal continuity characteristics of dynamic blur. In addition, generating multi-scale detail layers requires multiple image processing operations, which has high computational complexity. The fusion and repair module needs to alternately perform super-resolution reconstruction and morphological repair guided by local high-frequency information, which reduces the efficiency and accuracy of barcode recognition. Summary of the Invention
[0005] To address this, the present invention provides a method for optimizing barcode scanning images using a tablet camera, thereby overcoming the problems of existing technologies that only consider the dynamic blurring caused by the movement of the barcode during scanning, as well as the high computational complexity, which leads to reduced efficiency and accuracy of barcode recognition.
[0006] To achieve the above objectives, the present invention provides a method for optimizing barcode scanning images from a tablet camera, comprising:
[0007] The target barcode area is scanned based on the initial scanning parameters to obtain the original color image and the original depth image of the target barcode area, and the registration depth image is determined based on the original color image and the original depth image.
[0008] Based on the registered depth image, several key pixel regions are determined, and the regional depth distribution characteristics of each key pixel region are obtained to determine the key regions of the barcode.
[0009] The distortion type of the registration depth image is determined based on the grayscale features of the key barcode region, and the distortion of the registration depth image is corrected based on the distortion type to obtain the key barcode image.
[0010] Edge detection is performed on the key barcode image to obtain barcode edge features, and a barcode image evaluation value is determined based on the barcode edge features;
[0011] The image optimization method is determined based on the comparison between the barcode image evaluation value and the preset evaluation value, including a first optimization method and a second optimization method.
[0012] In the first optimization method, the barcode depth distribution features are determined based on the key barcode image, and the image optimization weight factor is determined based on the barcode depth distribution features and the barcode edge features, so as to optimize the key barcode image.
[0013] In the second optimization method, target scanning parameters are determined based on the barcode image evaluation value and the initial scanning parameters, so as to rescan the target barcode area.
[0014] Furthermore, the process of determining the registration depth image based on the original color image and the original depth image includes:
[0015] Based on the original color image, several image feature points are determined, and the corresponding mapping feature points are determined on the original depth image;
[0016] Several key feature point pairs are determined based on the mapping relationship between each of the image feature points and each of the mapped feature points;
[0017] The original depth image is registered based on each of the key feature points to obtain the registered depth image.
[0018] Furthermore, the process of determining several key pixel regions based on the registered depth image includes:
[0019] The registered depth image is divided into regions to obtain the barcode foreground region and the barcode background region;
[0020] Several key pixels are determined based on the pixel spacing within the foreground area of the barcode;
[0021] Cluster the key pixels to determine several key pixel regions.
[0022] Furthermore, the process of determining the key areas of the barcode includes:
[0023] The region depth representation value corresponding to each key pixel region is determined based on the region depth distribution characteristics of each key pixel region.
[0024] The key regions of the barcode are determined based on the comparison between the regional depth representation value of each key pixel region and the preset depth representation value.
[0025] Furthermore, the process of determining the distortion type of the registered depth image includes:
[0026] The distortion trend characterization value is determined based on the comparison result between the grayscale features of the key areas of the barcode and the preset grayscale features;
[0027] The distortion type of the registered depth image is determined based on the distortion trend characterization value and a preset distortion type lookup table.
[0028] Furthermore, the process of determining the image optimization method includes:
[0029] If the barcode image evaluation value is greater than the preset evaluation value, then the image optimization method is determined to be the first optimization method;
[0030] If the barcode image evaluation value is less than or equal to the preset evaluation value, then the image optimization method is determined to be the second optimization method.
[0031] Furthermore, the process of determining the image optimization weight factors includes:
[0032] Depth abrupt change regions are determined based on the barcode depth distribution characteristics, and depth weighting factors are determined based on the pixel spacing within the depth abrupt change regions.
[0033] The edge feature region is determined based on the barcode edge features, and the edge weight factor is determined based on the barcode gradient direction within the edge feature region;
[0034] The image optimization weight factor is determined based on the depth weight factor and the edge weight factor.
[0035] Furthermore, the process of determining the target scanning parameters includes:
[0036] The parameter adjustment coefficient is determined based on the comparison result between the barcode image evaluation value and the preset evaluation value;
[0037] The target scanning parameters are determined based on the parameter adjustment coefficients and the initial scanning parameters.
[0038] Furthermore, the process of optimizing the key barcode image includes:
[0039] The key barcode image is interpolated based on a preset super-resolution interpolation algorithm and the image optimization weight factor to obtain an optimized target barcode image.
[0040] Furthermore, the process of determining the evaluation value of the barcode image includes:
[0041] The evaluation value of the barcode image is determined based on the comparison result between the barcode edge features and the preset edge features.
[0042] Compared with existing technologies, the advantages of this invention are as follows: This invention acquires the original image based on initial scanning parameters and determines the registration depth image. Combining the texture information of the color image and the spatial information of the depth image, registration technology ensures a one-to-one correspondence between the color image and the depth image at the pixel level, avoiding recognition errors caused by alignment mistakes and improving the accuracy and robustness of barcode recognition. By determining key pixel regions and obtaining their depth distribution features, the barcode position is accurately located through key pixel region extraction, reducing misidentification. Analysis of the depth distribution features helps identify the barcode's geometry and spatial location, improving recognition accuracy. Determining the distortion type based on grayscale features and performing distortion correction reduces the impact of lens distortion on barcode recognition, improving image quality and recognition accuracy. Edge detection is performed on key barcode images, and a barcode image evaluation value is determined. Edge detection extracts the boundaries of bars and spaces in the barcode, providing data support for subsequent barcode recognition. The calculation of the barcode image evaluation value assesses image quality and provides a basis for subsequent optimization. Image optimization methods are determined based on barcode image evaluation values. The optimization method is dynamically selected according to the quality of the barcode image to ensure high-quality barcode images are obtained under different conditions, thereby improving the accuracy of barcode recognition. The first optimization method optimizes the image based on depth distribution features and edge features. By optimizing weight factors, the clarity of barcode edges is enhanced, blurring is reduced, and image resolution is improved, thus enhancing barcode recognizability. This further improves the efficiency and accuracy of barcode recognition. The second optimization method rescans based on the barcode image evaluation value and initial scanning parameters. By adjusting the scanning parameters, the image acquisition process is optimized, improving image quality.
[0043] Furthermore, this invention improves the accuracy of subsequent registration by determining the corresponding mapped feature points in the original depth image for feature points in the original color image. By filtering based on the mapping relationship between each image feature point and each mapped feature point to remove outliers and identify several key feature point pairs, the accuracy of the geometric description between images can be improved. Registration based on these key feature point pairs enables precise registration between the original color image and the original depth image, ensuring image integrity and reducing barcode recognition problems caused by alignment errors, thereby improving barcode recognition accuracy.
[0044] Furthermore, this invention divides the registered depth image into a barcode foreground region and a barcode background region, and determines several key pixels based on the pixel spacing within the barcode foreground region. This reduces the amount of data processing. By clustering the key pixels to determine several key pixel regions, it facilitates subsequent feature extraction and barcode recognition, thereby improving the accuracy and efficiency of barcode recognition.
[0045] Furthermore, by determining the regional depth representation value of each key pixel region, the present invention quantifies the depth features of each key pixel region. Through multi-dimensional feature representation, it reduces misjudgments caused by a single feature. By comparing the regional depth representation value with the preset depth representation value, it can accurately identify the key regions of the barcode, reduce misjudgments, and improve the accuracy of barcode recognition.
[0046] Furthermore, this invention enhances the pixel weights in depth-abrupt regions by determining a depth weight factor, thereby reducing interpolation blurring across depth regions. It also enhances the pixel weights in edge feature regions by determining an edge weight factor, reducing noise caused by inconsistent edge orientations. By comprehensively considering both depth and orientation information, the generated image optimization weight factors more comprehensively reflect the features of the barcode image, improving its clarity and contrast, reducing blur and noise. This results in the optimized barcode image better highlighting barcode edges, improving the accuracy and efficiency of barcode recognition. Attached Figure Description
[0047] Figure 1 This is a flowchart illustrating the method for optimizing barcode scanning images using a tablet camera according to an embodiment of the present invention.
[0048] Figure 2 This is a schematic diagram illustrating the process of determining the registration depth image in an embodiment of the present invention;
[0049] Figure 3 This is a flowchart illustrating the process of determining several key pixel regions in an embodiment of the present invention.
[0050] Figure 4 This is a logic decision diagram for determining the image optimization method in an embodiment of the present invention. Detailed Implementation
[0051] To make the objectives and advantages of the present invention clearer, the present invention will be further described below with reference to embodiments; it should be understood that the specific embodiments described herein are merely for explaining the present invention and are not intended to limit the present invention.
[0052] Preferred embodiments of the present invention will now be described with reference to the accompanying drawings. Those skilled in the art should understand that these embodiments are merely illustrative of the technical principles of the present invention and are not intended to limit the scope of protection of the present invention.
[0053] It should be noted that in the description of this invention, the terms "upper", "lower", "left", "right", "inner", "outer", etc., which indicate directions or positional relationships, are based on the directions or positional relationships shown in the accompanying drawings. This is only for the convenience of description and is not intended to indicate or imply that the device or element must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, it should not be construed as a limitation of this invention.
[0054] Furthermore, it should be noted that, in the description of this invention, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in this invention according to the specific circumstances.
[0055] Please see Figures 1-4 As shown, Figure 1 This is a flowchart illustrating the method for optimizing barcode scanning images using a tablet camera according to an embodiment of the present invention. Figure 2 This is a schematic diagram illustrating the process of determining the registration depth image in an embodiment of the present invention; Figure 3 This is a flowchart illustrating the process of determining several key pixel regions in an embodiment of the present invention. Figure 4 This is a logic judgment diagram for determining the image optimization method in an embodiment of the present invention; an embodiment of the present invention provides a method for optimizing barcode scanning images from a tablet camera, including:
[0056] Step S1: Scan the target barcode area based on the initial scanning parameters to obtain the original color image and the original depth image of the target barcode area, and determine the registration depth image based on the original color image and the original depth image.
[0057] Specifically, in step S1, the process of determining the registration depth image based on the original color image and the original depth image includes:
[0058] Step S11: Determine several image feature points based on the original color image, and determine the corresponding mapping feature points for each image feature point on the original depth image;
[0059] Step S12: Determine several key feature point pairs based on the mapping relationship between each image feature point and each mapped feature point;
[0060] Step S13: Register the original depth image based on each of the key feature points to obtain the registered depth image.
[0061] In implementation, image feature points are extracted from the original color image using feature extraction algorithms (e.g., SIFT, SURF, ORB, etc.). The same feature extraction algorithm is then used to extract feature points from the original depth image. A feature matching algorithm (e.g., FLANN or BFMatcher) is used to match the feature points in the color image with those in the depth image to determine the corresponding mapped feature point. Each image feature point and its corresponding mapped feature point are identified as candidate feature point pairs. Candidate feature point pairs with a matching degree greater than a preset matching threshold are identified as key feature point pairs. Least squares or other optimization methods are applied to the key feature point pairs to calculate the homography matrix from the original depth image to the original color image, thereby registering the original depth image and generating a registered depth image. Implementers can set the preset matching threshold based on actual conditions; preferably, the preset matching threshold is set to a range of 0.8 to 0.9.
[0062] This invention improves the accuracy of subsequent registration by determining the corresponding mapped feature points in the original depth image for feature points in the original color image. By filtering based on the mapping relationship between each image feature point and its mapped feature point, outliers are removed, and several key feature point pairs are identified, improving the accuracy of the geometric description between images. Registration based on these key feature point pairs enables precise registration between the original color image and the original depth image, ensuring image integrity and reducing barcode recognition problems caused by alignment errors, thereby improving barcode recognition accuracy.
[0063] Step S2: Based on the registered depth image, determine several key pixel regions and obtain the regional depth distribution characteristics of each key pixel region to determine the key regions of the barcode.
[0064] Specifically, in step S2, the process of determining several key pixel regions based on the registered depth image includes:
[0065] Step S21: Divide the registered depth image into regions to obtain the barcode foreground region and the barcode background region;
[0066] Step S22: Determine several key pixels based on the pixel spacing within the foreground area of the barcode;
[0067] Step S23: Cluster the key pixels to determine several key pixel regions.
[0068] In implementation, regions are divided based on depth information at various locations in the registered depth image. Regions enclosed by locations with depths greater than a depth threshold are defined as the barcode background region, while regions enclosed by locations with depths less than or equal to the depth threshold are defined as the barcode foreground region. In practice, implementers can determine the depth threshold based on the average depth of the corner points in the registered depth image.
[0069] Understandably, pixels in the barcode foreground area whose distance from adjacent pixels is greater than a preset distance are identified as key pixels. In practice, implementers can set the preset distance based on the average value of each pixel in the registration depth image.
[0070] It is understandable that key pixels are clustered to obtain several cluster groups, each containing at least one key pixel. Cluster groups with more than a preset number of key pixels are defined as key cluster groups, and the smallest region enclosed by the key pixels in each key cluster group is defined as the key pixel region. Implementers can set the preset number based on actual conditions; preferably, the preset number ranges from 3 to 5.
[0071] This invention divides the registered depth image into a barcode foreground region and a barcode background region, and determines several key pixels based on the pixel spacing within the barcode foreground region. This reduces the amount of data processing. By clustering the key pixels to determine several key pixel regions, it facilitates subsequent feature extraction and barcode recognition, thereby improving the accuracy and efficiency of barcode recognition.
[0072] Specifically, in step S2, the process of determining the key area of the barcode includes:
[0073] Step S24: Determine the region depth representation value corresponding to each key pixel region based on the region depth distribution characteristics of each key pixel region.
[0074] Step S25: Determine the key regions of the barcode based on the comparison results between the regional depth representation values of each key pixel region and the preset depth representation values.
[0075] In implementation, for any key pixel region, its regional depth distribution characteristics are calculated and determined. These characteristics include the depth mean, standard deviation, and pixel density. Based on the regional depth distribution characteristics Y1, Y2, ..., Yj, ..., Ym of any key pixel region and the preset depth distribution characteristics E1, E2, ..., Ej, ..., Em, the corresponding regional depth representation value QS is determined, where j = 1, 2, ..., m, and m is the number of depth distribution characteristics; QS = (∑ m j=1 Yj×Ej) / (sqrt(∑ m j=1 (Yj) 2 )×sqrt(∑ m j=1 (Ej) 2 )); sqrt() is the default function for determining the square root;
[0076] It is understandable that key pixel regions with depth representation values greater than preset depth representation values are identified as key barcode regions. Implementers can set preset depth representation values based on actual conditions; preferably, the preset depth representation value ranges from 0.8 to 0.9.
[0077] This invention quantifies the depth features of each key pixel region by determining the regional depth representation value of each key pixel region. Through multi-dimensional feature representation, it reduces misjudgments caused by single features. By comparing the regional depth representation value with the preset depth representation value, it can accurately identify the key regions of the barcode, reduce misjudgments, and improve the accuracy of barcode recognition.
[0078] Step S3: Determine the distortion type of the registration depth image based on the grayscale features of the key barcode region, and perform distortion correction on the registration depth image based on the distortion type to obtain the key barcode image;
[0079] Specifically, in step S3, the process of determining the distortion type of the registered depth image includes:
[0080] Step S31: Determine the distortion trend characterization value based on the comparison result between the grayscale features of the key area of the barcode and the preset grayscale features;
[0081] Step S32: Determine the distortion type of the registered depth image based on the distortion trend characterization value and a preset distortion type comparison table.
[0082] In practice, the key areas of the barcode are grayscale processed. As those skilled in the art know, grayscale processing is the process of converting a color image into a grayscale image. Its basic principle is to make the RGB components of the color image equal, that is, R=G=B, so as to obtain the grayscale value. This is existing technology and will not be elaborated further.
[0083] It is understandable that grayscale features include grayscale mean, grayscale standard deviation, contrast, correlation, energy, entropy, etc. The grayscale mean is the average grayscale value of each pixel in the key area of the barcode; the grayscale standard deviation is the standard deviation of the grayscale values of each pixel in the key area of the barcode; contrast reflects the degree of difference in grayscale values in the image. The larger the value, the clearer the texture of the image and the more drastic the grayscale changes; correlation measures the linear correlation of grayscale values in the image, reflecting the direction and regularity of the image texture; energy reflects the uniformity of the grayscale distribution and the coarseness of the texture. The larger the energy value, the more regular and uniform the texture of the image; entropy reflects the complexity of the texture in the image. The larger the entropy value, the more complex the texture of the image and the stronger the randomness. The methods for determining these features are all existing technologies and will not be elaborated here.
[0084] It is understandable that the grayscale features YH1, YH2, ..., YH of the key regions of the barcode are used. i , ..., YH n With preset grayscale features EH1, EH2, ..., EH i , ..., EH n Determine the distortion trend characterization value JQ, JQ=sqrt(∑ n i=1 (YH i -EH i ) 2 ), where i = 1, 2, ..., n, and n is the number of grayscale features.
[0085] Understandably, implementers can set up a preset distortion type comparison table based on the actual situation. For example, the distortion trend characterization value corresponding to the first distortion type is [0.1~0.3], the distortion trend characterization value corresponding to the second distortion type is [0.3~0.9], the distortion trend characterization value corresponding to the third distortion type is greater than or equal to 0.9, and the distortion trend characterization value corresponding to no obvious distortion type is less than 0.1.
[0086] It is understandable that for types with no obvious distortion, indicating that the distortion generated by the registered depth image is small, distortion correction can be omitted to improve data processing efficiency. For the first, second, and third distortion types, training sample sets corresponding to each distortion type can be generated based on barcode images that have passed the conformity inspection in historical data, and neural network models can be trained separately to obtain distortion correction models corresponding to each distortion type. Those skilled in the art will know that any model in the prior art that can output a distortion-corrected image falls within the protection scope of this invention, and will not be elaborated further here.
[0087] Step S4: Perform edge detection on the key barcode image to obtain barcode edge features, and determine the barcode image evaluation value based on the barcode edge features;
[0088] In implementation, the key barcode image is converted to grayscale, and edge detection is performed on the grayscale image. The edge detection method is not limited, such as the Sobel operator, Canny operator, or Laplacian operator. Edge features include, but are not limited to, edge strength, edge density, edge orientation consistency, and edge curvature. Edge strength is the total intensity of the edge image, i.e., the sum of the grayscale values of all edge pixels; edge density is the proportion of edge pixels to the total number of pixels; edge orientation consistency represents the consistency of the edge orientation, which can be determined by the concentration of the orientation histogram; edge curvature represents the degree of edge curvature, which can be calculated by the rate of change of the edge orientation.
[0089] Specifically, in step S5, the process of determining the barcode image evaluation value includes:
[0090] The evaluation value of the barcode image is determined based on the comparison result between the barcode edge features and the preset edge features.
[0091] In implementation, based on the barcode edge features RT1, RT2, ..., RT a , ..., RT b With preset edge features ET1, ET2, ..., ET a , ..., ET b Determine the barcode image evaluation value TM, where a = 1, 2, ..., b, TM = (∑ b a=1 RT a ×ET a ) / (sqrt(∑ b a=1 (RT a ) 2 )×sqrt(∑ b a=1 (ET a ) 2 b represents the number of edge features. Implementers can set preset edge features based on the actual situation or the average value of edge features that have passed the qualification test in historical data.
[0092] Step S5: Based on the comparison result between the barcode image evaluation value and the preset evaluation value, determine the image optimization method, including a first optimization method and a second optimization method.
[0093] In the first optimization method, the barcode depth distribution features are determined based on the key barcode image, and the image optimization weight factor is determined based on the barcode depth distribution features and the barcode edge features, so as to optimize the key barcode image.
[0094] In the second optimization method, target scanning parameters are determined based on the barcode image evaluation value and the initial scanning parameters, so as to rescan the target barcode area.
[0095] Specifically, in step S5, the process of determining the image optimization method includes:
[0096] If the barcode image evaluation value is greater than the preset evaluation value, then the image optimization method is determined to be the first optimization method;
[0097] If the barcode image evaluation value is less than or equal to the preset evaluation value, then the image optimization method is determined to be the second optimization method.
[0098] In practice, implementers can set preset evaluation values based on actual conditions or the average evaluation values of barcode images that have passed the qualification inspection in historical data.
[0099] Specifically, in step S5, the process of determining the image optimization weight factor includes:
[0100] Step S51: Determine the depth abrupt change region based on the barcode depth distribution characteristics, and determine the depth weighting factor based on the pixel spacing within the depth abrupt change region;
[0101] Step S52: Determine the edge feature region based on the barcode edge features, and determine the edge weight factor based on the barcode gradient direction within the edge feature region;
[0102] Step S53: Determine the image optimization weight factor based on the depth weight factor and the edge weight factor.
[0103] In implementation, barcode depth distribution features include, but are not limited to, depth mean, depth histogram, and depth gradient. The depth histogram is obtained by statistically analyzing the distribution of depth values in key barcode images (for example, dividing the depth values into several intervals and counting the number of pixels in each interval). The depth gradient represents the rate of depth change and can be calculated using the Sobel operator or the Laplacian operator.
[0104] Understandably, the smallest enclosing region in the depth histogram where the depth value is greater than the mean depth and the depth gradient is greater than a preset depth gradient is defined as a depth abrupt change region. Implementers can set the preset depth gradient based on actual conditions or the mean depth gradient.
[0105] Understandably, within the depth abrupt change region, the distance between any two adjacent pixels is calculated. Pixels with a distance greater than a preset distance are identified as important pixels. The sum of the distances between any important pixel and its adjacent pixels is defined as the first distance sum. The sum of the distances greater than the preset distance for any important pixel is defined as the second distance sum. The ratio of the second distance sum to the first distance sum is defined as the importance weight factor for that important pixel. The average of the importance weight factors for all important pixels is defined as the depth weight factor. For example, the distances between any important pixel and its adjacent pixels are AY1, AY2, ..., AY1. s , ...,AY t BY1, BY2, ..., BY u ... BY v Among them, BY u Greater than the preset spacing, AY s If the first spacing is less than or equal to the preset spacing, then the sum of the first spacings is S1 = (∑ t s=1 AY s )+(∑ v u= 1BY u ), the second spacing and S2=∑ v u=1 BY u The important weight factor corresponding to this important pixel is SQ = S2 / S1.
[0106] Understandably, the key barcode image edges are divided into several edge regions (this can be done by processing the key barcode image using a connected component analysis algorithm, extracting connected components, and uniformly dividing them into several edge regions, with the number of divisions proportional to the area of the connected components). The barcode edge features of these edge regions are then determined to establish a barcode edge image evaluation value. These evaluation values are then ranked, and the edge region corresponding to the highest barcode edge image evaluation value is identified as the edge feature region.
[0107] Understandably, the horizontal gradient Gx and vertical gradient Gy of the barcode in the edge feature region are determined based on a preset gradient determination method (e.g., the Sobel operator) to determine the gradient direction θ(x,y)=arctan(Gy(x,y) / Gx(x,y)) of each pixel. The gradient directions in the edge feature region are statistically analyzed to generate a gradient direction histogram (the gradient directions are divided into several intervals, such as 8 to 10, and the number of pixels in each interval is counted). The ratio of the gradient direction with the most pixels to the total number of pixels is determined as the edge weight factor.
[0108] It is understandable that the product of the depth weight factor and the edge weight factor is used to determine the image optimization weight factor.
[0109] This invention enhances the pixel weights in regions of abrupt depth changes by determining a depth weight factor, thereby reducing interpolation blurring across depth regions. It also enhances the pixel weights in edge feature regions by determining an edge weight factor, reducing noise caused by inconsistent edge orientations. By comprehensively considering both depth and orientation information, the generated image optimization weight factors more comprehensively reflect the features of the barcode image, improving its clarity and contrast, and reducing blur and noise. Consequently, the optimized barcode image better highlights barcode edges, improving the accuracy and efficiency of barcode recognition.
[0110] Specifically, in step S5, the process of determining the target scanning parameters includes:
[0111] Step S54: Determine the parameter adjustment coefficient based on the comparison result between the barcode image evaluation value and the preset evaluation value;
[0112] Step S55: Determine the target scanning parameters based on the parameter adjustment coefficients and the initial scanning parameters.
[0113] In practice, the initial scanning parameters include the initial exposure time and the initial sensitivity. The ratio of the barcode image evaluation value to the preset evaluation value is determined as the parameter adjustment coefficient. The product of the initial exposure time and the parameter adjustment coefficient is determined as the target exposure time. The product of the initial sensitivity and the parameter adjustment coefficient is determined as the target sensitivity.
[0114] Specifically, in step S5, the process of optimizing the key barcode image includes:
[0115] The key barcode image is interpolated based on a preset super-resolution interpolation algorithm and the image optimization weight factor to obtain an optimized target barcode image.
[0116] In implementation, the preset super-resolution interpolation algorithm can be a bicubic interpolation algorithm or a deep learning-based super-resolution algorithm, and the image optimization weight factor is determined as the interpolation weight to perform interpolation processing on the key barcode image.
[0117] This invention acquires the original image based on initial scanning parameters and determines the registration depth image. Combining the texture information of the color image and the spatial information of the depth image, registration technology ensures a one-to-one correspondence between the color and depth images at the pixel level, avoiding recognition errors caused by alignment mistakes and improving the accuracy and robustness of barcode recognition. By identifying key pixel regions and obtaining their depth distribution features, the barcode position is accurately located through key pixel region extraction, reducing misidentification. Analysis of the depth distribution features helps identify the barcode's geometry and spatial location, improving recognition accuracy. Based on grayscale features, the distortion type is determined and distortion correction is performed, reducing the impact of lens distortion on barcode recognition and improving image quality and recognition accuracy. Edge detection is performed on key barcode images to determine barcode image evaluation values. Edge detection extracts the boundaries of bars and spaces in the barcode, providing data support for subsequent barcode recognition. The calculation of the barcode image evaluation value assesses image quality and provides a basis for subsequent optimization. Based on the barcode image evaluation value, an image optimization method is determined. The optimization method is dynamically selected according to the barcode image quality, ensuring high-quality barcode images are obtained under different conditions, thereby improving the accuracy of barcode recognition. The first optimization method optimizes the image based on depth distribution and edge features. By optimizing the weighting factors, it enhances the clarity of barcode edges, reduces blurring, and improves image resolution, thereby enhancing barcode recognizability. This further improves the efficiency and accuracy of barcode recognition. The second optimization method rescans based on the barcode image evaluation value and initial scanning parameters. By adjusting the scanning parameters, it optimizes the image acquisition process and improves image quality.
[0118] The technical solution of the present invention has been described above with reference to the preferred embodiments shown in the accompanying drawings. However, it will be readily understood by those skilled in the art that the scope of protection of the present invention is obviously not limited to these specific embodiments. Without departing from the principles of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will all fall within the scope of protection of the present invention.
Claims
1. A method for optimizing barcode scanning images from a tablet camera, characterized in that, include: The target barcode area is scanned based on the initial scanning parameters to obtain the original color image and the original depth image of the target barcode area, and the registration depth image is determined based on the original color image and the original depth image. Based on the registered depth image, several key pixel regions are determined, and the regional depth distribution characteristics of each key pixel region are obtained to determine the key regions of the barcode. The distortion type of the registration depth image is determined based on the grayscale features of the key barcode region, and the distortion of the registration depth image is corrected based on the distortion type to obtain the key barcode image. Edge detection is performed on the key barcode image to obtain barcode edge features, and a barcode image evaluation value is determined based on the barcode edge features; The image optimization method is determined based on the comparison between the barcode image evaluation value and the preset evaluation value, including a first optimization method and a second optimization method. In the first optimization method, the barcode depth distribution features are determined based on the key barcode image, and the image optimization weight factor is determined based on the barcode depth distribution features and the barcode edge features, so as to optimize the key barcode image. In the second optimization method, target scanning parameters are determined based on the barcode image evaluation value and the initial scanning parameters, so as to rescan the target barcode area.
2. The method for optimizing the image of a code scanned by a tablet camera according to claim 1, wherein, The process of determining the registration depth image based on the original color image and the original depth image includes: Based on the original color image, several image feature points are determined, and the corresponding mapping feature points are determined on the original depth image; Several key feature point pairs are determined based on the mapping relationship between each of the image feature points and each of the mapped feature points; The original depth image is registered based on each of the key feature points to obtain the registered depth image.
3. The method of claim 2, wherein, The process of determining several key pixel regions based on the registered depth image includes: The registered depth image is divided into regions to obtain the barcode foreground region and the barcode background region; Several key pixels are determined based on the pixel spacing within the foreground area of the barcode; Cluster the key pixels to determine several key pixel regions.
4. The method of claim 3, wherein the method further comprises: The process of determining the key areas of the barcode includes: The region depth representation value corresponding to each key pixel region is determined based on the region depth distribution characteristics of each key pixel region. The key regions of the barcode are determined based on the comparison between the regional depth representation value of each key pixel region and the preset depth representation value.
5. The method of claim 4, wherein, The process of determining the distortion type of the registered depth image includes: The distortion trend characterization value is determined based on the comparison result between the grayscale features of the key areas of the barcode and the preset grayscale features; The distortion type of the registered depth image is determined based on the distortion trend characterization value and a preset distortion type lookup table.
6. The method of claim 5, wherein the method further comprises: The process of determining the image optimization method includes: If the barcode image evaluation value is greater than the preset evaluation value, then the image optimization method is determined to be the first optimization method; If the barcode image evaluation value is less than or equal to the preset evaluation value, then the image optimization method is determined to be the second optimization method.
7. The method for optimizing barcode scanning images from a tablet camera according to claim 6, characterized in that, The process of determining the image optimization weight factors includes: Depth abrupt change regions are determined based on the barcode depth distribution characteristics, and depth weighting factors are determined based on the pixel spacing within the depth abrupt change regions. The edge feature region is determined based on the barcode edge features, and the edge weight factor is determined based on the barcode gradient direction within the edge feature region; The image optimization weight factor is determined based on the depth weight factor and the edge weight factor.
8. The method for optimizing barcode scanning images from a tablet camera according to claim 7, characterized in that, The process of determining the target scanning parameters includes: The parameter adjustment coefficient is determined based on the comparison result between the barcode image evaluation value and the preset evaluation value; The target scanning parameters are determined based on the parameter adjustment coefficients and the initial scanning parameters.
9. The method for optimizing barcode scanning images from a tablet camera according to claim 8, characterized in that, The process of optimizing the key barcode image includes: The key barcode image is interpolated based on a preset super-resolution interpolation algorithm and the image optimization weight factor to obtain an optimized target barcode image.
10. The method for optimizing barcode scanning images from a tablet camera according to claim 9, characterized in that, The process of determining the evaluation value of the barcode image includes: The evaluation value of the barcode image is determined based on the comparison result between the barcode edge features and the preset edge features.
Citation Information
Patent Citations
Fuzzy barcode image processing method and system fused with super-resolution repair
CN120298268A
Non-reference quality evaluation method, apparatus, and system of two-dimensional barcode image
CN108681684A
Code reader distortion image correcting and decoding method and system based on machine vision
CN120318130A