Method and device for generating and decoding high-capacity composite color two-dimensional code with high safety and related equipment
By filling the color information of encrypted additional information in the QR code bitmap, combined with the error correction algorithm and the quaternary value table, a high-capacity and secure composite color QR code is generated, which solves the problem of QR codes in the big data era. Capacity and anti-counterfeiting issues, achieving compatibility and recognition.
Patent Information
- Application Number
- CN202410786098.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-18
- Publication Date
- 2024-10-11
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing QR codes are difficult to meet the high capacity and anti-counterfeiting needs in the big data era, especially in micro products with insufficient space and limited aesthetics. At the same time, existing technology cannot effectively improve information security and capacity.
The QR code bitmap is used to transmit the original information, and the additional information is converted into color information by encrypting it. The black module of the QR code bitmap is filled with the corresponding color to generate a composite color QR code, which is combined with the RS error correction algorithm and the quaternary system. Tables of values are encoded and decoded.
It achieves high security, large-capacity composite color QR code, is compatible with ordinary black and white QR codes, improves data storage capacity and anti-counterfeiting performance at low cost, and can be easily identified without additional equipment.
Smart Images

Figure CN118761431A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of two-dimensional codes, and in particular to a method, device and related equipment for generating and decoding a large-capacity composite color two-dimensional code with high security. Background Art
[0002] QR codes are widely used in various fields due to their high storage capacity and easy reading. However, in the era of big data and rampant counterfeiting, it is still difficult to meet various practical needs. On the one hand, some micro-sized products cannot provide enough space to accommodate QR codes, and a large QR code will affect the overall aesthetic effect of the product; on the other hand, due to the development of big data, QR codes are easily counterfeited. Therefore, information capacity and anti-counterfeiting have become related issues that need to be urgently solved in the field of QR codes.
[0003] At this stage, there are some existing solutions that combine multiple ordinary black and white QR codes into one through multiplexing technology. The generated color QR code can realize effective identification of clear code and hidden code under visible light and optical filters. To a certain extent, the information that needs to be encrypted is hidden in the form of hidden code, which achieves anti-counterfeiting performance and increases the capacity by 2 to 3 times. However, this type of QR code requires optical filtering products to obtain the hidden code; some existing solutions encode and modulate the original information through customized color coding technology to generate multi-color halftone dot matrix QR code, which improves the coding density of the QR code, but this type of technology does not achieve the security hiding of the information contained in the QR code; some existing solutions are to merge color pictures and black and white QR codes through synthesis to obtain an aesthetically pleasing color QR code, or to generate a color QR code by replacement method according to color block mapping, but this type of technology only provides an anti-counterfeiting label for the color QR code in an aesthetic sense, and does not solve the bottleneck problem of capacity. Summary of the invention
[0004] In order to solve one of the above-mentioned technical defects, the embodiments of the present application provide a method, device and related equipment for generating and decoding a composite color QR code which can improve the data storage capacity of the QR code, has good anti-counterfeiting performance and can be easily identified without additional equipment.
[0005] According to the first aspect of the embodiment of the present application, a method for generating a large-capacity composite color two-dimensional code with high security is provided, wherein the composite color two-dimensional code is mainly generated from two-dimensional code information, and the two-dimensional code information includes original information for reflecting the content stored in the two-dimensional code and additional information for anti-counterfeiting; the generation method includes: generating a QR code dot matrix according to the encoding rules of the QR code according to the original information; encrypting the additional information to obtain encrypted information; converting the encrypted information into color information, and filling the black module in the data area of the QR code dot matrix with corresponding colors according to the color information; and finally generating a composite color two-dimensional code and outputting it.
[0006] Preferably, the additional information is encrypted to obtain the encrypted information, specifically comprising: identifying the coding mode of the additional information; dividing the additional information into N groups in order of the characters, wherein: the number of characters in the first N-1 groups is M, 1≤the number of characters in the Nth group≤M, and M>1, N>1; starting from the first character in the first group, extracting the Pth character in each group in turn, and arranging and combining the extracted characters in turn into a line of character string sequence to form the Pth line of character string, until the Mth line of character string is formed, and finally obtaining a character string sequence with a total number of lines of M, wherein: 1≤P≤M; starting from the first line, all the M-line character string sequences are sequentially connected end to end in units of lines, and finally forming an irregular line of ciphertext character string; converting the ciphertext character string into a bit string associated with a preset color value table; adding a mode indicator, a character count indicator, and a terminator to the bit string to form a data bit stream; performing error correction by using the RS error correction algorithm to generate an error correction codeword; performing base conversion on the error correction codeword and adding it to the data bit stream to form a final ciphertext data codeword sequence.
[0007] Preferably, the preset color value table is represented by quaternary numbers; then the method of converting the ciphertext string into a bit string related to the preset color value table specifically includes: dividing the ciphertext string into multiple groups in sequence according to the order of character arrangement, with two of them in a group; converting each group of grouped data into a quaternary number, and if the converted quaternary number is less than 4 bits, filling 0 before the highest bit to supplement the bit number, and finally forming a bit string.
[0008] Preferably, the converting of encrypted information into color information and filling corresponding colors on the black modules in the data area of the QR code dot matrix according to the color information specifically includes: mapping the ciphertext data codeword sequence with the color value table one by one; filling the black modules in the data area of the QR code dot matrix with colors in sequence from left to right and from top to bottom according to the mapping result, and during the filling process, if the current black module has a functional graphic, skipping the black module to the next black module; converting all the ciphertext data codeword sequences into corresponding colors on the black modules in the data area of the QR code dot matrix.
[0009] Preferably, the method of generating a QR code dot map from the original information according to the QR code coding rules specifically includes: analyzing the original information, performing data encoding on the original information according to the QR code coding rules to form a data codeword; performing error correction encoding on the data codeword to obtain an error correction codeword; placing the function graphic, the data codeword, and the error correction codeword into the QR code structure to generate a QR code dot map;
[0010] According to a second aspect of an embodiment of the present application, a method for decoding the aforementioned composite color two-dimensional code is provided, comprising: decoding a black and white QR code dot matrix containing original information to obtain original information; decoding a color QR code dot matrix containing additional information to obtain additional information, specifically comprising: determining the starting position of the additional information according to the position information of the position detection pattern in the QR code dot matrix, traversing and reading each module in sequence from left to right and from top to bottom, and during the reading process, if the current module has a functional pattern, skipping the module to the next module; when reading the module, first determining the color information of the current module, and then reversely obtaining the quaternary number corresponding to the module according to the color value table, and then extracting each character in reverse order according to the character arrangement rule during encryption, and restoring the quaternary data bit stream; grouping the restored quaternary data bit stream into a group of 4 bits, recombining it into a data word stream, correcting the data word stream, and obtaining the corresponding data codeword sequence; according to the encoding rule, reversely operating the obtained data codeword sequence to obtain the encrypted additional information, and then decrypting the encrypted additional information to obtain the additional information.
[0011] Preferably, the decoding of the black-and-white QR code dot matrix image containing the original information to obtain the original information specifically includes: image preprocessing; establishing a sampling grid; removing the mask; reverse decoding; and obtaining the original information.
[0012] According to a third aspect of an embodiment of the present application, a device is provided, comprising a module for implementing the aforementioned generation method, or a module for implementing the aforementioned decoding method.
[0013] According to a fourth aspect of an embodiment of the present application, a device is provided, including:
[0014] Memory;
[0015] Processor; and
[0016] Computer programs;
[0017] The computer program is stored in the memory and is configured to be executed by the processor to implement the aforementioned generation method, or is configured to be executed by the processor to implement the aforementioned decoding method.
[0018] According to a fifth aspect of an embodiment of the present application, a computer-readable storage medium is provided, on which a computer program is stored; the computer program is executed by a processor to implement the aforementioned generation method, or to implement the aforementioned decoding method.
[0019] The embodiment of the present application adopts the technically mature QR code dot matrix to transmit the original information, encrypts and encodes the additional information using new rules, and assigns color information, which is then attached to the black module in the data area of the QR code dot matrix to generate a composite color two-dimensional code; the composite color two-dimensional code obtained by the method of the embodiment of the present application is compatible with ordinary black and white two-dimensional codes, has a low preparation cost, can greatly improve the data storage capacity of existing model two-dimensional codes, has excellent anti-counterfeiting performance, and can be conveniently and reliably identified without the need for additional equipment.
[0020] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or be understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the contents pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0022] Figure 1 An example of a color value table provided in an embodiment of the present application;
[0023] Figure 2 A schematic diagram of a module of a generating device provided in an embodiment of the present application;
[0024] Figure 3 A schematic diagram of an additional information encryption module in a generating device provided in an embodiment of the present application;
[0025] Figure 4 A schematic diagram of a module of a third character string generating unit in a generating device provided in an embodiment of the present application;
[0026] Figure 5 A schematic diagram of a color filling module in a generating device provided in an embodiment of the present application;
[0027] Figure 6 A schematic diagram of an original information encoding module in a generating device provided in an embodiment of the present application;
[0028] Figure 7 A schematic diagram of a module of a decoding device provided in an embodiment of the present application;
[0029] Figure 8 A schematic diagram of an original information decoding module in a decoding device provided in an embodiment of the present application;
[0030] In the figure: 101 is an original information encoding module, 102 is an additional information encryption module, 103 is a color filling module, 104 is a composite generation module, 1021 is a pattern recognition unit, 1022 is a first grouping unit, 1023 is a first string generation unit, 1024 is a second string generation unit, 1025 is a third string generation unit, 1026 is an indicator adding unit 1, 1027 is a first error correction unit, 1028 is a ciphertext data generation unit, 10251 is a second grouping unit, 10252 is a conversion unit, 10253 is a padding unit, 1031 is a mapping unit, 1032 is a filling unit, 1033 is a first skip unit, 1011 is a data encoding unit, 1012 is an error correction encoding unit, 1013 is a QR code generating unit, 1014 is a mask unit, 201 is an original information decoding module, 202 is an additional information decoding module, 2021 is a position determination unit, 2022 is a traversal reading unit, 2023 is a second skip unit, 2024 is a first recovery unit, 2025 is a second recovery unit, 2026 is an encrypted information acquiring unit, 2027 is a first decryption unit, 2011 is a preprocessing unit, 2012 is a sampling unit, 2013 is a mask removal unit, and 2014 is a second decryption unit. DETAILED DESCRIPTION
[0031] In order to make the technical solutions and advantages in the embodiments of the present application more clearly understood, the exemplary embodiments of the present application are further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than an exhaustive list of all the embodiments. It should be noted that the embodiments in the present application and the features in the embodiments can be combined with each other without conflict.
[0032] In view of some problems existing in the prior art, on the one hand, a method for generating a large-capacity composite color two-dimensional code with high security is provided in the embodiments of the present application. The method can be executed by a two-dimensional code generating device, or by components configured inside the two-dimensional code generating device, such as a chip, a chip system, etc., or by a logic module or software having some or all of the functions of a two-dimensional code generating device. This application is not limited to this. It should be noted that the composite color two-dimensional code in the embodiments of the present application is mainly generated by two-dimensional code information, and the two-dimensional code information includes original information for reflecting the content stored in the two-dimensional code and additional information for anti-counterfeiting.
[0033] Exemplarily, the generating method includes:
[0034] Generate a QR code dot matrix image based on the original information according to the QR code encoding rules;
[0035] Encrypting the additional information to obtain encrypted information;
[0036] The encrypted information is converted into color information, and the black module in the data area of the QR code dot matrix is filled with corresponding colors according to the color information;
[0037] Finally, a composite color QR code is generated and output.
[0038] Based on the above scheme, the original information is transmitted and reflected by the mature QR code dot matrix, and the additional information is encrypted and encoded, and then added to the black module in the data area of the QR code dot matrix after being given color information. In this scheme, there is no need to change the encoding rules of the existing black and white two-dimensional code, and only by making full use of its existing space, a color two-dimensional code with good compatibility, greatly improved data storage capacity, good anti-counterfeiting performance, and easy identification can be compositely generated at low cost.
[0039] In some possible implementations of the first aspect, encrypting the additional information to obtain the encrypted information specifically includes:
[0040] Identify the encoding mode of the additional information. In practical applications, the encoding mode of the additional information may be the following modes: digital mode, alphanumeric mode, 8-bit byte mode, Chinese character mode, mixed mode (inputting two or more character sets during encoding), etc.
[0041] Divide the additional information into N groups in the order of characters, wherein the number of characters in the first N-1 groups is M, 1≤the number of characters in the Nth group≤M, and M>1, N>1. In practical applications, the number of characters in the Nth group is preferably M, that is, the number of characters in each of the N groups is equal.
[0042] Starting from the first character in the first group, the Pth character in each group is extracted in sequence, and the extracted characters are arranged and combined in sequence to form a line of character string sequence, forming the Pth line of character string, until the Mth line of character string is formed, and finally a character string sequence with a total number of lines of M is obtained, where: 1≤P≤M;
[0043] Starting from the first line, all M lines of character string sequences are connected end to end in units of lines, and finally form an irregular ciphertext string line; for example: in actual application, if the additional information input is 123456789, then during encryption, according to the optimization principle, the additional information will be divided into the following 3 (N=3) groups in sequence: 123, 456, 789, and the number of characters in each group is 3 (M=3). After extracting each character accordingly, recombining them to form the following character string sequence: the first line is 147, the second line is 258, and the third line is 369. After the above three lines are connected at the end, the final irregular ciphertext string is: 147258369.
[0044] Converting the ciphertext string into a bit string associated with a predetermined color value table;
[0045] Adding a mode indicator, a character count indicator, and a terminator to the bit string to form a data bit stream. In practical applications, the mode indicator and the character count indicator may be located before the data bit stream, and the terminator may be located after the data bit stream.
[0046] Perform error correction through RS error correction algorithm to generate error correction codewords;
[0047] The error correction codeword is converted into a binary system and added to the data bit stream (in practical applications, the error correction codeword can be added after the data bit stream) to form a final ciphertext data codeword sequence.
[0048] Based on the above scheme, the encryption rules adopted have the advantages of high reliability and convenient decoding, so that the finally generated color QR code has excellent anti-counterfeiting ability.
[0049] Optionally, the preset color value table is represented by quaternary numbers; converting the ciphertext string into a bit string related to the preset color value table specifically includes:
[0050] Divide the ciphertext string into multiple groups according to the order of characters, with two of them in a group;
[0051] Convert each group of data into a quaternary number (for example, 99 is converted into a quaternary number of 1203). If the converted quaternary number is less than 4 digits, fill the highest digit with 0 to supplement the digits, and finally form a bit string.
[0052] In practical applications, the preset color value table can also be represented by other methods, such as octal numbers, etc. Regardless of the representation method used, the colors in the color value table are preferably dark colors, that is, colors with maximum contrast and difference, so as to improve the recognizability of the color QR code, and the choice of color can be determined according to the Euclidean distance principle. In the embodiment of the present application, the quaternary numbers 0, 1, 2, and 3 can correspond to red, green, blue, and yellow, respectively. Figure 1 shown.
[0053] In some possible implementations of the first aspect, the encrypted information is converted into color information, and the black module in the data area of the QR code dot matrix is filled with a corresponding color according to the color information, specifically including:
[0054] Map the ciphertext data codeword sequence to the color value table one by one;
[0055] According to the mapping results, the black modules in the data area of the QR code dot matrix are filled with colors in order from left to right and from top to bottom. During the filling process, if the current black module has a functional pattern, the black module is skipped and the next black module is moved to;
[0056] Convert all the ciphertext data codeword sequences into corresponding colors on the black modules in the data area of the QR code dot matrix.
[0057] Based on the above scheme, the color coding result of the additional information can be well compatible with the black and white coding result of the original information without affecting the coding result of the core original information, thereby further improving the reliability of the entire encoding and decoding result while ensuring low cost.
[0058] In some possible implementations of the first aspect, the original information is generated according to the QR code encoding rules to generate a QR code dot matrix image, specifically including:
[0059] Analyze the original information, and encode the original information according to the QR code encoding rules to form a data codeword;
[0060] Performing error correction coding on the data codeword to obtain an error correction codeword;
[0061] Put the function graphics, data codewords, and error correction codewords into the QR code structure to generate a QR code dot matrix image;
[0062] In order to prevent the appearance of large blank or black modules in the QR code, which would cause difficulty in recognition, the mask template and the generated QR code dot matrix are XORed, the resulting graphics after the XOR operation are scored, and the graphic with the lowest score is selected as the final QR code dot matrix.
[0063] In the second aspect, the present application provides a method for decoding a composite color two-dimensional code generated by the first aspect, which can be performed by a two-dimensional code decoding device, or by a component configured inside the two-dimensional code decoding device, such as a chip, a chip system, etc., or by a logic module or software having some or all of the functions of a two-dimensional code decoding device. This application does not limit this.
[0064] Exemplarily, the decoding method includes:
[0065] Decode the black and white QR code dot matrix containing the original information to obtain the original information;
[0066] Decode the color QR code dot matrix containing additional information to obtain the additional information, including:
[0067] According to the position information of the position detection pattern in the QR code dot matrix, the starting position of the additional information is determined, and the information is read from the data area between the upper left position detection pattern and the lower left position detection pattern, and each module is read in sequence from left to right and from top to bottom. During the reading process, if the current module has a functional pattern, the module is skipped to the next module;
[0068] When reading a module, first determine the color information of the current module, then reversely obtain the quaternary number corresponding to the module according to the color value table, and then reversely extract each character in turn according to the character arrangement rules during encryption (the arrangement order is: mode indicator, character number indicator, data bit stream, terminator, error correction codeword), and restore the quaternary data bit stream;
[0069] The recovered quaternary data bit stream is grouped into groups of 4 bits each, and reassembled into a data word stream, and error correction is performed on the data word stream to obtain a corresponding data codeword sequence;
[0070] According to the coding rule, the obtained data codeword sequence is operated in reverse to obtain the encrypted additional information, and then the encrypted additional information is decrypted to obtain the additional information.
[0071] In some possible implementations of the second aspect, decoding the black-and-white QR code dot matrix image containing the original information to obtain the original information specifically includes:
[0072] Image preprocessing;
[0073] Establishing a sampling grid;
[0074] Remove the mask;
[0075] Reverse decoding;
[0076] Get the original information.
[0077] In a third aspect, an embodiment of the present application provides a device, which is a generating device, and the generating device includes a module for implementing the aforementioned generating method, or the device is a decoding device, and the decoding device includes a module for implementing the aforementioned decoding method.
[0078] For example, Figure 2 As shown, the generating device comprises:
[0079] The original information encoding module 101 is used to generate a QR code dot matrix image according to the QR code encoding rules of the original information;
[0080] Additional information encryption module 102: used to encrypt additional information to obtain encrypted information;
[0081] Color filling module 103: used to convert the encrypted information into color information, and fill the black module in the data area of the QR code dot matrix with corresponding color according to the color information;
[0082] Composite generation module 104: used to finally generate a composite color two-dimensional code and output it.
[0083] In some possible implementations of the third aspect, such as Figure 3 As shown, the additional information encryption module 102 includes:
[0084] Mode recognition unit 1021: used to recognize the coding mode of the additional information;
[0085] The first grouping unit 1022 is used to group the additional information into N groups according to the order of characters, wherein the number of characters in the first N-1 groups is M, 1≤the number of characters in the Nth group≤M, and M>1, N>1;
[0086] The first character string generating unit 1023 is used to extract the Pth character in each group starting from the first character in the first group, and sequentially arrange and combine the extracted characters into a line of character string sequence to form a Pth line of character string, until the Mth line of character string is formed, and finally obtain a character string sequence with a total number of M lines, where: 1≤P≤M;
[0087] The second character string generating unit 1024 is used to connect all the M character string sequences in order from the first line to the end in units of lines, and finally form an irregular ciphertext character string of one line;
[0088] The third character string generating unit 1025 is used to convert the ciphertext character string into a bit character string related to a preset color value table;
[0089] The indicator adding unit 1026 is used to add the mode indicator, the character count indicator, and the terminator to the bit string to form a data bit stream;
[0090] The first error correction unit 1027 is used to perform error correction by using the RS error correction algorithm to generate an error correction codeword;
[0091] The ciphertext data generating unit 1028 is used to convert the error correction codeword into a binary system and add it to the data bit stream to form a final ciphertext data codeword sequence.
[0092] Optionally, the preset color value table is expressed in quaternary numbers. Figure 4 As shown, the third character string generating unit 1025 includes:
[0093] The second grouping unit 10251 is used to divide the ciphertext string into multiple groups according to the order of characters, with two groups in each group;
[0094] The conversion unit 10252 is used to convert each group of data into a quaternary number, and finally form a bit string;
[0095] Padding unit 10253: used to fill 0 before the highest bit to supplement the number of digits if the converted quaternary number is less than 4 digits.
[0096] In some possible implementations of the third aspect, such as Figure 5 As shown, the color filling module 103 includes:
[0097] Mapping unit 1031: used for mapping the ciphertext data codeword sequence with the color value table one by one;
[0098] Filling unit 1032: for filling the black modules in the QR code dot matrix data area with colors in order from left to right and from top to bottom according to the mapping result, and converting all the ciphertext data codeword sequences into corresponding colors on the black modules in the QR code dot matrix data area.
[0099] The first skipping unit 1033 is used for skipping the black module to the next black module if the current black module has a functional pattern during the filling process;
[0100] In some possible implementations of the third aspect, such as Figure 6 As shown, the original information encoding module 101 includes:
[0101] Data encoding unit 1011: used to analyze the original information, encode the original information according to the encoding rules of the QR code, and form a data codeword;
[0102] The error correction coding unit 1012 is used to perform error correction coding on the data codeword to obtain an error correction codeword;
[0103] QR code generating unit 1013: used to put the function graphics, data codewords, and error correction codewords into the QR code structure to generate a QR code dot matrix image;
[0104] The mask unit 1014 is used to perform an XOR operation on the mask template and the generated QR code dot pattern, score the result of the XOR operation, and select the pattern with the lowest score as the final QR code dot pattern.
[0105] For example, Figure 7 As shown, the decoding device comprises:
[0106] The original information decoding module 201 is used to decode the black and white QR code dot matrix containing the original information to obtain the original information;
[0107] Additional information decoding module 202: used to decode the color QR code dot matrix containing additional information to obtain the additional information;
[0108] The additional information decoding module 202 specifically includes:
[0109] Position determination unit 221: used to determine the starting position of the additional information according to the position information of the position detection pattern in the QR code dot map;
[0110] The traversal reading unit 2022 is used to traverse and read each module in sequence from left to right and from top to bottom;
[0111] The second skipping unit 2023 is used to skip the module and go to the next module if the current module has a functional pattern during the reading process;
[0112] The first recovery unit 2024 is used to determine the color information of the current module when reading the module, and then reversely obtain the quaternary number corresponding to the module according to the color value table, and then reversely extract each character in turn according to the character arrangement rule during encryption to restore the quaternary data bit stream;
[0113] The second recovery unit 2025 is used to group the recovered quaternary data bit stream into groups of 4 bits each, reassemble them into a data word stream, perform error correction on the data word stream, and obtain a corresponding data codeword sequence;
[0114] Encryption information acquisition unit 2026: used to reversely operate the obtained data codeword sequence according to the encoding rules to obtain the encrypted additional information;
[0115] The first decryption unit 2027 is used to decrypt the encrypted additional information to obtain the additional information.
[0116] In some possible implementations of the third aspect, such as Figure 8 As shown, the original information decoding module 201 includes:
[0117] Preprocessing unit 2011: used for image preprocessing;
[0118] Sampling unit 2012: used to establish a sampling grid;
[0119] The mask removing unit 2013 is used to remove the mask;
[0120] The second decryption unit 2014 is used to perform reverse decoding to obtain the original information.
[0121] In a fourth aspect, an embodiment of the present application provides a device, illustratively, the device includes:
[0122] Memory;
[0123] Processor; and
[0124] Computer programs;
[0125] The computer program is stored in the memory and is configured to be executed by the processor to implement the aforementioned generation method, or is configured to be executed by the processor to implement the aforementioned decoding method.
[0126] In a fifth aspect, a computer-readable storage medium is provided in an embodiment of the present application. Exemplarily, a computer program is stored on the readable storage medium; the computer program is executed by a processor to implement the aforementioned generation method, or to implement the aforementioned decoding method.
[0127] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can adopt the form of complete hardware embodiments, complete software embodiments, or embodiments in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code. The scheme in the embodiments of the present application can be implemented in various computer languages, for example, C language, VHDL language, Verilog language, object-oriented programming language Java and literal scripting language JavaScript, etc.
[0128] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features.
[0129] Although the preferred embodiments of the present application have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.
[0130] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A method for generating a large-capacity composite color two-dimensional code with high security, wherein the composite color two-dimensional code is mainly generated from two-dimensional code information, wherein the two-dimensional code information includes original information for reflecting the content stored in the two-dimensional code and additional information for anti-counterfeiting; characterized in that: The generation method comprises: Generate a QR code dot matrix image based on the original information according to the QR code encoding rules; Encrypting the additional information to obtain encrypted information; The encrypted information is converted into color information, and the black module in the data area of the QR code dot matrix is filled with corresponding colors according to the color information; Finally, a composite color QR code is generated and output.
2. The method for generating a high-security large-capacity composite color two-dimensional code according to claim 1, characterized in that: The step of encrypting the additional information to obtain the encrypted information specifically includes: Identify the coding pattern of the additional information; Divide the additional information into N groups in the order of characters, where the number of characters in the first N-1 groups is M, 1≤the number of characters in the Nth group≤M, and M>1, N>1; Starting from the first character in the first group, the Pth character in each group is extracted in sequence, and the extracted characters are arranged and combined in sequence to form a line of character string sequence, forming the Pth line of character string, until the Mth line of character string is formed, and finally a character string sequence with a total number of lines of M is obtained, where: 1≤P≤M; Starting from the first line, all M lines of string sequences are connected end to end in order, and finally form an irregular ciphertext string. Converting the ciphertext string into a bit string associated with a predetermined color value table; Add the mode indicator, character count indicator, and terminator to the bit string to form a data bit stream; Perform error correction through RS error correction algorithm to generate error correction codewords; The error correction codeword is converted into a binary system and added to the data bit stream to form the final ciphertext data codeword sequence.
3. The method for generating a large-capacity composite color two-dimensional code with high security according to claim 2, characterized in that: The preset color value table is represented by quaternary numbers; the step of converting the ciphertext string into a bit string associated with the preset color value table specifically includes: Divide the ciphertext string into multiple groups according to the order of characters, with two of them in a group; Convert each group of data into a quaternary number. If the converted quaternary number is less than 4 digits, fill the highest digit with 0 to supplement the digits, and finally form a bit string.
4. The method for generating a large-capacity composite color two-dimensional code with high security according to claim 2, characterized in that: The method of converting the encrypted information into color information and filling the black module in the data area of the QR code dot matrix with a corresponding color according to the color information specifically includes: Map the ciphertext data codeword sequence to the color value table one by one; According to the mapping results, the black modules in the data area of the QR code dot matrix are filled with colors in order from left to right and from top to bottom. During the filling process, if the current black module has a functional pattern, the black module is skipped and the next black module is moved to; Convert all the ciphertext data codeword sequences into corresponding colors on the black modules in the data area of the QR code dot matrix.
5. The method for generating a high-security large-capacity composite color two-dimensional code according to claim 4, characterized in that: The method of generating a QR code dot matrix image from the original information according to the QR code encoding rules specifically includes: Analyze the original information, and encode the original information according to the QR code encoding rules to form a data codeword; Performing error correction coding on the data codeword to obtain an error correction codeword; Put the function graphics, data codewords, and error correction codewords into the QR code structure to generate a QR code dot matrix image; Perform an XOR operation on the mask template and the generated QR code dot pattern, score the resulting pattern after the XOR operation, and select the pattern with the lowest score as the final QR code dot pattern.
6. The method for decoding a composite color two-dimensional code as claimed in claim 5, characterized in that: include: Decode the black and white QR code dot matrix containing the original information to obtain the original information; Decode the color QR code dot matrix containing additional information to obtain the additional information, including: According to the position information of the position detection pattern in the QR code dot matrix, the starting position of the additional information is determined, and each module is read in sequence from left to right and from top to bottom. During the reading process, if the current module has a functional pattern, the module is skipped to the next module; When reading a module, first determine the color information of the current module, then reversely obtain the quaternary number corresponding to the module according to the color value table, and then reversely extract each character in turn according to the character arrangement rules during encryption to restore the quaternary data bit stream; The recovered quaternary data bit stream is grouped into groups of 4 bits each, and reassembled into a data word stream, and error correction is performed on the data word stream to obtain a corresponding data codeword sequence; According to the coding rule, the obtained data codeword sequence is operated in reverse to obtain the encrypted additional information, and then the encrypted additional information is decrypted to obtain the additional information.
7. The method for decoding a composite color two-dimensional code according to claim 6, characterized in that: The decoding of the black and white QR code dot matrix containing the original information to obtain the original information specifically includes: Image preprocessing; Establishing a sampling grid; Remove the mask; Reverse decoding; Get the original information.
8. A device, characterized in that: The invention comprises a module for implementing the generation method according to any one of claims 1 to 5, or comprises a module for implementing the decoding method according to any one of claims 6 to 7.
9. A device, characterized in that: include: Memory; processor; as well as Computer programs; The computer program is stored in the memory and is configured to be executed by the processor to implement the generation method according to any one of claims 1 to 5, or is configured to be executed by the processor to implement the decoding method according to any one of claims 6 to 7.
10. A computer-readable storage medium, characterized in that: A computer program is stored thereon; the computer program is executed by a processor to implement the generation method according to any one of claims 1 to 5, or to implement the decoding method according to any one of claims 6 to 7.
Citation Information
Patent Citations
Method of encoding / decoding color QR code
CN104899630A
Proprietary code-based multidimensional two-dimensional code generation method and proprietary code-based multidimensional two-dimensional code decoding method
CN108734048A
Color QR code generation and identification method
CN111046996A
Two-channel color QR code encoding / decoding method
CN113935448A
