Code scanning image optimization method for flat panel camera
By acquiring color and depth images from a flat-panel camera for registration and distortion correction, and combining edge detection with optimized image processing, the problems of dynamic blur and high computational complexity in flat-panel camera barcode recognition are solved, thus improving recognition accuracy and efficiency.
Patent Information
- Application Number
- CN202511078270.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-01
- Publication Date
- 2025-11-18
- Estimated Expiration
- 2045-08-01
AI Technical Summary
In existing technologies, flat panel cameras suffer from dynamic blurring during barcode recognition, and the computational complexity is high, resulting in reduced recognition efficiency and accuracy.
The original color and depth images are acquired based on the initial scanning parameters. The depth image is registered and processed to determine the key pixel regions and distortion types. Distortion correction is performed, and the optimization method is determined by edge detection and image evaluation values. The scanning parameters are then adjusted to optimize the image.
It improves the accuracy and efficiency of barcode recognition, reduces the impact of blur and noise, and ensures high-quality barcode images under different conditions.
Smart Images

Figure CN120976058A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of image processing, and in particular to a scan code image optimization method for a tablet camera. BACKGROUND
[0002] In the fields of logistics, warehousing and industrial automation, barcode recognition is an important means to realize fast information acquisition and management. Tablet devices are widely used as handheld terminals for barcode scanning operations. Compared with mobile phone cameras, tablet cameras have the advantages of larger field of view and higher resolution. However, there are some limitations in practical applications. For example, there are differences in the pictures between tablet cameras and mobile phone cameras, which makes it difficult for the original scan code software to correctly recognize the barcode. In addition, in order to pursue thin and light design, the aperture of the tablet camera lens is small and the depth of field is large, which causes the barcode edges to be easily blurred in imaging. Traditional image interpolation algorithms (such as bicubic interpolation) only calculate weights based on pixel distance, which exacerbates blurring in the edge area due to the "smoothing assumption", reduces the barcode contrast, and reduces the accuracy and efficiency of barcode recognition.
[0003] Chinese Patent Publication No. CN120298268A discloses a blurred barcode image processing method and system fusing super-resolution repair. The method includes obtaining a barcode image containing dynamic blur, detecting a blurred area formed by a motion trajectory superimposed in the barcode image based on the spatiotemporal continuity feature of the dynamic blur, extracting an edge diffusion direction of the blurred area, generating a multi-scale detail layer for the blurred area according to the edge diffusion direction, inputting the multi-scale detail layer into a fusion repair module, alternately performing super-resolution reconstruction guided by local high-frequency information and morphological repair of module gaps, generating a repaired high-resolution barcode image, performing edge sharpening and noise suppression on the high-resolution barcode image, and outputting a clear image that meets the barcode decoding standard.
[0004] The existing technology has the following problems: only the influence of dynamic blur caused by the movement of the barcode during the scanning process is considered, the detection of the blurred area is based on the spatiotemporal continuity feature of the dynamic blur, which is difficult to ensure the accuracy of the detection of the blurred area, and the generation of the multi-scale detail layer requires multiple image processing operations, which has high computational complexity. The fusion repair module needs to alternately perform super-resolution reconstruction guided by local high-frequency information and morphological repair, which reduces the efficiency and accuracy of barcode recognition. SUMMARY
[0005] Therefore, the present application provides a scan code image optimization method for a tablet camera to overcome the problems in the prior art that only consider the influence of dynamic blur caused by the movement of the barcode during the scanning process, and have high computational complexity, which reduces the efficiency and accuracy of barcode recognition.
[0006] To achieve the above object, the application provides a code scanning image optimization method for a flat camera, comprising the following steps: Scanning a target barcode area based on initial scanning parameters to obtain an original color image and an original depth image of the target barcode area, and determining a registration depth image based on the original color image and the original depth image; Determining a plurality of key pixel areas based on the registration depth image, and obtaining the area depth distribution characteristics of each key pixel area to determine a barcode key area; Determining the distortion type of the registration depth image based on the grayscale characteristics of the barcode key area, and correcting the distortion of the registration depth image based on the distortion type to obtain a key barcode image; Performing edge detection on the key barcode image to obtain barcode edge characteristics, and determining a barcode image evaluation value based on the barcode edge characteristics; Determining an image optimization mode based on the comparison result of the barcode image evaluation value and a preset evaluation value, including a first optimization mode and a second optimization mode, In the first optimization mode, determining barcode depth distribution characteristics based on the key barcode image, and determining an image optimization weight factor based on the barcode depth distribution characteristics and the barcode edge characteristics to optimize the key barcode image; In the second optimization mode, determining a target scanning parameter based on the barcode image evaluation value and the initial scanning parameter to rescan the target barcode area.
[0007] Further, the process of determining a registration depth image based on the original color image and the original depth image comprises the following steps: Determining a plurality of image feature points based on the original color image, and determining the corresponding mapping feature points of each image feature point on the original depth image; Determining a plurality of key feature point pairs based on the mapping relationship between each image feature point and each mapping feature point; Performing registration processing on the original depth image based on each key feature point pair to obtain the registration depth image.
[0008] Further, the process of determining a plurality of key pixel areas based on the registration depth image comprises the following steps: Dividing the registration depth image into a barcode foreground area and a barcode background area; Determining a plurality of key pixel points based on the pixel point spacing in the barcode foreground area; Clustering each key pixel point to determine a plurality of key pixel areas.
[0009] Further, the process of determining the barcode key region comprises: determining a region depth feature of each of the key pixel regions; determining a region depth representation value of each of the key pixel regions based on the region depth feature of each of the key pixel regions;
[0010] Further, the process of determining the distortion type of the registered depth image comprises: determining a distortion trend representation value based on a comparison result of the grayscale feature of the barcode key region and a preset grayscale feature; determining the distortion type of the registered depth image based on the distortion trend representation value and a preset distortion type comparison table.
[0011] Further, the process of determining the image optimization mode comprises: if the barcode image evaluation value is greater than a preset evaluation value, determining the image optimization mode as a first optimization mode; if the barcode image evaluation value is less than or equal to the preset evaluation value, determining the image optimization mode as a second optimization mode.
[0012] Further, the process of determining the image optimization weight factor comprises: determining a depth mutation region based on the barcode depth distribution feature, and determining a depth weight factor based on a distance between each pixel point in the depth mutation region; determining an edge feature region based on the barcode edge feature, and determining an edge weight factor based on a barcode gradient direction in the edge feature region; determining the image optimization weight factor based on the depth weight factor and the edge weight factor.
[0013] Further, the process of determining the target scanning parameter comprises: determining a parameter adjustment coefficient based on a comparison result of the barcode image evaluation value and a preset evaluation value; determining the target scanning parameter based on the parameter adjustment coefficient and the initial scanning parameter.
[0014] Further, the process of optimizing the key barcode image comprises: performing interpolation processing on the key barcode image based on a preset super-resolution interpolation algorithm and the image optimization weight factor, to obtain a target barcode image after optimization.
[0015] Further, the process of determining the barcode image evaluation value comprises: determining the barcode image evaluation value based on a comparison result of the barcode edge feature and a preset edge feature.
[0016] Compared with the prior art, the present application has the beneficial effects that the present application obtains the original image based on the initial scanning parameters and determines the registered depth image, combines the texture information of the color image and the spatial information of the depth image, ensures one-to-one correspondence of the color image and the depth image at the pixel level through the registration technology, avoids recognition errors caused by alignment errors, and improves the accuracy and robustness of barcode recognition. By determining the key pixel region and obtaining the regional depth distribution feature, the position of the barcode is accurately located through the extraction of the key pixel region, reducing misrecognition, and the analysis of the regional depth distribution feature helps to identify the geometric shape and spatial position of the barcode, improving the accuracy of recognition. Based on the gray feature to determine the distortion type and perform distortion correction, the influence of lens distortion on barcode recognition can be reduced, and the image quality and recognition accuracy can be improved. By performing edge detection on the key barcode image and determining the barcode image evaluation value, edge detection can extract the boundaries of bars and spaces of the barcode, providing data support for subsequent barcode recognition, and the calculation of the barcode image evaluation value can evaluate the quality of the image, providing a basis for subsequent optimization. Based on the barcode image evaluation value, the image optimization mode is determined, and the optimization mode is dynamically selected according to the quality of the barcode image, ensuring that high-quality barcode images can be obtained under different conditions, thereby improving the accuracy of barcode recognition. The first optimization mode is based on depth distribution features and edge features to optimize the image, by optimizing the weight factor, the clarity of the barcode edge is enhanced, the blur is reduced, and the resolution of the image is improved, thereby enhancing the recognizability of the barcode. Further improve the efficiency and accuracy of barcode recognition. The second optimization mode is based on the barcode image evaluation value and the initial scanning parameters to rescan, by adjusting the scanning parameters, the image acquisition process is optimized, and the image quality is improved.
[0017] Further, the present application can improve the accuracy of subsequent registration by determining corresponding mapping 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 mapping feature point, removing abnormal points, and determining a plurality of key feature point pairs, the accuracy of the geometric description between images can be improved, and based on each key feature point pair, the original color image and the original depth image can be accurately registered, ensuring image integrity and reducing barcode recognition problems caused by alignment errors, thereby improving barcode recognition accuracy.
[0018] Further, the present application can reduce the amount of data processing by dividing the registered depth image into a barcode foreground region and a barcode background region, and determining a plurality of key pixel points based on the pixel point spacing in the barcode foreground region. By clustering the key pixel points to determine a plurality of key pixel regions, it is helpful for subsequent feature extraction and barcode recognition, and improves the accuracy and efficiency of barcode recognition.
[0019] Further, the application quantifies the depth features of each key pixel region by determining the regional depth representation value of each key pixel region, reduces the misjudgment caused by a single feature through multi-dimensional feature representation, and accurately identifies the key region of the barcode by comparing the regional depth representation value with the preset depth representation value, thereby reducing misjudgment and improving the accuracy of barcode recognition.
[0020] Further, the application enhances the pixel point weight of the depth mutation region by determining the depth weight factor, reduces the interpolation blur of the cross-depth region, enhances the pixel point weight of the edge feature region by determining the edge weight factor, and reduces the noise of inconsistent edge directions. By comprehensively considering the depth and direction information, the generated image optimization weight factor can more comprehensively reflect the features of the barcode image, improve the clarity and contrast of the barcode image, reduce blur and noise, so that the optimized barcode image can better highlight the barcode edge and improve the accuracy and efficiency of barcode recognition. BRIEF DESCRIPTION OF DRAWINGS
[0021] Figure 1 A flowchart of a barcode image optimization method for a flat camera according to an embodiment of the application is shown in the figure. Figure 2 A flowchart of determining a registered depth image according to an embodiment of the application is shown in the figure. Figure 3 A flowchart of determining a plurality of key pixel regions according to an embodiment of the application is shown in the figure. Figure 4 A logic diagram of determining an image optimization mode according to an embodiment of the application is shown in the figure. DETAILED DESCRIPTION
[0022] In order to make the objects and advantages of the application clearer, the application will be further described below with reference to the embodiments. It should be understood that the specific embodiments described herein are only used to explain the application and do not limit the application.
[0023] The preferred embodiments of the application will be described below with reference to the accompanying drawings. Those skilled in the art should understand that these embodiments are only used to explain the technical principles of the application and are not intended to limit the protection scope of the application.
[0024] It should be noted that in the description of the application, the terms "up", "down", "left", "right", "in", "out" and the like indicate the direction or positional relationship terms based on the direction or positional relationship shown in the drawings, which are only for the convenience of description and do not indicate or imply that the device or element must have a particular orientation, be constructed and operated in a particular orientation, and therefore cannot be understood as a limitation on the application.
[0025] Moreover, it needs to be explained that, in the description of the present application, unless otherwise explicitly specified and limited, the terms "mounting", "connecting", "connecting" should be understood broadly, for example, it can be fixed connection, or detachable connection, or integral connection; it can be mechanical connection, or electrical connection; it can be direct connection, or indirect connection through intermediate medium, or internal communication of two elements. For those skilled in the art, the specific meaning of the above terms in the present application can be understood according to the specific circumstances.
[0026] Please refer to Figures 1-4 shown, Figure 1 The flowchart of the scan code image optimization method for the tablet camera according to the embodiment of the present application is shown in the figure. Figure 2 The flowchart of determining the registration depth image according to the embodiment of the present application is shown in the figure. Figure 3 The flowchart of determining the key pixel region according to the embodiment of the present application is shown in the figure. Figure 4 The logic judgment chart of determining the image optimization mode according to the embodiment of the present application is shown in the figure. The embodiment of the present application provides a scan code image optimization method for the tablet camera, which comprises: Step S1, based on the initial scanning parameters, the target barcode region is scanned to obtain the original color image and the original depth image of the target barcode region, and the registration depth image is determined based on the original color image and the original depth image. Specifically, in the step S1, the process of determining the registration depth image based on the original color image and the original depth image comprises: Step S11, based on the original color image, a plurality of image feature points are determined, and the corresponding mapping feature points of each image feature point are determined on the original depth image. Step S12, based on the mapping relationship between each image feature point and each mapping feature point, a plurality of key feature point pairs are determined. Step S13, based on each key feature point pair, the original depth image is registered to obtain the registration depth image.
[0027] In implementation, based on a feature extraction algorithm (for example, SIFT algorithm, SURF algorithm, ORB algorithm, etc.), image feature points are extracted in the original color image, feature points are extracted on the original depth image using the same feature extraction algorithm, and a feature matching algorithm (for example, FLANN algorithm or BFMatcher algorithm) is used to match the feature points in the color image with the feature points in the depth image to determine the mapping feature points corresponding to each image feature point, each image feature point and the corresponding mapping feature point are determined as a candidate feature point pair, and the candidate feature point pair corresponding to the matching degree between any image feature point and the corresponding mapping feature point greater than a preset matching threshold is determined as a key feature point pair. The least square method or other optimization method is applied to the key feature point pair to calculate the homography matrix from the original depth image to the original color image to perform registration processing on the original depth image to generate a registered depth image. The actual implementer can set the preset matching threshold based on the actual situation, and preferably, the preset matching threshold is set to 0.8-0.9.
[0028] The application can improve the accuracy of subsequent registration by determining the corresponding mapping feature points of the feature points in the original color image in the original depth image. By screening based on the mapping relationship between each image feature point and each mapping feature point, removing abnormal points, and determining a plurality of key feature point pairs, the accuracy of the geometric description between images can be improved. Based on each key feature point pair, the original color image and the original depth image can be accurately registered, the image integrity is ensured, the barcode recognition problem caused by alignment error is reduced, and thus the barcode recognition accuracy is improved.
[0029] In step S2, a plurality of key pixel regions are determined based on the registered depth image, and the regional depth distribution characteristics of each key pixel region are obtained to determine the barcode key region. Specifically, in step S2, the process of determining a plurality of key pixel regions based on the registered depth image includes: In step S21, the registered depth image is regionally divided to obtain a barcode foreground region and a barcode background region. In step S22, a plurality of key pixel points are determined based on the distance between the pixel points in the barcode foreground region. In step S23, each key pixel point is clustered to determine a plurality of key pixel regions.
[0030] In implementation, the registered depth image is regionally divided based on the depth information of each position, the region surrounded by positions greater than a depth threshold is determined as the barcode background region, and the region surrounded by positions less than or equal to the depth threshold is determined as the barcode foreground region. The actual implementer can determine the depth threshold based on the average depth of the corner positions of the registered depth image.
[0031] It can be understood that the pixel points with a distance greater than the preset distance between adjacent pixel points in the barcode foreground region are determined as the key pixel points, and the actual implementer can set the preset distance based on the average of the pixel points in the registration depth image.
[0032] It can be understood that the key pixel points are clustered to obtain a plurality of clustering groups, each clustering group includes at least one key pixel point, the clustering group with a number of key pixel points greater than a preset number is determined as a key clustering group, and the smallest region surrounded by the key pixel points in the key clustering group is determined as the key pixel region. The actual implementer can set the preset number based on the actual situation, and preferably, the preset number is set to 3-5.
[0033] The present application can reduce the data processing amount by dividing the registration depth image into a barcode foreground region and a barcode background region, and determining a plurality of key pixel points based on the distance between the pixel points in the barcode foreground region. By clustering the key pixel points to determine a plurality of key pixel regions, it is helpful for subsequent feature extraction and barcode recognition, and improves the accuracy and efficiency of barcode recognition.
[0034] Specifically, in the step S2, the process of determining the barcode key region includes: Step S24, determining the region depth representation value corresponding to each key pixel region based on the region depth distribution characteristics of each key pixel region; Step S25, determining the barcode key region based on the comparison result of the region depth representation value of each key pixel region and the preset depth representation value.
[0035] In implementation, for any key pixel region, the region depth distribution characteristics are calculated and determined, including depth mean, standard deviation, pixel density, etc. According to the region depth distribution characteristics Y1, Y2, …, Yj, …, Ym of any key pixel region and the preset depth distribution characteristics E1, E2, …, Ej, …, Em, the region depth representation value QS corresponding to the key pixel region is determined, where j=1, 2, …, m, 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 a preset square root determination function; It can be understood that the key pixel region with the area depth representation value greater than the preset depth representation value is determined as the barcode key region. The preset depth representation value can be set by the actual implementer based on the actual situation, and preferably, the preset depth representation value is set to 0.8-0.9.
[0036] The present application quantifies the depth characteristics of each key pixel region by determining the area depth representation value of each key pixel region, reduces the misjudgment caused by a single feature through multi-dimensional feature representation, accurately identifies the barcode key region by comparing the area depth representation value with the preset depth representation value, reduces the misjudgment, and improves the accuracy of barcode identification.
[0037] In step S3, the distortion type of the registered depth image is determined based on the grayscale feature of the barcode key region, and the registered depth image is corrected based on the distortion type to obtain a key barcode image. Specifically, in step S3, the process of determining the distortion type of the registered depth image includes: In step S31, a distortion trend representation value is determined based on the comparison result of the grayscale feature of the barcode key region and the preset grayscale feature. In step S32, the distortion type of the registered depth image is determined based on the distortion trend representation value and a preset distortion type reference table.
[0038] In implementation, the barcode key region is subjected to grayscale processing. As known by those skilled in the art, grayscale processing is a process of converting a color image into a grayscale image, and its basic principle is to make the RGB components of the color image equal, i.e., R=G=B, so as to obtain a grayscale value, which is a prior art and will not be described herein.
[0039] It can be understood that the grayscale feature includes a grayscale mean value, a grayscale standard deviation, a contrast, a correlation, an energy, an entropy, etc. The grayscale mean value is the mean value of the grayscale values of the pixel points of the barcode key region. The grayscale standard deviation is the standard deviation of the grayscale values of the pixel points of the barcode key region. The contrast reflects the degree of difference in grayscale values in the image, and the greater the value, the clearer the texture of the image and the more drastic the grayscale change. The correlation is used to measure the linear correlation of the grayscale values in the image, and reflects the direction and regularity of the image texture. The energy reflects the uniformity of the grayscale distribution and the fineness of the texture of the image, and the greater the energy value, the more regular and uniform the texture of the image. The entropy reflects the complexity of the texture of the image, and the greater the entropy value, the more complex and random the texture of the image. The determination methods thereof are all prior art and will not be described herein.
[0040] It can be understood that the grayscale features YH1, YH2, …, YH i , …, YH nand preset gray scale features EH1, EH2, …, EHn, wherein i = 1, 2, …, n, and n is the number of gray scale features. i , …, EH n determine a distortion trend characteristic value JQ, JQ = sqrt(∑ n i=1 (YH i -EH i ) 2 ), wherein i = 1, 2, …, n, and n is the number of gray scale features.
[0041] It can be understood that the actual implementer can set the preset distortion type table based on the actual situation, for example, the distortion trend characteristic value corresponding to the first distortion type is [0.1-0.3), the distortion trend characteristic value corresponding to the second distortion type is [0.3-0.9), the distortion trend characteristic value corresponding to the third distortion type is greater than or equal to 0.9, and the distortion trend characteristic value corresponding to the no obvious distortion type is less than 0.1.
[0042] It can be understood that for the no obvious distortion type, it indicates that the distortion generated by the registered depth image is small, and the distortion correction can not be performed to improve the data processing efficiency. For the first distortion type, the second distortion type and the third distortion type, the training sample set corresponding to each distortion type can be generated based on the bar code images that pass the qualification test in the historical data, and the neural network model is trained respectively to obtain the distortion correction model corresponding to each distortion type. It is known to those skilled in the art that any model capable of outputting a distortion-corrected image in the prior art falls within the protection scope of the present application, and will not be described here.
[0043] In step S4, edge detection is performed on the key bar code image to obtain bar code edge features, and a bar code image evaluation value is determined based on the bar code edge features; In implementation, the key bar code image is subjected to gray scale processing, and the image after gray scale processing is subjected to edge detection. The method of edge detection is not limited, for example, Sobel operator, Canny operator or Laplacian operator, etc. The edge features include but are not limited to edge intensity, edge density, edge direction consistency, edge curvature, etc. The edge intensity is the total intensity of the edge image, i.e. the sum of the gray scale values of all edge pixels. The edge density is the proportion of edge pixels to total pixels. The edge direction consistency represents the consistency of edge direction, which can be determined by the concentration of direction histogram. The edge curvature represents the bending degree of edge, which can be calculated by the change rate of edge direction.
[0044] Specifically, in the step S5, the process of determining the bar code image evaluation value includes: determining the bar code image evaluation value based on the comparison result of the bar code edge features and the preset edge features.
[0045] In implementation, according to the barcode edge features RT1, RT2, …, RT a , …, RT b and the preset edge features ET1, ET2, …, ET a , …, ET b , the barcode image evaluation value TM is determined, wherein 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 )), and b is the number of edge features, and the actual implementer can set the preset edge features based on actual situation or average value of edge features passing the qualification test in historical data.
[0046] In step S5, the image optimization mode is determined based on the comparison result of the barcode image evaluation value and the preset evaluation value, including a first optimization mode and a second optimization mode, wherein in the first optimization mode, the barcode depth distribution feature is determined based on the key barcode image, and the image optimization weight factor is determined based on the barcode depth distribution feature and the barcode edge feature to optimize the key barcode image; in the second optimization mode, the target scanning parameter is determined based on the barcode image evaluation value and the initial scanning parameter to re-scan the target barcode region.
[0047] Specifically, in step S5, the process of determining the image optimization mode includes: if the barcode image evaluation value is greater than the preset evaluation value, the image optimization mode is determined as the first optimization mode; if the barcode image evaluation value is less than or equal to the preset evaluation value, the image optimization mode is determined as the second optimization mode.
[0048] In implementation, the actual implementer can set the preset evaluation value based on actual situation or average value of barcode image evaluation value passing the qualification test in historical data.
[0049] Specifically, in step S5, the process of determining the image optimization weight factor includes: In step S51, the depth mutation region is determined based on the barcode depth distribution feature, and the depth weight factor is determined based on the distance between each pixel point in the depth mutation region. Step S52, determining an edge feature region based on the barcode edge feature, and determining an edge weight factor based on the barcode gradient direction in the edge feature region; Step S53, determining the image optimization weight factor based on the depth weight factor and the edge weight factor.
[0050] In implementation, the barcode depth distribution feature includes but is not limited to depth mean value, depth histogram, depth gradient, etc. The depth histogram is obtained by counting the distribution of the depth values of the key barcode image (for example, the depth values are divided into several intervals, and the number of pixels in each interval is counted.), and the depth gradient represents the rate of depth change, which can be calculated based on Sobel operator or Laplacian operator.
[0051] It can be understood that the minimum surrounding region with the depth value greater than the depth mean value and the depth gradient greater than the preset minimum depth gradient in the depth histogram is determined as the depth mutation region. The actual implementer can set the preset depth gradient based on the actual situation or the depth gradient mean value.
[0052] It can be understood that the distance between any two adjacent pixel points in the depth mutation region is calculated respectively, the pixel point corresponding to any distance greater than the preset distance is determined as an important pixel point, the sum of the distance between any important pixel point and its adjacent pixel point is determined as the first distance sum, the sum of the distance greater than the preset distance corresponding to the important pixel point is determined as the second distance sum, the ratio of the second distance sum to the first distance sum is determined as the important weight factor corresponding to the important pixel point, and the mean value of the important weight factors corresponding to the important pixel points is determined as the depth weight factor. For example: the distance between any important pixel point and its adjacent pixel point is AY1, AY2, …, AY s , …, AY t , BY1, BY2, …, BY u , …, BY v , where BY u is greater than the preset distance, and AY s is less than or equal to the preset distance, then the first distance sum S1=(∑ t s=1 AY s )+(∑ v u= 1BY u ), the second distance sum S2=∑ v u=1 BY u , and the important weight factor SQ corresponding to the important pixel point is S2 / S1.
[0053] It can be understood that the key barcode image edge is divided into a plurality of edge regions (the key barcode image can be processed by a connected domain analysis algorithm, the connected regions are extracted and uniformly divided into a plurality of edge regions, and the number of divisions is proportional to the area of the connected region), and the barcode edge features of the edge regions are determined to determine the barcode edge image evaluation value, and the barcode edge image evaluation values are sorted, and the edge region corresponding to the largest barcode edge image evaluation value is determined as the edge feature region.
[0054] It can be understood that the barcode horizontal gradient Gx and the vertical gradient Gy of the edge feature region are determined based on a preset gradient determination method (for example, a Sobel operator), to determine the gradient direction θ(x,y)=arctan(Gy(x,y) / Gx(x,y)) of each pixel point, and the gradient directions in the edge feature region are counted to generate a gradient direction histogram (the gradient direction is divided into a plurality of intervals, such as 8-10, and the number of pixel points in each interval is counted), and the ratio of the gradient direction corresponding to the largest number of pixel points to the total number of pixel points is determined as the edge weight factor.
[0055] It can be understood that the product of the depth weight factor and the edge weight factor is determined as the image optimization weight factor.
[0056] The present application enhances the pixel point weight of the depth mutation region by determining the depth weight factor, can reduce the interpolation blur of the cross-depth region, enhances the pixel point weight of the edge feature region by determining the edge weight factor, can reduce the noise of the inconsistent edge direction. Considering the depth and direction information comprehensively, the generated image optimization weight factor can more comprehensively reflect the features of the barcode image, improve the clarity and contrast of the barcode image, reduce the blur and noise, so that the optimized barcode image can better highlight the barcode edge, improve the accuracy and efficiency of barcode recognition.
[0057] Specifically, in the step S5, the process of determining the target scanning parameter includes: Step S54, determining a parameter adjustment coefficient based on the comparison result of the barcode image evaluation value and the preset evaluation value; Step S55, determining the target scanning parameter based on the parameter adjustment coefficient and the initial scanning parameter.
[0058] In implementation, the initial scanning parameter includes an initial exposure time and an 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, and the product of the initial sensitivity and the parameter adjustment coefficient is determined as the target sensitivity.
[0059] Specifically, in the step S5, 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.
[0060] In implementation, the preset super-resolution interpolation algorithm can be a bicubic interpolation algorithm and a super-resolution algorithm based on deep learning, and the image optimization weight factor is determined as an interpolation weight to interpolate the key barcode image.
[0061] The present application obtains the original image based on the initial scanning parameters and determines the registration depth image, combines the texture information of the color image and the spatial information of the depth image, and ensures that the color image and the depth image correspond one by one at the pixel level through the registration technology, avoids recognition errors caused by alignment errors, and improves the accuracy and robustness of barcode recognition. By determining the key pixel region and obtaining the regional depth distribution feature, the position of the barcode is accurately positioned through the extraction of the key pixel region, and the misrecognition is reduced. The analysis of the regional depth distribution feature helps to identify the geometric shape and spatial position of the barcode, and improves the accuracy of recognition. Based on the gray feature, the distortion type is determined and distortion correction is performed, which can reduce the influence of lens distortion on barcode recognition and improve the image quality and recognition accuracy. By performing edge detection on the key barcode image and determining the barcode image evaluation value, edge detection can extract the boundaries of bars and spaces of the barcode, providing data support for subsequent barcode recognition, and the calculation of the barcode image evaluation value can evaluate the quality of the image, providing a basis for subsequent optimization. Based on the barcode image evaluation value, the image optimization method is determined, and the optimization method is dynamically selected according to the quality of the barcode image, ensuring that high-quality barcode images can be obtained under different conditions, thereby improving the accuracy of barcode recognition. The first optimization method is based on depth distribution features and edge features to optimize the image, and through the optimization weight factor, the clarity of the barcode edge is enhanced, the blur is reduced, and the resolution of the image is improved, thereby enhancing the recognizability of the barcode. Further improve the efficiency and accuracy of barcode recognition. The second optimization method is based on the barcode image evaluation value and the initial scanning parameters to rescan, and by adjusting the scanning parameters, the image acquisition process is optimized to improve the image quality.
[0062] So far, the technical solutions of the present application have been described in combination with the preferred embodiments shown in the drawings, but those skilled in the art can easily understand that the protection scope of the present application is obviously not limited to these specific embodiments. Without deviating from the principles of the present application, those skilled in the art can make equivalent changes or replacements to related technical features, and the technical solutions after these changes or replacements will fall within the protection scope of the present application.
Claims
1. A method for optimizing barcode scanning images from a tablet camera, characterized in that, The method comprises the following steps: scanning a target barcode area based on initial scanning parameters to obtain an original color image and an original depth image of the target barcode area, and determining a registered depth image based on the original color image and the original depth image; determining a plurality of key pixel regions based on the registered depth image, and obtaining region depth distribution features of each key pixel region to determine a barcode key region; determining a distortion type of the registered depth image based on grayscale features of the barcode key region, and performing distortion correction on the registered depth image based on the distortion type to obtain a key barcode image; performing edge detection on the key barcode image to obtain barcode edge features, and determining a barcode image evaluation value based on the barcode edge features; determining an image optimization mode based on a comparison result of the barcode image evaluation value and a preset evaluation value, wherein the image optimization mode comprises a first optimization mode and a second optimization mode, wherein, in the first optimization mode, barcode depth distribution features are determined based on the key barcode image, and an image optimization weight factor is determined based on the barcode depth distribution features and the barcode edge features to optimize the key barcode image; in the second optimization mode, target scanning parameters are determined based on the barcode image evaluation value and the initial scanning parameters to re-scan 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 a registered depth image based on the original color image and the original depth image comprises: determining a plurality of image feature points based on the original color image, and determining a mapping feature point corresponding to each image feature point on the original depth image; determining a plurality of key feature point pairs based on the mapping relationship between each image feature point and each mapping feature point; performing registration processing on the original depth image based on each key feature point pair to obtain the registered depth image.
3. The method of claim 2, wherein, The process of determining a plurality of key pixel regions based on the registered depth image comprises: performing region division on the registered depth image to obtain a barcode foreground region and a barcode background region; determining a plurality of key pixel points based on the distance between pixel points in the barcode foreground region; performing clustering on each key pixel point to determine a plurality of key pixel regions.
4. The method of claim 3, wherein the method further comprises: The process of determining the barcode key region comprises: determining a region depth representation value corresponding to each key pixel region based on the region depth distribution features of each key pixel region; determining the barcode key region based on a comparison result of the region depth representation value of each key pixel region and a preset depth representation value.
5. The method of claim 4, wherein, The process of determining the distortion type of the registered depth image comprises: determining a distortion trend representation value based on a comparison result of the grayscale features of the barcode key region and a preset grayscale feature; determining the distortion type of the registered depth image based on the distortion trend representation value and a preset distortion type reference table.
6. The method of claim 5, wherein the method further comprises: The process of determining the image optimization mode comprises: if the barcode image evaluation value is greater than a preset evaluation value, determining the image optimization mode as the first optimization mode; if the barcode image evaluation value is less than or equal to the preset evaluation value, determining the image optimization mode as the second optimization mode.
7. The method of claim 6, wherein the method further comprises: The process of determining the image optimization weight factor comprises: determining a depth mutation region based on the barcode depth distribution feature, and determining a depth weight factor based on the distance between each pixel point in the depth mutation region; determining an edge feature region based on the barcode edge feature, and determining an edge weight factor based on the barcode gradient direction in the edge feature region; determining the image optimization weight factor based on the depth weight factor and the edge weight factor.
8. The method of claim 7, wherein the method further comprises: The process of determining the target scanning parameter comprises: determining a parameter adjustment coefficient based on the comparison result of the barcode image evaluation value and the preset evaluation value; determining the target scanning parameter based on the parameter adjustment coefficient and the initial scanning parameter.
9. The method of claim 8, wherein, The process of optimizing the key barcode image comprises: performing interpolation processing on the key barcode image based on a preset super-resolution interpolation algorithm and the image optimization weight factor, to obtain an optimized target barcode image.
10. The method of claim 9, wherein the method further comprises: The process of determining the barcode image evaluation value comprises: determining the barcode image evaluation value based on the comparison result of the barcode edge feature and the preset edge feature.
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
Depth image optimization method, terminal and storage medium
CN110322411A
Method and device for correcting two-dimensional code
CN113850100A
Code reader distortion image correcting and decoding method and system based on machine vision
CN120318130A