DM code identification method and device, terminal equipment and computer program product

Through fine positioning processing and DM code unit value prediction model, the problem of low DM code recognition accuracy is solved with low image quality, and accurate recognition in fuzzy and overprinting scenarios is achieved.

CN120449907APending Publication Date: 2025-08-08SHENZHEN YANXIANG JINMA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510534025.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-25
Publication Date
2025-08-08

AI Technical Summary

Technical Problem

In the scenarios with low image quality, the recognition accuracy of DM codes is low, and sampling position errors and misjudgment of unit module values are prone to occur.

Method used

The specifications and fine positioning coordinates of the DM code are obtained through fine positioning processing, affine transformation and image scaling are performed to obtain multiple rows of DM code units; the pixel value calculation is calculated column by column, and the trained DM code unit value prediction model is input, and the unit value prediction model is decoded based on the unit value sequence.

Benefits of technology

In scenarios with low image quality, the recognition accuracy of DM codes is improved, and accurate decoding is achieved in fuzzy and overprinting scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120449907A_ABST
    Figure CN120449907A_ABST
Patent Text Reader

Abstract

The invention relates to a DM code recognition method and device, terminal equipment and a computer program product, and the method comprises the steps: carrying out the fine positioning of a to-be-recognized DM code, and obtaining a specification and a fine positioning coordinate corresponding to the to-be-recognized DM code; according to the fine positioning coordinates and specifications, affine transformation and image scaling are carried out on the to-be-recognized DM code, a corrected DM code is obtained, and the corrected DM code comprises multiple rows of DM code units; carrying out pixel value averaging calculation on pixels in the DM code unit column by column to obtain a pixel value sequence; inputting the pixel value sequence into a trained DM code unit value prediction model to obtain a unit value sequence which is output by the DM code unit value prediction model and corresponds to the DM code unit; and decoding the corrected DM code based on the unit value sequence corresponding to each row of DM code unit to obtain an identification result. Through application of the method and the device, the problem of relatively low DM code recognition accuracy in a scene of relatively low image quality is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of image processing technology, and in particular relates to a DM code recognition method, apparatus, terminal device and computer program product. Background Art

[0002] DM (Data Matrix) code is a two-dimensional matrix barcode composed of black and white modules. It has the characteristics of high information density and strong error correction capability. It is widely used in coding management, warehousing and logistics, industrial manufacturing and other fields.

[0003] Currently, DM codes are often detected and recognized by dividing the code into a grid and comparing the pixel value at the center of each grid with a fixed threshold to determine whether the value of the unit module corresponding to the grid is 0 or 1 (for example, 0 indicates that the unit module is black, and 1 indicates that the unit module is white). However, this recognition method is significantly affected by image quality. In cases of severe image noise, especially blurred images, it is prone to sampling errors (for example, sampling noise points) or misjudging unit module values, which can reduce the recognition accuracy of DM codes.

[0004] Currently, no effective solution has been proposed for the problem in related technologies of low recognition accuracy of DM codes in scenarios with low image quality. Summary of the Invention

[0005] The embodiments of the present application provide a DM code recognition method, apparatus, terminal device, and computer program product to at least solve the problem of low DM code recognition accuracy in scenarios with low image quality in the related art.

[0006] In a first aspect, an embodiment of the present application provides a DM code recognition method, comprising: performing fine positioning processing on the DM code to be recognized to obtain specifications and fine positioning coordinates corresponding to the DM code to be recognized; performing affine transformation and image scaling on the DM code to be recognized according to the fine positioning coordinates and the specifications to obtain a corrected DM code, wherein the corrected DM code includes multiple rows of DM code units; performing pixel value averaging calculation on the pixels in the DM code unit column by column to obtain a pixel value sequence; inputting the pixel value sequence into a trained DM code unit value prediction model to obtain a unit value sequence corresponding to the DM code unit output by the DM code unit value prediction model; decoding the corrected DM code based on the unit value sequence corresponding to the DM code unit in each row to obtain a recognition result.

[0007] In some embodiments, the fine positioning coordinates include the four corner coordinates of the DM code to be identified; performing affine transformation and image scaling on the DM code to be identified according to the fine positioning coordinates and the specifications to obtain the corrected DM code includes: performing affine transformation on the DM code to be identified according to the four corner coordinates to obtain the transformed DM code; performing image scaling on the transformed DM code according to the specification A to obtain the corrected DM code, wherein the image size of the corrected DM code is 4A×4A.

