CN115906898A - Method and device for decoding DataMatrix code - Google Patents

Method and device for decoding DataMatrix code Download PDF

Info

Publication number
CN115906898A
CN115906898A CN202310154183.1A CN202310154183A CN115906898A CN 115906898 A CN115906898 A CN 115906898A CN 202310154183 A CN202310154183 A CN 202310154183A CN 115906898 A CN115906898 A CN 115906898A
Authority
CN
China
Prior art keywords
datamatrix code
code
datamatrix
decoding
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310154183.1A
Other languages
Chinese (zh)
Inventor
温哲立
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Qingdao Chuangxin Qizhi Technology Group Co ltd
Original Assignee
Qingdao Chuangxin Qizhi Technology Group Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Qingdao Chuangxin Qizhi Technology Group Co ltd filed Critical Qingdao Chuangxin Qizhi Technology Group Co ltd
Priority to CN202310154183.1A priority Critical patent/CN115906898A/en
Publication of CN115906898A publication Critical patent/CN115906898A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Image Processing (AREA)

Abstract

The application relates to the technical field of image recognition, and provides a method and a device for decoding a DataMatrix code. The method comprises the following steps: preprocessing the DataMatrix code to obtain a target DataMatrix code; correcting the target DataMatrix code according to a preset error correcting code to obtain a corrected DataMatrix code; and decoding the corrected DataMatrix code according to the plurality of open source decoding libraries to obtain decoded data. The decoding method of the DataMatrix code provided by the embodiment of the application can improve the decoding accuracy of the DataMatrix code.

Description

