Coding and decoding method of dynamic self-adaptive mold coding based on binary system

Through the dynamic adaptive mold coding method, the problem of inflexible adjustment of mold code length and error correction level is solved, and efficient and reliable recognition of mold ID characters is achieved to meet diverse production needs.

CN120377931APending Publication Date: 2025-07-25GUANGDONG POLYTECHNIC NORMAL UNIV
View PDF 1 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Existing mold coding technologies cannot flexibly adjust the coding length and error correction level according to actual needs, resulting in limited application scenarios and difficult to adapt to diversified or high-precision production needs.

Method used

The dynamic adaptive mold encoding method based on binary is adopted to generate compact encoding patterns through character encoding conversion, error correction level configuration and Reed-Solomon encoding algorithm, which supports mold ID character encoding of any length, and has encoding error detection and automatic error correction functions.

Benefits of technology

It realizes flexible marking and high-precision recognition of mold ID character encoding, improves recognition accuracy and robustness, and adapts to the needs of different production scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120377931A_ABST
    Figure CN120377931A_ABST
Patent Text Reader

Abstract

The invention discloses a binary system-based coding and decoding method for dynamic self-adaptive mold coding. The method comprises the following steps of: converting an ID character of a mold into a character binary system code through a character coding table; the error correction level is converted into binary coding; generating an error correction code binary code based on the character code and the error correction level binary code; converting the binary data into pattern units and filling the pattern units into a matrix to generate a rectangular coding pattern; and decoding: carrying out error detection and error correction on the binary code obtained by recognition, and restoring the binary code into the original ID character code of the mold. According to the method, the mold character codes, the error correction level codes and the error correction codes are integrated to generate the two-dimensional coding patterns, the method has the advantages of being simple in pattern, high in fault tolerance and wide in adaptability, mold ID character code input of any length can be supported, dynamic error correction levels are configured, coding error detection and automatic error correction are achieved, and the method is suitable for large-scale popularization and application. And the identification accuracy and reliability of the ID character codes of the mold are obviously improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of mold coding, and specifically relates to an encoding and decoding method for dynamic adaptive mold coding based on binary system. Background Art

[0002] In the field of mold manufacturing and management, mold coding, as the core identifier for the full life cycle management of molds, undertakes important functions such as information storage, quick identification, and data traceability. With the advancement of Industry 4.0, the marking and identification technology of mold information has become the key to improving mold management efficiency. Currently, the following several mold information marking and identification methods are mainly adopted in the mold manufacturing industry:

[0003] 1. Barcode technology

[0004] By pasting barcode labels on the mold surface and using scanning equipment to read information. However, barcodes are easily affected by factors such as physical wear and pollution, resulting in a decrease in the recognition rate, and the information capacity is limited, which cannot meet the requirements of complex mold management.

[0005] 2. Two-dimensional code technology

[0006] Compared with barcodes, two-dimensional codes have a higher information capacity and error tolerance ability, but they still have the disadvantage of being easily affected by environmental factors (such as oil stains and dust), and in harsh environments such as high humidity and high temperature, the durability of two-dimensional codes is poor. The reason is that the pattern of the two-dimensional code is too complex, and it is difficult to locate and identify the two-dimensional code when there are many damaged areas.

[0007] 3. RFID technology

[0008] Through radio frequency identification technology, an electronic tag is embedded in the mold to achieve non-contact information reading. The disadvantages of RFID technology are high cost, and in some metal molds, the signal is easily interfered with, affecting the recognition effect, and in a production environment of high temperature and high pressure, the electronic tag is easily damaged, resulting in difficult recognition.

[0009] 4. Method for surface engraved mold ID characters based on ORC recognition

[0010] Usually, a CNC machining center or a steel stamp is used to directly engrave ID characters on the mold surface, and OCR technology based on image processing or deep learning is used for recognition. During the long-term use of the mold, pollutants such as chalk residue and oxidation rust are likely to accumulate on the surface, and coupled with the degradation of the character contour caused by mechanical wear, the readability of the ID coding is seriously affected; at the same time, affected by factors such as changes in environmental lighting conditions, character deformation, and position offset, misjudgment may occur during the recognition process, and the existing technical solutions lack an effective error detection and correction mechanism, making it difficult to ensure the reliability of the recognition result.

[0011] Existing binary-based mold coding recognition technology: A binary-based mold coding and recognition method, storage device, and intelligent terminal, with patent number ZL202311308579.3, disclose a binary-based mold coding and recognition method, storage device, and intelligent terminal.

[0012] This method significantly simplifies the complexity of the coding pattern by redesigned the mold coding pattern of the binary dot matrix code, making the coding recognition more efficient. However, this solution has obvious limitations in practical applications: the ID character coding length of its mold is strictly limited to 10 bits, and the error correction ability only supports two-bit errors, and it is impossible to dynamically adjust the coding length or error correction level according to actual production needs. This fixed design makes it unable to cope when facing different length coding requirements or high-precision production scenarios, greatly limiting the flexibility and adaptability of the solution. In addition, due to the inability to expand the coding length or improve the error correction ability, this solution shows obvious deficiencies when dealing with higher-precision technical requirements or expanding application scenarios, limiting its wide applicability and future development potential in modern intelligent manufacturing, and it is difficult to meet the growing diverse production needs and technology upgrade requirements.

[0013] Among the existing mainstream mold information marking methods, the method of surface engraved mold ID characters based on OCR recognition lacks an effective error correction mechanism to ensure recognition accuracy. Technical solutions such as RFID, paper barcode recognition, and laser two-dimensional code recognition cannot adapt to the high-temperature and high-pressure mold working environment and are difficult to meet the reliable recognition requirements during the mold production process. The method of binary-based mold coding disclosed in patent number ZL202311308579.3 fixes the mold ID character coding length at 10 bits and the error correction ability is limited to two-bit errors, and it is impossible to flexibly adjust the coding length and error correction level according to actual needs, resulting in limited application scenarios and insufficient flexibility, and it is difficult to adapt to diverse or high-precision production needs.

[0014] Therefore, it is necessary to improve the existing technology to overcome the inability to flexibly adjust the coding length and error correction level according to actual needs, resulting in limited application scenarios, insufficient flexibility, and difficulty in adapting to diverse or high-precision production needs.

[0015] In the existing technology, a high-efficiency binary coding mechanism is used to achieve large-capacity data compression, break through the limitation of the fixed coding length, support flexible marking of mold ID characters of any length, and fully meet the needs of diverse production scenarios. Summary of the Invention

[0016] To solve the above technical problems, the present invention proposes a binary-based dynamic adaptive die coding and decoding method that realizes large-capacity data compression through an efficient binary coding mechanism, breaks through the limitation of a fixed coding length, supports flexible marking of die ID character coding of any length, and fully meets the requirements of diverse production scenarios.

[0017] To achieve the above object, the technical solution adopted by the present invention is as follows:

[0018] A binary-based dynamic adaptive die coding and decoding method includes the following steps:

[0019] S1 Character coding conversion: Map each character of the original die ID character coding according to a preset character coding table to obtain the decimal value corresponding to the original ID character coding, and convert the decimal value into character binary coding;

[0020] S2 Error correction level configuration and confirmation: Set the error correction level, each error correction level corresponds to a numerical identifier, and convert the numerical identifier corresponding to the error correction level into error correction level binary coding according to a predetermined rule;

[0021] S3 Generate error correction code: Based on the character binary coding obtained in S1 and the error correction level binary coding obtained in S2, calculate the number of error correction codes according to a predetermined rule, and construct a generating polynomial according to the number of error correction codes;

[0022] Then, according to the Reed-Solomon coding algorithm, combine the message polynomial with the generating polynomial to generate a complete error correction code, and convert the error correction code into error correction code binary coding;

[0023] S4 Coding combination: Arrange and combine the character binary coding, error correction level binary coding, and error correction code binary coding in the preset coding structure and in the coding order from front to back to generate a combined binary coding sequence containing complete information;

[0024] S5 Generate coding pattern: According to the preset mapping rule from binary to pattern elements, convert each bit of binary data in the combined binary coding sequence into a corresponding pattern unit, and fill it into an N×N two-dimensional matrix according to the formulated arrangement rule, and finally generate a rectangular coding pattern with unique identification characteristics, where N is the scale parameter of the two-dimensional matrix, and N is the smallest positive integer that meets the coding capacity requirement;

[0025] S6 Coding recognition: Use coding recognition technology to recognize the rectangular coding pattern, and convert the recognized pattern information into a corresponding recognized binary coding sequence;

[0026] S7 decoding: Convert the recognized binary coding sequence into a corresponding recognized decimal numerical sequence through a preset rule, then perform error detection and correction according to the error correction coding rule, and convert the inspected decimal numerical sequence into a corrected binary coding. Restore the corrected binary coding to the original ID character coding of the mold according to the reverse operation corresponding to the S1 character coding conversion process.

[0027] Preferably, the scale parameter N is calculated and determined according to the length of the combined binary coding sequence.

[0028] Preferably, the S1 character coding conversion includes the following steps:

[0029] S11 Generate a coding table: According to the predetermined character set range and the number of characters of the original ID character coding of the mold, construct a mapping relationship table between characters and coding values according to the sequential arrangement rule, where each character corresponds to a unique decimal numerical value, and the coding values increase sequentially from the starting value, and finally generate a decimal numerical comparison table including the complete character set mapping relationship.

[0030] S12 Decimal coding calculation: According to the original ID character coding sequence of the mold, first divide the characters into groups of two in sequence. If the total number of characters is odd, the last character forms a single group.

[0031] Then perform decimal coding calculation on each character group according to the coding table to generate a decimal numerical value corresponding to the original ID character coding of the mold.

[0032] The decimal numerical calculation formula for each character group is: the decimal numerical value of the character group = the coding value of the first character * the length of the coding table + the coding value of the second character.

[0033] S13 Binary coding conversion: Convert each numerical value in the decimal numerical value into a group of binary codings with a fixed length of 11 bits. For the binary coding that is less than 11 bits after conversion, fill zeros at its high position until the specified length is reached, and then connect and combine each group of 11-bit binary codings in the order of the decimal numerical values, and finally generate the character binary coding corresponding to the original ID character coding of the mold.

[0034] Preferably, the S2 error correction level configuration and confirmation include the following steps:

[0035] S21 Level range setting: Set the configurable range of the error correction level to 10% to 100%, where the minimum error correction level is set to 10% and the maximum error correction level is set to 100%, and establish an equally spaced level division with 10% as the fixed increment unit.

[0036] S22 Hierarchy Mapping Establishment: Establish a one-to-one mapping relationship from the percentage error correction level to a digital identifier, where the 10% error correction level corresponds to the digital identifier 1, 20% corresponds to the digital identifier 2, and so on until 100% corresponds to the digital identifier 10, thereby constructing a complete error correction level mapping comparison table;

[0037] S23 Generate Hierarchy Binary Encoding: Determine the target error correction level according to the specific requirements of the application scenario, and obtain the corresponding digital identifier value by querying the hierarchy mapping table;

[0038] Convert the digital identifier within the range of 1 to 10 into a 4-bit binary encoding, and fill 0 at the high position when it is less than 4 bits;

[0039] Then copy and splice the generated 4-bit error correction level binary encoding to the high position to form an 8-bit binary encoding, where the high 4 bits and the low 4 bits maintain the same content, and finally generate a complete error correction level binary encoding.

[0040] Preferably, the S3 Generate Error Correction Code includes the following steps:

[0041] S31 Calculate Message Polynomial: Group the character binary encoding sequence generated in S13 in units of 8 bits in sequence, and fill 0 at the low position to make it 8 bits if the last group is less than 8 bits;

[0042] Then convert each 8-bit binary group into the corresponding decimal value, and generate a decimal value sequence containing all the conversion results of the groups;

[0043] And append the decimal value obtained by converting the error correction level binary encoding obtained in S23 to the end of the sequence, and finally generate a message polynomial decimal value sequence for constructing the message polynomial;

[0044] S32 Calculate the Number of Error Correction Codes: Take the low 4 bits of the error correction level binary encoding generated in S23 and convert them into the error correction level decimal value, and determine the corresponding error correction level Q by querying the hierarchy mapping table;

[0045] Then, based on the length N of the message polynomial decimal value sequence obtained in S31, calculate the error correction code error correction ability parameter E required to meet the error correction requirements in combination with the error correction level Q;

[0046] Finally, calculate the number of error correction codes k according to the relationship of the error correction ability;

[0047] S33 Calculate the Generator Polynomial: Based on the number of error correction codes k obtained in S32, calculate the generator polynomial G0(x) according to the Galois field theory, and the calculation formula of the generator polynomial is as follows:

[0048] G0(x)=(x-α0 )(x - α 1 )(x - α 2 )…(x - α k-1 ) (5)

[0049] where α 0 , α 1 , α 2 , …, α k-1 are all elements of the Galois field;

[0050] S34 calculates the error correction code: Based on the message polynomial calculated by S31 and the generator polynomial calculated by S33, the error correction code is calculated according to the Reed - Solomon coding theory, and the error correction code is converted into a binary error correction code.

[0051] Preferably, the steps for S31 to calculate the message polynomial include the following:

[0052] S311: According to the Reed - Solomon coding theory, the decimal numerical sequence of the message polynomial obtained by S31 is mapped to polynomial coefficients in order from the highest - degree term to the lowest - degree term. The first value in the sequence is used as the coefficient of the highest - degree term, and subsequent values correspond to the coefficients of decreasing - degree terms in turn, finally generating a message polynomial containing complete coefficient information. The constructed message polynomial M0(x) is as follows:

[0053] M0(x) = Ax 5 + Bx 4 + Cx 3 + Dx 2 + Ex 1 + F (1)

[0054] where A, B, C, D, E, F are the values of the decimal numerical sequence of the message polynomial obtained by S31 in order;

[0055] Convert each coefficient in M0(x) to a Galois - field coefficient according to the Galois - field mapping table. At this time, M0(x) is:

[0056] M0(x) = β1x 5 + β2x 4 + β3x 3 + β4x 2 + β5x 1 + β6 (2)

[0057] where β1, β2, β3, β4, β5, β6 are Galois - field coefficients.

[0058] Preferably, the steps for S32 to calculate the number of error correction codes include the following:

[0059] The calculation formula for the error correction ability E in S321 is as follows:

[0060] E = N × Q (3)

[0061] Where e is a positive integer, and it is rounded down to the nearest integer for (N × Q).

[0062] The calculation formula for the number of error correction codes k in S322 is as follows:

[0063] k = 2 × E (4).

[0064] Preferably, the S34 for calculating the error correction code includes the following steps:

[0065] S341 Alignment of the highest degree of the polynomial: Denote the highest degree of x in the determined message polynomial as w1, and the highest degree of x in the determined generator polynomial as w2. The highest power is aligned to w1 + w2;

[0066] Then each term of the message polynomial M0(x) is multiplied by Each term of the generator polynomial G0(x) is multiplied by To achieve the alignment of the highest degree of the new message polynomial M1(x) and the generator polynomial G1(x);

[0067] S342 Alignment of the coefficients corresponding to the highest degree: Extract the Galois field coefficient corresponding to the integer coefficient of the highest - degree term of x in the message polynomial M1(x) after the degree alignment process in S341, denoted as α1. Then multiply each term of the generator polynomial G1(x) after the degree alignment process in S341 by α1 to obtain the new generator polynomial G2(x) with aligned coefficients;

[0068] S342 Polynomial calculation: Perform term - by - term operations on the message polynomial M1(x) and the generator polynomial G2(x) in the Galois field. First, convert the Galois field coefficients of each term of the polynomial into corresponding integer values through the Galois field mapping table; then perform the combination of like terms, and perform XOR operations on the coefficient values of like terms during the combination process; finally, convert the integer coefficients in the operation result back to Galois field coefficients through the Galois field mapping table to generate the final operation result polynomial R(x);

[0069] S343 Iterative calculation: Based on the length N of the complete decimal numerical sequence of the constructed message polynomial obtained in S31, perform cyclic N - time iterative calculations on the three steps of S341, S342, and S342. Among them, the operation result polynomial R(x) obtained in each iterative calculation will be used as the message polynomial input for the next iterative calculation, and the required error correction code polynomial is finally obtained through cyclic calculation;

[0070] The sequence arranged according to the coefficient order of the polynomial terms is used as the final error correction code output sequence;

[0071] S344 generates a binary error correction code: convert each integer value in the error correction code sequence obtained in S343 into an 8-bit binary code with a fixed length. If the number of binary digits after conversion is less than 8 bits, fill 0s at the high position until it reaches 8 bits.

[0072] Then, connect and combine all the 8-bit binary codes in the original order of the coefficients of the coefficient polynomial, and finally generate a complete error correction code binary error correction code.

[0073] Preferably, the S4 encoding combination includes the following steps:

[0074] S4 encoding combination: arrange and combine the character binary code generated by S1, the error correction level binary code generated by S2, and the error correction code binary code generated by S3 in the order of a preset encoding structure. Among them, the character binary code is used as the information data segment and placed at the starting position of the encoding, the error correction level binary code is used as the configuration identification segment and located after the starting position, and the error correction code binary code is used as the check data segment and placed at the end of the encoding, and finally generate a combined binary code sequence containing complete information.

[0075] Preferably, the S7 decoding includes the following steps:

[0076] S71 Determine the error correction level: divide the recognized binary code sequence obtained in S6 into groups of 8 bits each. Based on the characteristic that the high 4 bits and the low 4 bits of the error correction level binary code are the same, search backward for the coding group that meets the conditions; when a certain group is detected to meet the characteristic, convert it into a decimal value and determine the error correction level P through the error correction level mapping table. At the same time, initially divide the L groups on the left side of this group into binary die character codes, and the R groups on the right side into binary error correction codes; then calculate the error correction ability T according to the following formula:

[0077] T = (L + 1) × P (6)

[0078] Where round down T.

[0079] Determine the theoretical number of error correction codes K according to the calculated error correction ability:

[0080] K = 2 × T (7)

[0081] Then, determine whether the current group is the error correction level binary code by verifying whether K is equal to R. If they are equal, confirm that this group is the error correction level binary code and proceed to the next step;