[0008] In some embodiments, the corrected DM code includes A rows of DM code units, and the image size of the DM code units in each row is 4A×4; performing pixel value averaging calculation on the pixels in the DM code units column by column to obtain a pixel value sequence includes: dividing the DM code unit into A unit modules arranged horizontally, wherein each unit module is a matrix composed of 4×4 pixels; for each of the matrices, performing pixel value averaging calculation and normalization processing on the pixels in the matrix column by column to obtain the pixel value sequence with a length of 4A.

[0009] In some embodiments, the DM code unit value prediction model is configured to input a numerical sequence with an input length of 40+8×N, and the DM code unit value prediction model is configured to output a numerical sequence with a length of 10+2×N, wherein N is a specification coefficient: N=(A-10) / 2; inputting the pixel value sequence into the trained DM code unit value prediction model to obtain a unit value sequence corresponding to the DM code unit output by the DM code unit value prediction model includes: inputting the pixel value sequence into the DM code unit value prediction model, and having the DM code unit value prediction model predict the unit prediction value corresponding to each of the unit modules to obtain the unit value sequence, wherein the unit value sequence includes A unit prediction values.

[0010] In some embodiments, before performing fine positioning processing on the DM code to be identified and obtaining the specifications and fine positioning coordinates corresponding to the DM code to be identified, the method also includes: acquiring the image to be processed; using the target detection algorithm to perform coarse positioning processing on the image to be processed to obtain the DM code to be identified.

[0011] In some embodiments, the DM code unit value prediction model is a neural network model constructed based on a one-dimensional convolutional neural network.

[0012] In some embodiments, performing fine positioning processing on the DM code to be identified to obtain specifications and fine positioning coordinates corresponding to the DM code to be identified includes: using the Libdmtx library to perform fine positioning processing on the DM code to be identified to obtain the specifications and fine positioning coordinates corresponding to the DM code to be identified.

[0013] In a second aspect, an embodiment of the present application provides a DM code recognition device, comprising: a fine positioning module, configured to perform fine positioning processing on a DM code to be recognized, and obtain specifications and fine positioning coordinates corresponding to the DM code to be recognized; a correction module, configured to perform affine transformation and image scaling on the DM code to be recognized according to the fine positioning coordinates and the specifications, and obtain a corrected DM code, wherein the corrected DM code includes multiple rows of DM code units; a calculation module, configured to perform pixel value averaging calculation on pixels in the DM code unit column by column, and obtain a pixel value sequence; a prediction module, configured to input the pixel value sequence into a trained DM code unit value prediction model, and obtain a unit value sequence corresponding to the DM code unit output by the DM code unit value prediction model; and a decoding module, configured to decode the corrected DM code based on the unit value sequence corresponding to the DM code units in each row, and obtain a recognition result.

[0014] In a third aspect, an embodiment of the present application provides a terminal device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the DM code recognition method of any one of the above-mentioned first aspects is implemented.

[0015] In a fourth aspect, an embodiment of the present application provides a computer program product, including a computer program. When the computer program is run, the DM code recognition method described in any one of the first aspects is executed.

[0016] Compared to related technologies, the DM code recognition method, apparatus, terminal device, and computer program product provided in the embodiments of the present application obtain the specifications and fine positioning coordinates of the DM code to be identified through fine positioning processing. Based on these specifications and fine positioning coordinates, the DM code to be identified is then affine transformed and scaled to obtain a corrected DM code comprising multiple rows of DM code units. Subsequently, for each row of DM code units, the pixel values within the DM code unit are averaged column by column to obtain a pixel value sequence. This pixel value sequence is input into a trained DM code unit value prediction model to obtain a unit value sequence corresponding to the DM code unit. The unit value sequences corresponding to each row of DM code units are then counted to decode the corrected DM code. The DM code unit value prediction model can predict the unit value sequence corresponding to a DM code unit comprising multiple unit modules. Furthermore, the DM code unit value prediction model can determine the pixel value change trend between each unit module within the DM code unit based on the pixel value sequence. Thus, the DM code unit value prediction model can combine these two methods to predict the unit value corresponding to each unit module within the DM code unit. Therefore, even in low-quality image scenarios, the DM code unit value prediction model can still accurately predict the unit values corresponding to each unit module of the DM code, thereby improving the accuracy of DM code recognition. This application solves the problem of low DM code recognition accuracy in low-quality image scenarios in related technologies, achieving the technical effect of improving DM code recognition accuracy.