Method and device for decoding DataMatrix code
Technical Field
The application relates to the technical field of image recognition, in particular to a method and a device for decoding a DataMatrix code.
Background
Two-dimensional (2D) matrix codes are growing in popularity and use, and they replace the conventional linear one-dimensional bar codes in many fields of life. Conventional two-dimensional Code types generally include DataMatrix codes Maxi Code, aztec, QR Code, etc., and when used to mark small items such as electronic components, dataMatrix codes are generally employed because they require less space to encode the same amount of data.
In the related art, the DataMatrix code may be decoded by converting the data area of the DataMatrix code from the image domain into a binary matrix. However, this decoding method has a high requirement on the image quality of the acquired two-dimensional code, and cannot ensure the accuracy of decoding when the image quality of the two-dimensional code is poor.
Disclosure of Invention
The present application is directed to solving at least one of the technical problems occurring in the related art. Therefore, the application provides a decoding method of the DataMatrix code, which can improve the decoding accuracy of the DataMatrix code.
The application also provides a decoding device of the DataMatrix code.
The application also provides an electronic device.
The application also provides a computer readable storage medium.
The method for decoding the DataMatrix code according to the embodiment of the first aspect of the present application includes:
preprocessing the DataMatrix code to obtain a target DataMatrix code;
correcting the target DataMatrix code according to a preset error correcting code to obtain a corrected DataMatrix code;
and decoding the corrected DataMatrix code according to the plurality of open source decoding libraries to obtain decoded data.
According to the decoding method of the DataMatrix code, the preprocessed target DataMatrix code is corrected according to the preset error correcting code, after the corrected DataMatrix code is obtained, the corrected DataMatrix code is decoded by utilizing the plurality of open source decoding libraries to obtain decoded data, the two-dimensional DataMatrix code is corrected by utilizing the error correcting code, even if part of the DataMatrix code is damaged, the wrong data can be recovered by utilizing the error correcting code, the image quality of the DataMatrix code is further improved, and the subsequent decoding of the DataMatrix code is facilitated. And because the high-image-quality DataMatrix code is decoded by the plurality of open source decoding libraries, the content of the DataMatrix code can be accurately and efficiently identified, and the decoding accuracy and the decoding efficiency of the DataMatrix code are improved.
According to an embodiment of the present application, preprocessing the DataMatrix code to obtain a target DataMatrix code includes:
preprocessing the DataMatrix code to obtain an initial DataMatrix code;
and correcting the bar code of the initial DataMatrix code to obtain the target DataMatrix code.
According to an embodiment of the present application, performing barcode correction on the initial DataMatrix code to obtain the target DataMatrix code includes:
acquiring vertex coordinates of each vertex of the initial DataMatrix code;
obtaining each conversion coefficient according to each vertex coordinate and the side length of a source square domain of the ideal DataMatrix code;
and performing perspective conversion on the initial DataMatrix code according to each conversion coefficient to obtain the target DataMatrix code.
According to an embodiment of the present application, correcting the target DataMatrix code according to a preset error correcting code to obtain a corrected DataMatrix code includes:
determining a syndrome polynomial of the target DataMatrix code according to the preset error correcting code;
constructing an error locator polynomial and an error estimator polynomial by the syndrome polynomial according to an Euclidean algorithm, and determining a correction value of the target DataMatrix code according to the error locator polynomial and the error estimator polynomial;
and correcting the target DataMatrix code according to the correction value to obtain a corrected DataMatrix code.
According to one embodiment of the present application, preprocessing a DataMatrix code includes:
and carrying out graying, gaussian filtering, binarization and histogram equalization on the DataMatrix code in sequence.
According to an embodiment of the present application, further comprising:
and adjusting the image contrast of the histogram equalized DataMatrix code.
According to one embodiment of the application, each of the open source decoding banks includes a zxing bank and a libdmtx bank.
The decoding device of the DataMatrix code according to the embodiment of the second aspect of the present application includes:
the two-dimensional code processing module is used for preprocessing the DataMatrix code to obtain a target DataMatrix code;
the two-dimensional code correction module is used for correcting the target DataMatrix code according to a preset error correcting code to obtain a corrected DataMatrix code;
the two-dimensional code decoding module is used for decoding the corrected DataMatrix code according to the open source decoding libraries to obtain decoding data;
wherein each of the open source decoding banks comprises a zxing bank and a labdmtx bank.
The electronic device according to the third aspect of the present application includes a processor and a memory storing a computer program, where the processor implements the method for decoding DataMatrix code according to any one of the above embodiments when executing the computer program.
A computer-readable storage medium according to an embodiment of the fourth aspect of the present application, has a computer program stored thereon, and when being executed by a processor, the computer program implements the method for decoding DataMatrix code according to any one of the above embodiments.
The computer program product according to an embodiment of the fifth aspect of the application comprises: the computer program, when executed by a processor, implements a method for decoding a DataMatrix code as in any of the embodiments described above.
One or more technical solutions in the embodiments of the present application have at least one of the following technical effects:
the preprocessed target DataMatrix code is corrected according to a preset error correcting code, the corrected DataMatrix code is obtained, then the corrected DataMatrix code is decoded by utilizing a plurality of open source decoding libraries to obtain decoded data, and the two-dimensional DataMatrix code is corrected by utilizing the error correcting code, so that even if the DataMatrix code is partially damaged, the erroneous data can be recovered by the error correcting code, the image quality of the DataMatrix code is improved, and the subsequent decoding of the DataMatrix code is facilitated. And because the high-image-quality DataMatrix code is decoded by the plurality of open-source decoding libraries, the content of the DataMatrix code can be accurately and efficiently identified, and the decoding accuracy and the decoding efficiency of the DataMatrix code are improved.
Drawings
In order to more clearly illustrate the technical solutions in the present application or the prior art, the drawings needed for the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a flowchart illustrating a decoding method of a DataMatrix code according to an embodiment of the present application;
fig. 2 is a schematic flowchart illustrating further details of obtaining a target DataMatrix code in the method for decoding the DataMatrix code of fig. 1 according to the embodiment of the present application;
FIG. 3 is a schematic perspective transformation diagram provided by an embodiment of the present application;
fig. 4 is a schematic flowchart illustrating further details of obtaining a corrected DataMatrix code in the method for decoding the DataMatrix code of fig. 1 according to the embodiment of the present application;
fig. 5 is a schematic structural diagram of a decoding apparatus for DataMatrix codes according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of an electronic device provided in an embodiment of the present application.
Detailed Description
To make the purpose, technical solutions and advantages of the present application clearer, the technical solutions in the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Hereinafter, the method and apparatus for decoding DataMatrix code provided in the embodiments of the present application will be described in detail by several specific embodiments.
In one embodiment, a method for decoding a DataMatrix code is provided, and the method is applied to a server and used for decoding the DataMatrix code. The server can be an independent server or a server cluster formed by a plurality of servers, and can also be a cloud server providing basic cloud computing services such as cloud service, a cloud database, cloud computing, a cloud function, cloud storage, network service, cloud communication, middleware service, domain name service, security service, CDN (content delivery network), big data and artificial intelligence sampling point equipment and the like.
As shown in fig. 1, the decoding method of DataMatrix code provided in this embodiment includes:
step 101, preprocessing a DataMatrix code to obtain a target DataMatrix code;
102, correcting the target DataMatrix code according to a preset error correcting code to obtain a corrected DataMatrix code;
and 103, decoding the corrected DataMatrix code according to the plurality of open source decoding libraries to obtain decoded data.
The preprocessed target DataMatrix code is corrected according to a preset error correcting code, the corrected DataMatrix code is obtained, then the corrected DataMatrix code is decoded by utilizing a plurality of open source decoding libraries to obtain decoded data, and the two-dimensional DataMatrix code is corrected by utilizing the error correcting code, so that even if the DataMatrix code is partially damaged, the erroneous data can be recovered by the error correcting code, the image quality of the DataMatrix code is improved, and the subsequent decoding of the DataMatrix code is facilitated. And because the high-image-quality DataMatrix code is decoded by the plurality of open source decoding libraries, the content of the DataMatrix code can be accurately and efficiently identified, and the decoding accuracy and the decoding efficiency of the DataMatrix code are improved.
In one embodiment, the DataMatrix code may be acquired by an image capture device, such as a camera or the like. And noise and various types of distortion are inevitable in the captured image of the DataMatrix code in consideration of the limitation of physical environment. Therefore, in order to improve the accuracy and reliability of the subsequent identification of the DataMatrix code, the DataMatrix code may be preprocessed first. Since almost all images of the two-dimensional DataMatrix code acquired by the image capturing device are color images, and since the images are composed of pixels, each point is composed of three components of RGB, and the range is 0 to 255, a series of single-value transformation can be performed only after the images are grayed. The preprocessing may be to grayout the DataMatrix code to convert it into a gray image, thereby regarding the gray image as the target DataMatrix code.
Specifically, the graying of the DataMatrix code may be performed by obtaining RGB components of each pixel in the DataMatrix code, calculating an average value of three components, i.e., R, G, and B, according to the RGB components of each pixel, and then allocating the obtained average value to a gray value, so that the DataMatrix code is grayed by the gray value and converted into the target DataMatrix code.
Besides determining the gray value according to the average value of the RGB components of each pixel point, considering the sensitivity of human eyes to different colors, such as the most sensitive to green, the average values of the three components of R, G and B are weighted by setting different weighting coefficients, and then the data matrix code is grayed through the gray value after the weighted values are distributed to the gray value, and then the data matrix code is converted into the target data matrix code.
Or, the gray value may also be determined by a maximum value method, for example, the maximum value added by the three components R, G, and B is calculated, and then the value is assigned to the gray value, and then the DataMatrix code is grayed by the gray value and converted into the target DataMatrix code.
Considering that some noise may exist in the DataMatrix code due to physical environment, the preprocessing may be performed by performing gaussian filtering on the DataMatrix code. The gaussian filtering is a filtering method, and the filtering method for the DataMatrix code may be:
Figure SMS_1
wherein, (x, y) represents the coordinate value of any pixel point of the DataMatrix code, which takes the central point of the DataMatrix code as the origin of coordinates, and σ is the standard deviation. When the sigma is smaller than a preset value, the coefficient of the center of the generated Gaussian template is larger, and the coefficient of the periphery of the generated Gaussian template is smaller, so that the smoothing effect on the image is not obvious. And when the sigma is larger than the preset value, the difference of each coefficient of the generated Gaussian template is not very large, the method is similar to a mean template, and the smoothing effect on the DataMatrix code is obvious. Therefore, the primary role of the gaussian filter is to filter out the gaussian noise of the DataMatrix code, i.e., the noise conforming to the normal distribution.
In order to reduce the amount of data to be processed in the subsequent decoding of the DataMatrix code, so as to improve the decoding efficiency, in an embodiment, the preprocessing may be binarization for the DataMatrix code. The binarization is to set the gray value of a pixel point on the image of the DataMatrix code to 0 or 255, that is, to set the whole DataMatrix code to have an obvious black-and-white effect. Specifically, the binarization of the DataMatrix code may be performed by presetting a preset threshold T, and then for the grayed DataMatrix code, the pixel value of a certain pixel point P (x, y) is as follows:
Figure SMS_2
wherein, P src (x, y) represents a gray value of the pixel (x, y) after gray scaling, and P (x, y) represents a value of the pixel (x, y) after binary scaling. When the gray value of the pixel point (x, y) after graying is less than or equal to a preset threshold value T, the value of the pixel point (x, y) after binaryzation is 0; otherwise, the binarized value of the pixel point (x, y) is 255.
The target DataMatrix code is obtained by performing graying processing on the DataMatrix code and then performing binarization on the DataMatrix code, so that the target DataMatrix code is simplified, the data volume is reduced, and the outline of an interested target can be highlighted.
In addition, the DataMatrix code is preprocessed, and the DataMatrix code can also be preprocessed in a histogram equalization mode. Histogram equalization is used for contrast enhancement of images, and is a method for indirectly enhancing contrast.
Specifically, the histogram equalization may be performed on the data matrix code by performing nonlinear stretching on the grayed data matrix code, and redistributing the pixel values of the data matrix code so that the number of pixels in a certain gray scale range is substantially the same.
In order to achieve a better preprocessing effect of the DataMatrix code and further improve the decoding accuracy of the DataMatrix code, in an embodiment, the preprocessing of the DataMatrix code may be performed by sequentially performing graying, gaussian filtering, binarization and histogram equalization on the DataMatrix code, so that the preprocessed DataMatrix code can better reduce distortion and noise in a cascade processing manner, thereby further improving the decoding accuracy of the DataMatrix code.
In view of the fact that the contrast of the image also affects the recognition result, in order to further improve the decoding accuracy of the DataMatrix code, in an embodiment, after graying, gaussian filtering, binarization and histogram equalization are sequentially performed on the DataMatrix code, the image contrast of the DataMatrix code after histogram equalization may be further adjusted.
The image contrast refers to measurement of different brightness levels between the brightest white and the darkest black of a bright and dark area in an image, the larger the difference range is, the larger the contrast is, and the contrast reflects the layering of the bright area and the dark area on the image. And reflecting to the image editing of the DataMatrix code, adjusting the contrast is to enlarge or reduce the difference between the bright point and the dark point under the condition of ensuring that the average brightness is not changed. Since it is to ensure the average brightness is constant, the adjustment ratio for each point must be applied to the difference between the average brightness and the value, so as to ensure the calculated average brightness is constant, and there is an adjustment formula:
Out = Average + (In – Average) * ( 1 + percent)
wherein In represents the original pixel brightness of each pixel In the DataMatrix code, average represents the Average brightness of the whole DataMatrix code, out represents the regulated brightness, and percent represents the regulation range [ -1,1].
After the image contrast adjustment is performed on the DataMatrix code, the adjusted DataMatrix code can be used as a target DataMatrix code. However, because the DataMatrix code may have a bar distortion due to a shooting angle or a physical environment, and the preprocessing mainly adjusts pixel values of pixels of the DataMatrix code and cannot perform a graphic correction, the result is that if the acquired DataMatrix code has a bar distortion, the preprocessed target DataMatrix code still has a bar distortion, which affects the decoding accuracy.
To this end, in an embodiment, as shown in fig. 2, preprocessing the DataMatrix code to obtain a target DataMatrix code includes:
step 201, preprocessing a DataMatrix code to obtain an initial DataMatrix code;
step 202, performing bar code correction on the initial DataMatrix code to obtain the target DataMatrix code.
In one embodiment, after preprocessing the DataMatrix code, the preprocessed DataMatrix code may be marked as the initial DataMatrix code. Then, the initial DataMatrix code is spatially transformed by a predetermined spatial transformation algorithm, such as perspective transformation, to realize barcode correction of the initial DataMatrix code, so that the corrected initial DataMatrix code is used as the target DataMatrix code.
In order to obtain a target DataMatrix code with better precision, in an embodiment, performing barcode correction on the initial DataMatrix code to obtain the target DataMatrix code, includes:
acquiring first vertex coordinates of each vertex of the initial DataMatrix code;
obtaining each conversion coefficient according to each vertex coordinate and the side length of a source square domain of the ideal DataMatrix code;
and performing perspective conversion on the initial DataMatrix code according to each conversion coefficient to obtain the target DataMatrix code.
In one embodiment, as shown in fig. 3, assuming that the vertex coordinates of 4 vertices P1, P2, P3, and P4 of the initial DataMatrix code are obtained, a perspective transformation from a source square field representing an ideal DataMatrix code to a quadrilateral object representing a real DataMatrix code in the initial DataMatrix code may be set. Specifically, assuming that P1 has coordinates (x 1, y 1) in the source square domain of the ideal DataMatrix code, P2 has coordinates (x 2, y 2) in the source square domain of the ideal DataMatrix code, P3 has coordinates (x 3, y 3) in the source square domain of the ideal DataMatrix code, and P4 has coordinates (x 4, y 4) in the source square domain of the ideal DataMatrix code, the perspective-transformed result of the initial DataMatrix code can be determined using the following equations:
Figure SMS_3
when x and y are x1 and y1, u ', v' are u '1,v'1, that is, the vertex P1 after perspective conversion is P (u '1,v' 1). Similarly, when x and y are x2 and y2, u 'and v' are u '2 and v'2; when x and y are x3 and y3, u ', v' are u '3,v'3; when x, y are x4, y4, u ', v' are u '4,v'4.
The conversion coefficients a, b, c, d, e, f, g, and h can be calculated according to the vertex coordinates of the four vertices P1 (u 1, v 1), P2 (u 2, v 2), P3 (u 3, v 3), and P4 (u 4, v 4) and the side length of the source square field of the ideal DataMatrix code, specifically:
Figure SMS_4
and after the initial DataMatrix code is subjected to perspective conversion, the target DataMatrix code can be obtained.
After the target DataMatrix code is obtained, the target DataMatrix code can represent information in the horizontal direction and the vertical direction, so that a two-dimensional plane which greatly increases the information density is fully utilized, and large data are encoded in a small area. However, it is inevitable that some data is lost or interfered with to cause errors during the use of the DataMatrix code, and therefore, the target DataMatrix code may be corrected by using a predetermined error correction code, such as a non-binary cyclic error correction code.
In order to make the correction result of the target DataMatrix code more accurate, in an embodiment, as shown in fig. 4, the correcting the target DataMatrix code according to a preset error correcting code to obtain a corrected DataMatrix code includes:
step 301, determining a syndrome polynomial of the target DataMatrix code according to the preset error correcting code;
step 302, constructing an error locator polynomial and an error estimator polynomial by the syndrome polynomial according to an Euclidean algorithm, and determining a correction value of the target DataMatrix code according to the error locator polynomial and the error estimator polynomial;
step 303, correcting the target DataMatrix code according to the correction value to obtain a corrected DataMatrix code.
In the decoding process of the DataMatrix code, some error information can be obtained due to image distortion or improper binarization, and the Reed-Solomon code has strong error correction capability, so that the Reed-Solomon code can be adopted to recover the error data to realize the function of error correction code. Specifically, after the target DataMatrix code is obtained, a message received from the target DataMatrix code is treated as a coefficient of a polynomial S (x):
Figure SMS_5
wherein r is i Indicating that the received message is located at location i, these syndromes are therefore:
Figure SMS_6
is defined as:
Figure SMS_7
where 2t is equal to the number of codewords available for error correction and α is the basic element on the galois field. The syndrome polynomial is defined as:
Figure SMS_8
after the syndrome polynomial is calculated, an error locator polynomial and an error estimator polynomial are constructed using euclidean algorithms. The error locator polynomial may be used to find an error location and the error assignor polynomial may be used to find an error value. Wherein the euclidean algorithm is based on:
Figure SMS_9
only given
Figure SMS_10
And t, so that an error locator polynomial is obtained>
Figure SMS_11
And error estimator polynomial>
Figure SMS_12
Then the above formula can be expressed as:
Figure SMS_13
finally, we can generate the error locator polynomial and the error estimator polynomial using euclidean algorithms.
To solve for the error value, the algorithm of Forney was chosen. The error value of the reed solomon code is calculated by the formula:
Figure SMS_14
wherein e is ik Is a corrected value at the position ik,
Figure SMS_15
is at position k->
Figure SMS_16
A root; and->
Figure SMS_17
Is->
Figure SMS_18
The formal derivative of (c). Thus, the correction data of the target DataMatrix code can be obtained by using the above formula, thereby obtaining the corrected DataMatrix code. />
After the corrected DataMatrix code is obtained, the corrected DataMatrix code may be decoded and identified according to a plurality of open source decoding libraries, for example, combining a zxing library and a libdmtx library, so as to obtain decoded data of the corrected DataMatrix code.
It is considered that when the corrected DataMatrix code is decoded through a plurality of open source decoding libraries, the recognition of the DataMatrix code may fail due to insufficient resolution of the corrected DataMatrix code. Therefore, to ensure that the DataMatrix code can be decoded, in an embodiment, when decoding of the corrected DataMatrix code fails, each image frame of the DataMatrix code within a preset time may be acquired by a camera, then each image frame is preprocessed, and then corrected by a preset error correction code, each image frame of the corrected DataMatrix code is acquired, and then each image frame of the corrected DataMatrix code is sequentially input to a trained video super-resolution structure neural network, so as to acquire a high-resolution correction code corresponding to the corrected DataMatrix code from the video super-resolution structure neural network. And after the high-resolution correction code is obtained, decoding the high-resolution correction code according to the plurality of open source decoding libraries to obtain decoded data.
The video super-resolution structure neural network is obtained by training a plurality of low-resolution DataMatrix codes and prediction results of the low-resolution DataMatrix codes in a high-resolution space. Specifically, the video super-resolution structure neural network (ETDM) is a cyclic convolution network based on a one-way structure, that is, the hidden layer feature only adopts a forward propagation mode. In the training process, for each moment, the input of the network is divided into two layers: one is a sequence of images in low resolution space (previous frame _ I { t-1}, current frame _ I { t }, and next frame _ I { t +1 }); the other is the prediction result in high resolution space. The image sequences in the low-resolution space and the corresponding prediction results in the high-resolution space are input into the video super-resolution structure neural network for training, so that when the video super-resolution structure neural network is trained to determine the prediction results of different image sequences in the high-resolution space, the training of the video super-resolution structure neural network is completed, and the high-resolution correction codes corresponding to the DataMatrix codes can be predicted and corrected in subsequent application.
The following describes a decoding apparatus of the DataMatrix code provided in the present application, and the decoding apparatus of the DataMatrix code described below and the decoding method of the DataMatrix code described above may be referred to correspondingly.
In an embodiment, as shown in fig. 5, there is provided an apparatus for decoding a DataMatrix code, including:
the two-dimensional code processing module 210 is configured to preprocess the DataMatrix code to obtain a target DataMatrix code;
the two-dimensional code correction module 220 is configured to correct the target DataMatrix code according to a preset error correction code, and obtain a corrected DataMatrix code;
the two-dimensional code decoding module 230 is configured to decode the corrected DataMatrix code according to the multiple open source decoding libraries, and obtain decoded data;
wherein each of the open source decoding banks comprises a zxing bank and a labdmtx bank.
The preprocessed target DataMatrix code is corrected according to a preset error correcting code to obtain a corrected DataMatrix code, and then the corrected DataMatrix code is decoded by utilizing a plurality of open source decoding libraries to obtain decoded data, so that the DataMatrix two-dimensional code is corrected by utilizing the error correcting code, even if the DataMatrix code is partially damaged, wrong data can be recovered by the error correcting code, the image quality of the DataMatrix code is improved, and the DataMatrix code can be conveniently decoded subsequently. And because the high-image-quality DataMatrix code is decoded by the plurality of open source decoding libraries, the content of the DataMatrix code can be accurately and efficiently identified, and the decoding accuracy and the decoding efficiency of the DataMatrix code are improved.
In an embodiment, the two-dimensional code processing module 210 is specifically configured to:
preprocessing the DataMatrix code to obtain an initial DataMatrix code;
and correcting the bar code of the initial DataMatrix code to obtain the target DataMatrix code.
In an embodiment, the two-dimensional code processing module 210 is specifically configured to:
acquiring vertex coordinates of each vertex of the initial DataMatrix code;
obtaining each conversion coefficient according to each vertex coordinate and the side length of a source square domain of the ideal DataMatrix code;
and performing perspective conversion on the initial DataMatrix code according to each conversion coefficient to obtain the target DataMatrix code.
In an embodiment, the two-dimensional code correction module 220 is specifically configured to:
determining a syndrome polynomial of the target DataMatrix code according to the preset error correcting code;
constructing an error locator polynomial and an error estimator polynomial by the syndrome polynomial according to an Euclidean algorithm, and determining a correction value of the target DataMatrix code according to the error locator polynomial and the error estimator polynomial;
and correcting the target DataMatrix code according to the correction value to obtain a corrected DataMatrix code.
In an embodiment, the two-dimensional code processing module 210 is specifically configured to:
and carrying out graying, gaussian filtering, binarization and histogram equalization on the DataMatrix code in sequence.
In an embodiment, the two-dimensional code processing module 210 is further configured to:
and adjusting the image contrast of the histogram equalized DataMatrix code.
In one embodiment, each of the open source decoding banks includes a zxing bank and a libdmtx bank.
Fig. 6 illustrates a physical structure diagram of an electronic device, which may include, as shown in fig. 6: a processor (processor) 810, a Communication Interface 820, a memory 830 and a Communication bus 840, wherein the processor 810, the Communication Interface 820 and the memory 830 communicate with each other via the Communication bus 840. The processor 810 may call the computer program in the memory 830 to perform a method of decoding DataMatrix codes, including, for example:
preprocessing the DataMatrix code to obtain a target DataMatrix code;
correcting the target DataMatrix code according to a preset error correcting code to obtain a corrected DataMatrix code;
and decoding the corrected DataMatrix code according to the plurality of open source decoding libraries to obtain decoded data.
In addition, the logic instructions in the memory 830 may be implemented in software functional units and stored in a computer readable storage medium when the logic instructions are sold or used as independent products. Based on such understanding, the technical solution of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
In another aspect, embodiments of the present application further provide a storage medium, where the storage medium includes a computer program, where the computer program is stored on a non-transitory computer-readable storage medium, and when the computer program is executed by a processor, the computer is capable of performing the method for decoding DataMatrix codes provided in the foregoing embodiments, for example, the method includes:
preprocessing the DataMatrix code to obtain a target DataMatrix code;
correcting the target DataMatrix code according to a preset error correcting code to obtain a corrected DataMatrix code;
and decoding the corrected DataMatrix code according to the plurality of open source decoding libraries to obtain decoded data.
On the other hand, embodiments of the present application further provide a processor-readable storage medium, where a computer program is stored, and the computer program is configured to enable a processor to execute the method provided in the foregoing embodiments, for example, the method includes:
preprocessing the DataMatrix code to obtain a target DataMatrix code;
correcting the target DataMatrix code according to a preset error correcting code to obtain a corrected DataMatrix code;
and decoding the corrected DataMatrix code according to the plurality of open source decoding libraries to obtain decoded data.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions in the embodiments of the present application.