[0082] If they are not equal, continue to search forward for other coding groups; if all searches fail, it is determined that the S6 encoding recognition is incorrect and re-recognize;

[0083] S72 coding detection: Based on the number of error correction codes K determined by S71, construct the corresponding generating polynomial G(x) according to the generating polynomial calculation formula of S33 and solve the root set of G(x)=0;

[0084] Convert the binary coding sequence recognized by S6 into a decimal numerical sequence List in groups of 8 bits and construct the corresponding message polynomial R(x); verify by substituting each root of the generating polynomial into the message polynomial R(x). If all roots make the value of the message polynomial R(x) zero, it is determined that the coding recognition is error-free. If there is a root that makes the value of the message polynomial R(x) non-zero, it is determined that there is an error in the coding recognition and the corresponding error correction processing mechanism is triggered;

[0085] S73 coding error correction: Based on the calculation result of the message polynomial R(x) obtained by S72, construct the error polynomial E(x) and the error location polynomial σ(x), determine the error location by solving the roots of the error location polynomial, and calculate the error amplitude in combination with the error polynomial. Finally, locate and correct the error bits in the recognized coding according to the obtained error location and error amplitude to achieve accurate recovery of the coding data;

[0086] S74 coding restoration: Convert the decimal numerical sequence after being tested and error-corrected in S72 and S73 steps into binary coding, extract the binary coding segment representing the mold coding information according to the preset coding combination rule, and then perform the inverse operation corresponding to the coding conversion process in S1 step to restore the binary coding sequence to the original mold ID character coding through the character coding mapping table.

[0087] Preferably, constructing the error polynomial E(x) and the error location polynomial σ(x) includes the following steps:

[0088] Assume that the correct message polynomial C(x) has an identification error during the identification process, and the error polynomial is E(x). Therefore, the actually recognized message polynomial R(x) can be expressed as:

[0089] R(x)=C(x)+E(x) (8)

[0090] If the correct message polynomial C(x):

[0091]

[0092] The actually recognized information polynomial R(x):

[0093]

[0094] The error polynomial E(x):

[0095]

[0096] Assume that the error correction capability of the current error correction code is \(t\), then the number of error correction codes is \(2t\). Assume that the actual number of errors \(e\) in the identification information satisfies \(e\leq t\). In \(E(x)\), only \(e\) terms are non-zero. Denote these \(e\) terms as and the other terms are all \(0\). Then we have:

[0097]