[0017] The details of one or more embodiments of the present application are set forth in the following drawings and description to make other features, objects, and advantages of the present application more readily apparent. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the embodiments or descriptions of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0019] Figure 1 is a schematic diagram of sampling a DM code according to the related art;

[0020] Figure 2 is a schematic diagram of sampling a DM code in an image blur scenario according to the related art;

[0021] Figure 3 is a schematic diagram of sampling a DM code in an overprinting scenario according to the related art;

[0022] Figure 4 is a flow chart of a DM code recognition method according to an embodiment of the present application;

[0023] Figure 5 is a flow chart of a DM code recognition method according to another embodiment of the present application;

[0024] Figure 6 2 is a schematic structural diagram of a DM code unit value prediction model according to an embodiment of the present application;

[0025] Figure 7 1 is a structural diagram of a DM code recognition device according to an embodiment of the present application;

[0026] Figure 8 It is a structural diagram of a terminal device according to an embodiment of the present application. DETAILED DESCRIPTION

[0027] In the following description, specific details such as specific system structures and techniques are provided for purposes of illustration rather than limitation to facilitate a thorough understanding of the embodiments of the present application. However, it will be apparent to those skilled in the art that the present application may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid obscuring the description of the present application with unnecessary detail.

[0028] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or collections thereof.

[0029] It will also be understood that the term "and / or" used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.

[0030] As used in this specification and the appended claims, the term "if" can be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.

[0031] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.

[0032] References to "one embodiment" or "some embodiments" in this specification mean that a particular feature, structure, or characteristic described in conjunction with that embodiment is included in one or more embodiments of the present application. Thus, phrases such as "in one embodiment," "in some embodiments," "in other embodiments," and "in other embodiments" appearing in various places in this specification do not necessarily refer to the same embodiment, but rather mean "one or more but not all embodiments," unless otherwise specifically emphasized. The terms "including," "comprising," "having," and variations thereof all mean "including but not limited to," unless otherwise specifically emphasized.

[0033] DM (Data Matrix) code is a two-dimensional matrix barcode composed of black and white modules. It has the characteristics of high information density and strong error correction capability. It is widely used in coding management, warehousing and logistics, industrial manufacturing and other fields.

[0034] Currently, DM codes are often detected and recognized by dividing the code into a grid and comparing the pixel value at the center of each grid with a fixed threshold to determine whether the value of the unit module corresponding to the grid is 0 or 1 (for example, 0 indicates that the unit module is black, and 1 indicates that the unit module is white). However, this recognition method is significantly affected by image quality. In cases of severe image noise, especially blurred images, it is prone to sampling errors (for example, sampling noise points) or misjudging unit module values, which can reduce the recognition accuracy of DM codes.

[0035] As an example, see Figure 1 , Figure 1 FIG. 1 is a schematic diagram of sampling a DM code according to related art. Figure 1 As shown, in a scene with a clear DM code image, after the DM code to be identified is divided into grids, the pixels of each grid are evenly distributed, and the pixel value corresponding to the center point often corresponds to the unit value of the unit module corresponding to the grid.

[0036] However, in the scenario where the DM code image is blurred, the sampling position is easily misplaced due to the unclear edge contour of the DM code, or the step of comparing the pixel value with the fixed threshold due to the slow change of the pixel value may cause an error, resulting in the misjudgment of the unit value of the unit module.

[0037] See Figure 2 , Figure 2 FIG is a schematic diagram of sampling DM code in a blurred image scene according to the related art. Figure 2As shown in the figure, due to the image blur and the presence of more noise, the edge contour of the DM code to be identified is diffused, causing the originally regular edge contour to spread to the adjacent cells. This causes the entire grid to shift to the left during the grid division process, which will cause errors in the subsequent DM code decoding process.

[0038] In addition, due to improper settings of the printer's nozzles, there may be excessive ink in a certain unit module, which will cause the unit modules of the DM code to be recognized to be uneven in size, which will also reduce the recognition accuracy of the DM code. Figure 3 , Figure 3 FIG is a schematic diagram of sampling DM code in an overprinting scenario according to the related art. Figure 3 As shown, due to excessive printing of the image, the sizes of the unit modules of the DM code to be identified are uneven. After the DM code to be identified is divided into grids, the pixel values corresponding to the center points of some grids may not necessarily correspond to the unit values of the unit modules corresponding to the grids, which may also cause errors in the subsequent DM code decoding process.