Claims (10)

1. A method for decoding DataMatrix codes, comprising:
preprocessing the DataMatrix code to obtain a target DataMatrix code;
correcting the target DataMatrix code according to a preset error correcting code to obtain a corrected DataMatrix code;
and decoding the corrected DataMatrix code according to the plurality of open source decoding libraries to obtain decoded data.
2. The method of claim 1, wherein preprocessing the DataMatrix code to obtain a target DataMatrix code comprises:
preprocessing the DataMatrix code to obtain an initial DataMatrix code;
and correcting the bar code of the initial DataMatrix code to obtain the target DataMatrix code.
3. The method of claim 2, wherein performing barcode correction on the initial DataMatrix code to obtain the target DataMatrix code comprises:
acquiring vertex coordinates of each vertex of the initial DataMatrix code;
obtaining each conversion coefficient according to each vertex coordinate and the side length of the source square domain of the ideal DataMatrix code;
and performing perspective conversion on the initial DataMatrix code according to each conversion coefficient to obtain the target DataMatrix code.
4. The method for decoding a DataMatrix code according to claim 1, wherein the step of correcting the target DataMatrix code according to a predetermined error correction code to obtain a corrected DataMatrix code comprises:
determining a syndrome polynomial of the target DataMatrix code according to the preset error correcting code;
constructing an error locator polynomial and an error estimator polynomial by the syndrome polynomial according to an Euclidean algorithm, and determining a correction value of the target DataMatrix code according to the error locator polynomial and the error estimator polynomial;
and correcting the target DataMatrix code according to the correction value to obtain a corrected DataMatrix code.
5. The method for decoding DataMatrix code according to any of claims 1-4, wherein preprocessing the DataMatrix code comprises:
and carrying out graying, gaussian filtering, binarization and histogram equalization on the DataMatrix code in sequence.
6. The method of decoding DataMatrix code according to claim 5, further comprising:
and adjusting the image contrast of the histogram equalized DataMatrix code.
7. The method of claim 1, wherein each of the open source decoding banks includes a zxing bank and a libdmtx bank.
8. An apparatus for decoding a DataMatrix code, comprising:
the two-dimensional code processing module is used for preprocessing the DataMatrix code to obtain a target DataMatrix code;
the two-dimensional code correction module is used for correcting the target DataMatrix code according to a preset error correcting code to obtain a corrected DataMatrix code;
the two-dimensional code decoding module is used for decoding the corrected DataMatrix code according to the open source decoding libraries to obtain decoding data;
wherein each of the open source decoding banks comprises a zxing bank and a labdmtx bank.
9. An electronic device comprising a processor and a memory storing a computer program, wherein the processor implements the method for decoding DataMatrix code of any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium on which a computer program is stored, the computer program, when being executed by a processor, implementing a method for decoding a DataMatrix code according to any one of claims 1 to 7.
CN202310154183.1A 2023-02-23 2023-02-23 Method and device for decoding DataMatrix code Pending CN115906898A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310154183.1A CN115906898A (en) 2023-02-23 2023-02-23 Method and device for decoding DataMatrix code

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310154183.1A CN115906898A (en) 2023-02-23 2023-02-23 Method and device for decoding DataMatrix code