[0098] where is the number of error positions, and \(Y_1, Y_2, \cdots, Y e are the error magnitudes at the corresponding positions.

[0099] Based on the fact that the number of error correction codes is \(2t\), the construction formula of the corresponding generator polynomial is as follows:

[0100] G(x)=(x - \alpha 0 )(x - \alpha 1 )(x - \alpha 2 )\cdots(x - \alpha 2t-1 ) (13)

[0101] So the roots of the generator polynomial are: \(\alpha 0 , \alpha 1 , \alpha 2 , \cdots, \alpha 2t-1 , and the corresponding values are the coefficients in the Galois field.

[0102] Evaluate the generator polynomial \(G(x)\) of the error correction code at each zero \(\alpha j \((j = 0, 2, \cdots, 2t - 1)\) for \(R(x)\), and denote the result as the syndrome polynomial \(S j :

[0103] S j =R(\alpha j ) = C(\alpha j ) + E(\alpha j ) = E(\alpha j ) j = 0, 1, 2, \cdots, 2t - 1 (14)

[0104] where \(C(x)\) is the correct message polynomial. So substituting each zero \(\alpha j \((j = 0, 1, 2, \cdots, 2t - 1)\) of the generator polynomial \(G(x)\), \(C(\alpha j )\) are all \(0\).

[0105] From equations (12) and (14), we can obtain:

[0106]

[0107] Define equation (15) as:

[0108]

[0109] When \(j = 1\), \(S1 = Y1X1+Y2X2+\cdots+Y\) e X e . Similarly, extending to each zero point \(\alpha\) j \((j = 0,1,2,\cdots,2t - 1)\), a system of equations with \(2t\) equations can be obtained:

[0110]

[0111] Among them, the number of error positions

[0112] The error correction process is to solve the values of the equations in formula (17), and solve the error positions \(X\) k \((k = 1,2,\cdots,e)\) and the corresponding error magnitudes \(Y\) k \((k = 1,2,\cdots,e)\). Since the above formula is a non - linear equation, \(X\) k and \(Y\) k are processed separately to transform the non - linear equation into a linear equation for solution. For this, an error - location polynomial \(\sigma(x)\) is defined:

[0113] \(\sigma(x)=(1 - X1x)(1 - X2x)\cdots(1 - X\) t x)

[0114] \(=1+\sigma1x+\cdots+\sigma\) t-1 x t-1 +\(\sigma\) t x t (18)

[0115] Among them, \(t\) represents the error - correction ability.

[0116] The expansion calculation of formula (18) can be obtained:

[0117]

[0118] According to formula (18), the roots of \(\sigma(x)\) are the reciprocals of the error - location numbers, that is, \(\sigma((X\) k ) -1 ) = 0, so \(\sigma(x)\) is the error - location polynomial. Substituting \((X\) k ) -1 into formula (18) gives:

[0119] \(\sigma((X\) k ) -1 ) = 1+\sigma1(X\) k ) -1 +\cdots+\sigma\) t-1 (X\) k ) -t+1 +\(\sigma\)t (X k ) -t =0 k=1,2,…,t (20)

[0120] Multiply both sides of the above formula (20) by (X k ) t to obtain:

[0121] (X k ) t +σ1(X k ) t-1 +…+σ t-1 X k +σ t =0 (21)

[0122] Multiply both sides of the above formula (21) by Y k (X k ) j , and sum over k (k = 1, 2, …, t) to obtain:

[0123]

[0124] According to formula (16), formula (22) can be transformed into:

[0125] S j+t +σ1S j+t-1 +…+σ t-1 S j+1 +σ t S j =0 j=1,2,…,t (23)

[0126] Expanding formula (23) gives:

[0127]

[0128] Therefore, the error positions can be determined through the relationship between the adjoint polynomial S j and the error location polynomial σ(x). Then, the error magnitudes are calculated by combining with the error polynomial E(X). Finally, the error bits in the identification code are located and corrected based on the obtained error positions and error magnitudes, realizing the accurate recovery of the encoded data.

[0129] Advantageous technical effects of the present invention: By organically integrating die character encoding, error correction level encoding, and error correction codes, the present invention generates a two-dimensional encoding pattern with a compact structure, which has the characteristics of a simple pattern, strong fault tolerance, and wide adaptability. At the same time, it is easy to identify and process, further improving the intelligent level and operation efficiency of die management, and providing strong technical support for modern intelligent manufacturing;

[0130] The present invention supports the input of mold ID character codes of any length, sets a dynamic adaptive error correction level according to actual recognition accuracy requirements, realizes flexible adaptation from low precision to high precision, and significantly improves the accuracy and robustness of information recognition.

[0131] The present invention has the functions of encoding error detection and automatic error correction, significantly improving the recognition accuracy and reliability of mold ID character codes. Brief Description of the Drawings

[0132] Figure 1 It is a step flow chart of an encoding and decoding method for a binary-based dynamic adaptive mold encoding of the present invention.

[0133] Figure 2 It is an 11*11 sequence matrix composed of combined binary codes obtained in an embodiment of an encoding and decoding method for a binary-based dynamic adaptive mold encoding of the present invention.

[0134] Figure 3 It is an encoded pattern graph generated in an embodiment of an encoding and decoding method for a binary-based dynamic adaptive mold encoding of the present invention; (where the black code points represent the preset pattern marks at the corresponding positions with a value of "1" in the combined binary code). Detailed Description of the Invention

[0135] The solution of the present invention will use the primitive α value and the corresponding field value of the Galois Field in the prior art, and the four arithmetic operations of the Galois Field. The following will give an appendix description of these several principles:

[0136] Appendix 1. Primitive α Value and Corresponding Field Value of Galois Field

[0137] In the present invention, the finite field GF(2 8 ) is adopted, and the primitive α = 2; in this finite field, the value range of all exponents of α is 0 - 255, with 255 different values. Each power of α will correspond to a value, which is called the field value, and the value range is 1 - 255, also with 255 different values. When the value of α is 0, 1, 2, 3, 4, 5, 6, 7, the field values obtained with the exponent of 2 are shown in Table 1 below:

[0138] Table 1 Partial Correspondence Table of α Value and Field Value

[0139] α value 0 1 2 3 4 5 6 7 Threshold value 1 2 4 8 16 32 64 128

[0140] During the calculation process, if the exponent of α exceeds 255, the exponent needs to be modulo 255. When the range value result exceeds 255, an exclusive OR operation needs to be performed on the range value result and 285. For example, when the exponent value of α is 8, the corresponding domain value of 28 is 256, and its binary representation is 100000000. The binary representation of 285 is 100011101, and the exclusive OR result of the two is 000011101, whose corresponding decimal representation is 29. Therefore, when α takes the value of 8, the finally calculated domain value is 29. Similarly, when α takes the value of 9, the domain value of the exponent 9 is equal to 29 * 2 = 58.

[0141] Appendix 2. Four Arithmetic Operations of Galois Field

[0142] (1) Addition / Subtraction in Galois Field

[0143] In Galois field, addition and subtraction are equivalent. For example, α 2 -α 2 is equivalent to α 2 +α 2 . And in Galois field, addition and subtraction are XOR operations on the coefficients, rather than ordinary addition and subtraction operations. For example: α 4 +α 8 The calculation process is as follows: First, convert α 4 , α 5 into the corresponding decimal numbers according to the Galois field mapping table, which are α 4 = 16, α 8 = 29. Then perform the XOR operation: 13 corresponds to α in Galois field 104 . Similarly, Galois field subtraction can be converted to addition for addition operation.

[0144] (2) Multiplication in Galois Field:

[0145] In Galois field, the multiplication operation is manifested as the addition of the exponents of the primitive element α in the Galois field. And when the exponent of the primitive element α is greater than 255, the exponent needs to be modulo 255. When two positive integers are multiplied, the integers need to be first converted into the corresponding primitive elements according to the Galois field mapping table, and then the multiplication operation is performed. For example: 17 × 18, according to the Galois field mapping table, the integer 17 corresponds to α 100 , the integer 18 corresponds to α 224 , 17 × 18 = α 100 ×α 224 = α 324 . At this time, the exponent of the primitive element α is 324, which is greater than 255. Therefore, modulo 255 operation is required. So the final operation result is:

[0146] 17×18 = α 100 ×α 224 = α 324 = α 324mod255 = α 69 。

[0147] In order to make the objectives, technical solutions and advantages of the present invention clearer and more understandable, the present invention will be further described in detail below in conjunction with embodiments. However, the scope of protection required by the present invention is not limited to the specific embodiments described below.

[0148] As Figures 1-3 shown, a method for encoding and decoding binary-based dynamic adaptive die coding includes the following steps:

[0149] S1 Character encoding conversion: Map each character of the original ID character encoding of the die of any length according to a preset character encoding table (Table 2) to obtain the decimal value corresponding to each character in the original ID character encoding, and convert the corresponding decimal value into a character binary encoding.

[0150] The specific steps are as follows:

[0151] S11 Generate an encoding table: According to the predetermined character set range and the number of characters of the original ID character encoding of the die, construct a mapping relationship table between characters and encoding values in sequence, where each character corresponds to a unique decimal value encoding, and the encoding values increase sequentially from the starting value;

[0152] Specifically, taking the die ID character encoding SS-2015-K as an example, the die ID character set includes 45 characters including the numbers 0-9, capital letters A-Z, and 9 special characters. As shown in Table 2 below, the mapping relationship between characters and encoding values is represented in the form of alternating two columns, where all characters are listed in sequence in the left column, and the decimal encoding value of each character is listed correspondingly in the right column to form a complete character encoding comparison table.

[0153] Table 2 Die ID Character Encoding Table

[0154] Character Value Character Value Character Value Character Value Character Value Character Value Character Value Character Value 0 0 6 6 C 12 I 18 O 24 U 30 SP 36 . 42 1 1 7 7 D 13 j 19 P 25 V 31 S 37 / 43 2 2 8 8 E 14 K 20 Q 26 W 32 % 38 : 44 3 3 9 9 F 15 L 21 R 27 X 33 * 39 4 4 A 10 G 16 M 22 S 28 Y 34 + 40 5 5 B 11 H 17 N 23 T 29 Z 35 - 41

[0155] S12 Decimal encoding calculation: First, divide the characters into groups of two in sequence. If the total number of characters is odd, the last character forms a separate group; then perform decimal encoding calculation on each character group according to the encoding table, where the decimal encoding value calculation formula for each character group is: the encoding value of the character group = the encoding value of the first character * the length of the encoding table + the encoding value of the second character;

[0156] Specifically, taking the mold ID character code SS-2025-2K as an example, group every two characters of this ID character code in sequence. If the total number of characters is odd, the last character forms a single group. So SS-2025-2K can be divided into 5 groups: "SS", "-2", "02", "5-", "2K". According to the calculation formula of the encoding value for each character group, we can get:

[0157] ① "SS": 28 * 45 + 28 = 1288

[0158] ② "-2": 41 * 45 + 2 = 1847

[0159] ③ "02": 0 * 45 + 2 = 2

[0160] ④ "5-": 5 * 45 + 41 = 266

[0161] ⑤ "2K": 2 * 45 + 20 = 110

[0162] S13 binary encoding conversion: Convert each value in the decimal encoding sequence into a group of 11-bit binary encodings with a fixed length. For the binary encodings that are less than 11 bits after conversion, pad 0s at the high position until the specified length is reached. Then, connect and combine each group of 11-bit binary encodings in the order of the original decimal encoding sequence to finally generate a complete binary encoding sequence of the mold ID characters;

[0163] Specifically, convert the decimal numbers corresponding to the 5 groups of characters in S12 into 11-bit binary encodings with a fixed length:

[0164] ① "SS": 1288 is converted into binary encoding: 10100001000, padded to 11 bits: 10100001000

[0165] ② "-2": 1847 is converted into binary encoding: 11100110111, padded to 11 bits: 11100110111

[0166] ③ "02": 2 is converted into binary encoding: 10, padded to 11 bits: 00000000010

[0167] ④ "5-": 266 is converted into binary encoding: 100001010, padded to 11 bits: 00100001010

[0168] ⑤ "2K": 110 is converted into binary encoding: 1101110, padded to 11 bits: 00001101110

[0169] Connect each group of 11-bit binary codes in sequence according to the order of the original decimal code sequence, and finally generate the complete binary code sequence of the mold ID characters as follows:

[0170] 1010000100011100110111000000000100010000101000001101110.

[0171] S2 Error Correction Level Configuration and Confirmation: Set the error correction level, set the error correction level range from 10% to 100%, grade it in 10% increments, and there is a mapping relationship between the percentage error correction level and the digital identifier. Each level corresponds to a unique digital identifier, and convert the digital identifier corresponding to the confirmed error correction level into the corresponding error correction level binary code according to the established rules;

[0172] The specific steps are as follows:

[0173] S21 Level Range Setting: According to the system error correction ability requirements and application scenario characteristics, determine that the configurable range of the error correction level is from 10% to 100%, where the minimum error correction level is set to 10% and the maximum error correction level is set to 100%, and establish an equally spaced level division with 10% as the fixed increment unit.

[0174] S22 Level Mapping Establishment: Establish a one-to-one mapping relationship from the percentage error correction level to the digital identifier, where the 10% error correction level corresponds to the digital identifier 1, 20% corresponds to the digital identifier 2, and so on until 100% corresponds to the digital identifier 10. The error correction level mapping table is shown in Table 3 below:

[0175] Table 3 Error Correction Level Mapping Table

[0176] Error correction level Digital identifier 10% 1 20% 2 30% 3 40% 4 50% 5 60% 6 70% 7 80% 8 90% 9 100% 10

[0177] S23 Generate Level Binary Code: Determine the target error correction level according to the specific requirements of the application scenario, and obtain the corresponding digital identifier value by querying the level mapping table; convert the digital identifier within the range of 1 to 10 into a 4-bit binary code, and fill 0 in the high position when it is less than 4 bits; then copy and splice the generated 4-bit level binary code to the high position to form an 8-bit binary code, where the high 4 bits and the low 4 bits maintain the same content, and generate the complete error correction level binary code.

[0178] Specifically, taking the determined error correction level of 40% as an example, its corresponding digital identifier is 4, which is converted to binary as: 100, filling 0 in the high position to 4 bits gives: 0100; copying and splicing to the high position to form an 8-bit complete error correction level binary code is: 01000100.

[0179] S3 Generate error correction codes: Based on the character binary codes corresponding to the character encodings obtained in S1 and the error correction level binary codes corresponding to the error correction levels determined in step S2, calculate the number of error correction codes according to the formulated rules, and then construct the corresponding generator polynomial through the number of error correction codes.

[0180] Finally, according to the Reed - Solomon coding algorithm, combine the message polynomial and the generator polynomial to generate the complete error correction codes, and convert the error correction codes into error correction binary codes;

[0181] The specific steps are as follows:

[0182] S31 Calculate the message polynomial: Group the die ID character binary code sequence generated in S13 in units of 8 bits in sequence. If the last group is less than 8 bits, pad 0s at the low - order bits to make it 8 bits; then convert each 8 - bit binary group into the corresponding decimal value to generate a decimal value sequence containing all the conversion results of the groups. And append the decimal value obtained by converting the error correction level binary code obtained in S23 to the end of the sequence, finally generating a complete decimal coefficient sequence for constructing the message polynomial.

[0183] Specifically, the die ID character binary code obtained according to S13 is: 1010000100011100110111000000000100010000101000001101110. Group it in units of 8 bits in sequence. If the last group is less than 8 bits, pad 0s at the low - order bits to make it 8 bits, and convert each group into the corresponding decimal value. The grouping results are as follows:

[0184] 10100001000111001101110000000001000100001010000011011100. Convert each group into a decimal value: 161, 28, 220, 1, 16, 160, 220.

[0185] Then append the error correction level binary code obtained in S23: 01000100, and its corresponding decimal value: 68, to the end of the decimal sequence converted from the die ID character binary code, generating a complete decimal coefficient sequence for constructing the message polynomial: 161, 28, 220, 1, 16, 160, 220, 68.

[0186] Map them to the polynomial coefficients in order from the highest - order term to the lowest - order term, where the first value in the sequence is used as the coefficient of the highest - order term, and the subsequent values correspond to the coefficients of the decreasing - order terms in turn.

[0187] Finally, generate a message polynomial containing complete coefficient information:

[0188] M0(x) = 161x 7 + 28x 6 + 220x 5 + x 4 + 16x 3 + 160x 2 + 220x + 68。

[0189] Convert each coefficient in M0(x) to a Galois field coefficient according to the Galois field mapping table. At this time, M0(x) is transformed into: M0(x) = α 63 x 7 + α 200 x 6 + α 187 x 5 + α 0 x 4 + α 4 x 3 + α 55 x 2 + α 187 x + α 102 。

[0190] S32 calculates the number of error correction codes: Take the lower 4 bits of the binary encoding of the error correction level generated by S23 and convert them into a decimal value. Determine the corresponding error correction level Q by querying the level mapping table; then, based on the length N of the decimal value sequence obtained in S31, calculate the error correction code error correction ability parameter E required to meet the error correction requirements in combination with the error correction level Q. Finally, calculate the number of error correction codes k according to the relationship of the error correction ability.

[0191] Specifically, taking the complete error correction level binary encoding obtained from S23 as: 01000100 as an example, extract the lower 4-bit binary encoding: 0100, and convert it into a decimal value: 4. According to the error correction level mapping table, the corresponding error correction level is: Q = 40%.

[0192] According to the decimal value sequence obtained in S31: 161, 28, 220, 1, 16, 160, 220, 68, its corresponding length N = 8. According to the error correction ability E calculation formula: E = N × Q = 8 × 40% = 3.2, rounding down to obtain E = 3. According to the error correction code number k calculation formula: k = 2 × E = 2 × 3 = 6.

[0193] S33 calculates the generating polynomial: Based on the number of error correction codes k = 6 obtained in S32, calculate the generating polynomial G0(x) according to the Galois field theory:

[0194] G0(x) = (x - α 0 )(x - α 1 )(x - α2 )(x - α 3 )(x - α 4 )(x - α 5 )

[0195] where α 0 , α 1 , α 2 , α 3 , α 4 , α 5 are all coefficients of the Galois field GF(2 3 ).

[0196] The expansion of the generating polynomial G0(x) is:

[0197] G0(x) = a 0 x 6 + a 166 x 5 + a 0 x 4 + a 134 x 3 + a 5 x 2 + a 176 x 1 + a 15

[0198] S34 calculates the error - correcting code: Based on the message polynomial calculated by S31 and the generating polynomial calculated by S33, the error - correcting code is calculated according to the Reed - Solomon coding theory, and the error - correcting code is converted into a binary error - correcting code.

[0199] The specific steps are as follows:

[0200] S341 Alignment of the highest degree of the polynomial: Align the highest degree of the polynomial: Denote the highest degree of x in the determined message polynomial as w1, and the highest degree of x in the determined generating polynomial as w2, then the highest - power alignment is w1 + w2.

[0201] Specifically, from S31, the message polynomial is known as: M0(x) = α 63 x 7 + α 200 x 6 + α 187 x 5 + α 0 x 4 + α 4 x 3 + α 55 x 2 + α 187 x + α 102, it can be known that the highest degree of \(x\) in the message polynomial \(w1 = 7\). From the above \(S33\), it can be known that the generating polynomial is: \(G0(x)=a 0 x 6 +a 166 x 5 +a 0 x 4 +a 134 x 3 +a 5 x 2 +a 176 x 1 +a 15 , it can be known that the highest degree of \(x\) in the generating polynomial \(w2 = 6\), so the highest power needs to be aligned as: \(w1 + w2 = 7 + 6 = 13\).

[0202] The aligned message polynomial \(M1(x)=M0(x)\times x 6 is:

[0203] M1(x)=\alpha 63 x 13 +\alpha 200 x 12 +\alpha 187 x 11 +\alpha 0 x 10 +\alpha 4 x 9 +\alpha 55 x 8 +\alpha 187 x 7 +\alpha 102 x 6 The aligned generating polynomial \(G1(x)=G0(x)\times x 7 is:

[0204] G1(x)=a 0 x 13 +a 166 x 12 +a 0 x 11 +a 134 x 10 +a 5 x 9 +a 176 x 8 +a 15 x 7 .

[0205] S342 Highest Degree Coefficient Alignment: Extract the Galois field coefficient corresponding to the highest-degree term of \(x\) in the message polynomial \(M1(x)\) after degree alignment in S341, denoted as \(\alpha1\). Then multiply each term of the generator polynomial \(G1(x)\) after degree alignment in S341 by \(\alpha1\) to obtain a new generator polynomial \(G2(x)\) with aligned coefficients.

[0206] Specifically, according to S341, the Galois field coefficient corresponding to the highest-degree term of \(x\) in the aligned message polynomial \(M1(x)\) is \(\alpha\) 63 , so multiply each term of \(G1(x)\) after highest-degree alignment by \(\alpha\) 63 (according to the Galois field multiplication operation in Appendix 2), to obtain a new generator polynomial \(G2(x)\) with aligned coefficients:

[0207] G2(x) = a 63 x 13 +a 229 x 12 +a 63 x 11 +a 197 x 10 +a 68 x 9 +a 239 x 8 +a 78 x 7

[0208] S342 Polynomial Calculation: Perform term-by-term operations on the message polynomial \(M1(x)\) and the generator polynomial \(G2(x)\) in the Galois field. First, convert the Galois field coefficients of each term of the polynomial into corresponding integer values through the Galois field mapping table; then perform combination of like terms, and perform exclusive OR operations on the coefficient values of like terms during the combination process (according to the Galois field addition operation in Appendix 2); finally, convert the integer coefficients in the operation result back into Galois field coefficients through the Galois field mapping table to generate the final operation result polynomial \(R(x)\).

[0209] Specifically, the generator polynomials \(M1(x)\) and \(G2(x)\) with aligned coefficients obtained in S341:

[0210] M1(x) = \(\alpha\) 63 x 13 +\(\alpha\) 200 x 12 +\(\alpha\) 187 x 11 +\(\alpha\) 0 x 10 +\(\alpha\) 4 x 9 +\(\alpha\) 55 x 8 +\(\alpha\) 187 x7 +α 102 x 6

[0211] G2(x) = a 63 x 13 +a 229 x 12 +a 63 x 11 +a 197 x 10 +a 68 x 9 +a 239 x 8 +a 78 x 7

[0212] Converting each Galois field coefficient to its corresponding integer value according to the Galois field mapping table gives:

[0213] M1(x) = 161x 13 +28x 12 +220x 11 +x 10 +16x 9 +160x 8 +220x 7 +68x 6

[0214] G2(x) = 161x 13 +122x 12 +161x 11 +141x 10 +153x 9 +22x 8 +120x 7

[0215] Combining like terms in M1(x) and G2(x), and performing XOR operations on the coefficients of like terms during the combination process:

[0216]

[0217] XOR operation result:

[0218] R(x) = 102x 12 +125x 11 +140x 10 +137x 9 +182x 8 +164x 7 +68x 6

[0219] S343 Iterative Calculation: Based on the length N of the complete decimal coefficient sequence of the constructed message polynomial obtained in S31, the three steps of S341, S342, and S342 are iteratively calculated N times in a loop. The operation result polynomial R(x) obtained in each iterative calculation will be used as the message polynomial input for the next iterative calculation. Through the loop calculation, the required error correction code polynomial is finally obtained. The sequence arranged in the order of the coefficients of the polynomial terms is used as the final error correction code output sequence.

[0220] Specifically, based on S31, the length N of the complete decimal coefficient sequence of the constructed message polynomial is 8. Therefore, the three steps of S341, S342, and S342 are iteratively calculated 8 times in a loop, and the operation result polynomial R(x) obtained in each iterative calculation will be used as the message polynomial input for the next iterative calculation. After 8 iterative calculations, the final result polynomial R(x) is: R(x) = 52x 5 + 129x 4 + 80x 3 + 241x 2 + 170x + 246. So the 6 error correction codes finally obtained are: 52, 129, 80, 241, 170, 246.

[0221] S344 Generate Binary Error Correction Codes: Convert each integer value in the error correction code sequence obtained in S343 into an 8-bit binary code with a fixed length. If the converted binary digits are less than 8 bits, fill 0s at the high position until it reaches 8 bits. Then, connect and combine all the 8-bit binary codes in the original order of the integer sequence to finally generate a complete binary error correction code sequence.

[0222] Specifically, taking the error correction codes 52, 129, 80, 241, 170, 246 calculated in S34 as examples, each error correction code is converted into an 8-bit binary code as a separate group. If the converted binary digits are less than 8 bits, fill 0s at the high position until it reaches 8 bits.

[0223] ① 55: Converted to binary code: 110111, padded to 8 bits: 00110111

[0224] ② 129: Converted to binary code: 10000001, padded to 8 bits: 10000001

[0225] ② 80: Converted to binary code: 1010000, padded to 8 bits: 01010000

[0226] ④ 241: Converted to binary code: 11110001, padded to 8 bits: 11110001

[0227] ⑤170: Convert to binary code: 10101010. Pad to 8 bits: 10101010

[0228] ⑥246: Convert to binary code: 11110110. Pad to 8 bits: 11110110

[0229] So the final complete binary error correction code sequence is generated: 001101111000000101010000111100011010101011110110.

[0230] S4 Encoding combination: The character binary code generated by S1, the binary code for determining the error correction level generated by S2, and the binary code of the error correction code generated by S3 are arranged and combined in the order of a preset encoding structure. Among them, the character binary code is used as the information data segment at the starting position of the encoding, the binary code for determining the error correction level is used as the configuration identification segment immediately following it, and the error correction binary code is used as the check data segment at the end of the encoding. Finally, a combined binary code sequence containing complete information is generated;

[0231] Specifically, the character binary code generated by S1 is: 1010000100011100110111000000000100010000101000001101110; the binary code for determining the error correction level generated by S2 is: 01000100; the binary code of the error correction code generated by S3 is: 001101111000000101010000111100011010101011110110; According to the structure of the combined binary code finally containing complete information: character binary code + binary code for determining the error correction level + binary code of the error correction code, the final combined binary code can be obtained as: 101000010001110011011100000000010001000010100000110111001000100001101111000000101010000111100011010101011110110.

[0232] S5 Generate encoding pattern: Based on the combined binary code sequence obtained in S4, first calculate and determine the scale parameter N of the two-dimensional matrix according to the length of the encoding sequence, where N is the smallest positive integer that meets the encoding capacity requirements; then, according to the preset mapping rule from binary to pattern elements, convert each bit of binary data in the encoding sequence into the corresponding pattern unit, and fill it into the N×N two-dimensional matrix according to the formulated arrangement rule. Finally, a rectangular encoding pattern with unique identification characteristics is generated;

[0233] Specifically, the mapping rule is:

[0234] 1) Map the values of the combined binary coding sequence to an N×N rectangular array bit by bit in the arrangement order from top to bottom and from left to right according to a preset printing order to generate a corresponding two-dimensional coding pattern.

[0235] 2) Define that in the N×N rectangular array, each array position corresponds to one bit value of the binary coding. Among them, the value "1" is represented by printing a preset pattern mark at the corresponding position, while the value "0" is represented by keeping the corresponding position blank without printing any mark.

[0236] S6 coding recognition: Use coding recognition technology to recognize the S5 coding pattern, and convert the recognized pattern information into a corresponding binary coding sequence.

[0237] S7 decoding: Convert the binary coding recognized in S6 into a corresponding decimal numerical sequence according to a specified rule, and then perform error detection and correction according to the error correction coding rule. Finally, restore the verified decimal numerical sequence to the original ID character coding of the mold according to the inverse operation corresponding to the S1 coding conversion process.

[0238] It includes the following steps:

[0239] S71 Determine the error correction level: Divide the binary coding sequence recognized in S6 into groups of 8 bits each. Based on the feature that the upper 4 bits and the lower 4 bits of the error correction level binary coding are the same, search for the qualified coding group from back to front; when a certain group meets the feature, convert the lower 4 bits coding into a decimal number and determine the error correction level P through the error correction level mapping table. At the same time, initially divide the L groups on the left side of this group as the binary mold character coding, and the R groups on the right side as the binary error correction code; then calculate the error correction ability T.

[0240] Specifically, assume that the binary sequence obtained by coding recognition is: 1010000100011100110111000000000100010000101000001101110001000100001101111000000101010000111100011010101011110110,

[0241] Divide it into groups of 8 bits each, then it is divided into the following 14 groups: 10100001, 00011100, 11011100, 00000001, 00010000, 10100000, 11011100, 01000100, 00110111, 10000001, 01010000, 11110001, 10101010, 11110110.

[0242] Next, based on the feature that the high 4 bits and the low 4 bits of the error correction level binary code are the same, search for the eligible code groups from back to front. The first eligible group found is the second-to-last group: 10101010. Convert the low 4-bit code: 1010 to a decimal number, which is 10. According to the error correction level mapping table, the corresponding error correction level for 10 is 100%. At the same time, initially divide the L = 12 groups on the left side of this group as binary die character codes, and the R = 1 on the right side as binary error correction codes. According to the calculated error correction ability T, round T down:

[0243] T=(L + 1)×P=(12 + 1)×100% = 12

[0244] According to the calculated error correction ability, the number of error correction codes K required can be determined: K = 2×T = 2×12 = 24. Then verify whether K is equal to R. It can be seen that K = 24 ≠ R. So the information stored in this group is not the error correction level binary code.

[0245] Next, continue to search forward for other code groups. The second eligible group found is the seventh-to-last group: 01000100. Convert the low 4-bit code: 0100 to a decimal number, which is 4. According to the error correction level mapping table, the corresponding error correction level for 4 is 40%. At the same time, initially divide the L = 7 groups on the left side of this group as binary die character codes, and the R = 6 on the right side as binary error correction codes. According to the calculated error correction ability T, round T down:

[0246] T=(L + 1)×P=(7 + 1)×40% = 3

[0247] According to the calculated error correction ability, the number of error correction codes K required can be determined: K = 2×T = 2×3 = 6. Then verify whether K is equal to R. It can be seen that K = 6 = R. So the information stored in this group is the error correction level binary code, and the error correction level is determined to be 40%, the number of error correction codes is K = 6, and the number of binary die character code groups is 7 groups.

[0248] If all groups are searched and failed, it is determined that the code recognized in S6 is incorrect, and re-identification is required.

[0249] S72 Coding Detection: Based on the number of error correction codes K determined in S71, construct the corresponding generating polynomial G(x) according to the generating polynomial calculation formula in S33 and solve its root set. Convert the binary code sequence recognized in S6 into a decimal value sequence List in groups of 8 bits and construct the corresponding message polynomial R(x); verify by substituting each root of the generating polynomial into the message polynomial R(x). If all roots make the value of the message polynomial R(x) zero, it is determined that the code recognition is error-free. If there is a root that makes the value of the message polynomial R(x) non-zero, it is determined that the code recognition is incorrect, and the corresponding error correction processing mechanism is triggered.

[0250] Specifically, assuming that the number of error correction codes determined based on the S71 is K = 4, then the corresponding generating polynomial is:

[0251] G(x) = (x - α 0 )(x - α 1 )(x - α 2 )(x - α 3 )

[0252] The roots corresponding to the generating polynomial G(x) can be obtained as α 0 , α 1 , α 2 , α 3 .

[0253] Assume that the binary coding sequence correctly recognized by the S6 is:

[0254] 101011000010011111001101100001011100100010110000000111110110000000010111011001010011101110001101. Converted into a decimal numerical sequence List in groups of 8 bits: 172, 39, 205, 133, 200, 176, 31, 96, 23, 101, 59, 141. The corresponding message polynomial R(x) is: R(x) = 172x 11 + 39x 10 + 205x 9 + 133x 8 + 200x 7 + 176x 6 + 31x 5 + 96x 4 + 23x 3 + 101x 2 + 59x + 141

[0255] Substitute the roots α 0 , α 1 , α 2 , α 3 of the generating polynomial G(x) into the above R(x). The final calculation result is R(α 0 ) = 0, R(α 1 ) = 0, R(α 2 ) = 0, R(α 3 ) = 0. If all roots make the value of the message polynomial R(x) zero, it is determined that the coding recognition is error-free.

[0256] Suppose the misidentified binary coding sequence is: 101011000010011111001101100001101100100010110000000111100110000000010111011001010011101110001101. Converted into a decimal numerical sequence List in groups of 8 bits: 172, 39, 205, 134, 200, 176, 30, 96, 23, 101, 59, 141. The corresponding message polynomial R(x) is: R(x) = 172x 11 + 39x 10 + 205x 9 + 134x 8 + 200x 7 + 176x 6 + 30x 5 + 96x 4 + 23x 3 + 101x 2 + 59x + 141

[0257] Substitute the roots α 0 , α 1 , α 2 , α 3 of the generating polynomial G(x) into the above R(x). The final calculation results are R(α 0 ) = 2, R(α 1 ) = 7, R(α 2 ) = 160, R(α 3 ) = 170. If all the roots exist such that the value of the message polynomial R(x) is not zero, it is determined that there is an error in the coding recognition.

[0258] S73 coding error correction: Based on the calculation results of the message polynomial R(x) obtained from the above S72, construct the error polynomial E(x) and the error location polynomial σ(x). Determine the error location by solving the roots of the error location polynomial, and calculate the error magnitude in combination with the error polynomial. Finally, locate and correct the error bits in the recognized coding according to the obtained error location and error magnitude to achieve accurate recovery of the coded data.

[0259] Specifically, taking the binary coding with recognition errors in the above S72 as an example, the corresponding message polynomial R(x) is: R(x) = 172x 11 + 39x 10 + 205x 9 + 134x 8 + 200x 7 + 176x 6 + 30x 5 + 96x 4 + 23x3 +101x 2 +59x + 141

[0260] Substitute the roots α of the generator polynomial G(x) 0 , α 1 , α 2 , α 3 into the above R(x), and the final calculation results are R(α 0 ) = 2, R(α 1 ) = 7, R(α 2 ) = 160, R(α 3 ) = 170.

[0261] According to the number of error - correcting codes K = 4, it can be known that it can correct at most 2 errors. Assume that the correct message polynomial C(x) has an identification error during the identification process, and the error polynomial is E(x). Therefore, the actually identified message polynomial R(x) can be expressed as:

[0262] R(x)=C(x)+E(x)

[0263] According to the process of constructing the error polynomial, the syndrome polynomial S j and the error generator E(x) have the following relationship:

[0264]

[0265] According to the above S73, construct the error polynomial σ(x), assuming that it can correct t errors:

[0266] σ(x)=(1 - X1x)(1 - X2x)…(1 - X t x)=1 + σ1x+…+σ t-1 x t-1 +σ t x t

[0267] Expanding it gives:

[0268]

[0269] Finally, it is transformed into:

[0270]

[0271] Among them, this addition is the Galois addition operation (i.e., the exclusive - or operation)

[0272] According to the error correction code K = 4, at most 2 errors can be corrected. Therefore, there are at most 2 error position numbers and error amplitudes. So the error polynomial only has two terms: σ(x) = (1 - X1x)(1 - X2x). Thus, σ1 = -(X1 + X2) and σ2 = X1X2 can be obtained.

[0273] According to the syndrome polynomial S t and σ t , the following relationship can be obtained:

[0274]

[0275] Substituting the values of S0, S1, S2, and S3, we can get:

[0276]

[0277] Solving, we can get:

[0278]

[0279] According to the addition and multiplication operation rules of the Galois field in Appendix 2, and during the operation process, decimal integers need to be converted into Galois field coefficients. We can further obtain: X1 = 45 (equivalent to α in the Galois field 8 ), X2 = 32 (equivalent to α in the Galois field 5 ).

[0280] So we can know that the positions where errors occur are the two coefficients of x 8 and x 5 .

[0281] Then substituting X1 = 45 (equivalent to α in the Galois field 8 ) and X2 = 32 (equivalent to α in the Galois field 5 ) into E(x), we can obtain Y1 = 3 and Y2 = 1.

[0282] So the correct message polynomial C(x) = R(x) - E(x) = R(x) + E(x) (according to the addition operation rule of the Galois field in Appendix 2):

[0283]

[0284] Finally, the corrected correct message polynomial is:

[0285] C(x) = 172x 11 + 39x 10 + 205x 9 + 133x 8 + 200x 7 + 176x 6 + 31x 5+96x 4

[0286] +23x 3 +101x 2 +59x+141

[0287] S74 coding restoration: Convert the decimal value sequence after error checking and correction in steps S72 and S73 into binary coding, extract the binary coding segment representing the mold coding information according to the preset coding combination rule, and then perform the inverse operation corresponding to the coding conversion process in step S1. Restore the binary coding sequence to the original mold ID character coding through the character coding mapping table.

[0288] Specifically, assume that the decimal value sequence after error checking and correction in steps S72 and S73 is converted into binary coding as: 1010000100011100110111000000000100010000101000001101110001000100001101111000000101010000111100011010101011110110, a total of 112 bits. Among them, according to the error correction code K = 6 determined in step S72 and the S4 coding combination rule, it can be known that the last 48 bits of this sequence are 6 8-bit binary error correction codes, the first 8 bits are the binary coding of the error correction level, and the remaining first 56 bits are the mold character binary coding 10100001000111001101110000000001000100001010000011011100;

[0289] Based on the character coding conversion rule in step S13, each group of character coding is 11 bits. Therefore, the 56-bit mold character coding can be divided into 5 groups, and the last group is filled with 1 bit of 0 at the low position to 11 bits because 56 divided by 11 has a remainder of 1. Therefore, based on the generation rule of character coding, divide the first 55-bit binary coding into 5 character groups by 11 bits per group, and calculate and restore the original coding value corresponding to each character group by group through the reverse parsing formula "coding value of the character group = coding value of the first character × coding table length + coding value of the second character".

[0290] 11-bit coding of the first group: 10100001000 Corresponding decimal value: 1288 Corresponding character coding: "SS"

[0291] 11-bit coding of the second group: 11100110111 Corresponding decimal value: 1847 Corresponding character coding: "-2"

[0292] Group 3 11-bit encoding: 00000000010, corresponding decimal value: 2, corresponding character encoding: "02"

[0293] Group 4 11-bit encoding: 00100001010, corresponding decimal value: 266, corresponding character encoding: "5-"

[0294] Group 5 11-bit encoding: 00001101110, corresponding decimal value: 110, corresponding character encoding: "2K"

[0295] Therefore, the original mold ID character encoding finally restored is: SS-2025-2K

[0296] According to the disclosure and teaching of the above specification, those skilled in the art to which the present invention pertains can also make changes and modifications to the above embodiments. Therefore, the present invention is not limited to the specific embodiments disclosed and described above, and some modifications and changes to the invention should also fall within the protection scope of the claims of the present invention. In addition, although some specific terms are used in this specification, these terms are only for convenience of description and do not constitute any limitation to the invention.

Claims

1. A coding and decoding method for binary-based dynamic adaptive die coding, characterized in that Including the following steps: S1 Character encoding conversion: Map each character of the original ID character encoding of the mold according to a preset character encoding table to obtain the decimal value corresponding to the original ID character encoding, and convert the decimal value into a character binary encoding; S2 Error correction level configuration and confirmation: Set the error correction level, each error correction level corresponds to a numerical identifier, and convert the numerical identifier corresponding to the error correction level into an error correction level binary encoding according to a predetermined rule; S3 Generating error correction codes: Based on the character binary encoding obtained in S1 and the error correction level binary encoding obtained in S2, calculate the number of error correction codes according to a predetermined rule, and construct a generating polynomial according to the number of error correction codes; Then, according to the Reed-Solomon coding algorithm, combine the message polynomial and the generating polynomial to generate a complete error correction code, and convert the error correction code into an error correction code binary encoding; S4 Coding combination: Arrange and combine the character binary encoding, the error correction level binary encoding, and the error correction code binary encoding in the preset coding structure and in the front-to-back coding order to generate a combined binary encoding sequence containing complete information; S5 Generating a coding pattern: According to the preset mapping rule from binary to pattern elements, convert each binary data in the combined binary encoding sequence into a corresponding pattern unit, and fill it into an N×N two-dimensional matrix according to the formulated arrangement rule, and finally generate a rectangular coding pattern with unique identification characteristics, where N is the scale parameter of the two-dimensional matrix, and N is the smallest positive integer that meets the coding capacity requirements; S6 Coding recognition: Use coding recognition technology to recognize the rectangular coding pattern, and convert the recognized pattern information into a corresponding recognized binary encoding sequence; S7 Decoding: Convert the recognized binary encoding sequence into a corresponding recognized decimal numerical sequence through a preset rule, then perform error detection and correction according to the error correction coding rule, and convert the verified decimal numerical sequence into a corrected binary encoding, and restore the corrected binary encoding to the original ID character encoding of the mold according to the inverse operation corresponding to the S1 character encoding conversion process.

2. The encoding and decoding method of a binary-based dynamic adaptive die coding according to claim 1, characterized in that The scale parameter N is calculated and determined according to the length of the combined binary encoding sequence.

3. The encoding and decoding method of a binary-based dynamic adaptive die coding according to claim 1, characterized in that, The S1 character encoding conversion includes the following steps: S11 Generating a coding table: According to the predetermined character set range and the number of characters of the original ID character encoding of the mold, construct a mapping relationship table between characters and coding values according to the sequential arrangement rule, where each character corresponds to a unique decimal value, and the coding values increase sequentially from the starting value, and finally generate a decimal value comparison table containing the complete character set mapping relationship; S12 Decimal coding calculation: According to the original ID character encoding sequence of the mold, first divide the characters into groups of two in order. If the total number of characters is odd, the last character forms a separate group; Then perform decimal coding calculation on each character group according to the coding table to generate the decimal value corresponding to the original ID character encoding of the mold. The decimal value calculation formula for each character group is: the decimal value of the character group = the encoding value of the first character * the length of the encoding table + the encoding value of the second character; S13 Binary Encoding Conversion: Convert each value in the decimal value into a group of binary encodings with a fixed length of 11 bits. For the binary encodings that are less than 11 bits after conversion, pad zeros at the high positions until the specified length is reached. Then, connect and combine each group of 11-bit binary encodings in the order of the decimal values to finally generate the character binary encoding corresponding to the original ID characters of the mold.

4. The encoding and decoding method of a binary-based dynamic adaptive die encoding according to claim 3, wherein, The S2 error correction level configuration and confirmation include the following steps: S21 Level Range Setting: Set the configurable range of the error correction level to be from 10% to 100%, where the minimum error correction level is set to 10% and the maximum error correction level is set to 100%, and establish equally spaced level divisions with 10% as the fixed increment unit; S22 Level Mapping Establishment: Establish a one-to-one mapping relationship from the percentage error correction level to the digital identifier. Among them, the 10% error correction level corresponds to the digital identifier 1, 20% corresponds to the digital identifier 2, and so on until 100% corresponds to the digital identifier 10, thereby constructing a complete error correction level mapping comparison table; S23 Generate Level Binary Encoding: Determine the target error correction level according to the specific requirements of the application scenario, and obtain the corresponding digital identifier value by querying the level mapping table; Convert the digital identifier within the range of 1 to 10 into a 4-bit binary encoding, and pad 0 at the high position when it is less than 4 bits; Then copy and splice the generated 4-bit error correction level binary encoding to the high position to form an 8-bit binary encoding, where the high 4 bits and the low 4 bits have the same content, and finally generate the complete error correction level binary encoding.

5. The encoding and decoding method of a binary-based dynamic adaptive die coding according to claim 4, characterized in that, The S3 error correction code generation includes the following steps: S31 Calculate the Message Polynomial: Group the character binary encoding sequence generated in S13 in units of 8 bits in order. If the last group is less than 8 bits, pad 0 at the low position until it reaches 8 bits; Then convert each 8-bit binary group into the corresponding decimal value to generate a decimal value sequence containing all the conversion results of the groups; And append the decimal value obtained by converting the error correction level binary encoding obtained in S23 to the end of the sequence to finally generate the message polynomial decimal value sequence for constructing the message polynomial; S32 Calculate the Number of Error Correction Codes: Take the low 4 bits of the error correction level binary encoding generated in S23 and convert them into the error correction level decimal value, and determine the corresponding error correction level Q by querying the level mapping table; Then, based on the length N of the message polynomial decimal value sequence obtained in S31, calculate the error correction code error correction ability parameter E required to meet the error correction requirements in combination with the error correction level Q; Finally, calculate the number of error correction codes k according to the relationship of the error correction ability; S33 Calculate the Generator Polynomial: Based on the number of error correction codes k obtained in S32, calculate the generator polynomial G0(x) according to the Galois field theory. The calculation formula of the generator polynomial is as follows: G0(x) = (x - α 0 )(x - α 1 )(x - α 2 )…(x - α k-1 ) (5) Among them, α 0 , α 1 , α 2 , …, α k-1 are all elements of the Galois field; S34 Calculate the error correction code: Based on the message polynomial calculated in S31 and the generator polynomial calculated in S33, calculate the error correction code according to the Reed-Solomon coding theory, and convert the error correction code into a binary error correction code.

6. A coding and decoding method for binary-based dynamic adaptive die coding according to claim 5, characterized in that The calculation of the message polynomial in S31 includes the following steps: S311: According to the Reed-Solomon coding theory, map the decimal numerical sequence of the message polynomial obtained in S31 to polynomial coefficients in order from the highest-degree term to the lowest-degree term. The first numerical value in the sequence is used as the coefficient of the highest-degree term, and the subsequent numerical values correspond to the coefficients of the decreasing-degree terms in turn, and finally generate a message polynomial containing complete coefficient information. The constructed message polynomial M0(x) is as follows: M0(x) = Ax 5 + Bx 4 + Cx 3 + Dx 2 + Ex 1 + F(1) where A, B, C, D, E, F are the numerical values in order of the decimal numerical sequence of the message polynomial obtained in S31; Convert each coefficient in M0(x) to a Galois field coefficient according to the Galois field mapping table. At this time, M0(x) is: M0(x) = β1x 5 + β2x 4 + β3x 3 + β4x 2 + β5x 1 + β6(2) where β1, β2, β3, β4, β5, β6 are Galois field coefficients.

7. A coding and decoding method for binary-based dynamic adaptive die coding according to claim 6, characterized in that The calculation of the number of error correction codes in S32 includes the following steps: The formula for calculating the error correction ability E in S321 is as follows: E = N × Q (3) where e is a positive integer and is rounded down to the nearest integer of (N × Q); The formula for calculating the number of error correction codes k in S322 is as follows: k = 2 × E (4).

8. A coding and decoding method for binary-based dynamic adaptive die coding according to claim 7, characterized in that The calculation of the error correction code in S34 includes the following steps: S341 Alignment of the highest degree of the polynomial: Denote the highest degree of x in the determined message polynomial as w1, and denote the highest degree of x in the determined generator polynomial as w2. The highest degree is aligned to w1 + w2; Then each term of the message polynomial M0(x) is multiplied by Each term of the generating polynomial G0(x) is multiplied by Align the highest degree of the new message polynomial M1(x) with the generating polynomial G1(x); S342 Alignment of the coefficients corresponding to the highest degree: Extract the Galois field coefficient corresponding to the integer coefficient of the highest-degree term of x in the message polynomial M1(x) after the degree alignment process in S341, denoted as α1. Then multiply each term of the generator polynomial G1(x) after the degree alignment process in S341 by α1 to obtain a new generator polynomial G2(x) with aligned coefficients; S342 Polynomial calculation: Perform term-by-term operations on the message polynomial M1(x) and the generator polynomial G2(x) in the Galois field. First, convert the Galois field coefficients of each term of the polynomial to the corresponding integer values through the Galois field mapping table; then perform the combination of like terms, and perform exclusive OR operations on the coefficient values of like terms during the combination process; finally, convert the integer coefficients in the operation result back to Galois field coefficients through the Galois field mapping table to generate the final operation result polynomial R(x); S343 Iterative Calculation: Based on the length N of the complete decimal numerical sequence of the constructed message polynomial obtained from S31, the three steps of S341, S342, and S342 are iteratively calculated N times in a loop. The operation result polynomial R(x) obtained from each iterative calculation will be used as the message polynomial for the next iterative calculation input. Through loop calculation, the required error correction code polynomial is finally obtained; The sequence arranged in the order of the coefficients of the polynomial terms is used as the final error correction code output sequence; S344 Generate Binary Error Correction Code: Convert each integer value in the error correction code sequence obtained from S343 into an 8-bit binary code with a fixed length. If the number of bits after conversion is less than 8 bits, fill 0s in the high positions until it reaches 8 bits; Then connect and combine all 8-bit binary codes in the original order of the coefficients of the coefficient polynomial, and finally generate the complete error correction code binary error correction code.

9. A coding and decoding method for binary-based dynamic adaptive die coding according to claim 8, characterized in that, The S4 encoding combination includes the following steps: S4 Encoding Combination: Arrange and combine the character binary code generated by S1, the error correction level binary code generated by S2, and the error correction code binary code generated by S3 in the order of the preset encoding structure. The character binary code is used as the information data segment at the starting position of the encoding, the error correction level binary code is used as the configuration identification segment after the starting position, and the error correction code binary code is used as the check data segment at the end of the encoding. Finally, a combined binary code sequence containing complete information is generated.

10. A coding and decoding method for binary-based dynamic adaptive die coding according to claim 9, characterized in that, The S7 decoding includes the following steps: S71 Determine the Error Correction Level: Divide the identified binary code sequence obtained from S6 into groups of 8 bits. Based on the feature that the high 4 bits and the low 4 bits of the error correction level binary code are the same, search for the qualified code group from back to front; When it is detected that a certain code group meets the feature, convert this code group into a decimal value and determine the error correction level P through the error correction level mapping table. At the same time, initially divide the L groups on the left side of this code group as binary die character codes, and the R groups on the right side as binary error correction code codes; then calculate the error correction ability T according to the following formula: T = (L + 1) × P (6) where floor(T) is taken; According to the calculated error correction ability, determine the theoretical number of error correction codes K: K = 2 × T (7) Then, determine whether the current code group grouping is the error correction level binary code by verifying whether K is equal to R. If they are equal, confirm that this code group is the error correction level binary code and proceed to the next step; If they are not equal, continue to search for other code groups forward; if all searches fail, it is determined that the S6 encoding recognition is incorrect and re-identification is required; S72 Encoding Detection: Based on the number of error correction codes K determined in S71, construct the corresponding generating polynomial G(x) according to the generating polynomial calculation formula of S33 and solve the root set of G(x) = 0; Convert the binary coding sequence recognized by S6 into a decimal numerical sequence List in groups of 8 bits and construct the corresponding message polynomial R(x); verify by substituting each root of the generating polynomial into the message polynomial R(x). If all roots make the value of the message polynomial R(x) zero, it is determined that the coding recognition is error-free. If there is a root that makes the value of the message polynomial R(x) non-zero, it is determined that there is an error in the coding recognition, and the corresponding error correction processing mechanism is triggered; S73 Coding Error Correction: Based on the calculation result of the message polynomial R(x) obtained in S72, construct the error polynomial E(x) and the error location polynomial σ(x), determine the error location by solving the roots of the error location polynomial, and calculate the error magnitude in combination with the error polynomial. Finally, locate and correct the error bits in the recognized coding according to the obtained error location and error magnitude to accurately restore the coded data; S74 Coding Restoration: Convert the decimal numerical sequence after being tested and error-corrected in steps S72 and S73 into a binary coding, extract the binary coding segment representing the mold coding information according to the preset coding combination rule, and then perform the inverse operation corresponding to the coding conversion process in step S1, and restore the binary coding sequence to the original mold ID character coding through the character coding mapping table.

Citation Information

Patent Citations

  • A binary-based pattern encoding and recognition method, storage device, and smart terminal

    CN117375623B