[0039] Currently, no effective solution has been proposed for the problem in related technologies of low recognition accuracy of DM codes in scenarios with low image quality.

[0040] In view of this, an embodiment of the present application provides a method for identifying a DM code. The method obtains the specifications and fine positioning coordinates of the DM code to be identified through fine positioning processing, and performs affine transformation and image scaling on the DM code to be identified based on the specifications and fine positioning coordinates to obtain a corrected DM code comprising multiple rows of DM code units. Subsequently, for each row of DM code units, the pixel values in the DM code unit are averaged column by column to obtain a pixel value sequence. The pixel value sequence is input into a trained DM code unit value prediction model to obtain a unit value sequence corresponding to the DM code unit. The unit value sequences corresponding to each row of DM code units are counted to decode the corrected DM code. The DM code unit value prediction model can predict the unit value sequence corresponding to a DM code unit comprising multiple unit modules. Furthermore, the DM code unit value prediction model can determine the pixel value transformation trend between each unit module within the DM code unit based on the pixel value sequence. Thus, the DM code unit value prediction model can combine the above two methods to predict the unit value corresponding to each unit module within the DM code unit. Therefore, even in low-quality image scenarios, the DM code unit value prediction model can still accurately predict the unit values corresponding to each unit module of the DM code, thereby improving the accuracy of DM code recognition. This application solves the problem of low DM code recognition accuracy in low-quality image scenarios in related technologies, achieving the technical effect of improving DM code recognition accuracy.

[0041] The following will be combined Figure 4For an explanation of the DM code recognition method provided by an embodiment of the present application, please refer to Figure 4 , Figure 4 : is a flow chart of a DM code recognition method according to an embodiment of the present application. Figure 4 As shown, the method includes:

[0042] Step S401: Perform fine positioning processing on the DM code to be identified to obtain the specifications and fine positioning coordinates corresponding to the DM code to be identified.

[0043] In this embodiment, the Libdmtx library can be used to perform fine positioning processing on the DM code to be identified, and obtain the specifications and fine positioning coordinates corresponding to the DM code to be identified.

[0044] Libdmtx is an open-source software library specifically designed for generating and reading DM codes. It can be used to determine the precise boundary coordinates of the DM code to be recognized, obtain the coordinates of its four corners, and use these four corners as fine positioning coordinates.

[0045] In addition, the Libdmtx library can be used to determine the L-shaped characteristic edge of the DM code to be identified. Based on the number of unit modules on the opposite side of the L-shaped characteristic edge, the format of the DM code to be identified can be determined. The format of the DM code to be identified can be 10×10 (abbreviated as 10), 12×12 (abbreviated as 12), ..., 144×144 (abbreviated as 144), etc.

[0046] In one embodiment, before step S401, the method further includes the following steps:

[0047] Step 1: Obtain the image to be processed.

[0048] Step 2: Use the target detection algorithm to perform coarse positioning processing on the image to be processed to obtain the DM code to be identified.

[0049] In this embodiment, a terminal device with code reading and image acquisition capabilities (e.g., a code reader) can be used to capture an image of the area containing the DM code to obtain an image to be processed. The image to be processed can be preprocessed before subsequent coarse positioning processing. Preprocessing can include grayscale stretching, smoothing filtering, binarization, etc.

[0050] Then, you can use an object detection algorithm (for example, a trained YOLOv8 object detection model) to perform coarse localization processing on the image to obtain the DM code to be recognized. The YOLOv8 object detection model is a convolutional neural network that can predict the location and category of multiple detection boxes at once. It is mainly used for end-to-end object detection and recognition.

[0051] As an example, if the image to be processed includes a DM code to be identified, the YOLOv8 target detection model outputs the position of the detection box corresponding to the DM code to be identified; and the DM code to be identified is obtained according to the position of the detection box.

[0052] Step S402 : performing affine transformation and image scaling on the DM code to be identified according to the fine positioning coordinates and specifications to obtain a corrected DM code, wherein the corrected DM code includes multiple rows of DM code units.

