An information code generation method, related device, equipment and storage medium
By optimizing the point distribution of information codes, the problem of existing QR codes being concentrated after mask processing is solved, and better information code detection and recognition effects are achieved.
Patent Information
- Application Number
- CN202010060017.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-01-19
- Publication Date
- 2025-06-24
- Estimated Expiration
- 2040-01-19
AI Technical Summary
The existing QR code is prone to concentrated points after mask processing, resulting in poor detection and identification of information codes.
By obtaining the number of fill-in bits of information to be encoded, designing and beautifying the value of points, optimizing the point distribution of information codes, and then generating information codes that are easier to detect and identify.
It improves the point display effect of information codes and enhances the detection and recognition capabilities of information codes.
Smart Images

Figure CN113139636B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of information processing technologies, and in particular, to a method for generating information codes, related devices, equipment, and storage media. Background Art
[0002] With the development of the Internet, the application of information codes in the Internet has become increasingly widespread, such as two-dimensional barcodes or QR codes, etc. Information codes have the advantages of high coding density, large information capacity, and high recognition rate. Users can use terminal devices to achieve various functions by recognizing information codes, such as information query, data download, and online banking payment, etc.
[0003] QR codes are prone to problems such as overly concentrated distribution of black and white dots and inconvenient recognition. In response to this problem, the common practice in the industry is to adopt multiple built-in mask patterns, perform effect scoring according to the morphology of the mask patterns, then select one of the mask patterns for masking processing, and encode the identifier of the mask pattern into the meta-information of the information code.
[0004] The data matrices generated after encoding different data are diverse. However, the currently provided mask patterns are limited, usually only eight common mask patterns. Therefore, in the case where the masking effects corresponding to these eight mask patterns are all poor, there may still be a situation where the points are concentrated after masking, which is not conducive to the detection and recognition of information codes. Summary of the Invention
[0005] Embodiments of this application provide a method for generating information codes, related devices, equipment, and storage media, which can design the values of beautifying points according to data bits and error correction bits, and it is easier to obtain a better point display effect, which is conducive to the detection and recognition of information codes.
[0006] In view of this, embodiments of this application provide a method for generating information codes, including:
[0007] Obtain the number of padding bits corresponding to the information to be encoded;
[0008] According to the number of padding bits, obtain the to-be-filled template corresponding to the target beautifying level, where the to-be-filled template includes N points, the N points include M beautifying points and (N - M) to-be-filled points, N is an integer greater than 1, and M is an integer greater than 1 and less than N;
[0009] Fill the data bits and error correction bits corresponding to the information to be encoded into the (N - M) to-be-filled points in the to-be-filled template to obtain a to-be-synthesized information code;
[0010] According to the to-be-synthesized information code, fill the M beautifying points in the to-be-filled template to obtain the target information code.
[0011] An embodiment of the present application provides an information code generation device, including:
[0012] An acquisition module, configured to acquire the number of padding bits corresponding to the information to be encoded;
[0013] The acquisition module is further configured to acquire a to-be-filled template corresponding to the target beautification level according to the number of padding bits acquired by the acquisition module, where the to-be-filled template includes N positions, and the N positions include M beautification positions and (N - M) to-be-filled positions, N is an integer greater than 1, and M is an integer greater than 1 and less than N;
[0014] A filling module, configured to fill the data bits and error correction bits corresponding to the information to be encoded acquired by the acquisition module into the (N - M) to-be-filled positions in the to-be-filled template to obtain a to-be-synthesized information code;
[0015] The filling module is further configured to fill the M beautification positions in the to-be-filled template according to the to-be-synthesized information code obtained by the filling module to obtain a target information code.
[0016] In a possible design, the embodiment of the present application further includes
[0017] The acquisition module is specifically configured to acquire the information to be encoded and the version information corresponding to the information to be encoded, where the version information is used to determine the total number of positions;
[0018] Determine the number of data bits and the number of error correction bits according to the information to be encoded;
[0019] Determine the number of padding bits corresponding to the information to be encoded according to the total number of positions, the number of data bits, and the number of error correction bits.
[0020] In a possible design, the embodiment of the present application further includes
[0021] The acquisition module is specifically configured to determine the target beautification level from the beautification level set according to the number of padding bits, where the beautification level set includes at least one beautification level, and each beautification level corresponds to a beautification position number range;
[0022] Acquire the to-be-filled template corresponding to the target beautification level, where the target beautification level corresponds to at least one to-be-filled template, and the to-be-filled template belongs to any one of the at least one to-be-filled template.
[0023] In a possible design, the information code generation device in the embodiment of the present application further includes an adding module;
[0024] The acquisition module is further configured to acquire the beautification level identifier corresponding to the target beautification level;
[0025] An adding module, configured to add a beautification level identifier to meta-information corresponding to information to be encoded, where the meta-information further includes version information, error correction level information, and mask array identifier corresponding to the information to be encoded.
[0026] In a possible design, the information code generation device in the embodiment of the present application further includes an encoding module;
[0027] The encoding module is configured to encode the information to be encoded to obtain data bits corresponding to the information to be encoded, where the data bits are composed of multiple binary data;
[0028] The encoding module is further configured to encode the data bits to obtain parity bits corresponding to the information to be encoded, where the parity bits are composed of multiple binary data.
[0029] In a possible design, the information code generation device in the embodiment of the present application further includes a generation module;
[0030] The generation module is configured to generate a binary sequence according to the data bits and parity bits corresponding to the information to be encoded;
[0031] The filling module is specifically configured to:
[0032] Determine the number of target positions according to the binary sequence, where the number of target positions is the sum of the number of data bits and the number of parity bits;
[0033] According to the number of target positions, fill the binary sequence into (N - M) to-be-filled positions in the to-be-filled template in the information code filling order to obtain a to-be-synthesized information code.
[0034] In a possible design, the embodiment of the present application further includes:
[0035] The filling module is specifically configured to, if the number of target positions is equal to (N - M), fill the binary sequence into (N - M) to-be-filled positions in the to-be-filled template in the information code filling order;
[0036] When the (N - M) to-be-filled positions are filled, generate a to-be-synthesized information code.
[0037] In a possible design, the embodiment of the present application further includes:
[0038] The filling module is specifically configured to, if the number of target positions is less than (N - M), fill the binary sequence into P to-be-filled positions in the to-be-filled template in the information code filling order, where P is an integer greater than or equal to 1 and less than (N - M);
[0039] When the P to-be-filled positions are filled, obtain (N - M - P) to-be-filled positions;
[0040] Fill the (N - M - P) to - be - filled positions in the to - be - filled template to obtain the to - be - synthesized information code.
[0041] In a possible design, the embodiment of the present application further includes:
[0042] A filling module, specifically configured to obtain a beautification point sequence according to M beautification points in the to - be - filled template, where the beautification point sequence includes at least one continuous beautification point among the M beautification points;
[0043] According to the to - be - synthesized information code, determine a first adjacent bit and a second adjacent bit associated with the beautification point sequence, where the first adjacent bit is a to - be - filled position adjacent to the first beautification point of the beautification point sequence, and the second adjacent bit is a to - be - filled position adjacent to the last beautification point of the beautification point sequence;
[0044] Obtain a first value corresponding to the first adjacent bit and a second value corresponding to the second adjacent bit;
[0045] If the first value is the same as the second value, fill a third value into each beautification point in the beautification point sequence, where the third value, the first value, and the second value are the same value.
[0046] In a possible design, the embodiment of the present application further includes:
[0047] A filling module, specifically configured to obtain a beautification point sequence according to M beautification points in the to - be - filled template, where the beautification point sequence includes at least one continuous beautification point among the M beautification points;
[0048] According to the to - be - synthesized information code, determine a first adjacent bit and a second adjacent bit associated with the beautification point sequence, where the first adjacent bit is a to - be - filled position adjacent to the first beautification point of the beautification point sequence, and the second adjacent bit is a to - be - filled position adjacent to the last beautification point of the beautification point sequence;
[0049] Obtain a first value corresponding to the first adjacent bit and a second value corresponding to the second adjacent bit;
[0050] If the first value is different from the second value, obtain a first continuous value count corresponding to the first value and a second continuous value count corresponding to the second value;
[0051] If the first continuous value count is greater than the second continuous value count, fill a third value into each beautification point in the beautification point sequence, where the third value is the same as the first value;
[0052] If the number of the first consecutive numerical values is less than the number of the second consecutive numerical values, then fill each beautification point in the beautification point sequence with a third numerical value, where the third numerical value is the same as the second numerical value.
[0053] In a possible design, the embodiment of the present application further includes:
[0054] A generation module, specifically configured to generate a to-be-processed binary sequence according to data bits and error correction bits corresponding to to-be-encoded information;
[0055] Obtain a set of mask arrays, where the set of mask arrays includes Q mask arrays, and Q is an integer greater than or equal to 1;
[0056] Based on the set of mask arrays, calculate the to-be-processed binary sequence by using each mask array to obtain Q to-be-selected binary sequences, where the to-be-selected binary sequences and the mask arrays have a one-to-one correspondence;
[0057] Generate Q mask scores according to the Q to-be-selected binary sequences, where the to-be-selected binary sequences and the mask scores have a one-to-one correspondence;
[0058] Determine a target mask score according to the Q mask scores, where the target mask score is the minimum value among the Q mask scores;
[0059] Determine the to-be-selected binary sequence corresponding to the target mask score as the binary sequence.
[0060] In a possible design, the embodiment of the present application further includes:
[0061] A generation module, specifically configured to obtain an initial score corresponding to the to-be-selected binary sequence among the Q to-be-selected binary sequences;
[0062] Obtain the number of isolated points and the number of consecutive points according to the to-be-selected binary sequence, where an isolated point represents a point where the value is different from the values of two adjacent points, and a consecutive point represents a point where the value is the same as the value of at least one adjacent point;
[0063] Determine a first score according to the number of isolated points;
[0064] Determine a second score according to the number of consecutive points;
[0065] Determine the mask score corresponding to the to-be-selected binary sequence among the Q mask scores according to the initial score, the first score, and the second score.
[0066] The embodiment of the present application provides an electronic device, including: a memory, a transceiver, a processor, and a bus system;
[0067] Wherein, the memory is used to store programs;
[0068] The processor is used to execute the program in the memory, including executing the method described in the above aspects;
[0069] The bus system is used to connect the memory and the processor, so that the memory and the processor can communicate with each other.
[0070] An embodiment of the present application provides a computer-readable storage medium, in which instructions are stored. When the instructions run on a computer, the computer is enabled to execute the methods described in the above aspects.
[0071] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages:
[0072] In the embodiments of the present application, a method for generating an information code is provided. First, the number of padding bits corresponding to the information to be encoded is obtained, and then according to the obtained number of padding bits, the filling template corresponding to the target beautification level is obtained. The filling template includes N positions, and the N positions include M beautification positions and (N - M) positions to be filled. Furthermore, the data bits and error correction bits corresponding to the information to be encoded are filled into the (N - M) positions to be filled in the filling template to obtain the information code to be synthesized. Finally, according to the information code to be synthesized, the M beautification positions in the filling template can be filled to obtain the target information code, where N is an integer greater than 1, and M is an integer greater than 1 and less than N. Through the above method, for different information to be encoded, the positions of the beautification positions corresponding to the filling template can be determined, and the value of each beautification position is flexible, that is, the value of the beautification position can be designed according to the data bits and error correction bits, which is more likely to achieve a better position display effect and is beneficial to the detection and recognition of the information code. BRIEF DESCRIPTION OF THE DRAWINGS
[0073] Figure 1 It is a schematic structural diagram of an information code generation system in an embodiment of the present application;
[0074] Figure 2 It is a schematic diagram of an embodiment of the method for generating an information code in an embodiment of the present application;
[0075] Figure 3 It is a schematic diagram of an embodiment of a target information code in an embodiment of the present application;
[0076] Figure 4 It is a schematic diagram of an embodiment of a filling template in an embodiment of the present application;
[0077] Figure 5 It is a schematic diagram of an embodiment of the target information code corresponding to the beautification level in an embodiment of the present application;
[0078] Figure 6 Schematic diagram of an embodiment of the information code filling order in the embodiment of the present application;
[0079] Figure 7 Schematic diagram of another embodiment of the information code filling order in the embodiment of the present application;
[0080] Figure 8 Schematic diagram of an embodiment of the beautification point filling in the embodiment of the present application;
[0081] Figure 9 Schematic diagram of another embodiment of the beautification point filling in the embodiment of the present application;
[0082] Figure 10 Schematic diagram of an embodiment of the corresponding relationship between mask data and characters in the embodiment of the present application;
[0083] Figure 11 Schematic diagram of an embodiment of the corresponding relationship between mask data and probability in the embodiment of the present application;
[0084] Figure 12 Schematic diagram of an embodiment of the information code generation device in the embodiment of the present application;
[0085] Figure 13 Schematic diagram of a structure of an electronic device in the embodiment of the present application. Detailed implementation manners
[0086] The embodiment of the present application provides a method, a related device, a device and a storage medium for information code generation, which are used to determine the position of the beautification point corresponding to the template to be filled for different information to be encoded, and the value of each beautification point is flexible, that is, the value of the beautification point can be designed according to the data bit and the error correction bit, and it is easier to obtain a better point display effect, which is beneficial to the detection and recognition of the information code.
[0087] The terms "first", "second", "third", "fourth", etc. (if any) in the specification, claims and drawings of the present application are used to distinguish similar objects, and do not have to be used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances, so that the embodiments of the present application described here can be implemented in an order other than those illustrated or described here. In addition, the terms "include" and "correspond to" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device including a series of steps or units does not have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0088] It should be understood that the embodiments of the present application can be used in scenarios for identifying information codes. In the embodiments of the present application, the information code is taken as a two-dimensional code as an example for further illustration. In practical applications, the information code can also include barcodes, program codes of data information, or identification codes, etc., which are not limited herein. Specifically, the two-dimensional code can also be called a two-dimensional bar code, which is a black and white pattern distributed in a plane according to a certain rule with specific geometric figures to record data symbol information. In terms of code compilation, the concept of "0" and "1" bit streams that form the internal logic basis of a computer is utilized, and several geometric shapes corresponding to binary are used to represent alphanumeric information. Each code system has its specific character set, each character occupies a certain width, and has a certain verification function. By identifying the two-dimensional code through a terminal device, information identification can be achieved.
[0089] Specifically, taking information query as an example, a terminal device can scan a two-dimensional code storing personal business card information, map information, data information, or Wi-Fi password to obtain the corresponding information, thereby improving the efficiency of information acquisition. Taking online banking payment as another example, the terminal device identifies the product two-dimensional code, and after correctly identifying the two-dimensional code, the payment can be completed through the terminal device channel provided by the bank or a third-party payment, improving the efficiency of product payment while ensuring the accuracy of product payment. Taking automatic traceability as yet another example, by identifying the two-dimensional code corresponding to official documents, production line parts, customer service marks, mail order shipments, maintenance records, dangerous goods, logistics supply marks, medical examination marks, or ecological research, the traceability of the aforementioned items or information can be automatically carried out, saving information query and traceability resources and improving the traceability efficiency. It should be understood that the two-dimensional code can also be applied to the transmission and exchange of materials such as official document forms, commercial forms, import and export declarations, and manifests, reducing manual repeated input of form data, avoiding human errors, and reducing labor costs, or can also be applied to the data registration and automatic input of documents such as passports, identity cards, registration certificates, driver's licenses, membership cards, identification cards, and chain store membership cards, improving the effect of information management. The examples here are only for facilitating the understanding of this solution and do not exhaust all application scenarios of the present application.
[0090] In order to enable the information code to achieve a better point display effect and improve the detection and recognition effect of the information code in the above various scenarios, the present application proposes a method for generating an information code, which is applied to Figure 1 the information code generation system shown in, please refer to Figure 1 , Figure 1This is a schematic architecture diagram of the information code generation system in an embodiment of the present application. As shown in the figure, the information code generation system includes a server and a terminal device. The information code generation device can be deployed on the server or on a terminal device with higher computing power. Hereinafter, an example in which the information code generation device is deployed on the terminal device will be introduced.
[0091] Specifically, before generating the information code, the terminal device needs to first obtain the information to be encoded, and then obtain the corresponding number of padding bits according to the information to be encoded. Then, according to the number of padding bits, obtain the filling template corresponding to the target beautification level. The filling template includes N positions, and the N positions include M beautification positions and (N - M) positions to be filled. Further, the terminal device can fill the data bits and error correction bits corresponding to the information to be encoded into the (N - M) positions to be filled in the filling template to obtain the information code to be synthesized. Finally, according to the information code to be synthesized, fill the M beautification positions in the filling template to obtain the target information code, where N is an integer greater than 1, and M is an integer greater than 1 and less than N. The terminal device can determine the positions of the beautification positions corresponding to the filling template for different information to be encoded, and the value of each beautification position is flexible, that is, the value of the beautification position can be designed according to the data bits and error correction bits, which is easier to achieve a better position display effect and is beneficial to the detection and recognition of the information code.
[0092] It should be noted that the terminal device includes, but is not limited to, tablet computers, laptop computers, palmtop computers, mobile phones, voice interaction devices, and personal computers (PCs), and is not limited here. Among them, the voice interaction device includes, but is not limited to, smart speakers and smart home appliances. It can also be a monitoring device, a face recognition device, etc., and is not limited here. Among them, the voice interaction device includes, but is not limited to, smart speakers and smart home appliances.
[0093] The terminal device and the server can communicate through a wireless network, a wired network, or a removable storage medium. Among them, the above wireless network uses standard communication technologies and / or protocols. The wireless network is usually the Internet, but can also be any network, including but not limited to any combination of Bluetooth, Local Area Network (LAN), Metropolitan Area Network (MAN), Wide Area Network (WAN), mobile, private network, or virtual private network. In some embodiments, customized or dedicated data communication technologies can be used to replace or supplement the above data communication technologies. The removable storage medium can be a Universal Serial Bus (USB) flash drive, a mobile hard drive, or other removable storage media, etc.
[0094] Although Figure 1 only five terminal devices and one server are shown, it should be understood that Figure 1 the examples in it are only for understanding the present solution, and the specific numbers of terminal devices and servers should be flexibly determined according to the actual situation.
[0095] Combined with the above introduction, the method for generating information codes in the present application will be introduced below. Please refer to Figure 2 , Figure 2 which is a schematic diagram of an embodiment of the method for generating information codes in an embodiment of the present application. As shown in the figure, an embodiment of the method for generating information codes in an embodiment of the present application includes:
[0096] 101. Obtain the number of padding bits corresponding to the information to be encoded;
[0097] In this embodiment, the information code generation device can first obtain the information to be encoded, and the information to be encoded can be address information, identity information, or other types of information. Then, the information code generation device obtains the number of padding bits according to the information to be encoded. The information to be encoded can be the information received by the information code generation device through a wired network, or the information stored in the information code generation device itself. It should be noted that the information code generation device can be deployed on the server or on the terminal device. In the present application, the case where the information code generation device is deployed on the terminal device is taken as an example for illustration, but this should not be construed as a limitation of the present application.
[0098] 102. According to the number of padding bits, obtain the to-be-filled template corresponding to the target beautification level, where the to-be-filled template includes N positions, and the N positions include M beautification positions and (N - M) to-be-filled positions, N is an integer greater than 1, and M is an integer greater than 1 and less than N;
[0099] In this embodiment, the information code generation device can further obtain the to-be-filled template including N positions corresponding to the target beautification level according to the number of padding bits obtained in step 101, where the N positions include M beautification positions and (N - M) to-be-filled positions, and N is an integer greater than 1, and M is an integer greater than 1 and less than N.
[0100] For ease of understanding, taking the template to be filled including 11 beautification points and 430 points to be filled as an example, the template to be filled corresponding to the target beautification level includes 441 points. Taking the template to be filled including 25 beautification points and 600 points to be filled as another example, the template to be filled corresponding to the target beautification level includes 625 points. Taking the template to be filled including 31 beautification points and 810 points to be filled as yet another example, the template to be filled corresponding to the target beautification level includes 841 points.
[0101] 103. Fill the data bits and error correction bits corresponding to the information to be encoded into the (N - M) points to be filled in the template to be filled, to obtain the information code to be synthesized;
[0102] In this embodiment, after obtaining the information to be encoded, the information code generation device can also obtain the data bits and error correction bits corresponding to the information to be encoded, and then fill the data bits and error correction bits into the (N - M) points to be filled in the template to be filled, so as to obtain the information code to be synthesized.
[0103] For ease of understanding, taking the data bits corresponding to the information to be encoded as 200 bits, and the template to be filled including 625 points as an example, assuming that the number of error bits calculated according to the data bits is 400 bits, then the 600 bits of data bits and error correction bits can be filled into the 600 points to be filled in the template to be filled together, so as to obtain the information code to be synthesized including 600 filled points. Taking the data bits corresponding to the information to be encoded as 270 bits, and the template to be filled including 841 points as another example, assuming that the error correction bits calculated according to the data bits are 540 bits, then the 810 bits of data bits and error correction bits can be filled into the 810 points to be filled in the template to be filled, so as to obtain the information code to be synthesized including 810 filled points.
[0104] 104. Fill the M beautification points in the template to be filled according to the information code to be synthesized, to obtain the target information code.
[0105] In this embodiment, the information code generation device can fill the M beautification points in the template to be filled according to the information code to be synthesized obtained in step 103, and finally obtain the target information code. Specifically, please refer to Figure 3 , Figure 3 is a schematic diagram of an embodiment of the target information code in the embodiments of the present application. As shown in the figure, after filling the beautification points, the target information codes shown in (A) and (B) in the figure can be obtained. It should be understood that the target information code can be Figure 3 the applet information code shown in (A) in the figure, or can be Figure 3 the one shown in (A) in the figure, or can also be Figure 3The network disk information code shown in (B). In actual applications, the target information code can also have other forms of representation, which will not be enumerated here.
[0106] For ease of understanding, take the example of obtaining a to-be-synthesized information code including 600 filled positions. Since the to-be-filled template includes 625 positions and 600 of them have been filled, the remaining 25 beautification positions can be filled, thus obtaining a target information code including 25 beautification positions, 200 data positions, and 400 error correction positions. Take another example of obtaining a to-be-synthesized information code including 810 filled positions. Since the to-be-filled template includes 841 positions and 810 of them have been filled, the remaining 31 beautification positions can be filled, thus obtaining a target information code including 31 beautification positions, 270 data positions, and 540 error correction positions.
[0107] In the embodiments of the present application, a method for generating an information code is provided. First, obtain the number of padding bits corresponding to the information to be encoded. Then, according to the obtained number of padding bits, obtain the to-be-filled template corresponding to the target beautification level. The to-be-filled template includes N positions, and the N positions include M beautification positions and (N - M) to-be-filled positions. Furthermore, fill the data positions and error correction positions corresponding to the information to be encoded into the (N - M) to-be-filled positions in the to-be-filled template to obtain a to-be-synthesized information code. Finally, according to the to-be-synthesized information code, fill the M beautification positions in the to-be-filled template to obtain the target information code, where N is an integer greater than 1, and M is an integer greater than 1 and less than N. By the above method, for different information to be encoded, the positions of the beautification positions corresponding to the to-be-filled template can be determined, and the value of each beautification position is flexible, that is, the value of the beautification position can be designed according to the data positions and error correction positions, which is more likely to achieve a better position display effect and is beneficial to the detection and recognition of the information code.
[0108] Optionally, based on the above Figure 2 In an optional embodiment of the method for generating an information code provided in the embodiments of the present application corresponding to each of the above embodiments, obtaining the number of padding bits corresponding to the information to be encoded may include:
[0109] Obtain the information to be encoded and the version information corresponding to the information to be encoded, where the version information is used to determine the total number of positions;
[0110] Determine the number of data positions and the number of error correction positions according to the information to be encoded;
[0111] Determine the number of padding bits corresponding to the information to be encoded according to the total number of positions, the number of data positions, and the number of error correction positions.
[0112] In this embodiment, the information code generation device can obtain the information to be encoded and the version information corresponding to the information to be encoded, where the version information is used to determine the total number of positions. Then, the number of data bits and the number of error correction bits are determined according to the information to be encoded. Finally, the number of padding bits corresponding to the information to be encoded is determined according to the total number of positions, the number of data bits, and the number of error correction bits. It should be understood that the information to be encoded can be a uniform resource locator (URL) address. In practical applications, the information to be encoded can also be other information, which is not limited here.
[0113] Specifically, in this embodiment, the version information is the size information indicating the information code. Taking the information code as a two-dimensional code as an example for illustration. The two-dimensional code has a total of 40 sizes, which are called versions (Version). Among them, Version 1 is a 21*21 matrix, Version 2 is a 25*25 matrix, and Version 3 is a 29*29 matrix. That is to say, for each increase in one version, the size increases by 4. The version and the matrix size can be calculated according to the following formula:
[0114] Matrix = (V - 1) * 4 + 21;
[0115] Where V represents the version number and Matrix represents the matrix size.
[0116] Currently, the highest version of the two-dimensional code is Version 40. Therefore, substituting the version number 40 corresponding to Version 40 into the above formula (40 - 1) * 4 + 21, the matrix size can be obtained as 177. Therefore, the current maximum size of the two-dimensional code is 177*177. And the total number of positions is the sum of the sizes. If it is a 21*21 matrix, the total number of positions is 441. If it is a 33*33 matrix, the total number of positions is 1089.
[0117] For easy understanding, taking the version information corresponding to the information to be encoded as Version 2 and the number of data bits determined according to the information to be encoded as 200 bits as an example for illustration. Since the version information is Version 2, according to the above formula, the two-dimensional code is a 25*25 matrix, and the total number of positions can be determined as 625 bits. According to the number of data bits, the number of error correction bits can be calculated as 400 bits. Then, subtracting the number of data bits 200 bits and the number of error correction bits 400 bits from the total number of positions 625 bits, the number of padding bits corresponding to the information to be encoded, which is 25 bits, can be obtained.
[0118] Taking the version information corresponding to the information to be encoded as Version 5, and determining that the number of data bits is 400 bits according to the information to be encoded as another example for illustration. Since the version information is Version 5, according to the above formula, the QR code is a 37*37 matrix, and thus the total number of positions can be determined to be 1369 bits. And since the number of data bits is 400 bits, the number of error correction bits is 800 (400*2) bits. Then, subtracting the number of data bits 400 bits and the number of error correction bits 800 bits from the total number of positions 1369 bits, the number of padding bits corresponding to the information to be encoded can be obtained as 169 bits.
[0119] In the embodiments of the present application, a method for determining the number of padding bits is provided. By the above method, since the total number of positions corresponding to different version information is different, after confirming the version information and then obtaining the number of data bits and the number of error correction bits, the accuracy of determining the number of padding bits can be improved, so as to more accurately determine the positions of the beautification points, thereby improving the accuracy of information code generation, which is beneficial to the detection and recognition of information codes.
[0120] Optionally, based on the above Figure 2 corresponding various embodiments, in an optional embodiment of the information code generation method provided by the embodiments of the present application, according to the number of padding bits, obtaining a to-be-filled template corresponding to a target beautification level may include:
[0121] Determining a target beautification level from a set of beautification levels according to the number of padding bits, where the set of beautification levels includes at least one beautification level, and each beautification level corresponds to a range of beautification point numbers;
[0122] Obtaining a to-be-filled template corresponding to the target beautification level, where the target beautification level corresponds to at least one filling template, and the to-be-filled template belongs to any one of the at least one filling template.
[0123] In this embodiment, the information code generation device can determine a target beautification level from the set of beautification levels according to the obtained number of padding bits. The set of beautification levels includes at least one beautification level, and each beautification level corresponds to a range of beautification point numbers. Therefore, the number of padding bits should be within the range of beautification point numbers corresponding to the target beautification level. Then, a to-be-filled template corresponding to the target beautification level can be obtained. The target beautification level corresponds to one or more filling templates, and the to-be-filled template in the present application belongs to any one of the at least one filling template.
[0124] Specifically, taking the example that the beautification level set includes 8 beautification levels for illustration, please refer to Table 1. Table 1 is an example of the range of the number of beautification points corresponding to the beautification levels. It should be understood that in this embodiment, the fact that the beautification level set includes 8 beautification levels is only for illustration, and the range of the number of beautification points is also for illustration. In actual applications, there can be various corresponding division methods for the beautification levels and ranges in the beautification level set, which will not be enumerated here.
[0125] Table 1
[0126] Beautification level 1 2 3 4 5 6 7 8 Range of the number of beautification points 1~10 11~20 21~30 31~40 41~50 51~60 61~70 71~80
[0127] Based on Table 1, it can be seen that each beautification level corresponds to a different range of the number of beautification points. For each additional beautification level, the corresponding range of the number of beautification points also increases by 10.
[0128] For the sake of easy understanding, taking the padding bit number of 16 and the padding bit number of 33 as examples respectively for further illustration. From Table 1, it can be seen that the padding bit number of 16 belongs to the range of the number of beautification points corresponding to 11 - 20, so the corresponding beautification level is 2, while the padding bit number of 33 belongs to the range of the number of beautification points corresponding to 31 - 40, so the corresponding beautification level is 4. Please refer to Figure 4 , Figure 4 which is a schematic diagram of an embodiment of the template to be filled in the embodiment of the present application. As shown in the figure, Figure 4 the number of beautification points shown in (A) is 16, which belongs to the template to be filled corresponding to the beautification level of 2. It can be seen that Figure 4 A11 to A16 shown in (A) represent the positions corresponding to the beautification points in the template to be filled, and A11 to A16 include 16 beautification points. Figure 4 the number of beautification points shown in (A) is 33, which belongs to the template to be filled corresponding to the beautification level of 4. It can be seen that Figure 4 A21 to A28 shown in (A) represent the positions corresponding to the beautification points in the template to be filled, and A21 to A27 include 33 beautification points. Further, it can be seen that Figure 4 the positions corresponding to the 33 beautification points in (B) are continuous, and the beautification points are connected and shown in the form of line segments, while Figure 4 the positions corresponding to the 16 padding bits in (A) are relatively scattered. Among them, the position corresponding to the beautification point A15 is an independent point, Figure 4 the template to be filled shown in (A) and Figure 4By comparing with the template to be filled as shown in (B), it can be seen that generally, the higher the beautification level, the more continuous the distribution of beautification points in the corresponding template to be filled, which can be represented in the form of line segments. When the beautification level is low, the distribution of beautification points in the corresponding template to be filled is relatively scattered, and there may also be beautification points at isolated positions.
[0129] Specifically, please refer to Figure 5 , Figure 5 which is a schematic diagram of an embodiment of the target information code corresponding to the beautification level in the embodiment of the present application. As shown in the figure, different beautification levels correspond to different templates to be filled, and the target information codes generated according to different templates to be filled have different point display effects. For example, Figure 5 the target information code shown in (A) is generated from the template to be filled corresponding to the beautification level of 2, while Figure 5 the target information code shown in (B) is generated from the template to be filled corresponding to the beautification level of 4. It can be seen that Figure 5 there are isolated points in the target information code shown in (A), while Figure 5 the target information code shown in (B) is all continuous line segments. From this, it can also be seen that the higher the beautification level, the better the point display effect of the target information code generated according to the template to be filled corresponding to the beautification level. It should be understood that the example of the target information code corresponding to the beautification level is only for facilitating the understanding of this solution. In practical applications, the target information codes corresponding to different beautification levels can also have other point display effects, which will not be enumerated here.
[0130] In the embodiment of the present application, a method for obtaining a template to be filled is provided. Through the above method, the target beautification level is determined according to the number of filled bits. Since each beautification level corresponds to at least one template to be filled, the template to be filled corresponding to the target beautification level can be obtained. Subsequently, the data bits, error correction bits, and beautification points are filled according to the template to be filled, which can improve the point display effect in the information code, thereby improving the detection and recognition efficiency of the information code.
[0131] Optionally, on the basis of the above Figure 2 corresponding embodiments, in an optional embodiment of the information code generation method provided in the embodiment of the present application, after determining the target beautification level from the beautification level set according to the number of filled bits, it may further include:
[0132] Obtaining the beautification level identifier corresponding to the target beautification level;
[0133] Adding the beautification level identifier to the meta-information corresponding to the information to be encoded, where the meta-information further includes the version information, error correction level information, and mask array identifier corresponding to the information to be encoded.
[0134] In this embodiment, the information code generation device may further obtain a beautification level identifier corresponding to the target beautification level, and add the beautification level identifier to the meta-information corresponding to the information to be encoded. The meta-information further includes the version information, error correction level information, and mask array identifier corresponding to the information to be encoded.
[0135] Specifically, in this embodiment, the beautification level set includes 8 beautification levels for illustrative purposes. The beautification levels correspond to beautification level identifiers. Please refer to Table 2, which is an example of the beautification level identifiers corresponding to the beautification levels. It should be understood that the 8 beautification levels and beautification level identifiers in this embodiment are for the convenience of understanding the solution. In actual applications, there can be various corresponding methods for the beautification levels and beautification level identifiers in the beautification level set, and they will not be enumerated here.
[0136] Table 2
[0137] Beautification level 1 2 3 4 5 6 7 8 Beautification level identifier A B C D E F G H
[0138] Based on Table 1, it can be seen that each beautification level has a unique beautification level identifier. Then, adding the beautification level identifier to the meta-information corresponding to the information to be encoded means that A to H can be added to the meta-information.
[0139] Furthermore, the meta-information further includes the version information, error correction level information, and mask array identifier corresponding to the information to be encoded. Among them, the mask array identifier corresponds to the mask array one by one. The version information (Version) is the size corresponding to the QR code, and this size is called the version. Currently, there are 40 sizes for QR codes in total. The version information has been described in the foregoing embodiments and will not be elaborated here. In addition, there are currently four levels of error correction in QR codes. Different levels of error correction will generate different error correction bits. The four levels are the L level, M level, Q level, and H level. The L-level error correction can correct 7% of the characters in the QR code, the M-level error correction can correct 15% of the characters in the QR code, the Q-level error correction can correct 25% of the characters in the QR code, and the H-level error correction can correct 30% of the characters in the QR code. Therefore, the error correction level information is the error correction level corresponding to the information to be encoded, and the error correction level information can be any one of the L level, M level, Q level, and H level.
[0140] For the convenience of understanding, based on Table 2, assume that the target beautification level is 3, that is, the corresponding beautification level identifier is C. Please refer to Table 3, which is an example of the meta-information. It should be understood that the information and identifiers included in the meta-information in this embodiment are for the convenience of understanding the solution. In actual applications, the meta-information may further include more information and identifiers, and they will not be enumerated here.
[0141] Table 3
[0142]
[0143] As can be seen from Table 1, the version information included in the meta-information of the information to be encoded is 1, the error correction level information is H, the mask array identifier is 1, and the target beautification level identifier is C.
[0144] In an embodiment of the present application, another method for generating an information code is provided. Through the above method, after determining the target beautification level, the beautification level identifier corresponding to the target beautification level can be obtained, and the beautification level identifier is added to the meta-information to improve the information content of the information to be encoded, so that the generated information code includes more data information and improves the practicability of the information code.
[0145] Optionally, based on the above Figure 2 corresponding embodiments, in an optional embodiment of the information code generation method provided by the embodiments of the present application, the information code generation method further includes:
[0146] Encode the information to be encoded to obtain the data bits corresponding to the information to be encoded, where the data bits are composed of multiple binary data;
[0147] Encode the data bits to obtain the parity bits corresponding to the information to be encoded, where the parity bits are composed of multiple binary data.
[0148] In this embodiment, the information code generation device can encode the information to be encoded and obtain the data bits corresponding to the information to be encoded. The data bits are composed of multiple binary data. Further, the data bits are encoded to obtain the parity bits corresponding to the information to be encoded, where the parity bits are composed of multiple binary data.
[0149] Specifically, the data bits are obtained by encoding the information to be encoded. The encoding methods include, but are not limited to, numeric mode, alphanumeric mode, byte mode, kanji mode, extended channel interpretation mode, and structured append mode. Among them, numeric mode is an encoding method that only uses numbers and relevant special characters to represent data and instructions. That is, numeric mode only uses 0 to 9. When the number of digits to be encoded is not a multiple of 3, the remaining 1 or 2 digits will be converted into 4 bits or 7 bits, and every other 3 digits will be encoded into 10, 12, and 14 bits. The length of the numeric encoding depends on the version information of the QR code. Alphanumeric mode can encode letters, numbers, and other symbols, and represents this integer in 7-bit binary. That is to say, alphanumeric mode can include 0 to 9, uppercase A to Z (excluding lowercase), and other symbols ($%*+–. / : including spaces). These characters will be mapped to a character index table. The process of alphanumeric encoding is to group the characters in pairs, then convert them into the 45 - base corresponding to the character index table, and then convert them into 11 - bit binary. If there is a single remaining character at the end, the character will be converted into 6 - bit binary. It should be understood that in practical applications, the alphanumeric encoding mode and the number of characters need to be encoded into 9, 11, or 13 bits according to the size (Version) of the QR code. In addition, byte mode is to encode ISO - 8859 - 1 characters from 0 to 255. Kanji mode is Japanese encoding, and kanji mode can also be used for Chinese encoding. The encoding of Japanese and Chinese characters will subtract a value. Extended channel interpretation mode is mainly used for special character sets. The structured append mode contains multiple encoding formats.
[0150] For ease of understanding, taking digital encoding as an example, when the size of Version 1 and the error correction level is H, encoding 01234567. First, divide the digits 01234567 into three groups: 012, 345, and 67. Then convert 012, 345, and 67 into binary respectively. That is, convert 012 to 0000001100, 345 to 0101011001, and 67 to 1000011. Then concatenate the three corresponding binary strings to get 0000001100 0101011001 1000011. Further, convert the number of digits into binary (for version 1 and H level, it corresponds to 10 bits). So the binary obtained after encoding 01234567 is 0000001000. Then add the digital encoding flags 0001 and 0000001000 to the binary obtained by concatenating the three binary strings. Thus, the binary 0001 0000001000 0000001100 0101011001 1000011 can be obtained. And this binary encoding has a total of 41 characters, which is not a multiple of 8. Therefore, 7 zeros need to be added after this binary, that is, the data bits corresponding to the information to be encoded 01234567 can be obtained as 00010000 00100000 00001100 01010110 0110000110000000.
[0151] Taking character encoding as another example, when the version information is 1 and the error correction level is H, encoding AC-42. First, find the indices of the five characters AC-42 from the character index table (10, 12, 41, 4, 2). Then, group the found indices (10, 12, 41, 4, 2) in pairs to get (10, 12), (41, 4), and (2). Further, convert (10, 12), (41, 4), and (2) into 11-bit binary. For (10, 12), through calculation, we get 10 * 45 + 12 = 462, that is, convert 462 to 00111001110. For (41, 4), through calculation, we get 41 * 45 + 4 = 1849, that is, convert 1849 to 11100111001. For (2), through calculation, we get 2, that is, convert 2 to 000010. Connect the obtained binary to get 00111001110 11100111001 000010. Further, convert the number of characters into binary (Version 1 and H level correspond to 9 bits). Since there are 5 characters in total, convert 5 to 000000101. Then, add the digital encoding flags 0001 and 000000101 to the binary obtained by connecting the binary. Thus, we can get the binary 0010 000000101 00111001110 11100111001000010. After encoding this binary, there are 41 characters, which is not a multiple of 8. Therefore, 7 zeros need to be added after this binary, that is, we can get the data bits corresponding to the information to be encoded 01234567, which is 00100000 00101001 1100111011100111 00100001 00000000.
[0152] After obtaining the data bits corresponding to the information to be encoded through encoding, the data bits can be encoded to obtain the error correction bits corresponding to the information to be encoded. And there are four levels of error correction in the QR code, and different levels of error correction will generate different error correction bits. The four levels are the L level, the M level, the Q level, and the H level. The error correction levels have been described in the foregoing embodiments and will not be elaborated herein. Specifically, first, the data bits need to be grouped, that is, the data bits are divided into different blocks, and the number of codes in each block. The number of this code is how many 8-bit bytes there are in each block. Finally, error correction encoding is performed on each block, and the error correction bits corresponding to the information to be encoded can be obtained. It should be understood that the error correction bits of the QR code can be calculated through the Reed-Solomon error correction algorithm. This algorithm can include polynomial division. For example, the numbers from 1 to 255 are mapped to the Galois Field of 2 to the nth power, where n is an integer greater than or equal to 0 and less than or equal to 255. In practical applications, other mathematical algorithms can also be used to calculate the error correction bits, which will not be elaborated here.
[0153] For the sake of easy understanding, taking the information to be encoded as HELLO WORLD, the version information as 1, and the error correction level as M as an example for illustration. Through the foregoing method, the data bits corresponding to the information to be encoded HELLO WORLD can be obtained as 0010000001011011 00001011 01111000 11010001 01110010 11011100 0100110101000011 01000000. In this embodiment, a 1-M QR code is adopted, so a binary string of 16 * 8 = 128 bits is required. On the basis of the data bits, 48 bits of padding code are also required. The 11101100 00010001 can be repeatedly added behind the data bits to obtain the following 128-bit binary string: 00100000 01011011 00001011 01111000 11010001 01110010 1101110001001101 01000011 01000000 11101100 00010001 11101100 00010001 1110110000010001
[0155] Furthermore, converting this binary string into decimal numbers can obtain the following 16 numbers:
[0156] 32,91,11,120,209,114,220,77,67,64,236,17,236,17,236,17
[0157] By calculation, a remainder polynomial can be generated, and the coefficients of the remainder polynomial are 196 35 39 119 235 215 231 22693 23. Then, convert this decimal number to binary 11000100 10001110 01111110 11111101 01111010 11111100 11111100 01010111 0110111. After encoding this binary, there are 71 characters, which is not a multiple of 8. Therefore, add 1 '0' after this binary to obtain the error correction bits corresponding to the information to be encoded HELLO WORLD, that is, 11000100 10001110 01111110 11111101 01111010 11111100 11111100 01010111 01101110.
[0158] In the embodiments of the present application, a method for obtaining data bits and error correction bits is provided. Through the above method, data bits including data information can be obtained through encoding, and error correction bits that can detect and correct errors after errors occur during transmission can be obtained, thereby improving the accuracy and practicality of information code generation, and being beneficial to the detection and recognition of information codes.
[0159] Optionally, based on the above Figure 2 In an optional embodiment of the information code generation method provided in the embodiments of the present application corresponding to each of the above corresponding embodiments, filling the data bits and error correction bits corresponding to the information to be encoded into (N - M) to-be-filled positions in the to-be-filled template to obtain the to-be-synthesized information code may include:
[0160] Generate a binary sequence according to the data bits and error correction bits corresponding to the information to be encoded;
[0161] Determine the number of target positions according to the binary sequence, where the number of target positions is the sum of the number of data bits and the number of error correction bits;
[0162] According to the number of target positions, fill the binary sequence into (N - M) to-be-filled positions in the to-be-filled template in the information code filling order to obtain the to-be-synthesized information code.
[0163] In this embodiment, the information code generation device can generate a binary sequence according to the data bits and parity bits corresponding to the information to be encoded, then determine the number of target positions according to the binary sequence, where the number of target positions is the sum of the number of data bits and the number of parity bits. Finally, according to the number of target positions, the binary sequence is filled into the (N - M) to-be-filled positions in the to-be-filled template in the information code filling order to obtain the to-be-synthesized information code.
[0164] For ease of understanding, taking the information to be encoded as HELLO WORLD, the version information as 1, and the error correction level as M as an example, it can be obtained through the foregoing embodiments that the data bits corresponding to the information to be encoded are 0010000001011011 00001011 01111000 11010001 01110010 11011100 0100110101000011 0100000011101100 00010001 11101100 00010001 11101100 00010001, and the parity bits corresponding to the information to be encoded are 11000100 10001110 01111110 11111101 01111010 1111110011111100 0101011101101110. Through the data bits and the parity bits, a binary sequence 0010000001011011 0000101101111000 11010001 01110010 11011100 01001101 0100001101000000 11101100 00010001 11101100 00010001 11101100 00010001 1100010010001110 01111110 11111101 0111101011111100 11111100 01010111 01101110 can be generated. Further, the number of target positions can be determined through the binary sequence, and the number of target positions is the sum of the number of data bits and the number of parity bits. Through the data bits, the corresponding number is 128, and through the parity bits, the corresponding number is 72. Therefore, the number of target positions is 200. The obtained binary sequence is filled into the 200 to-be-filled positions in the to-be-filled template in the information code filling order, and the to-be-synthesized information code is obtained. If the to-be-filled template includes more than 200 to-be-filled positions, other values can be filled in after filling the first 200 to-be-filled positions.
[0165] For ease of understanding, taking the example that there is no other occlusion code in the information code, please refer to Figure 6 , Figure 6This is a schematic diagram of an embodiment of the information code filling order in the embodiments of the present application. As shown in the figure, Figure 6 The information code filling order shown in (A) is to start from the positioning area B1 and fill in the obtained binary sequence in a clockwise circular order until all the points to be filled are completed, thus obtaining the information code to be synthesized. As Figure 6 The information code filling order shown in (B) is to start from the positioning area B21 and fill in the obtained binary sequence in an order that moves back and forth between the positioning area B22 and back to the positioning area B21 until all the points to be filled are completed, thus obtaining the information code to be synthesized. As Figure 6 The information code filling order shown in (C) is to start from the positioning area B31 and fill in the obtained binary sequence in an order that moves back and forth between the positioning area B32 and back to the positioning area B31 until all the points to be filled are completed, thus obtaining the information code to be synthesized.
[0166] Taking the example that there are other occlusion codes in the information code for further illustration, please refer to Figure 7 , Figure 7 This is a schematic diagram of another embodiment of the information code filling order in the embodiments of the present application. As shown in the figure, Figure 7 The information code filling order shown in (A) is to start from the positioning area C11 and fill in the obtained binary sequence in an order that moves back and forth between the positioning area C12 and back to the positioning area C11. When encountering the occlusion code C13, the area where the occlusion code C13 is located is skipped and the filling continues without changing the order until all the points to be filled are completed, thus obtaining the information code to be synthesized. As Figure 7 The information code filling order shown in (B) is to start from the positioning area C21 and fill in the obtained binary sequence in an order that moves back and forth between the positioning area C22 and back to the positioning area C21. When encountering the occlusion code C23, the area where the occlusion code C23 is located is skipped and the filling continues without changing the order until all the points to be filled are completed, thus obtaining the information code to be synthesized. As Figure 7 The information code filling order shown in (C) is to start from the positioning area C31 and fill in the obtained binary sequence in a clockwise circular order. Since the occlusion code C32 is located in the middle of the information code, the points to be filled should surround the occlusion code C32 until all the points to be filled are completed, thereby obtaining the information code to be synthesized. It should be understood that in practical applications, there can be more information code filling orders different from those described in this embodiment, which will not be enumerated here.
[0167] In the embodiments of the present application, a method for generating a to-be-synthesized information code is provided. In the above manner, a binary sequence is filled into the to-be-filled positions according to different information code filling orders. Due to different information code filling orders, the positions shown by the to-be-synthesized information code obtained are also different, which improves the flexibility and selectivity of generating the to-be-synthesized information code, and thus improves the flexibility and selectivity of generating the target information code.
[0168] Optionally, based on the corresponding respective embodiments above, in an alternative embodiment of the information code generation method provided by the embodiments of the present application, filling the binary sequence into (N - M) to-be-filled positions in the to-be-filled template according to the information code filling order to obtain the to-be-synthesized information code may include: Figure 2 If the number of target positions is equal to (N - M), then fill the binary sequence into (N - M) to-be-filled positions in the to-be-filled template according to the information code filling order;
[0169] When the (N - M) to-be-filled positions are filled, generate the to-be-synthesized information code.
[0170] In this embodiment, when the number of target positions is equal to (N - M), the information code generation device fills the binary sequence into (N - M) to-be-filled positions in the to-be-filled template according to the information code filling order, and then when the (N - M) to-be-filled positions are filled, the to-be-synthesized information code can be generated.
[0171] For ease of understanding, taking the number of target positions as 200 and the number of to-be-filled positions as 200 as an example for illustration. Since the number of target positions 200 is equal to the number of to-be-filled positions 200, the binary sequence is filled in according to one of the foregoing multiple information code filling orders. When the 200 to-be-filled positions are filled by the 200 target positions, the to-be-synthesized information code can be generated.
[0172] Similarly, taking the number of target positions as 360 and the number of to-be-filled positions as 360 as another example for illustration. Since the number of target positions 360 is equal to the number of to-be-filled positions 360, the binary sequence is filled in according to one of the foregoing multiple information code filling orders. When the 360 to-be-filled positions are filled by the 360 target positions, the to-be-synthesized information code can be generated.
[0173] In the embodiments of the present application, another method for generating a to-be-synthesized information code is provided. In the above manner, when the number of target positions is equal to the number of to-be-filled positions, the binary sequence can be directly filled into the to-be-filled positions according to different information code filling orders. After completing the filling of the to-be-filled positions, the to-be-synthesized information code can be generated, which improves the efficiency of generating the to-be-synthesized information code, and thus improves the efficiency of generating the target information code.
[0174]
[0175] Optionally, based on each of the above Figure 2 corresponding embodiments, in an optional embodiment of the method for generating an information code provided by the embodiments of the present application, filling the binary sequence into (N - M) to-be-filled positions in the to-be-filled template according to the information code filling order to obtain the to-be-synthesized information code may include:
[0176] If the number of target positions is less than (N - M), then fill the binary sequence into P to-be-filled positions in the to-be-filled template according to the information code filling order, where P is an integer greater than or equal to 1 and less than (N - M);
[0177] When the P to-be-filled positions are filled, obtain (N - M - P) to-be-filled positions;
[0178] Fill the (N - M - P) to-be-filled positions in the to-be-filled template to obtain the to-be-synthesized information code.
[0179] In this embodiment, when the number of target positions is less than (N - M), the information code generation device fills the binary sequence into P to-be-filled positions in the to-be-filled template according to the information code filling order, and then when the P to-be-filled positions are filled, obtains (N - M - P) to-be-filled positions, and finally fills the (N - M - P) to-be-filled positions in the to-be-filled template to obtain the to-be-synthesized information code, where P is an integer greater than or equal to 1 and less than (N - M).
[0180] For ease of understanding, taking the number of target positions as 200 and the number of to-be-filled positions as 360 as an example for illustration. Since the number of target positions 200 is less than the number of to-be-filled positions 360, the binary sequence is filled in according to one of the foregoing multiple information code filling orders. Only 200 of the to-be-filled positions can be filled by the target positions, and there are still 160 to-be-filled positions unfilled. At this time, 160 "0"s or 160 "1"s can be used to fill the remaining 160 to-be-filled positions, thereby generating the to-be-synthesized information code.
[0181] Similarly, taking the number of target positions as 260 and the number of to-be-filled positions as 280 as another example for illustration. Since the number of target positions 260 is less than the number of to-be-filled positions 280, the binary sequence is filled in according to one of the foregoing multiple information code filling orders. Only 260 of the to-be-filled positions can be filled by the target positions, and there are still 20 to-be-filled positions unfilled. At this time, 20 "0"s or 20 "1"s can be used to fill the remaining 20 to-be-filled positions, thereby generating the to-be-synthesized information code.
[0182] It should be understood that for the (N - M - P) positions to be filled, they can be filled with all "0"s or all "1"s, or filled with consecutive multiple "0"s plus consecutive multiple "1"s, and can also include consecutive bits of multiple "0"s and multiple "1"s. The examples in this embodiment are only for understanding this solution, and the specific way of filling with "0"s and "1"s should be flexibly determined according to the actual situation.
[0183] In an embodiment of the present application, another method for generating the information code to be synthesized is provided. Through the above method, when the number of target positions is less than the number of positions to be filled, all the target positions cannot completely fill the positions to be filled. Therefore, it is necessary to supplement the remaining unfilled positions to generate the information code to be synthesized. Thereby, the integrity of generating the information code to be synthesized can be improved, and then the integrity of generating the target information code can be improved, and the target information code has a better display effect, which is beneficial to the detection and recognition of the target information code.
[0184] Optionally, based on the above Figure 2 In an optional embodiment of the method for generating an information code provided in the embodiment of the present application corresponding to each of the above embodiments, filling the M beautification positions in the filling template according to the information code to be synthesized may include:
[0185] Obtain a beautification position sequence according to the M beautification positions in the filling template, where the beautification position sequence includes at least one consecutive beautification position among the M beautification positions;
[0186] Determine a first adjacent position and a second adjacent position associated with the beautification position sequence according to the information code to be synthesized, where the first adjacent position is the position to be filled adjacent to the first beautification position of the beautification position sequence, and the second adjacent position is the position to be filled adjacent to the last beautification position of the beautification position sequence;
[0187] Obtain a first value corresponding to the first adjacent position and a second value corresponding to the second adjacent position;
[0188] If the first value is the same as the second value, fill a third value into each beautification position in the beautification position sequence, where the third value, the first value, and the second value are the same value.
[0189] In this embodiment, the information code generation device can obtain a beautification point sequence according to M beautification points in the template to be filled. The beautification point sequence includes at least one continuous beautification point among the M beautification points. Then, according to the information code to be synthesized, the first adjacent bit and the second adjacent bit associated with the beautification point sequence are determined. The first adjacent bit is the point to be filled adjacent to the first beautification point of the beautification point sequence, and the second adjacent bit is the point to be filled adjacent to the last beautification point of the beautification point sequence. Further, the first value corresponding to the first adjacent bit and the second value corresponding to the second adjacent bit can be obtained. When the first value is the same as the second value, the third value is filled into each beautification point in the beautification point sequence, where the third value, the first value, and the second value are the same value. It should be understood that in this embodiment, the beautification point sequence can be a continuous plurality of "0"s or a continuous plurality of "1"s, but does not include a continuous sequence with both "0" and "1".
[0190] For the sake of easy understanding, taking the template to be filled corresponding to the beautification level of 2 including 16 beautification points as an example for illustration, a beautification point sequence with at least one continuous beautification point is obtained according to the 16 beautification points. For example, 000 or 11111 is a continuous beautification point sequence. Specifically, please refer to Figure 8 , Figure 8 which is a schematic diagram of beautification point filling in the embodiment of the present application. As shown in the figure, Figure 8 what is shown in (A) is the information code to be synthesized obtained after filling the data bits and error correction bits. Among them, the points shown by D11 to D16 are all beautification point sequences. There are 16 beautification points in the beautification point sequence. Taking the beautification point sequence D11 as an example, it can be seen that the point adjacent to the first beautification point in the beautification point sequence D11 is 0, and the point adjacent to the last beautification point in the beautification point sequence D11 is 0, that is, the first value is 0 and the second value is also 0. Since the first value is the same as the second value, the third value is the same as the first value and the second value, and the third value is also 0. And this third value 0 is filled into each beautification point in the beautification point sequence D11, so as to obtain the beautification points after completion of filling of D21 as shown in Figure 8 (B). Similar to the beautification point sequence D11, the beautification point sequences D12 to D16 can also fill the values of the beautification points according to a similar method. That is, the beautification point sequence D12 can fill 2 third values of 1, so as to obtain the beautification points after completion of filling of D22 as shown in Figure 8 (B). The beautification point sequence D13 can fill 2 third values of 0, so as to obtain the beautification points after completion of filling of D23 as shown in Figure 8 (B). The beautification point sequence D14 can fill 4 third values of 0, so as to obtain the beautification points after completion of filling as shown in Figure 8The beautification points after the completion of filling D24 as shown in (B). The beautification point sequence D15 can fill 1 third value 0, thus obtaining as shown in Figure 8 the beautification points after the completion of filling D25 as shown in (B). The beautification point sequence D16 can fill 2 third values 0, thus obtaining as shown in Figure 8 the beautification points after the completion of filling D26 as shown in (B), and after filling all the beautification points, the target information code as shown in Figure 8 can be obtained as shown in (B). The display effect of the beautification points in the target information code is a continuous black or white line segment. For example, if the value filled in the beautification point is 1, it is black, and if the value filled in the beautification point is 0, it is white. It should be understood that in actual applications, it can also be that if the value filled in the beautification point is 0, it is black, and if the value filled in the beautification point is 1, it is white. Again, no limitation is made.
[0191] In the embodiments of the present application, a method for filling beautification points is provided. Through the above method, by obtaining adjacent values of the beautification point sequence and filling the beautification points with the adjacent values, the values of the continuous beautification points and their adjacent data points are the same after filling, so that the values filled in the beautification points are continuous with the adjacent values, and the display effect of the beautification points is a continuous black or white line segment, thereby improving the display effect of the generated information code, and thus improving the detection and recognition efficiency of the information code.
[0192] Optionally, on the basis of the above Figure 2 corresponding embodiments, in an optional embodiment of the information code generation method provided by the embodiments of the present application, according to the information code to be synthesized, filling the M beautification points in the filling template to obtain the target information code may include:
[0193] Obtaining a beautification point sequence according to the M beautification points in the filling template, where the beautification point sequence includes at least one continuous beautification point among the M beautification points;
[0194] Determining a first adjacent bit and a second adjacent bit associated with the beautification point sequence according to the information code to be synthesized, where the first adjacent bit is a filling point to be filled adjacent to the first beautification point of the beautification point sequence, and the second adjacent bit is a filling point to be filled adjacent to the last beautification point of the beautification point sequence;
[0195] Obtaining a first value corresponding to the first adjacent bit and a second value corresponding to the second adjacent bit;
[0196] If the first value and the second value are different, obtaining a first continuous value number corresponding to the first value and a second continuous value number corresponding to the second value;
[0197] If the number of consecutive first values is greater than the number of consecutive second values, then fill each beautification point in the beautification point sequence with a third value, where the third value is the same as the first value;
[0198] If the number of consecutive first values is less than the number of consecutive second values, then fill each beautification point in the beautification point sequence with a third value, where the third value is the same as the second value.
[0199] In this embodiment, the information code generation device may first obtain a beautification point sequence according to M beautification points in the to-be-filled template, where the beautification point sequence includes at least one consecutive beautification point among the M beautification points. Then, according to the to-be-synthesized information code, determine the first adjacent bit and the second adjacent bit associated with the beautification point sequence. The first adjacent bit is the to-be-filled point adjacent to the first beautification point of the beautification point sequence, and the second adjacent bit is the to-be-filled point adjacent to the last beautification point of the beautification point sequence. Then, obtain the first value corresponding to the first adjacent bit and the second value corresponding to the second adjacent bit. When the first value and the second value are different, obtain the number of consecutive first values corresponding to the first value and the number of consecutive second values corresponding to the second value. Further, when the number of consecutive first values is greater than the number of consecutive second values, fill each beautification point in the beautification point sequence with a third value, where the third value is the same as the first value. When the number of consecutive first values is less than the number of consecutive second values, fill each beautification point in the beautification point sequence with a third value, where the third value is the same as the second value.
[0200] For ease of understanding, take the to-be-filled template corresponding to a beautification level of 4, which includes 33 beautification points, as an example for illustration. According to these 33 beautification points, obtain a beautification point sequence with at least one consecutive beautification point, such as 00 or 11, which is a consecutive beautification point sequence. Specifically, please refer to Figure 9 , Figure 9 which is a schematic diagram of beautification point filling in the embodiment of the present application. As shown in the figure, Figure 9 what is shown in (A) is the to-be-synthesized information code obtained after filling the data bits and error correction bits. Among them, the points shown as E11 to E18 are all beautification point sequences. There are 33 beautification points in the beautification point sequence. Taking the beautification point sequence E11 as an example, it can be seen that the point adjacent to the first beautification point in the beautification point sequence E11 is 1, and the point adjacent to the last beautification point in the beautification point sequence E11 is 0. The first value is 1 and the second value is 0. Since the first value and the second value are different, it is necessary to further obtain the number of consecutive first values corresponding to the first value 1 and the number of consecutive second values corresponding to the second value 0. As Figure 9As shown in (A), for the beautification point sequence E11, the first consecutive value is 1, and the corresponding number is 2, while the second consecutive value is 0, and the corresponding number is 1. Since the number of the first consecutive values is greater than the number of the second consecutive values, the third value is the same as the first value, the third value is 1, and this third value 1 is filled into each beautification point in the beautification point sequence E11, thus obtaining the beautification points after completion of filling for E21 as shown in Figure 9 (B).
[0201] Similar to the beautification point sequence E11, the beautification point sequences E12 to E18 can also fill the values of the beautification points according to a similar method. For the beautification point sequence E12, the number of the first consecutive value 0 is less than the number of the second consecutive value 1. Therefore, the third value is the same as the second value, the third value is 1, and this third value 1 is filled into each beautification point in the beautification point sequence E12, thus obtaining the beautification points after completion of filling for E22 as shown in Figure 9 (B). For the beautification point sequence E13, the number of the first consecutive value 0 is greater than the number of the second consecutive value 1. Therefore, the third value is the same as the first value, the third value is 0, and this third value 0 is filled into each beautification point in the beautification point sequence E13, thus obtaining the beautification points after completion of filling for E23 as shown in Figure 9 (B). For the beautification point sequence E14, the number of the first consecutive value 0 is less than the number of the second consecutive value 1. Therefore, the third value is the same as the second value, the third value is 1, and this third value 1 is filled into each beautification point in the beautification point sequence E14, thus obtaining the beautification points after completion of filling for E24 as shown in Figure 9 (B). For the beautification point sequence E17, the number of the first consecutive value 1 is greater than the number of the second consecutive value 0. Therefore, the third value is the same as the first value, the third value is 1, and this third value 1 is filled into each beautification point in the beautification point sequence E17, thus obtaining the beautification points after completion of filling for E27 as shown in Figure 9 (B). For the beautification point sequence E18, the number of the first consecutive value 1 is less than the number of the second consecutive value 0. Therefore, the third value is the same as the second value, the third value is 0, and this third value 0 is filled into each beautification point in the beautification point sequence E18, thus obtaining the beautification points after completion of filling for E28 as shown in Figure 9 (B).
[0202] For the beautification point sequence E16, the number of the first consecutive numerical value 0 is the same as the number of the second consecutive numerical value 1. In this embodiment, the third numerical value is 0 as an example. Therefore, the third numerical value 0 is filled into each beautification point in the beautification point sequence E16, so as to obtain the beautification points after filling in E26 as shown in Figure 9 (B) therein. It should be understood that in this case in actual application, the third numerical value can be either 1 or 0, which is not limited in the embodiments of the present application.
[0203] For the beautification point sequence E15, the first numerical value 1 is the same as the second numerical value 1. Therefore, the third numerical value is 1, and the third numerical value 1 is filled into each beautification point in the beautification point sequence E15, so as to obtain the beautification points after filling in E25 as shown in Figure 9 (B) therein. After filling all the beautification points through the foregoing steps, the target information code as shown in Figure 9 (B) therein can be obtained. The display effect of the beautification points in the target information code is a continuous black or white line segment. For example, when the numerical value filled in the beautification point is 1, it is black, and when the numerical value filled in the beautification point is 0, it is white. It should be understood that in actual application, it can also be that when the numerical value filled in the beautification point is 0, it is black, and when the numerical value filled in the beautification point is 1, it is white, which is not limited again.
[0204] In the embodiments of the present application, a method for filling beautification points is provided. Through the above method, by obtaining adjacent numerical values of the beautification point sequence, when the adjacent numerical values are different, one of the numerical values can also be used to fill the beautification points. After filling, at least one of the continuous beautification points has the same numerical value as at least one of its adjacent data points, so that the numerical value filled in the beautification points has continuity with at least one adjacent numerical value, and the display effect of the beautification points is still a continuous black or white line segment, thereby improving the display effect of the generated information code, and thus improving the detection and recognition efficiency of the information code.
[0205] Optionally, on the basis of the above Figure 2 corresponding embodiments, in an optional embodiment of the method for generating an information code provided by the embodiments of the present application, according to the data bits and parity bits corresponding to the information to be encoded, a binary sequence is generated, including:
[0206] Generating a binary sequence to be processed according to the data bits and parity bits corresponding to the information to be encoded;
[0207] Obtaining a set of mask arrays, where the set of mask arrays includes Q mask arrays, and Q is an integer greater than or equal to 1;
[0208] Based on the set of mask arrays, each mask array is used to calculate the binary sequence to be processed, and Q binary sequences to be selected are obtained, where the binary sequences to be selected have a one-to-one correspondence with the mask arrays;
[0209] Generate Q mask scores according to Q binary sequences to be selected, where there is a one-to-one correspondence between the binary sequences to be selected and the mask scores;
[0210] Determine the target mask score according to the Q mask scores, where the target mask score is the minimum value among the Q mask scores;
[0211] Determine the binary sequence corresponding to the target mask score as the binary sequence.
[0212] In this embodiment, the information code generation device first needs to generate a binary sequence to be processed according to the data bits and parity bits corresponding to the information to be encoded, and then obtain a mask array set including Q mask arrays, and based on this mask array set, each mask array can be used to calculate the binary sequence to be processed to obtain Q binary sequences to be selected, and the binary sequences to be selected correspond to the mask arrays one by one. Further, Q mask scores are generated according to the Q binary sequences to be selected, and the binary sequences to be selected correspond to the mask scores one by one. Thus, the target mask score can be determined according to the Q mask scores, and the target mask score is the minimum value among the Q mask scores. Finally, the binary sequence corresponding to the target mask score is determined as the binary sequence, where Q is an integer greater than or equal to 1.
[0213] For ease of understanding, an example is given where the mask array set includes 36 mask arrays. Specifically, please refer to Figure 10 , Figure 10 is a schematic diagram of an embodiment of the correspondence between the mask array and the character in the embodiment of the present application. As shown in the figure, Figure 10 can represent an example of the correspondence between the mask array and the characters (capital A to Z, numbers 0 to 9). It should be understood that in this embodiment, an example where the mask array set includes 36 mask arrays is used for ease of understanding of the solution. In practical applications, the mask array set may also include at least one mask array, and there are also other corresponding relationships between the mask array and the characters, which will not be enumerated here.
[0214] Suppose the binary sequence to be processed generated according to data bits and error correction bits is 01000101 01010010 10101011 11010110 10101010 1010. XOR calculations can be performed on the binary sequence to be processed according to each mask array in the obtained mask array set described above. For example, XOR calculation is performed on the mask array 01000001 and the binary sequence to be processed, and the binary sequence to be selected 00000100 00010011 11101010 10010111 11101011 1110 can be obtained. XOR calculations are performed on the 36 mask arrays and the binary sequence to be processed respectively, and 36 binary sequences to be selected can be obtained. Then, score the 36 binary sequences to be selected to obtain 36 mask scores, determine the minimum value among the 36 mask scores as the target mask score, and the binary sequence to be selected corresponding to the target mask score can be determined as the binary sequence.
[0215] Based on Figure 10 It can be seen that the high bits in the mask arrays of some characters are the same. That is to say, the occurrence probability of some binary strings is higher than that of other binary strings. For the convenience of description, please refer to Figure 11 , Figure 11 This is a schematic diagram of an embodiment of the correspondence between mask arrays and probabilities in the embodiments of the present application. As shown in the figure, for the mask arrays corresponding to characters H to O, the binary string F1 corresponding to the first 5 bits is 01001, and there are 8 mask arrays corresponding to 01001***. Therefore, the probability of the mask arrays corresponding to 01001*** appearing in the mask array set containing 36 mask arrays is about 22.22%. Similarly, the probability of the mask arrays corresponding to 00110*** appearing in the mask array set containing 36 mask arrays is about 22.22%, and the probability of the mask arrays corresponding to 01000*** appearing in the mask array set containing 36 mask arrays is about 19.44%, etc. for the probabilities of other binary strings. Therefore, in this embodiment, the first 10 binary strings with higher probabilities can also be used as mask arrays, thereby increasing the number of occurrences of continuous 0 segments or continuous 1 segments. The subsequent method for determining the binary sequence is similar to the foregoing and will not be elaborated here.
[0216] In the embodiments of the present application, a method for determining a binary sequence is provided. Through the above method, by calculating the mask scores of the binary sequences to be selected, the minimum value among the mask scores is determined as the target mask score. The smaller the score, the better the display effect of the corresponding binary sequence to be selected. Therefore, the binary sequence to be selected is determined as the binary sequence, and the information code generated by this binary sequence also has a better display effect, which is beneficial to the detection and recognition efficiency of the information code.
[0217] Optionally, in the aboveFigure 2 Based on the corresponding various embodiments, in an alternative embodiment of the method for generating an information code provided in the embodiments of the present application, generating Q mask scores according to Q binary sequences to be selected includes:
[0218] Obtaining the initial score corresponding to the binary sequence to be selected among the Q binary sequences to be selected;
[0219] Obtaining the number of isolated points and the number of consecutive points according to the binary sequence to be selected, where an isolated point represents a point where the value is different from the values of the two adjacent points, and a consecutive point represents a point where the value is the same as the value of at least one adjacent point;
[0220] Determining a first score according to the number of isolated points;
[0221] Determining a second score according to the number of consecutive points;
[0222] Determining the mask score corresponding to the binary sequence to be selected among the Q mask scores according to the initial score, the first score, and the second score.
[0223] In this embodiment, after the information code generation device obtains the Q binary sequences to be selected, it can further obtain the initial score corresponding to each binary sequence to be selected among the Q binary sequences to be selected, and then obtain the number of isolated points and the number of consecutive points according to the binary sequence to be selected. The isolated point represents a point where the value is different from the values of the two adjacent points, and the consecutive point represents a point where the value is the same as the value of at least one adjacent point. Determine a first score according to the number of isolated points, and determine a second score according to the number of consecutive points. Finally, according to the initial score, the first score, and the second score, determine the mask score corresponding to the binary sequence to be selected among the Q mask scores.
[0224] For the sake of easy understanding, taking the initial score as 50 points, adding 1 point for one isolated point and subtracting 1 point for one consecutive point as an example, if the binary sequence to be selected is 00001010 10100000, then the number of isolated points and the number of consecutive points in the binary sequence to be selected can be obtained. The number of isolated points is 7, and the number of consecutive points is 9. Therefore, the first score can be determined to be 7 points according to the number of isolated points, and the second score can be determined to be -9 points according to the number of consecutive points. Then, adding the initial score of 50 points, the first score of 7 points, and the second score of -9 points, the mask score corresponding to the binary sequence to be selected can be obtained as 48.
[0225] If the binary sequence to be selected is 00000100 00010011 11101010 10010111 111010111110, the number of isolated points and the number of consecutive points in the binary sequence to be selected can be obtained. Among them, the number of isolated points is 14, and the number of consecutive points is 30. Therefore, according to the number of isolated points, the first score can be determined to be 14 points, and according to the number of consecutive points, the second score can be determined to be -30 points. Then, by adding the initial score of 50 points, the first score of 14 points, and the second score of -30 points, the mask score corresponding to the binary sequence to be selected can be obtained as 34. It should be understood that the sum of the isolated points and the consecutive points should be equal to the number of binary digits in the binary sequence to be selected.
[0226] In an embodiment of the present application, a method for calculating a mask score is provided. Through the above method, since the mask score is calculated based on the number of isolated points and the number of consecutive points, the display effect of the isolated points is poor, while the display effect of the consecutive points is good. Therefore, the mask score obtained through the isolated points and the consecutive points can reflect the display effect of the binary sequence to be selected, so that a binary sequence to be selected with a good display effect can be selected for filling subsequently, making the generated information code have a good display effect, and also being beneficial to the detection and recognition efficiency of the information code.
[0227] The information code generation device in the present application will be described in detail below. Please refer to Figure 12 , Figure 12 which is a schematic diagram of an embodiment of the information code generation device in an embodiment of the present application. The information code generation device 200 includes:
[0228] An acquisition module 201, configured to acquire the number of padding bits corresponding to the information to be encoded;
[0229] The acquisition module 201 is further configured to acquire a to-be-filled template corresponding to the target beautification level according to the number of padding bits acquired by the acquisition module 201. Among them, the to-be-filled template includes N positions, and the N positions include M beautification positions and (N - M) to-be-filled positions. N is an integer greater than 1, and M is an integer greater than 1 and less than N;
[0230] A filling module 202, configured to fill the data bits and error correction bits corresponding to the information to be encoded acquired by the acquisition module 201 into the (N - M) to-be-filled positions in the to-be-filled template to obtain a to-be-synthesized information code;
[0231] The filling module 202 is further configured to fill the M beautification positions in the to-be-filled template according to the to-be-synthesized information code obtained by the filling module 202 to obtain a target information code.
[0232] In an embodiment of the present application, a method for generating an information code is provided. Through the above method, the position of the beautification point corresponding to the template to be filled can be determined for different information to be encoded, and the value of each beautification point is flexible, that is, the value of the beautification point can be designed according to the data bit and the error correction bit, which makes it easier to achieve a better point display effect, which is beneficial to the detection and identification of the information code.
[0233] Optionally, in the above Figure 12 On the basis of the corresponding embodiment, in another embodiment of the information code generating device 200 provided in the embodiment of the present application,
[0234] The acquisition module 201 is specifically used for:
[0235] Obtain the information to be encoded and the version information corresponding to the information to be encoded, wherein the version information is used to determine the total number of points;
[0236] Determining the number of data bits and the number of error correction bits according to the information to be encoded;
[0237] The number of padding bits corresponding to the information to be encoded is determined based on the total number of points, the number of data bits, and the number of error correction bits.
[0238] In an embodiment of the present application, a method for determining the number of padding bits is provided. Through the above method, since the total number of points corresponding to different version information is different, the number of data bits and the number of error correction bits are obtained after confirming the version information, which can improve the accuracy of determining the number of padding bits, thereby more accurately determining the position of the beautification points, thereby improving the accuracy of information code generation, which is beneficial to the detection and identification of information codes.
[0239] Optionally, in the above Figure 12 On the basis of the corresponding embodiment, in another embodiment of the information code generating device 200 provided in the embodiment of the present application,
[0240] The acquisition module 201 is specifically used for:
[0241] Determine a target beautification level from a beautification level set according to the number of padded positions, wherein the beautification level set includes at least one beautification level, and each beautification level corresponds to a range of beautification point number;
[0242] A to-be-filled template corresponding to a target beautification level is obtained, wherein the target beautification level corresponds to at least one filling template, and the to-be-filled template belongs to any one of the at least one filling template.
[0243] In an embodiment of the present application, a method for obtaining a template to be filled is provided. Through the above method, the corresponding target beautification level is determined according to the number of padding bits. Since each beautification level corresponds to at least one template to be filled, the template to be filled corresponding to the target beautification level can be obtained accordingly. Subsequently, the data bits, error correction bits, and beautification bits are filled according to the template to be filled, which can improve the display effect of the bits in the information code, thereby improving the detection and recognition efficiency of the information code.
[0244] Optionally, based on the corresponding embodiment above, in another embodiment of the information code generation device 200 provided in the embodiment of the present application, the information code generation device 200 further includes an adding module 203. Figure 12 In an embodiment of the present application, a method for obtaining a template to be filled is provided. Through the above method, the corresponding target beautification level is determined according to the number of padding bits. Since each beautification level corresponds to at least one template to be filled, the template to be filled corresponding to the target beautification level can be obtained accordingly. Subsequently, the data bits, error correction bits, and beautification bits are filled according to the template to be filled, which can improve the display effect of the bits in the information code, thereby improving the detection and recognition efficiency of the information code.
[0245] The obtaining module 201 is further configured to obtain a beautification level identifier corresponding to the target beautification level.
[0246] The adding module 203 is configured to add the beautification level identifier to the meta-information corresponding to the information to be encoded, where the meta-information further includes the version information, error correction level information, and mask array identifier corresponding to the information to be encoded.
[0247] In an embodiment of the present application, another method for generating an information code is provided. Through the above method, after determining the target beautification level, the beautification level identifier corresponding to the target beautification level can be obtained, and the beautification level identifier is added to the meta-information, improving the information content of the information to be encoded, so that the generated information code includes more data information and improves the practicality of the information code.
[0248] Optionally, based on the corresponding embodiment above, in another embodiment of the information code generation device 200 provided in the embodiment of the present application, the information code generation device 200 further includes an encoding module 204. Figure 12 In an embodiment of the present application, a method for obtaining a template to be filled is provided. Through the above method, the corresponding target beautification level is determined according to the number of padding bits. Since each beautification level corresponds to at least one template to be filled, the template to be filled corresponding to the target beautification level can be obtained accordingly. Subsequently, the data bits, error correction bits, and beautification bits are filled according to the template to be filled, which can improve the display effect of the bits in the information code, thereby improving the detection and recognition efficiency of the information code.
[0249] The encoding module 204 is configured to encode the information to be encoded to obtain the data bits corresponding to the information to be encoded, where the data bits are composed of multiple binary data.
[0250] The encoding module 204 is further configured to encode the data bits to obtain the error correction bits corresponding to the information to be encoded, where the error correction bits are composed of multiple binary data.
[0251] In an embodiment of the present application, a method for obtaining data bits and error correction bits is provided. Through the above method, data bits including data information can be obtained through encoding, and error correction bits that can detect and correct errors after errors occur during transmission can be obtained, thereby improving the accuracy and practicality of information code generation and facilitating the detection and recognition of information codes.
[0252] Optionally, based on the corresponding embodiment above,Figure 12 Based on the corresponding embodiment, in another embodiment of the information code generation device 200 provided in the embodiments of the present application, the information code generation device 200 further includes a generation module 205.
[0253] The generation module 205 is configured to generate a binary sequence according to the data bits and parity bits corresponding to the information to be encoded.
[0254] The filling module 202 is specifically configured to:
[0255] Determine the number of target positions according to the binary sequence, where the number of target positions is the sum of the number of data bits and the number of parity bits.
[0256] According to the number of target positions, fill the binary sequence into the (N - M) to-be-filled positions in the to-be-filled template in the information code filling order to obtain the to-be-synthesized information code.
[0257] In the embodiments of the present application, a method for generating a to-be-synthesized information code is provided. By the above method, the binary sequence is filled into the to-be-filled positions in different information code filling orders. Since the filling orders of the information codes are different, the positions shown by the obtained to-be-synthesized information codes are also different, which improves the flexibility and selectivity of generating the to-be-synthesized information code, and thus improves the flexibility and selectivity of generating the target information code.
[0258] Optionally, based on the corresponding embodiment above, in another embodiment of the information code generation device 200 provided in the embodiments of the present application, Figure 12 The filling module 202 is specifically configured to:
[0259] If the number of target positions is equal to (N - M), then fill the binary sequence into the (N - M) to-be-filled positions in the to-be-filled template in the information code filling order.
[0260] When the (N - M) to-be-filled positions are filled, generate the to-be-synthesized information code.
[0261] When the filling of the (N - M) to-be-filled positions is completed, generate the to-be-synthesized information code.
[0262] In the embodiments of the present application, another method for generating a to-be-synthesized information code is provided. By the above method, when the number of target positions is equal to the number of to-be-filled positions, the binary sequence can be directly filled into the to-be-filled positions in different information code filling orders, and the to-be-synthesized information code can be generated after the filling of the to-be-filled positions is completed, which improves the efficiency of generating the to-be-synthesized information code, and thus improves the efficiency of generating the target information code.
[0263] Optionally, based on the corresponding embodiment above, in another embodiment of the information code generation device 200 provided in the embodiments of the present application, Figure 12 Based on the corresponding embodiment above, in another embodiment of the information code generation device 200 provided in the embodiments of the present application,
[0264] The filling module 202 is specifically configured to:
[0265] If the number of target points is less than (N - M), then fill the P to-be-filled points in the to-be-filled template with the binary sequence according to the information code filling order, where P is an integer greater than or equal to 1 and less than (N - M);
[0266] When the P to-be-filled points are filled, obtain (N - M - P) to-be-filled points;
[0267] Fill the (N - M - P) to-be-filled points in the to-be-filled template to obtain the to-be-synthesized information code.
[0268] In the embodiments of the present application, another method for generating the to-be-synthesized information code is provided. Through the above method, when the number of target points is less than the number of to-be-filled points, all the target points cannot completely fill the to-be-filled points. Therefore, it is necessary to supplement the remaining unfilled points to generate the to-be-synthesized information code. Thus, the integrity of the generation of the to-be-synthesized information code can be improved, thereby improving the integrity of the generation of the target information code, and enabling the target information code to have a better display effect, which is beneficial to the detection and recognition of the target information code.
[0269] Optionally, on the basis of the corresponding embodiments above, in another embodiment of the information code generation device 200 provided by the embodiments of the present application, Figure 12
[0270] The filling module 202 is specifically configured to:
[0271] Obtain a beautification point sequence according to the M beautification points in the to-be-filled template, where the beautification point sequence includes at least one continuous beautification point among the M beautification points;
[0272] Determine a first adjacent bit and a second adjacent bit associated with the beautification point sequence according to the to-be-synthesized information code, where the first adjacent bit is the to-be-filled point adjacent to the first beautification point of the beautification point sequence, and the second adjacent bit is the to-be-filled point adjacent to the last beautification point of the beautification point sequence;
[0273] Obtain a first value corresponding to the first adjacent bit and a second value corresponding to the second adjacent bit;
[0274] If the first value is the same as the second value, then fill each beautification point in the beautification point sequence with a third value, where the third value, the first value, and the second value are the same value.
[0275]
[0275] In an embodiment of the present application, a method for filling beautification points is provided. Through the above-mentioned method, the adjacent numerical values of the beautification point sequence are obtained, and the beautification points are filled with the numerical values of the adjacent numerical values. After filling, the numerical values of the continuous beautification points and their adjacent data points are the same, so that the numerical values filled with the beautification points are continuous with the adjacent numerical values. The display effect of the beautification points is a continuous black or white line segment, thereby improving the display effect of the generated information code, thereby improving the detection and recognition efficiency of the information code.
[0276] Optionally, in the above Figure 12 On the basis of the corresponding embodiment, in another embodiment of the information code generating device 200 provided in the embodiment of the present application,
[0277] The filling module 202 is specifically used for:
[0278] Acquire a beautification point sequence according to the M beautification points in the to-be-filled template, wherein the beautification point sequence includes at least one continuous beautification point among the M beautification points;
[0279] According to the information code to be synthesized, determine the first adjacent bit and the second adjacent bit associated with the beautification point sequence, wherein the first adjacent bit is the point to be filled adjacent to the first beautification point in the beautification point sequence, and the second adjacent bit is the point to be filled adjacent to the last beautification point in the beautification point sequence;
[0280] Obtain a first value corresponding to the first adjacent bit and a second value corresponding to the second adjacent bit;
[0281] If the first value is different from the second value, obtaining the number of first consecutive values corresponding to the first value and the number of second consecutive values corresponding to the second value;
[0282] If the number of the first continuous values is greater than the number of the second continuous values, then fill the third value into each beautification point in the beautification point sequence, wherein the third value is the same as the first value;
[0283] If the number of the first continuous values is less than the number of the second continuous values, the third value is filled into each beautification point in the beautification point sequence, wherein the third value is the same as the second value.
[0284] In an embodiment of the present application, a method for beautifying dot position filling is provided. Through the above method, by obtaining adjacent values of the beautifying dot sequence, even when the adjacent values are different, one of the values can be used to fill the beautifying dot positions. After filling, at least one of the continuous beautifying dots has the same value as at least one of its adjacent data points, so that the values filled in the beautifying dot positions are continuous with at least one adjacent value, and the display effect of the beautifying dot positions is still a continuous black or white line segment. Thus, the display effect of the generated information code is improved, and the detection and recognition efficiency of the information code is enhanced.
[0285] Optionally, based on the corresponding embodiment above, in another embodiment of the information code generation device 200 provided in the embodiments of the present application, Figure 12 the generation module 205 is specifically configured to:
[0286] Generate a to-be-processed binary sequence according to the data bits and parity bits corresponding to the information to be encoded;
[0287] Obtain a set of mask arrays, where the set of mask arrays includes Q mask arrays, and Q is an integer greater than or equal to 1;
[0288] Based on the set of mask arrays, calculate the to-be-processed binary sequence using each mask array to obtain Q to-be-selected binary sequences, where the to-be-selected binary sequences have a one-to-one correspondence with the mask arrays;
[0289] Generate Q mask scores according to the Q to-be-selected binary sequences, where the to-be-selected binary sequences have a one-to-one correspondence with the mask scores;
[0290] Determine a target mask score according to the Q mask scores, where the target mask score is the minimum value among the Q mask scores;
[0291] Determine the to-be-selected binary sequence corresponding to the target mask score as the binary sequence.
[0292] In an embodiment of the present application, a method for determining a binary sequence is provided. Through the above method, by calculating the mask scores of the to-be-selected binary sequences, the minimum value among the mask scores is determined as the target mask score. The smaller the score, the better the display effect of the corresponding to-be-selected binary sequence. Therefore, the to-be-selected binary sequence is determined as the binary sequence, and the information code generated by this binary sequence also has a good display effect, which is beneficial to the detection and recognition efficiency of the information code.
[0293] Optionally, based on the corresponding embodiment above, in another embodiment of the information code generation device 200 provided in the embodiments of the present application,
[0294] Optionally, based on the corresponding embodiment above, in another embodiment of the information code generation device 200 provided in the embodiments of the present application, Figure 12 the information code generation device 200 provided in the embodiments of the present application,
[0295] The generation module 202 is specifically configured to:
[0296] Obtain the initial score corresponding to the to-be-selected binary sequence among Q to-be-selected binary sequences;
[0297] Obtain the number of isolated points and the number of consecutive points according to the to-be-selected binary sequence, where an isolated point represents a point whose value is different from the values of the two adjacent points, and a consecutive point represents a point whose value is the same as the value of at least one adjacent point;
[0298] Determine the first score according to the number of isolated points;
[0299] Determine the second score according to the number of consecutive points;
[0300] Determine the mask score corresponding to the to-be-selected binary sequence among the Q mask scores according to the initial score, the first score, and the second score.
[0301] In the embodiment of the present application, a method for calculating a mask score is provided. Through the above method, since the mask score is calculated based on the number of isolated points and the number of consecutive points, the display effect of isolated points is poor, while the display effect of consecutive points is good. Therefore, the mask score obtained through isolated points and consecutive points can reflect the display effect of the to-be-selected binary sequence, so that a to-be-selected binary sequence with a good display effect can be selected for filling subsequently, making the generated information code have a good display effect, and also being beneficial to the detection and recognition efficiency of the information code.
[0302] The embodiment of the present application also provides another information code generation device. The information code generation device can be deployed on an electronic device, and the electronic device can be a terminal device, such as Figure 13 As shown, for the convenience of description, only the part related to the embodiment of the present application is shown. For the specific technical details not disclosed, please refer to the method part of the embodiment of the present application. The terminal device can be any terminal device including a mobile phone, a tablet computer, a personal digital assistant (PDA), a point of sales (POS) device, an in-vehicle computer, etc. Taking the terminal device as a mobile phone as an example:
[0303] Figure 13 What is shown is a block diagram of a part of the structure of a mobile phone related to the terminal device provided by the embodiment of the present application. Refer to Figure 13, the mobile phone includes components such as a radio frequency (RF) circuit 1310, a memory 1320, an input unit 1330, a display unit 1340, sensors 1350, an audio circuit 1360, a wireless fidelity (WiFi) module 1370, a processor 1380, and a power supply 1390. Those skilled in the art can understand that Figure 13 the mobile phone structure shown in Figure 13 does not limit the mobile phone and may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements. The following will specifically introduce each component of the mobile phone in combination with
[0304] The RF circuit 1310 can be used for receiving and sending signals during information reception or call processes. Specifically, after receiving the downlink information from the base station, it is given to the processor 1380 for processing; in addition, the designed uplink data is sent to the base station. Generally, the RF circuit 1310 includes, but is not limited to, antennas, at least one amplifier, a transceiver, a coupler, a low noise amplifier (LNA), a duplexer, etc. In addition, the RF circuit 1310 can also communicate with the network and other devices through wireless communication. The above wireless communication can use any communication standard or protocol, including but not limited to the global system of mobile communication (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), long term evolution (LTE), email, short messaging service (SMS), etc.
[0305] The memory 1320 can be used to store software programs and modules. The processor 1380 executes various functional applications and data processing of the mobile phone by running the software programs and modules stored in the memory 1320. The memory 1320 mainly includes a program storage area and a data storage area. Among them, the program storage area can store an operating system, application programs required for at least one function (such as a sound playback function, an image playback function, etc.); the data storage area can store data created according to the use of the mobile phone (such as audio data, phone book, etc.). In addition, the memory 1320 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0306] The input unit 1330 can be used to receive input digital or character information, and generate key signal inputs related to the user settings and function control of the mobile phone. Specifically, the input unit 1330 may include a touch panel 1331 and other input devices 1332. The touch panel 1331, also known as a touch screen, can collect touch operations of the user on or near it (such as operations of the user using a finger, a stylus, or any suitable object or accessory on or near the touch panel 1331), and drive the corresponding connection device according to a pre-set program. Optionally, the touch panel 1331 may include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the touch orientation of the user, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into contact coordinates, and then sends it to the processor 1380, and can receive and execute the commands sent by the processor 1380. In addition, various types such as resistive, capacitive, infrared, and surface acoustic wave can be used to implement the touch panel 1331. In addition to the touch panel 1331, the input unit 1330 may also include other input devices 1332. Specifically, the other input devices 1332 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, power on / off keys, etc.), a trackball, a mouse, a joystick, etc.
[0307] The display unit 1340 can be used to display information input by the user or information provided to the user, as well as various menus of the mobile phone. The display unit 1340 may include a display panel 1341. Optionally, the display panel 1341 can be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), etc. Further, the touch panel 1331 can cover the display panel 1341. When the touch panel 1331 detects a touch operation on or near it, it is transmitted to the processor 1380 to determine the type of touch event. Subsequently, the processor 1380 provides a corresponding visual output on the display panel 1341 according to the type of touch event. Although in Figure 13 , the touch panel 1331 and the display panel 1341 are implemented as two independent components to realize the input and input functions of the mobile phone, but in some embodiments, the touch panel 1331 and the display panel 1341 can be integrated to realize the input and output functions of the mobile phone.
[0308] The mobile phone may further include at least one sensor 1350, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor. Among them, the ambient light sensor can adjust the brightness of the display panel 1341 according to the brightness of the ambient light, and the proximity sensor can turn off the display panel 1341 and / or the backlight when the mobile phone is moved to the ear. As a kind of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in all directions (generally three axes). When stationary, it can detect the magnitude and direction of gravity, and can be used for applications that identify the posture of the mobile phone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; As for other sensors that the mobile phone can also be configured with, such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc., they will not be elaborated here.
[0309] The audio circuit 1360, the speaker 1361, and the microphone 1362 can provide an audio interface between the user and the mobile phone. The audio circuit 1360 can transmit the electrical signal converted from the received audio data to the speaker 1361, and the speaker 1361 converts it into a sound signal for output; on the other hand, the microphone 1362 converts the collected sound signal into an electrical signal, which is received by the audio circuit 1360 and then converted into audio data. After the audio data is output to the processor 1380 for processing, it is sent to another mobile phone, for example, via the RF circuit 1310, or the audio data is output to the memory 1320 for further processing.
[0310] WiFi belongs to short - range wireless transmission technology. Through the WiFi module 1370, a mobile phone can help users send and receive emails, browse the web, and access streaming media, etc. It provides users with wireless broadband Internet access. Although Figure 13 the WiFi module 1370 is shown, it can be understood that it does not belong to an essential component of the mobile phone and can be completely omitted within the scope of not changing the essence of the invention as needed.
[0311] The processor 1380 is the control center of the mobile phone, connecting various parts of the entire mobile phone through various interfaces and circuits. By running or executing software programs and / or modules stored in the memory 1320, and by calling data stored in the memory 1320, it executes various functions of the mobile phone and processes data. Optionally, the processor 1380 may include one or more processing units; optionally, the processor 1380 may integrate an application processor and a modem processor. Among them, the application processor mainly processes the operating system, user interface, and application programs, etc., and the modem processor mainly processes wireless communication. It can be understood that the above - mentioned modem processor may not be integrated into the processor 1380 either.
[0312] The mobile phone also includes a power source 1390 (such as a battery) for powering each component. Optionally, the power source can be logically connected to the processor 1380 through a power management system, so as to realize functions such as management of charging, discharging, and power consumption management through the power management system. Although not shown, the mobile phone may also include a camera, a Bluetooth module, etc., which will not be elaborated here.
[0313] In the embodiments of the present application, the processor 1380 included in the terminal device is used to execute as Figure 2 the corresponding various embodiments.
[0314] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the above - described systems, devices, and units can refer to the corresponding processes in the foregoing method embodiments, which will not be elaborated here.
[0315] In several embodiments provided in the present application, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point, the couplings or direct couplings or communication connections shown or discussed with each other can be through some interfaces, and the indirect couplings or communication connections of devices or units can be in electrical, mechanical, or other forms.
[0316] The unit described as a separation component may or may not be physically separated. The component shown as a unit may or may not be a physical unit, that is, it may be located in one place or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0317] In addition, each functional unit in various embodiments of the present application can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
[0318] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or all or part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present application. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical discs that can store program codes.
[0319] As mentioned above, the above embodiments are only used to illustrate the technical solutions of the present application and are not intended to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of various embodiments of the present application.
Claims
1. A method for generating an information code, characterized in that, including: obtaining the number of padding bits corresponding to the information to be encoded; obtaining a to-be-filled template corresponding to a target beautification level according to the number of padding bits, where the number of padding bits is within the range of the number of beautification points corresponding to the target beautification level, the to-be-filled template includes N points, the N points include M beautification points and N-M to-be-filled points, N is an integer greater than 1, and M is an integer greater than 1 and less than N; filling the data bits and error correction bits corresponding to the information to be encoded into the N-M to-be-filled points in the to-be-filled template to obtain a to-be-synthesized information code; filling the M beautification points in the to-be-filled template according to the to-be-synthesized information code to obtain a target information code.
2. The method according to claim 1, wherein The obtaining the number of padding bits corresponding to the information to be encoded includes: obtaining the information to be encoded and the version information corresponding to the information to be encoded, where the version information is used to determine the total number of points; determining the number of data bits and the number of error correction bits according to the information to be encoded; determining the number of padding bits corresponding to the information to be encoded according to the total number of points, the number of data bits, and the number of error correction bits.
3. The method according to claim 1, wherein The obtaining the to-be-filled template corresponding to a target beautification level according to the number of padding bits includes: determining the target beautification level from a set of beautification levels according to the number of padding bits, where the set of beautification levels includes at least one beautification level, and each beautification level corresponds to a range of the number of beautification points; obtaining the to-be-filled template corresponding to the target beautification level, where the target beautification level corresponds to at least one filling template, and the to-be-filled template belongs to any one of the at least one filling template.
4. The method according to claim 3, characterized in that, After determining the target beautification level from the set of beautification levels according to the number of padding bits, the method further includes: obtaining a beautification level identifier corresponding to the target beautification level; adding the beautification level identifier to the meta-information corresponding to the information to be encoded, where the meta-information further includes the version information, error correction level information, and mask array identifier corresponding to the information to be encoded.
5. The method according to claim 1, characterized in that The method further includes: encoding the information to be encoded to obtain the data bits corresponding to the information to be encoded, where the data bits are composed of multiple binary data; encoding the data bits to obtain the error correction bits corresponding to the information to be encoded, where the error correction bits are composed of multiple binary data.
6. The method according to any one of claims 1 to 5, characterized in that The filling the data bits and error correction bits corresponding to the information to be encoded into the N-M to-be-filled points in the to-be-filled template to obtain a to-be-synthesized information code includes: generating a binary sequence according to the data bits and error correction bits corresponding to the information to be encoded; determining a target number of points according to the binary sequence, where the target number of points is the sum of the number of data bits and the number of error correction bits; filling the binary sequence into the N-M to-be-filled points in the to-be-filled template in the information code filling order according to the target number of points to obtain the to-be-synthesized information code.
7. The method according to claim 6, wherein Filling the N-M unfilled positions in the to-be-filled template with the binary sequence in the information code filling order according to the number of target positions to obtain the to-be-synthesized information code includes: If the number of target positions is equal to N-M, filling the N-M unfilled positions in the to-be-filled template with the binary sequence in the information code filling order; When the N-M unfilled positions are filled, generating the to-be-synthesized information code.
8. The method according to claim 6, characterized in that, Filling the N-M unfilled positions in the to-be-filled template with the binary sequence in the information code filling order according to the number of target positions to obtain the to-be-synthesized information code includes: If the number of target positions is less than N-M, filling P unfilled positions in the to-be-filled template with the binary sequence in the information code filling order, where P is an integer greater than or equal to 1 and less than N-M; When the P unfilled positions are filled, obtaining N-M-P unfilled positions; Filling the N-M-P unfilled positions in the to-be-filled template to obtain the to-be-synthesized information code.
9. The method according to claim 1, characterized in that Filling the M beautifying positions in the to-be-filled template according to the to-be-synthesized information code includes: Obtaining a beautifying position sequence according to the M beautifying positions in the to-be-filled template, where the beautifying position sequence includes at least one continuous beautifying position among the M beautifying positions; Determining a first adjacent position and a second adjacent position associated with the beautifying position sequence according to the to-be-synthesized information code, where the first adjacent position is an unfilled position adjacent to the first beautifying position of the beautifying position sequence, and the second adjacent position is an unfilled position adjacent to the last beautifying position of the beautifying position sequence; Obtaining a first value corresponding to the first adjacent position and a second value corresponding to the second adjacent position; If the first value is the same as the second value, filling a third value into each beautifying position in the beautifying position sequence, where the third value, the first value, and the second value are the same value.
10. The method according to claim 1, wherein Filling the M beautifying positions in the to-be-filled template according to the to-be-synthesized information code to obtain the target information code includes: Obtaining a beautifying position sequence according to the M beautifying positions in the to-be-filled template, where the beautifying position sequence includes at least one continuous beautifying position among the M beautifying positions; Determining a first adjacent position and a second adjacent position associated with the beautifying position sequence according to the to-be-synthesized information code, where the first adjacent position is an unfilled position adjacent to the first beautifying position of the beautifying position sequence, and the second adjacent position is an unfilled position adjacent to the last beautifying position of the beautifying position sequence; Obtaining a first value corresponding to the first adjacent position and a second value corresponding to the second adjacent position; If the first value is different from the second value, obtain the number of consecutive first values corresponding to the first value and the number of consecutive second values corresponding to the second value; If the number of consecutive first values is greater than the number of consecutive second values, fill each beautification point in the beautification point sequence with a third value, where the third value is the same as the first value; If the number of consecutive first values is less than the number of consecutive second values, fill each beautification point in the beautification point sequence with a third value, where the third value is the same as the second value.
11. The method according to claim 6, characterized in that, The generating a binary sequence according to the data bits and parity bits corresponding to the information to be encoded includes: Generating a binary sequence to be processed according to the data bits and parity bits corresponding to the information to be encoded; Obtain a set of mask arrays, where the set of mask arrays includes Q mask arrays, and Q is an integer greater than or equal to 1; Based on the set of mask arrays, calculate the binary sequence to be processed using each mask array to obtain Q binary sequences to be selected, where the binary sequences to be selected have a one-to-one correspondence with the mask arrays; Generate Q mask scores according to the Q binary sequences to be selected, where the binary sequences to be selected have a one-to-one correspondence with the mask scores; Determine a target mask score according to the Q mask scores, where the target mask score is the minimum value among the Q mask scores; Determine the binary sequence to be selected corresponding to the target mask score as the binary sequence.
12. The method according to claim 11, wherein The generating Q mask scores according to the Q binary sequences to be selected includes: Obtain the initial score corresponding to the binary sequence to be selected among the Q binary sequences to be selected; Obtain the number of isolated points and the number of consecutive points according to the binary sequence to be selected, where the isolated point represents a point where the value is different from the values of the adjacent two points, and the consecutive point represents a point where the value is the same as the value of at least one adjacent point; Determine a first score according to the number of isolated points; Determine a second score according to the number of consecutive points; Determine the mask score corresponding to the binary sequence to be selected among the Q mask scores according to the initial score, the first score, and the second score.
13. An information code generation device, characterized in that, Includes: An obtaining module for obtaining the number of padding bits corresponding to the information to be encoded; The obtaining module is further configured to obtain a template to be filled corresponding to the target beautification level according to the number of padding bits obtained by the obtaining module, where the number of padding bits is within the range of the number of beautification points corresponding to the target beautification level, the template to be filled includes N points, the N points include M beautification points and N - M points to be filled, N is an integer greater than 1, and M is an integer greater than 1 and less than N; A filling module for filling the data bits and parity bits corresponding to the information to be encoded obtained by the obtaining module into the N - M points to be filled in the template to be filled to obtain an information code to be synthesized; The filling module is further configured to fill the M beautification points in the to-be-filled template according to the to-be-synthesized information code obtained by the filling module, so as to obtain a target information code.
14. The device according to claim 13, characterized in that, The obtaining module is specifically configured to: Obtain the to-be-encoded information and the version information corresponding to the to-be-encoded information, where the version information is used to determine the total number of points; Determine the number of data bits and the number of error correction bits according to the to-be-encoded information; Determine the number of padding bits corresponding to the to-be-encoded information according to the total number of points, the number of data bits, and the number of error correction bits.
15. The device according to claim 13, characterized in that, The obtaining module is specifically configured to: Determine the target beautification level from the beautification level set according to the number of padding bits, where the beautification level set includes at least one beautification level, and each beautification level corresponds to a range of the number of beautification points; Obtain the to-be-filled template corresponding to the target beautification level, where the target beautification level corresponds to at least one filling template, and the to-be-filled template belongs to any one of the at least one filling templates.
16. The device according to claim 15, characterized in that, The device further includes: an adding module; The obtaining module is further configured to obtain the beautification level identifier corresponding to the target beautification level; The adding module is configured to add the beautification level identifier to the meta information corresponding to the to-be-encoded information, where the meta information further includes the version information, the error correction level information, and the mask array identifier corresponding to the to-be-encoded information.
17. The device according to claim 13, characterized in that, The device further includes: an encoding module; The encoding module is configured to encode the to-be-encoded information to obtain the data bits corresponding to the to-be-encoded information, where the data bits are composed of multiple binary data; The encoding module is further configured to encode the data bits to obtain the error correction bits corresponding to the to-be-encoded information, where the error correction bits are composed of multiple binary data.
18. The device according to any one of claims 13 to 17, characterized in that, The device further includes a generating module; The generating module is configured to generate a binary sequence according to the data bits and error correction bits corresponding to the to-be-encoded information; The filling module is specifically configured to: Determine the target number of points according to the binary sequence, where the target number of points is the sum of the number of data bits and the number of error correction bits; According to the target number of points, fill the binary sequence into the N - M to-be-filled points in the to-be-filled template in the information code filling order, so as to obtain the to-be-synthesized information code.
19. The device according to claim 18, wherein The filling module is specifically configured to: If the target number of points is equal to N - M, fill the binary sequence into the N - M to-be-filled points in the to-be-filled template in the information code filling order; When the N - M to-be-filled points are filled, generate the to-be-synthesized information code.
20. The device according to claim 18, wherein The filling module is specifically configured to: If the target number of points is less than N - M, fill the binary sequence into P to-be-filled points in the to-be-filled template in the information code filling order, where P is an integer greater than or equal to 1 and less than N - M; When the P to-be-filled points are filled, obtain N - M - P to-be-filled points; Fill the N-M-P to-be-filled positions in the to-be-filled template to obtain the to-be-synthesized information code.
21. The device according to claim 13, characterized in that, The filling module is specifically configured to: Obtain a beautification position sequence according to the M beautification positions in the to-be-filled template, where the beautification position sequence includes at least one continuous beautification position among the M beautification positions; Determine a first adjacent position and a second adjacent position associated with the beautification position sequence according to the to-be-synthesized information code, where the first adjacent position is a to-be-filled position adjacent to the first beautification position of the beautification position sequence, and the second adjacent position is a to-be-filled position adjacent to the last beautification position of the beautification position sequence; Obtain a first value corresponding to the first adjacent position and a second value corresponding to the second adjacent position; If the first value is the same as the second value, fill a third value into each beautification position in the beautification position sequence, where the third value, the first value, and the second value are the same value.
22. The device according to claim 13, characterized in that, The filling module is specifically configured to: Obtain a beautification position sequence according to the M beautification positions in the to-be-filled template, where the beautification position sequence includes at least one continuous beautification position among the M beautification positions; Determine a first adjacent position and a second adjacent position associated with the beautification position sequence according to the to-be-synthesized information code, where the first adjacent position is a to-be-filled position adjacent to the first beautification position of the beautification position sequence, and the second adjacent position is a to-be-filled position adjacent to the last beautification position of the beautification position sequence; Obtain a first value corresponding to the first adjacent position and a second value corresponding to the second adjacent position; If the first value is different from the second value, obtain a first continuous value count corresponding to the first value and a second continuous value count corresponding to the second value; If the first continuous value count is greater than the second continuous value count, fill a third value into each beautification position in the beautification position sequence, where the third value is the same as the first value; If the first continuous value count is less than the second continuous value count, fill a third value into each beautification position in the beautification position sequence, where the third value is the same as the second value.
23. The device according to claim 18, characterized in that The generation module is specifically configured to: Generate a to-be-processed binary sequence according to the data bits and parity bits corresponding to the to-be-encoded information; Obtain a mask array set, where the mask array set includes Q mask arrays, and Q is an integer greater than or equal to 1; Based on the mask array set, calculate the to-be-processed binary sequence using each mask array to obtain Q to-be-selected binary sequences, where the to-be-selected binary sequences have a one-to-one correspondence with the mask arrays; Generate Q mask scores according to the Q to-be-selected binary sequences, where the to-be-selected binary sequences have a one-to-one correspondence with the mask scores; Determine a target mask score according to the Q mask scores, where the target mask score is the minimum value among the Q mask scores; Determine the to-be-selected binary sequence corresponding to the target mask score as the binary sequence.
24. The device according to claim 23, characterized in that, The generating module is specifically configured to: Obtain the initial score corresponding to the to-be-selected binary sequence among the Q to-be-selected binary sequences; Obtain the number of isolated points and the number of continuous points according to the to-be-selected binary sequence, where the isolated point represents a point whose value is different from the values of the adjacent two points, and the continuous point represents a point whose value is the same as the value of at least one adjacent point; Determine a first score according to the number of isolated points; Determine a second score according to the number of continuous points; Determine the mask score corresponding to the to-be-selected binary sequence among the Q mask scores according to the initial score, the first score, and the second score.
25. An electronic device, characterized in that, Comprising: A memory, a transceiver, a processor, and a bus system; Wherein, the memory is used for storing programs; The processor is configured to execute the programs in the memory, including executing the method according to any one of claims 1 to 12 above; The bus system is used for connecting the memory and the processor, so that the memory and the processor communicate with each other.
26. A computer-readable storage medium, comprising instructions, which when running on a computer, cause the computer to execute the method according to any one of claims 1 to 12.
27. A computer program product, comprising instructions, which when executed by a computer device, implement the method according to any one of claims 1 to 12.
Citation Information
Patent Citations
Encoding system and method and decoding system and method of two-dimension code
CN101908155A
Method for generating beautified two-dimensional code
CN105069497A