Parameter debugging method and system for identification code decoding
By optimizing brightness parameters and filter selection in stages, the problem of low debugging efficiency of identification code decoding parameters was solved, and efficient and accurate automatic debugging of decoding parameters was achieved.
Patent Information
- Application Number
- CN202510874507.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-27
- Publication Date
- 2025-11-21
AI Technical Summary
In the existing technology, the debugging method of the pre-processing algorithm for identifier code decoding relies on manual experience and lacks a systematic process, resulting in low debugging efficiency and accuracy, and low decoding success rate.
By acquiring test images of the target scene under different brightness parameters, the target frame and region are determined, decoding parameters and filters are adjusted to attempt decoding, decoding difficulty indicators are traversed to determine the best filter, and brightness parameters and filter selection are optimized in stages.
It improves the efficiency and accuracy of debugging the identification code decoding parameters, realizes one-click debugging, and ensures decoding success rate and efficiency.
Smart Images

Figure CN120996060A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of identification code reading technology, and in particular to a parameter debugging method and system for identification code decoding. Background Technology
[0002] One-dimensional and two-dimensional barcode technologies are widely used in logistics, payment, and identity recognition due to their advantages such as large information storage capacity, strong fault tolerance, and fast recognition speed. Algorithms that obtain high-quality images containing identification codes (including one-dimensional and two-dimensional barcodes) and perform appropriate preprocessing are crucial for ensuring efficient and accurate subsequent decoding. The debugging process of such preprocessing algorithms directly affects the final decoding performance.
[0003] In existing technologies, debugging methods for pre-processing algorithms used in identifier code decoding typically rely on manual experience or trial-and-error parameter adjustments. The debugging effectiveness is highly dependent on the experience level of the debugger, lacks a systematic debugging framework, exhibits strong randomness, and is difficult to standardize, resulting in low debugging efficiency and accuracy. Low debugging accuracy leads to a low decoding success rate for the debugged algorithm. Summary of the Invention
[0004] This application provides a method, system, electronic device, and storage medium for debugging parameters of identifier code decoding, so as to at least solve the problem of low efficiency in debugging identifier code decoding parameters in related technologies.
[0005] In a first aspect, embodiments of this application provide a parameter debugging method for identifier code decoding, the method comprising:
[0006] Acquire test images of the target scene under different brightness parameters, determine the target frame from the test images, and use the brightness parameters of the target frame as the target brightness parameters, wherein the test images contain a code to be identified;
[0007] Based on the target brightness parameters, obtain the image of the code to be identified, adjust the decoding parameters and filter to attempt to decode the image of the code to be identified until successful decoding, and obtain the code to be identified parameters and target decoding parameters.
[0008] Based on the target decoding parameters, the candidate filters are traversed, the image to be identified is decoded twice, and the decoding difficulty index of each decoding is obtained. The target filter is determined based on the decoding difficulty index.
[0009] The parameters of the decoding algorithm for the code to be identified are determined based on the code to be identified parameters and the target filter.
[0010] In some embodiments, acquiring test images of the target scene under different brightness parameters and determining the target frame from the test images includes:
[0011] Iterate through the candidate brightness parameters, obtain the test images under different brightness parameters, and use all the test images as a test image set;
[0012] The target region is determined based on the test image set, and image statistical indicators are obtained for the target region within each frame of the test image set.
[0013] The test image with the best image statistical indicators is used as the target frame; or
[0014] The step of acquiring test images of the target scene under different brightness parameters and determining the target frame from the test images includes:
[0015] Acquire test images of the target scene under the current brightness parameters, and use the acquired test images and the current test image as the test image set;
[0016] Based on the test image set, determine the target region and the image statistical indicators of the target region in the current test image;
[0017] The candidate brightness parameters are iterated and the corresponding image statistical indicators are obtained. The target frame is determined in the test image based on the obtained image statistical indicators.
[0018] In some embodiments, determining the target region includes:
[0019] Within each of the test images, the potential region of the code to be identified is determined, and the image information of the potential region is statistically analyzed to obtain the confidence level of the statistical results.
[0020] The potential region with the highest confidence in each test image is selected as the candidate region, and the target region is determined based on the candidate region.
[0021] In some embodiments, the attempt to decode the image to be identified by adjusting the decoding parameters and filters includes:
[0022] Based on the current decoding parameters and the current filter, an attempt is made to decode the image of the code to be identified.
[0023] If decoding is successful, obtain the parameters of the code to be identified, and use the current decoding parameters as the target decoding parameters;
[0024] If decoding fails, adjust the decoding parameters and / or the filter, and continue to attempt decoding.
[0025] In some embodiments, the decoding attempt includes:
[0026] The image of the code to be identified is recognized to determine the location region and number of bits of the code.
[0027] Based on the location region and the number of code bits, the image of the code to be identified is sampled and parsed to obtain the matrix to be decoded;
[0028] Based on the matrix to be decoded and the number of code bits, an attempt is made to decode the code to be identified.
[0029] In some embodiments, the step of recognizing the image of the code to be identified and determining the location region and number of code bits includes:
[0030] Determine the potential region of the code to be identified in the image of the code to be identified, analyze the potential region, and obtain the locator information and PPM information of the code to be identified;
[0031] The location region of the code to be identified is obtained based on the locator information;
[0032] The location region is perspective-transformed into a rectangular region with PPM values within a preset range, and the number of code points is obtained based on the rectangular region and the PPM information; or
[0033] The step of recognizing the image of the code to be identified and determining the location region and number of bits of the code includes:
[0034] Determine the potential region of the code to be identified in the image of the code to be identified;
[0035] Each potential region is matched with a template library, and the preliminary region of the code to be identified is determined based on the matching results;
[0036] Edge filtering is performed on the image to be identified to obtain an edge intensity image, wherein the value of each pixel in the edge intensity image represents the edge intensity of the original image at that location;
[0037] Based on the edge intensity image and the preliminary region projection, the location region and PPM information are determined;
[0038] The location area is perspective-transformed into a rectangular area with a PPM value within a preset range, and the number of code bits is obtained based on the rectangular area and the PPM information.
[0039] In some embodiments, determining the location region and PPM information based on the edge intensity image and the preliminary region projection includes:
[0040] For any edge, project the edge intensity image based on the preliminary region.
[0041] Adjust the projection direction each time to obtain the standard deviation of the projection waveform under different projection directions. The projection waveform is generated based on the pixel value of the edge intensity image. The projection direction with the largest standard deviation is taken as the target direction of the current edge.
[0042] The location region is determined based on the target direction of each edge, and the Fourier transform is performed on the projected waveform under the target direction to obtain the PPM information.
[0043] In some embodiments, the step of attempting to decode the code to be identified based on the matrix to be decoded and the number of code bits includes:
[0044] If the number of code bits falls within the specified number of bits for the code system, the decoding library is invoked to perform error correction on the matrix to be decoded, and decoding is attempted; and / or
[0045] If the number of code bits does not belong to the value specified in the code system, the matrix to be decoded is corrected so that the number of code bits corresponding to the matrix to be decoded conforms to the specified number of code bits. The decoding library is then called to perform error correction processing on the corrected matrix to be decoded, and decoding is attempted.
[0046] Secondly, embodiments of this application provide a parameter debugging system for identifier code decoding, the system comprising:
[0047] A brightness parameter matching module is used to acquire test images of a target scene under different brightness parameters, determine a target frame from the test images, and use the brightness parameters of the target frame as the target brightness parameters, wherein the test images contain a code to be identified;
[0048] The decoding module is used to obtain the image of the code to be identified based on the target brightness parameters, adjust the decoding parameters and filters to attempt to decode the image of the code to be identified, and obtain the code to be identified parameters and target decoding parameters until successful decoding.
[0049] The filter matching module is used to traverse the candidate filters based on the target decoding parameters, perform secondary decoding on the image to be identified, obtain the decoding difficulty index for each decoding, and determine the target filter based on the decoding difficulty index.
[0050] The parameter determination module is used to determine the parameters of the decoding algorithm for the code to be identified based on the code to be identified parameters and the target filter.
[0051] Thirdly, embodiments of this application provide a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the parameter debugging method for decoding the identifier code as described in the first aspect above.
[0052] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the parameter debugging method for identifier code decoding as described in the first aspect above; or a computer-readable storage medium storing a HEX / BIT project file thereon, which, when executed by a field-programmable gate array, implements the parameter debugging method for identifier code decoding as described in the first aspect above.
[0053] Compared to related technologies, the parameter debugging method for identifier code decoding provided in this application involves selecting brightness parameters, decoding parameters, and filters in stages. Specifically, by matching brightness parameters, decoding attempts are made under the optimal brightness parameters to determine the decoding parameters, thus improving the efficiency of decoding parameter determination. Filter matching is then performed based on the successful decoding parameters from the decoding attempts, improving the efficiency of filter matching and thereby solving the problem of low debugging efficiency for identifier code decoding parameters. Attached Figure Description
[0054] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0055] Figure 1 This is a flowchart of a parameter debugging method for decoding an identifier code according to an embodiment of this application;
[0056] Figure 2 This is a flowchart of determining an optimal filter according to an embodiment of this application;
[0057] Figure 3 This is a flowchart of a brightness parameter determination method according to an embodiment of this application;
[0058] Figure 4 This is a flowchart of another method for determining brightness parameters according to an embodiment of this application;
[0059] Figure 5 This is a schematic diagram of a potential region for a code to be identified according to an embodiment of this application;
[0060] Figure 6 This is a flowchart of a decoding attempt according to an embodiment of this application;
[0061] Figure 7 This is a schematic diagram of an edge intensity image projection according to an embodiment of this application;
[0062] Figure 8 This is a structural block diagram of a parameter debugging system for decoding identifier codes according to an embodiment of this application;
[0063] Figure 9This is a schematic diagram of the internal structure of an electronic device according to an embodiment of this application. Detailed Implementation
[0064] To make the objectives, technical solutions, and advantages of this application clearer, the application is described and illustrated below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application. All other embodiments obtained by those skilled in the art based on the embodiments provided in this application without inventive effort are within the scope of protection of this application.
[0065] Obviously, the accompanying drawings described below are merely some examples or embodiments of this application. Those skilled in the art can apply this application to other similar scenarios based on these drawings without any inventive effort. Furthermore, it is understood that although the efforts made in this development process may be complex and lengthy, for those skilled in the art related to the content disclosed in this application, any changes to design, manufacturing, or production based on the technical content disclosed in this application are merely conventional technical means and should not be construed as insufficient disclosure of the content of this application.
[0066] In this application, the reference to "embodiment" means that a specific feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment that is mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described in this application may be combined with other embodiments without conflict.
[0067] Unless otherwise defined, the technical or scientific terms used in this application shall have the ordinary meaning understood by one of ordinary skill in the art to which this application pertains. The terms “a,” “an,” “an,” “the,” and similar words used in this application do not indicate quantity limitation and may indicate singular or plural. The terms “comprising,” “including,” “having,” and any variations thereof used in this application are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or device that includes a series of steps or modules (units) is not limited to the listed steps or units, but may also include steps or units not listed, or may include other steps or units inherent to these processes, methods, products, or devices. The terms “connected,” “linked,” “coupled,” and similar words used in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. “Multiple” used in this application refers to two or more. “And / or” describes the relationship between related objects, indicating that three relationships may exist; for example, “A and / or B” can represent: A alone, A and B simultaneously, and B alone. The character " / " generally indicates that the preceding and following objects are in an "or" relationship. The terms "first," "second," and "third" used in this application are merely to distinguish similar objects and do not represent a specific ordering of the objects.
[0068] This embodiment provides a parameter debugging method for identifier code decoding. Figure 1 This is a flowchart of a parameter debugging method for decoding an identifier code according to an embodiment of this application, as shown below. Figure 1 As shown, the process includes the following steps:
[0069] Step S101: Obtain test images of the target scene under different brightness parameters, determine the target frame from the test images, and use the brightness parameters of the target frame as the target brightness parameters. The test images contain the code to be identified.
[0070] In this embodiment, the code to be identified includes one-dimensional and two-dimensional codes. Brightness parameters include, but are not limited to, exposure time, gain, and light source type. Light source type includes combinations of different forms of light, such as visible / invisible light, blue / red / white light, and uniform / polarized / direct light.
[0071] Optionally, a brightness parameter lookup table is constructed based on the candidate brightness parameters. By controlling variables, the brightness parameter lookup table is traversed, and the code to be identified is captured under different exposure times, gains, or light source types to obtain test images. The brightness parameters of each obtained test image are scored, and the optimal brightness parameter is determined based on the scoring results as the target brightness parameter.
[0072] Step S102: Obtain the image of the code to be identified based on the target brightness parameters, adjust the decoding parameters and filter to attempt to decode the image of the code to be identified until decoding is successful, and obtain the parameters of the code to be identified and the target decoding parameters.
[0073] The parameters of the code to be identified include, but are not limited to, the code system, the number of bits, the PPM value, the size of the code, the grayscale histogram, and the location area of the code. The decoding parameters include, but are not limited to, the pyramid layer, the background color (black / white), and the matching template.
[0074] This embodiment ensures that the image to be identified is acquired under optimal brightness parameters, thereby improving the efficiency of each subsequent decoding step.
[0075] The algorithm iterates through the candidate decoding parameters and filters, executes the decoding algorithm to attempt decoding, and uses the first successfully decoded parameter as the target decoding parameter. It's important to note that the iteration stops once a set of successfully decoded parameters and filters is found. The successfully decoded parameter is then used as the decoding parameter for subsequent filter iterations. This ensures that at least one filter can be successfully decoded during the selection of the optimal filter.
[0076] Step S103: Based on the target decoding parameters, traverse the candidate filters, perform secondary decoding on the image to be identified, and obtain the decoding difficulty index for each decoding. Determine the target filter based on the decoding difficulty index.
[0077] In this embodiment, the filter types traversed include, but are not limited to, gamma filters, tone-mapping filters, erosion-dilation filters, median filters, mean filters, Gaussian filters, and SOBEL filters. It should be noted that the filter used each time during the traversal can be any combination of one, two, or more of the above types.
[0078] It should be noted that step S103 will only be executed after successful decoding in step S102. In step S102, the location region of the code in the image has been obtained, and this location region is processed with a filter to improve the decoding success rate. Figure 2 This is a flowchart illustrating the determination of an optimal filter according to an embodiment of this application. In this embodiment, the purpose of secondary decoding is to find the optimal filter using a decoding difficulty index as the evaluation criterion.
[0079] Step S104: Determine the parameters of the decoding algorithm based on the parameters of the code to be identified and the target filter.
[0080] The code parameters to be identified obtained in step S102 and the target filter obtained in step S103 are used as the code parameters and filter in the decoding algorithm to improve the decoding success rate and decoding efficiency.
[0081] The above steps involve selecting brightness parameters, decoding parameters, and filters in stages. Specifically, the optimal brightness parameters are determined through brightness parameter matching, and decoding attempts are performed under these optimal brightness parameters to obtain the final decoding parameters, improving the efficiency of decoding parameter determination. Filter matching is then performed based on the successfully obtained decoding parameters, improving filter matching efficiency. The obtained code parameters and target filter are used as the decoding parameters for the decoding algorithm, increasing the decoding success rate and efficiency, thus solving the problem of low debugging efficiency for identifier code decoding parameters. Furthermore, when decoding parameter debugging is required, the debugging personnel only need to send a debugging command, and the code reading / decoding device automatically executes the above debugging process, achieving one-click debugging and improving debugging efficiency and accuracy.
[0082] In this embodiment of the application, step S101 provides two optional methods.
[0083] As an optional approach, all test images are obtained by first traversing the brightness parameters, and then statistical evaluation is performed to obtain the target frame. Specifically, step S101 includes:
[0084] Step S201: Traverse the candidate brightness parameters, obtain test images under different brightness parameters, and use all test images as a test image set.
[0085] Step S202: Determine the target region based on the test image set, and obtain image statistical indicators for the target region within each frame of the test image set.
[0086] Step S203: Select the test image with the best image statistical indicators as the target frame.
[0087] In this optional method, after capturing images of the code to be identified based on all candidate brightness parameters, the captured test images are analyzed to obtain image statistical indicators for all test images. It should be noted that in this embodiment, the target area is the region where the code to be identified is most likely to exist. Figure 3 This is a flowchart of a brightness parameter determination method according to an embodiment of this application, such as... Figure 3 As shown, this process can be implemented in the following ways:
[0088] Step S2011: Read the brightness parameter table. Step S2012: Traverse the brightness parameter table and capture images of the code to be identified. In step S2012, the brightness parameter table is traversed first to obtain test images. Step S2021: After traversing all brightness parameters in the brightness parameter table, obtain the image statistical index for each captured image. Step S2031: Select the brightness parameter corresponding to the image with the best image statistical index as the target brightness parameter.
[0089] In this way, after traversing all brightness parameters, the target area only needs to be determined once.
[0090] As an alternative approach, while traversing the brightness parameters to acquire test images, a statistical evaluation is performed on each acquired test image to obtain the target frame. Specifically, step S101 includes:
[0091] Step S301: Obtain a test image of the target scene under the current brightness parameters, and use the obtained test image and the current test image as a test image set;
[0092] Step S302: Based on the test image set, determine the target region and the image statistical indicators of the target region in the current test image;
[0093] Step S303: Traverse the candidate brightness parameters and obtain the corresponding image statistical indicators, and determine the target frame in the test image based on the obtained image statistical indicators.
[0094] It should be noted that the acquired test images refer to all images captured before this image capture. For example, if the current brightness parameter is the 10th set of brightness parameters encountered, then the acquired test images are those captured under the previous 9 sets of brightness parameters. The process involves capturing images of the code to be identified by iterating through the candidate brightness parameters, analyzing the captured images to obtain the image statistical indicators, and finally, after iterating through all candidate brightness parameters, selecting the image with the best image statistical indicators as the target frame. Figure 4 This is a flowchart of another method for determining brightness parameters according to an embodiment of this application, such as... Figure 4 As shown, this process can be implemented in the following ways:
[0095] Step S3011: Read the brightness parameter table. Step S3021: Traverse the brightness parameter table, capture the image to be identified based on the current brightness parameters, and obtain the image statistical indicators of the currently captured image. After acquiring each test image in step S3021, analyze the test image first. Step S3031: After traversing all brightness parameters in the brightness parameter table, select the brightness parameter corresponding to the image with the best image statistical indicators as the target brightness parameter.
[0096] In this way, image statistical index analysis is performed after each test image is acquired. As the number of analyses increases, the accuracy of the analysis results will become higher and higher.
[0097] In both implementation methods described above, steps S202 and S302 employ the same target region determination method. Specifically, determining the target region includes:
[0098] Step S401: Within each test image, determine the potential region of the code to be identified, perform statistical analysis on the image information of the potential region, and obtain the confidence level of the statistical results.
[0099] Optionally, the potential regions where the code to be identified may exist in the image can be analyzed by an algorithm model. The algorithm model includes, but is not limited to, object detection networks such as YOLO SSD or fully convolutional neural networks such as Unet heatmap localization (FCN).
[0100] For a potential region, a trained CNN network is used to obtain the image statistical information of the potential region. The statistical image features include, but are not limited to, gray-level histogram, foreground peak and background peak, and the overall confidence of all features is obtained.
[0101] Step S402: Select the potential region with the highest confidence in each test image as the candidate region, and determine the target region based on the candidate region.
[0102] Based on the confidence level, a candidate region for the code to be identified is determined in each test image. The number of images with the same candidate region is counted, and the candidate region with the most identical images is taken as the region where the code to be identified is most likely to exist, i.e., the target region (denoted as X). Figure 5 This is a schematic diagram of a potential region for a code to be identified according to an embodiment of this application, such as... Figure 5 As shown in the figure, there are 4 test images. The small boxes in each test image are the potential regions of the code to be identified. Among them, the red boxes are the candidate regions with the highest confidence in each image. As can be seen from the figure, the candidate regions of the first and third frames are the same, while the others are different. Therefore, the candidate regions corresponding to the first and third frames are taken as the target regions X where the code to be identified is most likely to exist. The image statistical index at position X (the position of the dashed box) of each image is calculated, and the test image with the best image statistical index is taken as the target frame.
[0103] It should be noted that in step S202, image analysis is performed after all test images have been captured, so the target area only needs to be determined once, and this target area is obtained based on the analysis of all test images; while in step S302, after each test image is captured, the captured test image and all previously captured test images are analyzed, and the target area needs to be re-determined each time the analysis is performed. Here, the target area is obtained based on the captured image and all test images collected before the captured image.
[0104] The image statistical indicators in steps S202 and S302 include, but are not limited to, inter-class variance of pixels, average brightness, and foreground / background peak noise.
[0105] The various indicator data are processed. Optionally, the inter-class variance is normalized to the 0-1 interval, and the difference between the average brightness and the target brightness is normalized to the 0-1 interval. The processed indicators are then weighted and summed to obtain the statistical information score for each test image. The test image with the highest score is selected as the target frame.
[0106] In some embodiments, step S102, which involves adjusting the decoding parameters and filters to attempt decoding the image to be identified, includes:
[0107] Step S1021: Based on the current decoding parameters and the current filter, attempt to decode the image to be identified.
[0108] Step S1022: If decoding is successful, obtain the parameters of the code to be identified and use the current decoding parameters as the target decoding parameters.
[0109] Step S1023: If decoding fails, adjust the decoding parameters and / or filters, and then continue to attempt decoding.
[0110] Optionally, a decoding parameter table is pre-constructed based on the decoding parameters and filters. The parameters in the decoding parameter table include, but are not limited to, pyramid layers, background colors, matching templates, and filter types. The vertical axis of the table represents the parameter type, and the horizontal axis represents the value corresponding to each type of parameter. The table is traversed, and the traversal rules include, but are not limited to, depth-first traversal, breadth-first traversal, or weight-first traversal. The weight of each parameter is obtained based on historical decoding data.
[0111] Figure 6 This is a flowchart of a decoding attempt according to an embodiment of this application, such as... Figure 6 As shown, the process includes:
[0112] Step S501: Read the optimal brightness parameters.
[0113] Step S502: Capture an image of the code to be identified using the optimal brightness parameters.
[0114] Step S503: Iterate through the decoding parameters and attempt to decode. If decoding is successful, record the relevant parameters and end the decoding attempt. If decoding fails, continue to attempt to decode until successful. If decoding is still unsuccessful after iterating through all decoding parameters, the debugging is considered to have failed.
[0115] In some embodiments, the decoding attempt in step S1021 includes:
[0116] Step S601: Recognize the image of the code to be identified and determine the location area and number of bits of the code.
[0117] In one embodiment, step S601 specifically includes:
[0118] S6011, determine the potential region of the code to be identified in the image of the code to be identified, analyze the potential region, and obtain the locator information and PPM information of the code to be identified.
[0119] Optionally, the potential region of the code to be identified in the image is analyzed by an algorithm model, which includes, but is not limited to, object detection networks such as YOLO SSD or fully convolutional neural networks such as Unet heatmap localization (FCN).
[0120] The potential region of the code to be identified is analyzed using a trained CNN network to obtain the potential location of the locator and PPM information. The locator information includes: the L-angle and railway line of the DM code, the positioning and alignment patterns of the QR code, and the start and end positions of the one-dimensional code. PPM (Pixels Per Module) information represents the number of pixels occupied by each module in the image. Here, a module refers to the smallest black and white square unit in the code. A code consists of multiple modules; for example, PPM = 4 means that each module is a 4×4 pixel square.
[0121] During the analysis of potential areas, the code system, PPM information, locator location, and whether the background is white or black were obtained.
[0122] S6012, obtain the location area of the code to be identified based on the locator information.
[0123] Based on the locator information, the four vertices of the precise recovery code are used to obtain the specific location area of the code to be identified.
[0124] S6013 transforms the location area perspective to a rectangular area with PPM values within a preset range, and obtains the number of code bits based on the rectangular area and PPM information.
[0125] Transform the region of the code in the original image into a rectangular region with a PPM value within a preset range (e.g., between 4 and 8). According to actual needs, align the length of the rectangular region (e.g., 8, 16, or 32 pixels) and divide it by the PPM value obtained above to get the number of bits in the code.
[0126] In another embodiment, step S601 specifically includes:
[0127] Step S6014: Determine the potential region of the code to be identified in the image of the code to be identified.
[0128] Optionally, the potential region of the code to be identified in the image is analyzed by an algorithm model, which includes, but is not limited to, object detection networks such as YOLO SSD or fully convolutional neural networks such as Unet heatmap localization (FCN).
[0129] Step S6015: Match each potential region with the template library, and determine the preliminary region of the code to be identified based on the matching results.
[0130] Optionally, the template library contains templates of different sizes and shapes of codes to be identified. Each potential region is matched with the template library to find the potential region that is closest to the template in the template library, and this potential region is used as the initial location region of the code.
[0131] Step S6016: Perform edge filtering on the image to be identified to obtain an edge intensity image. The value of each pixel in the edge intensity image represents the edge intensity of the original image at that location.
[0132] Optionally, the image to be identified can be filtered using an edge filter (e.g., cany, sobel).
[0133] Step S6017: Determine the location region and PPM information based on the edge intensity image and the preliminary region projection.
[0134] In some embodiments, step S6017 specifically includes:
[0135] Step S701: For any edge, project the edge intensity image based on the preliminary region.
[0136] Step S702: Adjust the projection direction each time to obtain the standard deviation of the projection waveform under different projection directions. The projection waveform is generated based on the pixel value of the edge intensity image. The projection direction with the largest standard deviation is taken as the target direction of the current edge.
[0137] Step S703: Determine the location region based on the target direction of each edge, and perform Fourier transform on the projected waveform under the target direction to obtain PPM information.
[0138] The edges of the initial region may be inaccurate. The direction of each edge is corrected through projection. For each edge, within a preset angle range (e.g., ±15°), the projection direction is rotated by a fixed step size (e.g., 1°). At each angle θ, projection is made along the direction perpendicular to θ (i.e., normal projection). The edge intensity values are accumulated onto the projection axis to generate a projected waveform. The standard deviation of the projected waveform is calculated, and the angle that maximizes σ is selected as the accurate direction of the current edge. The standard deviation σ reflects the dispersion of the waveform data; the larger the σ, the more drastic the waveform fluctuations, indicating that the edges are concentrated in the projection direction (i.e., this direction is closer to the true edge normal).
[0139] Figure 7 This is a schematic diagram of an edge intensity image projection according to an embodiment of this application, such as... Figure 7As shown in the figure, m represents the original image of the code to be identified, and m' is the edge intensity image obtained by edge filtering m. The pixel values in the edge intensity image represent edge intensity; white has a value of 255, and black has a value of 0. The edge intensity image is projected, and for each position on the projection axis, all pixel values are accumulated within the projection bandwidth to obtain the projection waveform. The horizontal axis of the projection waveform represents the spatial position along the projection axis, used to locate the precise coordinates of the edge, and the vertical axis represents the accumulated edge intensity values, used to quantify the edge density and identify boundaries. The peaks of the projection waveform correspond to the locations where edge intensity is concentrated; the more prominent the peaks, the more likely they correspond to the true edge of the code to be identified. The standard deviation σ reflects the dispersion of the waveform data, and the projection direction corresponding to the projection waveform with the largest standard deviation is the target direction of the edge. Figure 7 In the above, the projected waveform b1 is obtained by projecting along the direction a1. b1 has obvious peaks and the waveform standard deviation is the largest, so its projection direction is the target direction. The projected waveform b2 is obtained by projecting along the direction a2. b2 has no obvious fluctuations and the waveform standard deviation is small, so its projection direction is not the target direction.
[0140] Perform an FFT (Fast Fourier Transform) on the waveform with the largest standard deviation and extract its main frequency components as the PPM value.
[0141] Step S6018: Transform the location area into a rectangular area with PPM values within a preset range, and obtain the number of code bits based on the rectangular area and PPM information.
[0142] The method for obtaining the number of bits in the code is the same as step S6013.
[0143] After obtaining the location area and number of bits of the code to be identified in step S601, step S601 is executed.
[0144] Step S602: Sample and analyze the image of the code to be identified based on the location region and the number of code bits to obtain the matrix to be decoded.
[0145] Sampling points are evenly distributed within the image at the location of the code to be identified, based on the number of bits in the code. Optionally, the average gray level within each sampling point is obtained through sampling frames of different sizes (e.g., 3x3 and 9x9 sampling frames). If the average gray level of the area corresponding to the smaller sampling frame is lower than that of the area corresponding to the larger sampling frame, the position is considered "black" and recorded as 1; otherwise, the position is considered "white" and recorded as 0. Finally, a 0-1 matrix is generated for decoding.
[0146] Step S603: Based on the matrix to be decoded and the number of code bits, attempt to decode the code to be identified.
[0147] In some embodiments, step S603 specifically includes:
[0148] Step S6031: If the number of code bits belongs to the value of the number of bits specified in the code system, call the decoding library to perform error correction processing on the matrix to be decoded, and attempt decoding.
[0149] Step S6032: If the number of code bits does not belong to the value of the code system's specified number of bits, correct the matrix to be decoded so that the number of code bits corresponding to the matrix to be decoded conforms to the code system's specified number of bits, call the decoding library to perform error correction processing on the corrected matrix to be decoded, and attempt to decode.
[0150] If the calculated number of code bits belongs to a certain value within the code system's specified number of bits, then the decoding library (e.g., the open-source Zxing decoding library) is called to perform error correction processing on the matrix to be decoded (e.g., RS error correction) before attempting decoding.
[0151] If the calculated number of code bits does not belong to any of the specified number of code bits, the matrix to be decoded will be pruned or padded so that the number of code bits corresponding to the 01 matrix is the number of code bits closest to the original number of code bits in the specified number of code bits, and then the decoding library will be called to perform error correction processing on the matrix to be decoded.
[0152] The above method determines the optimal brightness parameters through brightness parameter matching, and then performs decoding attempts under the optimal brightness parameters to obtain the decoding parameters, thus improving the efficiency of decoding parameter determination. Filter selection is only performed after a successful decoding attempt, ensuring that a filter can successfully decode the code under the given decoding parameters. Simultaneously, the location region of the code in the image is obtained during the decoding attempt. Filter matching is then performed based on the successful decoding parameters, and the location region is processed with the filter, improving filter matching efficiency. Finally, the obtained code parameters and target filter are used as the decoding parameters for the decoding algorithm, improving the decoding success rate and decoding efficiency, thereby solving the problem of low efficiency in debugging identifier code decoding parameters.
[0153] When debugging decoding algorithm parameters in a certain environment, the above method allows debuggers to simply send a debugging command to achieve one-click debugging without manually modifying parameters, thus improving debugging efficiency and accuracy.
[0154] It should be noted that the steps shown in the above process or in the flowchart of the accompanying figures can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.
[0155] This embodiment also provides a parameter debugging system for identifier code decoding. This system is used to implement the above embodiments and preferred embodiments, and details already described will not be repeated. As used below, the terms "module," "unit," "subunit," etc., can refer to a combination of software and / or hardware that performs a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0156] Figure 8 This is a structural block diagram of a parameter debugging system for decoding identifier codes according to an embodiment of this application, as shown below. Figure 8 As shown, the system includes:
[0157] The brightness parameter matching module 71 is used to acquire test images of the target scene under different brightness parameters, determine the target frame from the test image, and use the brightness parameters of the target frame as the target brightness parameters. The test image contains the code to be identified.
[0158] Optionally, the brightness parameter can be adjusted by controlling external devices, which include, but are not limited to, an image sensor and a flash.
[0159] The decoding module 72 is used to obtain the image of the code to be identified based on the target brightness parameters, adjust the decoding parameters and filters to attempt to decode the image of the code to be identified, and obtain the parameters of the code to be identified and the target decoding parameters when the decoding is successful.
[0160] The filter matching module 73 is used to traverse the candidate filters based on the target decoding parameters, perform secondary decoding on the image to be identified, obtain the decoding difficulty index for each decoding, and determine the target filter based on the decoding difficulty index.
[0161] The parameter determination module 74 is used to determine the parameters of the decoding algorithm based on the parameters of the code to be identified and the target filter.
[0162] In some embodiments, the brightness parameter matching module 71 includes:
[0163] The first image acquisition module is used to traverse the candidate brightness parameters, acquire test images under different brightness parameters, and use all test images as a test image set.
[0164] The first indicator determination module is used to determine the target region based on the test image set and obtain image statistical indicators for the target region within each frame of the test image set.
[0165] The first target frame determination module is used to select the test image with the best image statistical indicators as the target frame.
[0166] In some embodiments, acquiring test images of the target scene under different brightness parameters and determining the target frame from the test images includes:
[0167] The second image acquisition module is used to acquire test images of the target scene under the current brightness parameters, and uses the acquired test images and the current test image as a test image set.
[0168] The second indicator determination module is used to determine the image statistical indicators of the target region and the target region in the current test image based on the test image set.
[0169] The second target frame determination module is used to traverse the candidate brightness parameters and obtain the corresponding image statistical indicators, and determine the target frame in the test image based on the obtained image statistical indicators.
[0170] In some embodiments, the first indicator determination module and the second indicator determination module include:
[0171] The latent region analysis module is used to determine the latent regions of the code to be identified in each test image, perform statistical analysis on the image information of the latent regions, and obtain the confidence level of the statistical results.
[0172] The target region determination module is used to select the potential region with the highest confidence in each test image as the candidate region, and determine the target region based on the candidate region.
[0173] In some embodiments, the decoding module 72 includes a decoding parameter traversal module, which attempts to decode the image to be identified based on the current decoding parameters and the current filter. If the decoding is successful, the parameters of the code to be identified are obtained, and the current decoding parameters are used as the target decoding parameters. If the decoding is unsuccessful, the decoding parameters and / or the filter are adjusted, and the decoding attempt is continued.
[0174] In some embodiments, the decoding parameter traversal module includes:
[0175] The code information determination module is used to identify the image of the code to be identified and determine the location area and number of bits of the code.
[0176] The module for generating the matrix to be decoded is used to sample and parse the image of the code to be identified based on the location region and the number of code bits to obtain the matrix to be decoded.
[0177] The decoding attempt module is used to attempt to decode the code to be identified based on the matrix to be decoded and the number of bits.
[0178] In some embodiments, the code information determination module includes:
[0179] The analysis module is used to determine the potential regions of the code to be identified in the image, analyze the potential regions, and obtain the locator information and PPM information of the code to be identified.
[0180] The location determination module is used to determine the location area of the code to be identified based on the locator information.
[0181] The code number determination module is used to perform perspective transformation of the location area to a rectangular area with a PPM value within a preset range, and to obtain the code number based on the rectangular area and PPM information.
[0182] In some embodiments, identifying the image of the code to be identified and determining the location region and number of bits of the code includes:
[0183] The preliminary region determination module is used to determine the potential regions of the code to be identified in the image of the code to be identified, match each potential region with the template library, and determine the preliminary region of the code to be identified based on the matching results.
[0184] The edge filtering module is used to perform edge filtering on the image to be identified, and obtain an edge intensity image. The value of each pixel in the edge intensity image represents the edge intensity of the original image at that location.
[0185] The projection module is used to determine the location area and PPM information based on the edge intensity image and the preliminary area projection.
[0186] The code number determination module is used to perform perspective transformation of the location area to a rectangular area with a PPM value within a preset range, and to obtain the code number based on the rectangular area and PPM information.
[0187] In some embodiments, the projection module includes:
[0188] The edge projection module projects the edge intensity image onto any given edge based on the preliminary region.
[0189] The edge determination module adjusts the projection direction each time to obtain the standard deviation of the projection waveform under different projection directions. The projection waveform is generated based on the pixel values of the edge intensity image, and the projection direction with the largest standard deviation is taken as the target direction of the current edge.
[0190] The position and PPM determination module determines the position region based on the target direction of each edge, and performs a Fourier transform on the projected waveform under the target direction to obtain PPM information.
[0191] In some embodiments, the decoding module includes:
[0192] The error correction module is used to call the decoding library to perform error correction processing on the matrix to be decoded if the number of code bits belongs to the value specified by the code system, and then attempt to decode.
[0193] The matrix correction module is used to correct the matrix to be decoded if the number of code bits does not belong to the specified number of code bits, so that the number of code bits corresponding to the matrix to be decoded conforms to the specified number of code bits. The decoding library is then called to perform error correction processing on the corrected matrix to be decoded and to attempt decoding.
[0194] Through the above system, the brightness parameter matching module 71 acquires test images of the target scene under different brightness parameters, determines the target frame from the test images, and uses the brightness parameters of the target frame as the target brightness parameters. The decoding module 72 acquires the image of the code to be identified based on the target brightness parameters, adjusts the decoding parameters and filters to attempt decoding of the image of the code to be identified until successful decoding, and obtains the parameters of the code to be identified and the target decoding parameters. The filter matching module 73 traverses the candidate filters based on the target decoding parameters, performs secondary decoding on the image of the code to be identified, and obtains the decoding difficulty index for each decoding. The target filter is determined based on the decoding difficulty index. The parameter determination module 74 determines the parameters of the decoding algorithm based on the parameters of the code to be identified and the target filter. This solves the problem of low debugging efficiency of the identification code decoding parameters. By matching the brightness parameters, decoding parameters are determined by attempting decoding under the optimal brightness parameters, which improves the efficiency of determining the decoding parameters. Filter matching is performed based on the successful decoding parameters, which improves the efficiency of filter matching.
[0195] It should be noted that the above modules can be either functional modules or program modules, and can be implemented in software or hardware. For modules implemented in hardware, the above modules can be located in the same circuit structure; or the above modules can be located in different circuit structures in any combination. The circuit structure can be a processor, a field-programmable gate array (FPGA), or an application-specific integrated circuit (ASIC).
[0196] This embodiment also provides an electronic device, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.
[0197] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.
[0198] Optionally, in this embodiment, the processor can be configured to perform the following steps via a computer program:
[0199] S1. Obtain test images of the target scene under different brightness parameters, determine the target frame from the test images, and use the brightness parameters of the target frame as the target brightness parameters. The test images contain the code to be identified.
[0200] S2: Obtain the image of the code to be identified based on the target brightness parameters, adjust the decoding parameters and filters to attempt to decode the image of the code to be identified, and obtain the parameters of the code to be identified and the target decoding parameters when the decoding is successful.
[0201] S3: Based on the target decoding parameters, traverse the candidate filters, perform secondary decoding on the image to be identified, and obtain the decoding difficulty index for each decoding. Based on the decoding difficulty index, determine the target filter.
[0202] S4. Determine the parameters of the decoding algorithm based on the parameters of the code to be identified and the target filter.
[0203] It should be noted that the specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementations, and will not be repeated here.
[0204] In one embodiment, Figure 9 This is a schematic diagram of the internal structure of an electronic device according to an embodiment of this application, such as... Figure 9 As shown, an electronic device is provided, which includes, but is not limited to, a code reading device, a decoding device, a mobile phone or tablet with code reading and / or decoding functions, and its internal structure diagram can be as follows. Figure 8 As shown, this electronic device includes a processor, memory, network interface, and database connected via a system bus. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores the operating system, computer programs, and database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The database stores data. The network interface communicates with external terminals via a network connection. When executed by the processor, the computer program implements a parameter debugging method for identifier code decoding.
[0205] Those skilled in the art will understand that Figure 9 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the electronic device to which the present application is applied. The specific electronic device may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements.
[0206] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc.
[0207] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by instructing related hardware through a HEX / BIT project file. The HEX / BIT project file can be stored in a field-programmable gate array (FPGA). When the HEX / BIT project file is executed by the FPGA, it can include the processes of the embodiments of the above methods.
[0208] Those skilled in the art should understand that the technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments have been described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0209] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.
Claims
1. A parameter debugging method for decoding an identifier code, characterized in that, The method includes: Acquire test images of the target scene under different brightness parameters, determine the target frame from the test images, and use the brightness parameters of the target frame as the target brightness parameters, wherein the test images contain a code to be identified; Based on the target brightness parameters, obtain the image of the code to be identified, adjust the decoding parameters and filter to attempt to decode the image of the code to be identified until successful decoding, and obtain the code to be identified parameters and target decoding parameters. Based on the target decoding parameters, the candidate filters are traversed, the image to be identified is decoded twice, and the decoding difficulty index of each decoding is obtained. The target filter is determined based on the decoding difficulty index. The parameters of the decoding algorithm are determined based on the parameters of the code to be identified and the target filter.
2. The method according to claim 1, characterized in that, The step of acquiring test images of the target scene under different brightness parameters and determining the target frame from the test images includes: Iterate through the candidate brightness parameters, obtain the test images under different brightness parameters, and use all the test images as a test image set; The target region is determined based on the test image set, and image statistical indicators are obtained for the target region within each frame of the test image set. The test image with the best image statistical indicators is used as the target frame; or The step of acquiring test images of the target scene under different brightness parameters and determining the target frame from the test images includes: Acquire test images of the target scene under the current brightness parameters, and use the acquired test images and the current test image as the test image set; Based on the test image set, determine the target region and the image statistical indicators of the target region in the current test image; The candidate brightness parameters are iterated and the corresponding image statistical indicators are obtained. The target frame is determined in the test image based on the obtained image statistical indicators.
3. The method according to claim 2, characterized in that, The determined target area includes: Within each of the test images, the potential region of the code to be identified is determined, and the image information of the potential region is statistically analyzed to obtain the confidence level of the statistical results. The potential region with the highest confidence in each test image is selected as the candidate region, and the target region is determined based on the candidate region.
4. The method according to claim 1, characterized in that, The process of adjusting the decoding parameters and filters to attempt to decode the image to be identified includes: Based on the current decoding parameters and the current filter, an attempt is made to decode the image of the code to be identified. If decoding is successful, obtain the parameters of the code to be identified, and use the current decoding parameters as the target decoding parameters; If decoding fails, adjust the decoding parameters and / or the filter, and continue to attempt decoding.
5. The method according to claim 4, characterized in that, The decoding attempt includes: The image of the code to be identified is recognized to determine the location region and number of bits of the code. Based on the location region and the number of code bits, the image of the code to be identified is sampled and parsed to obtain the matrix to be decoded; Based on the matrix to be decoded and the number of code bits, an attempt is made to decode the code to be identified.
6. The method according to claim 5, characterized in that, The step of recognizing the image of the code to be identified and determining the location region and number of bits of the code includes: Determine the potential region of the code to be identified in the image of the code to be identified, analyze the potential region, and obtain the locator information and PPM information of the code to be identified; The location region of the code to be identified is obtained based on the locator information; The location region is perspective-transformed into a rectangular region with PPM values within a preset range, and the number of code points is obtained based on the rectangular region and the PPM information; or The step of recognizing the image of the code to be identified and determining the location region and number of bits of the code includes: Determine the potential region of the code to be identified in the image of the code to be identified; Each potential region is matched with a template library, and the preliminary region of the code to be identified is determined based on the matching results; Edge filtering is performed on the image to be identified to obtain an edge intensity image, wherein the value of each pixel in the edge intensity image represents the edge intensity of the original image at that location; Based on the edge intensity image and the preliminary region projection, the location region and PPM information are determined; The location area is perspective-transformed into a rectangular area with a PPM value within a preset range, and the number of code bits is obtained based on the rectangular area and the PPM information.
7. The method according to claim 6, characterized in that, The step of determining the location region and PPM information based on the edge intensity image and the preliminary region projection includes: For any edge, project the edge intensity image based on the preliminary region. Adjust the projection direction each time to obtain the standard deviation of the projection waveform under different projection directions. The projection waveform is generated based on the pixel value of the edge intensity image. The projection direction with the largest standard deviation is taken as the target direction of the current edge. The location region is determined based on the target direction of each edge, and the Fourier transform is performed on the projected waveform under the target direction to obtain the PPM information.
8. The method according to claim 5, characterized in that, The step of attempting to decode the code to be identified based on the matrix to be decoded and the number of code bits includes: If the number of code bits falls within the specified number of bits for the code system, the decoding library is invoked to perform error correction on the matrix to be decoded, and decoding is attempted; and / or If the number of code bits does not belong to the value specified in the code system, the matrix to be decoded is corrected so that the number of code bits corresponding to the matrix to be decoded conforms to the specified number of code bits. The decoding library is then called to perform error correction processing on the corrected matrix to be decoded, and decoding is attempted.
9. A parameter debugging system for decoding a code to be identified, characterized in that, The system includes: A brightness parameter matching module is used to acquire test images of a target scene under different brightness parameters, determine a target frame from the test images, and use the brightness parameters of the target frame as the target brightness parameters, wherein the test images contain a code to be identified; The decoding module is used to obtain the image of the code to be identified based on the target brightness parameters, adjust the decoding parameters and filters to attempt to decode the image of the code to be identified, and obtain the code to be identified parameters and target decoding parameters until successful decoding. The filter matching module is used to traverse the candidate filters based on the target decoding parameters, perform secondary decoding on the image to be identified, obtain the decoding difficulty index for each decoding, and determine the target filter based on the decoding difficulty index. The parameter determination module is used to determine the parameters of the decoding algorithm based on the parameters of the code to be identified and the target filter.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the parameter debugging method for decoding the identifier code as described in any one of claims 1 to 8.
11. A storage medium, characterized in that, It stores a computer program that, when executed by a processor, implements the parameter debugging method for decoding the identification code as described in any one of claims 1 to 8; or It stores HEX / BIT project files, which, when executed by a field-programmable gate array, implement the parameter debugging method for decoding the identifier code as described in any one of claims 1 to 8.
Citation Information
Patent Citations
Bar code image exposure judgment system and method based on CMOS
CN107124561A
Image coding method and device, image decoding method and device, medium and equipment
CN113542739A
Intelligent imaging optical parameter self-adjusting method
CN114143473A
Automatic parameter adjusting method for fixed code reader
CN116384419A
Determination of image processing parameters in barcode readers
CN119740588A