[0053] In this embodiment, since the direction of the DM code to be identified obtained after the rough positioning process may not be positive (i.e., the L-shaped characteristic edge is not located in the lower left corner), and the shape of the DM code to be identified may not be a square, it is necessary to perform an affine transformation (perspective transformation) on the DM code to be identified to convert it into a positive, square-shaped standard DM code.

[0054] Specifically, the above step S402 of "performing affine transformation and image scaling on the DM code to be identified according to the fine positioning coordinates and specifications to obtain a corrected DM code" may include: performing affine transformation on the DM code to be identified according to the four corner coordinates to obtain a transformed DM code; performing image scaling on the transformed DM code according to specification A to obtain a corrected DM code, wherein the image size of the corrected DM code is 4A×4A.

[0055] In this embodiment, since the input of the DM code unit value prediction model has certain format and size requirements, the transformed DM code needs to be image scaled so that the image size of the corrected DM code is 4A×4A.

[0056] As an example, if the specification of the DM code to be identified is 10, the image size of the corrected DM code needs to be 40×40, that is, composed of 1600 pixels.

[0057] The following will be combined Figure 5 The above steps S401 to S402 are further explained. Figure 5 , Figure 5 FIG. 1 is a flow chart of a DM code identification method according to another embodiment of the present application. Figure 5 As shown, the specification of the DM code 501 to be identified is 12, and the direction of the DM code 501 to be identified has a certain offset.

[0058] Affine transformation and image scaling can be performed on the DM code 501 to obtain a corrected DM code 502. The corrected DM code 502 is a standard DM code with a positive square shape. DM code decoding based on the corrected DM code can improve the accuracy of subsequent DM code decoding.

[0059] In addition, since the size of the DM code to be identified 501 is 12, the image size of the corrected DM code 502 can be 48×48, that is, composed of 2304 pixels.

[0060] Step S403 , performing pixel value averaging calculation on the pixels in the DM code unit column by column to obtain a pixel value sequence.

[0061] In this embodiment, the corrected DM code includes A rows of DM code units, and the image size of each row of DM code units is 4A×4. As an example, see Figure 5 , Figure 5 The corrected DM code 502 in includes 12 rows of DM code units 503, and the image size of each row of DM code units 503 is 48×4, that is, each row of DM code units 503 is 48 pixels long and 4 pixels wide.

[0062] In one embodiment, step S403 may include the following steps:

[0063] Step 1: Divide the DM code unit into A unit modules arranged horizontally, wherein each unit module is a matrix consisting of 4×4 pixels.

[0064] Step 2: For each matrix, perform pixel value averaging and normalization processing on the pixels in the matrix column by column to obtain a pixel value sequence with a length of 4A.

[0065] As an example, Figure 5 The DM code unit 503 may include 12 unit modules arranged horizontally, and each unit module is a matrix composed of 4×4 pixels.

[0066] See Figure 5 Each row of DM code units 503 in the corrected DM code 502 can be traversed from top to bottom. A separate analysis is performed on each row of DM code units 503, and pixel values in the matrix corresponding to each unit module are averaged and normalized column by column. Specifically, the calculated pixel values can be normalized from a range of 0 to 255 to a range of 0 to 1 to facilitate subsequent prediction.

[0067] Then, a pixel value sequence 504 of length 48 can be obtained. In this pixel value sequence 504, from left to right, every four pixels can represent a unit module. Compared with calculating the unit value of the unit module corresponding to each grid only by the center point of each grid, the method of using four pixels to represent a unit module has stronger noise resistance. The unit value sequence obtained by inputting the pixel value sequence using four pixels to represent a unit module into the DM code unit value prediction model has higher accuracy.

[0068] Step S404: input the pixel value sequence into the trained DM code unit value prediction model to obtain a unit value sequence corresponding to the DM code unit output by the DM code unit value prediction model.

[0069] In this embodiment, the DM code unit value prediction model is a neural network model built based on a one-dimensional convolutional neural network. Figure 6 , Figure 6 Schematic diagram of the structure of the DM code unit value prediction model according to an embodiment of the present application. Figure 6 As shown, the DM code unit value prediction model is configured to input a numerical sequence with a length of 40+8×N, and the DM code unit value prediction model is configured to output a numerical sequence with a length of 10+2×N, where N is the specification coefficient: N=(A-10) / 2, C1 is the number of module output channels, C2 is the number of module output channels, S is the stride, Pad is the convolution expansion number, ADD represents convolution addition, CONV is the convolution kernel, Relu is the nonlinear function, and Dwise represents depthwise convolution.