Publications (1)

Publication Number Publication Date
CN115906898A true CN115906898A (en) 2023-04-04

Family

ID=86491663

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310154183.1A Pending CN115906898A (en) 2023-02-23 2023-02-23 Method and device for decoding DataMatrix code

Country Status (1)

Country Link
CN (1) CN115906898A (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1653699A (en) * 2002-05-08 2005-08-10 汤姆森特许公司 Method of soft-decision decoding of reed-solomon codes
CN101882207A (en) * 2010-06-01 2010-11-10 福建新大陆电脑股份有限公司 Bar code decoding chip of Data Matrix codes and decoding method thereof
CN105046184A (en) * 2015-07-22 2015-11-11 福建新大陆自动识别技术有限公司 Distortion image correction based two-dimensional code decoding method and system
CN107545207A (en) * 2017-09-28 2018-01-05 云南电网有限责任公司电力科学研究院 DM two-dimensional code identification methods and device based on image procossing
CN109597951A (en) * 2018-12-05 2019-04-09 广州酷狗计算机科技有限公司 Information sharing method, device, terminal and storage medium
CN110032907A (en) * 2019-04-15 2019-07-19 苏州国芯科技股份有限公司 A kind of two-dimensional code identification method, system and electronic equipment and storage medium
CN115248924A (en) * 2021-04-27 2022-10-28 中移(苏州)软件技术有限公司 Two-dimensional code processing method and device, electronic equipment and storage medium
CN115456003A (en) * 2022-09-02 2022-12-09 合肥埃科光电科技股份有限公司 DPM two-dimensional code identification method and storage medium
CN115630662A (en) * 2022-09-15 2023-01-20 国网浙江省电力有限公司嘉兴供电公司 Verification and correction method for health codes of power transmission and transformation equipment

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1653699A (en) * 2002-05-08 2005-08-10 汤姆森特许公司 Method of soft-decision decoding of reed-solomon codes
CN101882207A (en) * 2010-06-01 2010-11-10 福建新大陆电脑股份有限公司 Bar code decoding chip of Data Matrix codes and decoding method thereof
CN105046184A (en) * 2015-07-22 2015-11-11 福建新大陆自动识别技术有限公司 Distortion image correction based two-dimensional code decoding method and system
CN107545207A (en) * 2017-09-28 2018-01-05 云南电网有限责任公司电力科学研究院 DM two-dimensional code identification methods and device based on image procossing
CN109597951A (en) * 2018-12-05 2019-04-09 广州酷狗计算机科技有限公司 Information sharing method, device, terminal and storage medium
CN110032907A (en) * 2019-04-15 2019-07-19 苏州国芯科技股份有限公司 A kind of two-dimensional code identification method, system and electronic equipment and storage medium
CN115248924A (en) * 2021-04-27 2022-10-28 中移(苏州)软件技术有限公司 Two-dimensional code processing method and device, electronic equipment and storage medium
CN115456003A (en) * 2022-09-02 2022-12-09 合肥埃科光电科技股份有限公司 DPM two-dimensional code identification method and storage medium
CN115630662A (en) * 2022-09-15 2023-01-20 国网浙江省电力有限公司嘉兴供电公司 Verification and correction method for health codes of power transmission and transformation equipment

Similar Documents

Publication Publication Date Title
JP7446997B2 (en) Training methods, image processing methods, devices and storage media for generative adversarial networks
US20230215197A1 (en) Systems and Methods for Detection and Localization of Image and Document Forgery
US11790198B2 (en) Method and apparatus for processing encoded pattern, storage medium, and electronic apparatus
US8550351B2 (en) Matrix type two-dimensional barcode decoding chip and decoding method thereof
US8810633B2 (en) Robust image alignment for distributed multi-view imaging systems
CN111275626A (en) Video deblurring method, device and equipment based on ambiguity
CN115294409A (en) Video compression method, system and medium for security monitoring
CN112560861A (en) Bill processing method, device, equipment and storage medium
CN113570508A (en) Image restoration method and device, storage medium and terminal
CN111784624A (en) Target detection method, device, equipment and computer readable storage medium
EP4300411A1 (en) Training method and apparatus for image processing network, computer device, and storage medium
CN116309148A (en) Image restoration model training method, image restoration device and electronic equipment
Fang et al. An optimization model for aesthetic two-dimensional barcodes
CN108491747B (en) Method for beautifying QR (quick response) code after image fusion
CN108491913B (en) Method for authenticating QR (quick response) code with secret beautification function
Wang et al. LLDiffusion: Learning degradation representations in diffusion models for low-light image enhancement
US20240062333A1 (en) Upscaling image data
CN113592965A (en) Image processing method, image processing device, electronic equipment and computer readable storage medium
CN115906898A (en) Method and device for decoding DataMatrix code
CN116934634A (en) Image enhancement method and device based on pixel classification
Melgar et al. Channel capacity analysis of 2D barcodes: QR Code and CQR Code-5
CN112669240B (en) High-definition image restoration method and device, electronic equipment and storage medium
CN115936037B (en) Decoding method and device for two-dimensional code
CN114066709A (en) Screen-shot-resistant robust watermarking system and algorithm based on deep learning
CN112183695A (en) Encoding method, encoding pattern reading method, and imaging device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20230404