[0070] The DM code unit value prediction model may be configured to predict the unit value of the unit module based on pixel values of unit modules surrounding the unit module and pixel value change trends between adjacent unit modules.

[0071] In one embodiment, a pixel value sequence is input into a trained DM code unit value prediction model to obtain a unit value sequence corresponding to the DM code unit output by the DM code unit value prediction model, including: inputting the pixel value sequence into the DM code unit value prediction model, and having the DM code unit value prediction model predict the unit prediction value corresponding to each unit module to obtain a unit value sequence, wherein the unit value sequence includes A unit prediction values.

[0072] See Figure 5 After obtaining the pixel value sequence 504 in step S403, the pixel value sequence 504 can be input into the DM code unit value prediction model to obtain a unit value sequence output by the DM code unit value prediction model. The unit value sequence includes 12 unit prediction values, each of which corresponds to a corresponding unit module in the DM code unit 503. The unit prediction value can be 0 or 1, where 0 indicates that the unit module is black and 1 indicates that the unit module is white.

[0073] In this embodiment, the DM code unit value prediction model can use the pixel values of the unit modules around the unit module and the pixel value change trend between adjacent unit modules to predict the unit value of the unit module. The unit value of each unit module in the DM code is predicted by the DM code unit value prediction model, which can greatly improve the recognition and decoding accuracy of the DM code in fuzzy scenes and other complex scenes (for example, over-printing scenes). At the same time, since DM codes have different specifications and sizes, the DM code unit value prediction model can dynamically adjust the input corresponding size according to the specification size of the DM code and obtain the output size of the corresponding specification, so that there is no need to design multiple models according to the various specifications of the DM code, which can improve the adaptability of the model.

[0074] Step S405 : decoding the corrected DM code based on the unit value sequence corresponding to each row of DM code units to obtain a recognition result.

[0075] In this embodiment, after obtaining the unit value sequence corresponding to each row of DM code units, that is, obtaining the black and white color conditions of each unit module in the corrected DM code, the Libdmtx library can be used to determine the recognition result corresponding to the corrected DM code based on the black and white color conditions of each unit module (the unit prediction value of each unit module).

[0076] Through steps S401 to S405, the specifications and fine positioning coordinates of the DM code to be identified are obtained through fine positioning processing. The DM code to be identified is then affine transformed and scaled based on the specifications and fine positioning coordinates to obtain a corrected DM code comprising multiple rows of DM code units. Subsequently, for each row of DM code units, the pixel values within the DM code unit are averaged column by column to obtain a pixel value sequence. The pixel value sequence is input into a trained DM code unit value prediction model to obtain a unit value sequence corresponding to the DM code unit. The unit value sequences corresponding to each row of DM code units are then counted to decode the corrected DM code. The DM code unit value prediction model can predict the unit value sequence corresponding to a DM code unit comprising multiple unit modules. Furthermore, the DM code unit value prediction model can determine the pixel value change trend between each unit module within the DM code unit based on the pixel value sequence. Thus, the DM code unit value prediction model can combine the above two methods to predict the unit value corresponding to each unit module within the DM code unit. Therefore, even in low-quality image scenarios, the DM code unit value prediction model can still accurately predict the unit values corresponding to each unit module of the DM code, thereby improving the accuracy of DM code recognition. This application solves the problem of low DM code recognition accuracy in low-quality image scenarios in related technologies, achieving the technical effect of improving DM code recognition accuracy.

[0077] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0078] Corresponding to the DM code recognition method described in the above embodiment, Figure 7 A structural diagram of a DM code recognition device according to an embodiment of the present application is shown. For ease of explanation, only the parts related to the embodiment of the present application are shown.

[0079] See Figure 7 The DM code recognition device 7 includes: a fine positioning module 70, used to perform fine positioning processing on the DM code to be recognized, and obtain the specifications and fine positioning coordinates corresponding to the DM code to be recognized; a correction module 71, used to perform affine transformation and image scaling on the DM code to be recognized according to the fine positioning coordinates and specifications, and obtain a corrected DM code, wherein the corrected DM code includes multiple rows of DM code units; a calculation module 72, used to perform pixel value averaging calculation on the pixels in the DM code unit column by column, and obtain a pixel value sequence; a prediction module 73, used to input the pixel value sequence into a trained DM code unit value prediction model, and obtain a unit value sequence corresponding to the DM code unit output by the DM code unit value prediction model; a decoding module 74, used to decode the corrected DM code based on the unit value sequence corresponding to each row of DM code units, and obtain a recognition result.

[0080] In one embodiment, the fine positioning coordinates include the four corner coordinates of the DM code to be identified; the correction module 71 is further used to perform an affine transformation on the DM code to be identified according to the four corner coordinates to obtain a transformed DM code; according to specification A, the transformed DM code is image scaled to obtain a corrected DM code, wherein the image size of the corrected DM code is 4A×4A.

[0081] In one embodiment, the corrected DM code includes A rows of DM code units, and the image size of each row of DM code units is 4A×4; the calculation module 72 is further used to divide the DM code units into A unit modules arranged horizontally, where each unit module is a matrix composed of 4×4 pixels; for each matrix, pixel values in the matrix are averaged and normalized column by column to obtain a pixel value sequence with a length of 4A.

[0082] In one embodiment, the DM code unit value prediction model is configured to input a numerical sequence with an input length of 40+8×N, and the DM code unit value prediction model is configured to output a numerical sequence with an output length of 10+2×N, where N is the specification coefficient: N=(A-10) / 2; the prediction module 73 is also used to input the pixel value sequence into the DM code unit value prediction model, and the DM code unit value prediction model predicts the unit prediction value corresponding to each unit module to obtain a unit value sequence, where the unit value sequence includes A unit prediction values.

[0083] In one embodiment, the DM code recognition device 7 further includes a coarse positioning module for acquiring an image to be processed; and performing coarse positioning processing on the image to be processed using a target detection algorithm to obtain a DM code to be recognized.

[0084] In one embodiment, the DM code unit value prediction model is a neural network model constructed based on a one-dimensional convolutional neural network.

[0085] In one embodiment, the fine positioning module 70 is further configured to use the Libdmtx library to perform fine positioning processing on the DM code to be identified, and obtain specifications and fine positioning coordinates corresponding to the DM code to be identified.

[0086] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of this application. Their specific functions and technical effects can be found in the method embodiment section and will not be repeated here.

[0087] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0088] Figure 8 This is a schematic diagram of the structure of a terminal device according to an embodiment of the present application. Figure 8 As shown, the terminal device 8 includes: at least one processor 80 ( Figure 8Only one is shown in the figure) a processor, a memory 81, and a computer program 82 stored in the memory 81 and executable on at least one processor 80. When the processor 80 executes the computer program 82, the steps in any of the above-mentioned embodiments of the DM code recognition method are implemented.

[0089] The terminal device 8 can be a computing device such as a desktop computer, a notebook, a PDA, or a cloud server. The terminal device 8 can include but is not limited to a processor 80 and a memory 81. It is understood by those skilled in the art that Figure 8 It is only an example of the terminal device 8 and does not constitute a limitation on the terminal device 8. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, it may also include input and output devices, network access devices, etc.

[0090] The processor 80 may be a central processing unit (CPU), or other general-purpose processors, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), an off-the-shelf programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. A general-purpose processor may be a microprocessor or any conventional processor.

[0091] In some embodiments, the memory 81 may be an internal storage unit of the terminal device 8, such as a hard disk or memory of the terminal device 8. In other embodiments, the memory 81 may also be an external storage device of the terminal device 8, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) card, a flash memory card, etc. equipped on the terminal device 8. In other embodiments, the memory 81 may include both an internal storage unit of the terminal device 8 and an external storage device. The memory 81 is used to store an operating system, application programs, a boot loader, data, and other programs, such as the program code of the computer program 82. The memory 81 may also be used to temporarily store data that has been output or is about to be output.

[0092] An embodiment of the present application further provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, the steps in the above-mentioned embodiments of the DM code recognition method can be implemented.

[0093] The embodiments of the present application provide a computer program product. When the computer program product is run on a mobile terminal, the mobile terminal can implement the steps in the above-mentioned embodiments of the DM code recognition method.

[0094] The present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, it can implement the steps of the above-mentioned various method embodiments. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device that can carry the computer program code to the terminal device, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electric carrier signal, a telecommunication signal and a software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk.

[0095] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant description of other embodiments.

[0096] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0097] In the embodiments provided in this application, it should be understood that the disclosed devices / network equipment and methods can be implemented in other ways. For example, the device / network equipment embodiments described above are merely schematic. For example, the division of modules or units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0098] Units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0099] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present application, and should all be included in the scope of protection of the present application.

Claims

1. A DM code recognition method, characterized in that: include: Perform fine positioning processing on the DM code to be identified to obtain specifications and fine positioning coordinates corresponding to the DM code to be identified; performing affine transformation and image scaling on the DM code to be identified according to the fine positioning coordinates and the specifications to obtain a corrected DM code, wherein the corrected DM code includes multiple rows of DM code units; Performing pixel value averaging calculation on the pixels in the DM code unit column by column to obtain a pixel value sequence; Inputting the pixel value sequence into a trained DM code unit value prediction model to obtain a unit value sequence corresponding to the DM code unit output by the DM code unit value prediction model; The corrected DM code is decoded based on the unit value sequence corresponding to the DM code units in each row to obtain a recognition result.

2. The method according to claim 1, characterized in that The fine positioning coordinates include the four corner coordinates of the DM code to be identified; according to the fine positioning coordinates and the specifications, the DM code to be identified is subjected to affine transformation and image scaling to obtain a corrected DM code including: Performing an affine transformation on the DM code to be identified according to the four corner coordinates to obtain a transformed DM code; According to the specification, image scaling is performed on the transformed DM code to obtain the corrected DM code, wherein the image size of the corrected DM code is 4A×4A.

3. The method according to claim 2, characterized in that The corrected DM code includes A rows of DM code units, and the image size of each row of DM code units is 4A×4; The pixel values in the DM code unit are averaged column by column to obtain a pixel value sequence including: Dividing the DM code unit into A unit modules arranged horizontally, wherein each unit module is a matrix consisting of 4×4 pixels; For each of the matrices, pixel values in the matrix are averaged and normalized column by column to obtain a pixel value sequence with a length of 4A.

4. The method according to claim 3, characterized in that The DM code unit value prediction model is configured to input a numerical sequence with a length of 40+8×N, and is configured to output a numerical sequence with a length of 10+2×N, where N is a specification coefficient: N=(A-10) / 2; the pixel value sequence is input into the trained DM code unit value prediction model, and the unit value sequence corresponding to the DM code unit obtained by the DM code unit value prediction model output includes: The pixel value sequence is input into the DM code unit value prediction model, and the DM code unit value prediction model predicts the unit prediction value corresponding to each unit module to obtain the unit value sequence, wherein the unit value sequence includes A unit prediction values.

5. The method according to any one of claims 1 to 4, characterized in that Before performing fine positioning processing on the DM code to be identified and obtaining the specifications and fine positioning coordinates corresponding to the DM code to be identified, the method further includes: Get the image to be processed; A target detection algorithm is used to perform coarse positioning processing on the image to be processed to obtain the DM code to be identified.

6. The method according to any one of claims 1 to 4, characterized in that The DM code unit value prediction model is a neural network model constructed based on a one-dimensional convolutional neural network.

7. The method according to any one of claims 1 to 4, characterized in that Performing fine positioning processing on the DM code to be identified, obtaining the specifications and fine positioning coordinates corresponding to the DM code to be identified includes: The Libdmtx library is used to perform fine positioning processing on the DM code to be identified, and the specification and the fine positioning coordinates corresponding to the DM code to be identified are obtained.

8. A DM code recognition device, characterized in that: include: A fine positioning module is used to perform fine positioning processing on the DM code to be identified, and obtain the specifications and fine positioning coordinates corresponding to the DM code to be identified; a correction module, configured to perform affine transformation and image scaling on the DM code to be identified according to the fine positioning coordinates and the specifications to obtain a corrected DM code, wherein the corrected DM code includes multiple rows of DM code units; a calculation module, configured to perform pixel value averaging calculation on the pixels in the DM code unit column by column to obtain a pixel value sequence; a prediction module, configured to input the pixel value sequence into a trained DM code unit value prediction model to obtain a unit value sequence corresponding to the DM code unit output by the DM code unit value prediction model; A decoding module is configured to decode the corrected DM code based on the unit value sequence corresponding to the DM code units in each row to obtain a recognition result.

9. A terminal device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the DM code recognition method according to any one of claims 1 to 7 is implemented.

10. A computer program product, characterized in that The invention comprises a computer program, which enables the DM code recognition method according to any one of claims 1 to 7 to be executed when the computer program is executed.