WO2017198189A1 - Generation and reading method and device for colour identified colour two-dimensional figure code - Google Patents
Generation and reading method and device for colour identified colour two-dimensional figure code Download PDFInfo
- Publication number
- WO2017198189A1 WO2017198189A1 PCT/CN2017/084880 CN2017084880W WO2017198189A1 WO 2017198189 A1 WO2017198189 A1 WO 2017198189A1 CN 2017084880 W CN2017084880 W CN 2017084880W WO 2017198189 A1 WO2017198189 A1 WO 2017198189A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- color
- matrix
- dimensional image
- data
- bit stream
- Prior art date
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06K—GRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
- G06K7/00—Methods or arrangements for sensing record carriers, e.g. for reading patterns
- G06K7/10—Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
- G06K7/14—Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation using light without selection of wavelength, e.g. sensing reflected white light
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06K—GRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
- G06K19/00—Record carriers for use with machines and with at least a part designed to carry digital markings
- G06K19/06—Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code
- G06K19/06009—Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code with optically detectable marking
- G06K19/06037—Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code with optically detectable marking multi-dimensional coding
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06K—GRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
- G06K19/00—Record carriers for use with machines and with at least a part designed to carry digital markings
- G06K19/06—Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06K—GRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
- G06K7/00—Methods or arrangements for sensing record carriers, e.g. for reading patterns
- G06K7/10—Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
- G06K7/14—Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation using light without selection of wavelength, e.g. sensing reflected white light
- G06K7/1404—Methods for optical code recognition
- G06K7/1408—Methods for optical code recognition the method being specifically adapted for the type of code
- G06K7/1417—2D bar codes
Definitions
- the present application relates to the field of two-dimensional graphics, and in particular to a method and apparatus for generating, reading, and reading a color-coded color two-dimensional image.
- the black and white two-dimensional image code is a more common one. Specifically, it encodes the data in a rectangular space by different distributions of black and white pixels in the matrix, and generally has a data storage area. And a feature information area, wherein the distribution form of the black and white pixels in the data storage area is used to store data information that needs to be included in the two-dimensional image code, and the feature information area is used to store feature information of the two-dimensional image code, wherein the feature information includes Format information, version information, and other data.
- color two-dimensional image code is defined relative to the black and white two-dimensional image code.
- the color two-dimensional image code is a special two-dimensional image code, which has all the functions of the ordinary black and white image code, and can display a color appearance. .
- the embodiment of the present application discloses a method for generating and reading a color identification type two-dimensional image code, and a device for solving the problem that the color information in the existing color two-dimensional image code does not contain any valid information.
- the technical solutions are as follows:
- an embodiment of the present application provides a method for generating a color identification type color two-dimensional image code, including:
- each group of data includes the binary bit stream data of a predetermined number of bits, the predetermined number of bits being based on The predetermined color model is determined;
- the predetermined color model is an RGB model
- the predetermined number of bits is three bits, and the predetermined multiple is 255 times.
- the grouping the binary bit stream data comprises:
- the binary bit stream data is grouped in groups of three bits according to a predetermined traversal sequence
- the predetermined traversal order is: a sequence from left to right or a sequence from right to left;
- the grouping the binary bit stream data includes:
- the binary bit stream data is grouped in groups of three bits according to a predetermined traversal sequence
- the predetermined traversal order is: left to right order or right to left order.
- the each set of data is placed in the to-be-placed matrix according to a preset rule, and the initial data matrix is specifically:
- Each set of data is sequentially placed into the matrix to be placed in a zigzag pattern, so that each element to be placed in the matrix corresponds to a set of data, and an initial data matrix is obtained.
- the preset relationship between the element and the color is:
- the element (0,0,0) corresponds to black; the element (0,0,255) corresponds to blue; the element (0,255,0) corresponds to green; the element (0,255,255) corresponds to cyan; element (255 , 0, 0) corresponds to red; elements (255, 0, 255) correspond to magenta; elements (255, 255, 0) correspond to yellow; elements (255, 255, 255) correspond to white.
- the method further includes:
- the embodiment of the present application provides a method for reading a color identification type color two-dimensional image code, including:
- the color two-dimensional image code to be read is a color two-dimensional image generated by the color identification type color two-dimensional image generation method ;
- the binary bit stream data is decoded to obtain original information, and the reading of the color two-dimensional image code is completed.
- the reducing each element in the second pixel matrix by a predetermined multiple is obtained.
- the original data matrix including:
- the error correction processing comprises:
- the preset elements include:
- the embodiment of the present application provides a device for generating a color identification type color two-dimensional image code, including:
- a first acquiring module configured to acquire original information to be encoded, and convert the same into binary bit stream data
- a grouping module configured to group the binary bit stream data, such that the number of groups obtained by the group is the same as the number of elements to be placed in the matrix, wherein each group of data includes the binary bit stream data of a predetermined number of bits, The predetermined number of bits is determined based on a predetermined color model;
- a placement module configured to place each set of data into the to-be-placed matrix according to a preset rule, Obtaining an initial data matrix
- An element expansion module configured to expand each element in the initial data matrix by a predetermined multiple to obtain a first pixel matrix, wherein the predetermined multiple is determined based on the predetermined color model;
- a color determining module configured to determine, according to a preset correspondence between elements and colors, a color corresponding to an element in the first pixel matrix
- a generating module configured to fill the determined color into a data storage area of the color two-dimensional image code to be generated, and fill the feature information set in advance for the original information to be encoded into the current color second In the feature information area of the Vital code, the generation of the color two-dimensional code is completed.
- an embodiment of the present application provides a color identification type color two-dimensional image reading device, including:
- a second acquiring module configured to acquire a second pixel matrix of the color two-dimensional image code to be read, wherein the color two-dimensional image code to be read is a method for generating a color two-dimensional image code by using the color identification type Generated color two-dimensional image code;
- An element reduction module configured to reduce each element in the second pixel matrix by a predetermined multiple to obtain a restored data matrix
- a decomposition module configured to decompose the restored data matrix into a data group consisting of the predetermined bit number of binary bit stream data according to an inverse process of a preset rule used when generating the color two-dimensional image code
- a restoration module configured to restore the data group according to an inverse process of the grouping process to obtain binary bit stream data
- a decoding module configured to decode the binary bit stream data, obtain original information, and complete reading of the color two-dimensional image code.
- the embodiment of the present application further provides an application program for executing the method for generating a color identification type color two-dimensional image code according to the above claims at runtime.
- the embodiment of the present application further provides a storage medium for storing an application, where the application is used to execute the color identification type color two-dimensional image generation method described above.
- the embodiment of the present application further provides an electronic device, which is suitable for generating a color identification type color two-dimensional image code, and the electronic device includes:
- the circuit board is disposed inside the space enclosed by the housing, the processor and the memory are disposed on the circuit board; and the power supply circuit is used for each circuit of the electronic device or The device is powered;
- the memory is for storing executable program code;
- the processor runs the program corresponding to the executable program code by reading the executable program code stored in the memory for performing the following steps:
- each group of data includes the binary bit stream data of a predetermined number of bits, the predetermined number of bits being based on The predetermined color model is determined;
- the embodiment of the present application further provides an application program for executing the above-mentioned color identification type color two-dimensional image code reading method at runtime.
- the embodiment of the present application further provides a storage medium for storing an application, where the application is used to execute the above-mentioned color identification type color two-dimensional image reading method.
- the embodiment of the present application further provides an electronic device, which is suitable for reading color-coded color two-dimensional image code, and the electronic device includes:
- the circuit board is disposed in the housing Inside the enclosed space, the processor and the memory are disposed on the circuit board; the power circuit is used to supply power to each circuit or device of the electronic device; the memory is used to store executable program code; and the processor reads the memory stored in the memory Execute the program code to run the program corresponding to the executable program code for performing the following steps:
- the binary bit stream data is decoded to obtain original information, and the reading of the color two-dimensional image code is completed.
- the original information to be encoded is obtained and converted into binary bit stream data; the binary bit stream data is grouped, so that the number of groups obtained by grouping is the same as the number of elements to be placed in the matrix, and then Each set of data is placed in the to-be-placed matrix according to a preset rule to obtain an initial data matrix; and each element in the initial data matrix is expanded by a predetermined multiple to obtain a first pixel matrix, according to a preset.
- the color information in the color two-dimensional code generated by the generation method contains valid original information, not just a visual impact.
- FIG. 1 is a flowchart of a method for generating a color identification type color two-dimensional image code according to an embodiment of the present application
- FIG. 2 is a flowchart of a method for reading a color-coded color two-dimensional image code according to an embodiment of the present application
- FIG. 3 is a schematic diagram of a device for generating a color-coded color two-dimensional image code according to an embodiment of the present application
- FIG. 4 is a schematic diagram of a color identification type color two-dimensional image reading device according to an embodiment of the present application.
- the embodiment of the present application provides a method and a device for generating and reading the color identification type color two-dimensional image code.
- a method for generating a color-coded color two-dimensional image code provided by an embodiment of the present application is first introduced.
- a method for generating a color-coded color two-dimensional image code may include:
- the original information to be encoded may be any information that needs to be stored in the color two-dimensional image code to be generated, and may be, for example, a manufacturer of the product, a production date, a web address link of the webpage, and the like.
- the conversion of the original information to be encoded into the binary bit stream data can be implemented by the prior art, and is not specifically limited herein. For example, if the original information to be encoded is Chinese character type information, it can be converted into binary bit stream data by using the national standard method; if the original information to be encoded is English letter type information, it can be ASCII coded. Converted to binary bitstream data.
- Each of the sets of data includes binary bit stream data of a predetermined number of bits, the predetermined number of bits being determined based on a predetermined color model, which may be an RGB model, and correspondingly, the predetermined number of bits is three bits.
- the number of rows and columns to be placed in the matrix may be determined according to the type of the color two-dimensional image code actually generated. For example, if a color two-dimensional image code of the D9ing code type is to be generated, the matrix to be placed is one.
- the empty matrix of 448 rows and 448 columns is of course not limited to this.
- the method for grouping the binary bit stream data may generally be in one of two ways:
- the first way is: grouping the binary bit stream data in groups of three according to a predetermined traversal order, and then determining whether the number of groups obtained by the group is the same as the number of elements to be placed in the matrix, and if not, continuing to follow
- the predetermined traversal sequence groups the binary bit stream data in groups of three until the number of groups is satisfied, wherein the predetermined traversal order is from left to right or from right to left.
- the predetermined to-be-placed matrix is the binary bit stream data that can convert all the original information to be encoded.
- the number of groups obtained by the above grouping is generally not greater than the number of elements to be placed in the matrix.
- the binary bit stream data is further grouped in groups of three bits in accordance with a predetermined traversal order until the number of groups is satisfied.
- the binary bit stream data converted by the original information to be encoded is 10010001011
- the binary bit stream data is grouped in groups of three bits according to a predetermined left-to-right traversal order to obtain three sets of data. They are: (1,0,0), (1,0,0), (0,1,0), and the remaining two binary bit stream data 1 and 1.
- the binary bit stream data is further grouped according to the traversal order from left to right, and the remaining The two binary bit stream data 1, 1 and the first bit binary bit stream data 1 are grouped into one group to obtain a fourth group of data (1, 1, 1), and the number of groups obtained by grouping at this time is to be placed
- the number of elements in the matrix is the same and the grouping is stopped. It is of course also possible to group the binary bit stream data in a traversal sequence from right to left. The specific process is similar to the above process of grouping the binary bit stream data in a traversal order from left to right. This will not be described in detail.
- the second way is: grouping the binary bit stream data in groups of three according to a predetermined traversal order; determining whether the number of groups obtained by the group is the same as the number of elements to be placed in the matrix, and if not, the number is 0.
- the predetermined traversal order is: left to right order or The order from right to left.
- the number of groups obtained by grouping is generally not greater than the number of elements to be placed in the matrix.
- the number 0 is used as the binary bit stream.
- the data complements the binary bit stream data and continues to group the remaining binary bit stream data of the current packet until the number of groups is met.
- the binary bit stream data converted from the original information to be encoded is 10010001011, and the binary bit stream data is grouped in groups of three bits according to the traversal order from left to right, and three sets of data are obtained, respectively. : (1,0,0), (1,0,0), (0,1,0), the remaining two binary bit stream data 1 and 1.
- the number of elements to be placed in the matrix is four, since the number of groups obtained by the group is three, which is smaller than the number of elements to be placed in the matrix, the number 0 is used as supplementary binary bit stream data of the binary bit stream data, and continues to The binary bit stream data remaining in the current packet is grouped to obtain a fourth group of data (1, 1, 0). At this time, the number of groups obtained by the group is the same as the number of elements to be placed in the matrix, and the packet is stopped. It is of course also possible to group the binary bit stream data in a traversal sequence from right to left. The specific process is similar to the above process of grouping the binary bit stream data in a traversal order from left to right, and no further details are performed here. Description.
- the set of data is placed into the to-be-placed matrix according to a preset rule to obtain an initial data matrix.
- each group of data may be sequentially placed into the to-be-placed matrix according to the Z-shaped direction, so that each element to be placed in the matrix corresponds to a set of data, and an initial data matrix is obtained.
- grouping binary bitstream data yields four sets of data, namely: (1,0,0), (1,0,0), (0,1,0), and (1,1,0)
- the matrix to be placed is a second-order empty matrix, and the number of elements is four.
- the first set of data (1, 0, 0) is sequentially placed into the first row and the first column of the matrix.
- the preset rule of the Z-shaped direction given in the embodiment of the present application is only an example, and should not be construed as limiting the embodiment of the present application. It can be understood that, in practical applications, the preset rule For example, other rules may be preset according to actual needs. For example, each group of data may be sequentially placed in each row of the matrix to be placed, and no specific limitation or description is provided herein.
- the predetermined multiple is determined based on the predetermined color model, and the predetermined color model is generally an RGB model.
- the predetermined multiple is 255 times the maximum gray level, and each element in the initial data matrix is expanded by 255 times, that is, Obtaining the first pixel matrix is of course not limited thereto.
- the above initial data matrix Enlarge 255 times to get the corresponding first pixel matrix
- S105 Determine, according to a preset correspondence between elements and colors, a color corresponding to an element in the first pixel matrix.
- the preset correspondence between elements and colors can be as follows:
- the corresponding relationship between the element and the color may be modified according to actual needs, and is not limited thereto.
- S106 Fill the determined color into the data storage area of the color two-dimensional image code to be generated, and fill the feature information set in advance for the original information to be encoded into the current color two-dimensional image code. In the feature information area, the generation of the color two-dimensional image code is completed.
- the number of pixels in the data storage area of the color two-dimensional image code to be generated is the same as the number of elements in the first pixel matrix, and the number of pixels in each row and each row in the first pixel matrix.
- the number of elements is the same, the number of pixels in each column is the same as the number of elements in each column in the first pixel matrix, and the pixels of the data storage area of the color two-dimensional image to be generated and the elements in the first pixel matrix There is a one-to-one correspondence.
- the color corresponding to the pixel of each position in the data storage area of the color two-dimensional image code to be generated is determined, for example, the first pixel matrix
- the color corresponding to the pixel at the four positions of the data storage area of the corresponding color two-dimensional image code to be generated is These colors are filled in the data storage area of the color two-dimensional image code to be generated according to the corresponding positional relationship, that is, the filling of the data storage area of the color two-dimensional image code to be generated is completed.
- the feature information set in advance for the original information to be encoded is filled into the feature information area of the current color two-dimensional image code to complete the color.
- the generation of two-dimensional code is
- the feature information set in advance for the original information to be encoded may include format information and version information, and the format information and the version information may be determined according to the type of the color two-dimensional image code to be generated, and the foregoing feature is The manner in which the feature information in the information area is filled in the feature information area of the current color two-dimensional image code may be used in the prior art, and is not specifically limited herein.
- the color two-dimensional image code to be generated is a D9ing code type
- the format information is generated according to the number of rows, the number of columns, and the error correction level of the color two-dimensional image code to be generated, and the existing D9ing code is used.
- the feature information filling mode fills the format information and the preset version information into the feature information area of the current color two-dimensional image code.
- the format information in the set feature information indicates an error correction level, which can be divided into four levels of L, M, Q, and H;
- the version information is the specification of the color two-dimensional image code to be generated of the QR code type, and one of the 40 specifications of the existing QR code can be used, and the feature information filling method of the existing QR code is adopted.
- the format information and the version information may be filled in the feature information area of the current color two-dimensional image code.
- the method may further include:
- the specific mask processing may adopt one of the existing mask processing according to actual needs, generally performing mask processing on the format information region in the feature information region, so that the generated color two-dimensional image code is more beautiful. At the same time, the confidentiality of the color two-dimensional image code is increased. Further, mask processing may be performed on the data storage area to increase the aesthetics of the color two-dimensional image code, so that the confidentiality is better.
- the original information to be encoded is first obtained and converted into binary bit stream data; the binary bit stream data is grouped, so that The number of groups obtained by grouping is the same as the number of elements to be placed in the matrix, and then each set of data is placed into the matrix to be placed according to a preset rule to obtain an initial data moment.
- the determined color is filled into the data storage area of the color two-dimensional image code to be generated, and the feature information set in advance for the original information to be encoded is filled into the current color two-dimensional image code.
- the generation of the color two-dimensional map code is completed.
- the color information in the color two-dimensional code generated by the generation method contains valid original information, not just a visual impact.
- the embodiment of the present application further provides a method for reading a color-coded color two-dimensional image code.
- the method for reading a color-coded color two-dimensional image code may include:
- the color two-dimensional image code to be read is a color two-dimensional image generated by the method for generating a color-coded color two-dimensional image code provided by the above-mentioned embodiment of the present application, and the to-be-readed is obtained.
- the manner of the second pixel matrix of the color two-dimensional image code may be any existing acquisition manner, which is not specifically limited herein.
- the predetermined multiple is determined based on a color model of the color two-dimensional image code to be read, and it can be understood that the color model of the color two-dimensional image code to be read and the generation of the color two-dimensional image code through the above
- the color model of the color two-dimensional image generated by the method is consistent.
- the color model may be in the RGB mode, and correspondingly, the predetermined multiple is 255 times.
- reducing each element in the second pixel matrix by a predetermined multiple to obtain a restored data matrix may include:
- the error correction processing may specifically include:
- the preset elements include: (0, 0, 0), (0, 0, 255), (0, 255, 0), (0, 255, 255), (255, 0, 0), ( 255,0,255), (255,255,0) and (255,255,255).
- the element in the second pixel matrix after the error correction processing is reduced by a predetermined multiple to determine a restored data matrix.
- one element in the second pixel matrix is (2, 0, 250), and the error correction processing thereof is specifically: performing Euclidean distance calculation separately from the preset eight elements according to the above formula.
- Obtaining r 1 to r 8 are: 250, 6, 357, 255, 356, 253, 438, and 439. It can be clearly seen that the value of r 2 is the smallest, and the element is replaced with an element (0, 0, 255).
- the elements in the two-pixel matrix (2, 0, 250) can be error-corrected by all the elements in the second pixel matrix by the same method, since the second pixel matrix obtained in practical application may be purely error It will lead to inaccuracy of reading, and error correction processing can eliminate the error, so that the obtained second pixel matrix is more accurate.
- each element in the second pixel matrix is reduced by a predetermined multiple.
- the above element (0, 0, 255) is reduced by 255 times to obtain an element (0, 0, 1), and the second pixel is obtained.
- the restored data matrix is obtained by reducing each element in the matrix by a predetermined multiple.
- the predetermined number of bits is determined based on a color model of the color two-dimensional image code to be read.
- the color model of the color two-dimensional image code to be read is an RGB model, and correspondingly, the pre- The number of positions is three.
- the elements in the restored data matrix may be oriented in a zigzag pattern. And sequentially decomposing into a data group consisting of the predetermined bit number of binary bit stream data, so that each element in the restored data matrix corresponds to a group of data, and the data group is obtained.
- the restored data matrix is The number of elements is four, according to the z-shaped trend, the first row of the first column of the elements (1,0,0), the second row of the first column of the elements (1,0,0), the first row of The elements of the second column (0, 1, 0), the elements of the second row and the second column (1, 1, 0) are decomposed to obtain a data group consisting of three bits of binary bit stream data, respectively: (1, 0 , 0), (1, 0, 0), (0, 1, 0) and (1, 1, 0).
- the data set is restored to obtain binary bit stream data according to an inverse process of a grouping process used when generating the color two-dimensional image code.
- the method for restoring the binary bit stream data according to the inverse process of the grouping process used when generating the color two-dimensional image code is determined according to the manner of the group used when generating the color two-dimensional image code.
- one of the following two methods can be used:
- the binary bit stream data is restored by the following method:
- the binary bit stream data used in the step of grouping the binary bit stream data in groups of three bits is continuously removed from the initial binary bit stream data in accordance with a predetermined traversal order to obtain the binary bit stream data. .
- the data set is (1,0,0), (1,0,0), (0,1,0), and (1,1,1), according to a predetermined left-to-right traversal order.
- the four data sets are restored to the initial binary bit stream data 100100010111; it is determined that, when the color two-dimensional image code is generated, there is a continuation of the predetermined traversal sequence in the grouping process, and the binary bit stream is grouped by three bits.
- the step of grouping the data and continuing to remove the binary bit stream data 1 used in the step of grouping the binary bit stream data in groups of three bits from the initial binary bit stream data 100100010111 according to a predetermined traversal order, to obtain the Binary bit stream data 10010001011.
- the traversal sequence is consistent with the traversal sequence used in the grouping process when generating the color two-dimensional image code, and the traversal sequence used in the grouping process when generating the color two-dimensional image code is from right to In the left traversal order, the traversal order is a traversal sequence from right to left.
- the specific process is similar to the above process of restoring the data group in the traversal order from left to right, and will not be described in detail herein.
- the binary bit stream data is restored by the following method:
- the supplemental binary bit stream data 0 is removed from the original binary bit stream data to obtain the binary bit stream data.
- the data set is (1,0,0), (1,0,0), (0,1,0), and (1,1,0), according to a predetermined left-to-right traversal order.
- the step of grouping the remaining binary bit stream data is performed, and the supplemental binary bit stream data 0 is removed from the initial binary bit stream data 100100010110 to obtain the binary bit stream data 10010001011.
- the traversal sequence is consistent with the traversal sequence used in the grouping process when generating the color two-dimensional image code, and the traversal sequence used in the grouping process when generating the color two-dimensional image code is from right to In the left traversal order, the traversal order is a traversal sequence from right to left.
- the specific process is similar to the above process of restoring the data group in the traversal order from left to right, and will not be described in detail herein.
- S205 Decode the binary bit stream data to obtain original information, and complete reading of the color two-dimensional image code.
- the method for decoding the binary bit stream data may adopt an existing decoding method, and is not specifically limited herein. If the color two-dimensional image code is generated, the coding method used is the national standard method, and the existing existing method may be adopted. The decoding method corresponding to the national standard method decodes the binary bit stream data; if the color two-dimensional image code is generated, the encoding method used is ASCII code, and the existing decoding method corresponding to the ASCII code may be adopted. The binary bit stream data is decoded.
- the foregoing method may further include:
- the image correction processing may include: image enhancement and denoising operation processing, and the existing gray enhancement algorithm and median filtering algorithm may be used to perform image correction processing on the color two-dimensional image code to be read. Improve the correct rate of reading and avoid reading errors.
- the method for reading a color-coded color two-dimensional image code provided by the present embodiment can accurately read the color two generated by the method for generating the color-coded color two-dimensional image code provided by the embodiment of the present application. Valid information stored in the dimension code.
- the embodiment of the present application further provides a device for generating a color-coded color two-dimensional image code.
- the device may include:
- the obtaining module 310 is configured to obtain original information to be encoded and convert the data into binary bit stream data.
- a grouping module 320 configured to group the binary bit stream data, so that the number of groups obtained by the group is the same as the number of elements to be placed in the matrix;
- each set of data includes the binary bit stream data of a predetermined number of bits, the predetermined number of bits being determined based on a predetermined color model;
- the placing module 330 is configured to put the each set of data into the to-be-placed matrix according to a preset rule to obtain an initial data matrix;
- An element expansion module 340 configured to expand each element in the initial data matrix by a predetermined multiple to obtain a first pixel matrix
- the predetermined multiple is determined based on the predetermined color model
- a color determining module 350 configured to determine, according to a preset correspondence between elements and colors, a color corresponding to an element in the first pixel matrix
- a generating module 360 configured to fill the determined color into a data storage area of the color two-dimensional image code to be generated, and fill the current color information with the feature information set in advance for the original information to be encoded. In the feature information area of the two-dimensional image code, the generation of the color two-dimensional image code is completed.
- the original information to be encoded is first obtained and converted into binary bit stream data; the binary bit stream data is grouped, so that The number of groups obtained by grouping is the same as the number of elements to be placed in the matrix, and then each set of data is placed into the matrix to be placed according to a preset rule to obtain an initial data matrix; and then the initial data matrix is Each element is expanded by a predetermined multiple, and after the first pixel matrix is obtained, the color corresponding to the element in the first pixel matrix is determined according to a preset correspondence relationship between the element and the color, and finally the determined color is filled.
- the feature information set in advance for the original information to be encoded is filled into the feature information area of the current color two-dimensional image code to complete the color two-dimensional image.
- the generation of the code The color information in the color two-dimensional code generated by the generating device contains valid original information, not just a visual impact.
- the predetermined color model is an RGB model
- the predetermined number of digits is three digits, and the predetermined multiple is 255 times.
- the grouping module 320 is specifically configured to:
- the binary bit stream data is grouped in groups of three bits according to a predetermined traversal sequence
- the placement module 330 is specifically configured to:
- Each set of data is sequentially placed into the to-be-placed matrix according to the Z-shaped direction, so that each element to be placed in the matrix corresponds to a set of data, and an initial data matrix is obtained.
- the element (0,0,0) corresponds to black; the element (0,0,255) corresponds to blue; the element (0,255,0) corresponds to green; the element (0,255,255) corresponds to cyan; element (255 , 0, 0) corresponds to red; elements (255, 0, 255) correspond to magenta; elements (255, 255, 0) correspond to yellow; elements (255, 255, 255) correspond to white.
- a color-coded color two-dimensional image code generating apparatus may further include:
- the mask processing module is configured to perform mask processing on the feature information region after the feature information in the feature information region is filled into the feature information region of the current color two-dimensional image code.
- the embodiment of the present application further provides a color identification type color two-dimensional image code reading device.
- the device may include :
- a second acquiring module 410 configured to acquire a second pixel matrix of the color two-dimensional image code to be read
- the color two-dimensional image code to be read is a color two-dimensional image code generated by the color identification type color two-dimensional image generation method provided by the embodiment of the present application.
- An element reduction module 420 configured to reduce each element in the second pixel matrix by a predetermined multiple to obtain a restored data matrix
- the decomposition module 430 is configured to decompose the restored data matrix into a data group consisting of the binary bit stream data of the predetermined number of bits according to an inverse process of a preset rule used when generating the color two-dimensional image code;
- a restoration module 440 configured to restore the data group according to an inverse process of the grouping process to obtain binary bit stream data
- the decoding module 450 is configured to decode the binary bit stream data to obtain original information, and complete reading of the color two-dimensional image code.
- the reading device of the color identification type color two-dimensional image code provided by the present embodiment can accurately read the color two generated by the method for generating the color identification type color two-dimensional image code provided by the embodiment of the present application. Valid information stored in the dimension code.
- the element reduction module 420 is specifically configured to:
- the error correction processing comprises:
- the preset elements include:
- the apparatus for reading a color-coded color two-dimensional image code may further include:
- the image correction processing module is configured to perform image enhancement and denoising operation processing on the color two-dimensional image code to be read.
- the application further provides an application for executing a method for generating a color-coded color two-dimensional image code provided by an embodiment of the present application at runtime.
- the method for generating the color identification type color two-dimensional image code includes:
- each group of data includes the binary bit stream data of a predetermined number of bits, the predetermined number of bits being based on The predetermined color model is determined;
- the color information in the generated color two-dimensional code contains valid information, not just a visual impact.
- the predetermined color model is an RGB model
- the predetermined number of bits is three bits, and the predetermined multiple is 255 times.
- the grouping the binary bit stream data includes:
- the binary bit stream data is grouped in groups of three bits according to a predetermined traversal sequence
- the predetermined traversal order is: a sequence from left to right or a sequence from right to left;
- the grouping the binary bit stream data includes:
- the binary bit stream data is grouped in groups of three bits according to a predetermined traversal sequence
- Determining whether the number of groups obtained by the group is the same as the number of elements to be placed in the matrix, and if not, using the number 0 as supplementary binary bit stream data of the binary bit stream data, continuing the binary bit stream data remaining for the current packet The grouping is performed until the number of groups is satisfied, wherein the predetermined traversal order is: left to right order or right to left order.
- the data is placed in the to-be-placed matrix according to a preset rule, and the initial data matrix is specifically:
- Each set of data is sequentially placed into the matrix to be placed in a zigzag pattern, so that each element to be placed in the matrix corresponds to a set of data, and an initial data matrix is obtained.
- the preset correspondence between the element and the color is:
- the element (0,0,0) corresponds to black; the element (0,0,255) corresponds to blue; the element (0,255,0) corresponds to green; the element (0,255,255) corresponds to cyan; element (255 , 0, 0) corresponds to red; elements (255, 0, 255) correspond to magenta; elements (255, 255, 0) correspond to yellow; elements (255, 255, 255) correspond to white.
- the method further includes:
- a storage medium is further provided, where the storage medium is used to execute the color identification type color two-dimensional image code provided by the embodiment of the present application at runtime. Reading method.
- the method for reading the color identification type color two-dimensional image code includes:
- each group of data includes the binary bit stream data of a predetermined number of bits, the predetermined number of bits being based on The predetermined color model is determined;
- the color information in the generated color two-dimensional code contains valid information, not just a visual impact.
- the predetermined color model is an RGB model
- the predetermined number of bits is three bits, and the predetermined multiple is 255 times.
- the grouping the binary bit stream data includes:
- the binary bit stream data is grouped in groups of three bits according to a predetermined traversal sequence
- the predetermined traversal order is: a sequence from left to right or a sequence from right to left;
- the grouping the binary bit stream data includes:
- the binary bit stream data is grouped in groups of three bits according to a predetermined traversal sequence
- Determining whether the number of groups obtained by the group is the same as the number of elements to be placed in the matrix, and if not, using the number 0 as supplementary binary bit stream data of the binary bit stream data, continuing the binary bit stream data remaining for the current packet The grouping is performed until the number of groups is satisfied, wherein the predetermined traversal order is: left to right order or right to left order.
- the data is placed in the to-be-placed matrix according to a preset rule, and the initial data matrix is specifically:
- the preset correspondence between the element and the color is:
- the element (0,0,0) corresponds to black; the element (0,0,255) corresponds to blue; the element (0,255,0) corresponds to green; the element (0,255,255) corresponds to cyan; element (255 , 0, 0) corresponds to red; elements (255, 0, 255) correspond to magenta; elements (255, 255, 0) correspond to yellow; elements (255, 255, 255) correspond to white.
- the method further includes:
- the description is relatively simple, and the relevant parts can be referred to the description of the method embodiment.
- an electronic device which is suitable for generating a color identification type color two-dimensional image code, and the electronic device includes:
- the circuit board is disposed inside the space enclosed by the housing, the processor and the memory are disposed on the circuit board; and the power supply circuit is used for each circuit of the electronic device or The device is powered;
- the memory is for storing executable program code;
- the processor runs the program corresponding to the executable program code by reading the executable program code stored in the memory for performing the following steps:
- each group of data includes the binary bit stream data of a predetermined number of bits, the predetermined number of bits being based on The predetermined color model is determined;
- the electronic device may exist in various forms including, but not limited to:
- Mobile communication devices These devices are characterized by mobile communication functions and are mainly aimed at providing voice and data communication.
- Such terminals include: smart phones (such as iPhone), multimedia phones, functional phones, and low-end phones.
- Ultra-mobile personal computer equipment This type of equipment belongs to the category of personal computers, has computing and processing functions, and generally has mobile Internet access.
- Such terminals include: PDAs, MIDs, and UMPC devices, such as the iPad.
- Portable entertainment devices These devices can display and play multimedia content. Such devices include: audio, video players (such as iPod), handheld game consoles, e-books, and smart toys and portable car navigation devices.
- the server consists of a processor, a hard disk, a memory, a system bus, etc.
- the server is similar to a general-purpose computer architecture, but because of the need to provide highly reliable services, processing power and stability High reliability in terms of reliability, security, scalability, and manageability.
- the color information in the generated color two-dimensional image code contains valid information, not just a visual impact.
- the predetermined color model is an RGB model
- the predetermined number of bits is three bits, and the predetermined multiple is 255 times.
- the processor runs a program corresponding to the executable program code by reading executable program code stored in the memory, and the performing the binary bit stream data is grouped, include:
- the binary bit stream data is grouped in groups of three bits according to a predetermined traversal sequence
- the predetermined traversal order is: a sequence from left to right or a sequence from right to left;
- the grouping the binary bit stream data includes:
- the binary bit stream data is grouped in groups of three bits according to a predetermined traversal sequence
- Determining whether the number of groups obtained by the group is the same as the number of elements to be placed in the matrix, and if not, using the number 0 as supplementary binary bit stream data of the binary bit stream data, continuing the binary bit stream data remaining for the current packet The grouping is performed until the number of groups is satisfied, wherein the predetermined traversal order is: left to right order or right to left order.
- the processor runs a program corresponding to the executable program code by reading executable program code stored in the memory, and the performing the each group of data according to the preset
- the rule is placed in the matrix to be placed, and the initial data matrix is obtained as follows:
- Each set of data is sequentially placed into the matrix to be placed in a zigzag pattern, so that each element to be placed in the matrix corresponds to a set of data, and an initial data matrix is obtained.
- the preset correspondence between the element and the color is:
- the element (0,0,0) corresponds to black; the element (0,0,255) corresponds to blue; the element (0,255,0) corresponds to green; the element (0,255,255) corresponds to cyan; element (255 , 0, 0) corresponds to red; elements (255, 0, 255) correspond to magenta; elements (255, 255, 0) correspond to yellow; elements (255, 255, 255) correspond to white.
- the processor runs a program corresponding to the executable program code by reading executable program code stored in the memory, and the executed feature is performed. After the feature information in the information area is filled in the feature information area of the current color two-dimensional image code, the method further includes:
- the description is relatively simple, and the relevant parts can be referred to the description of the method embodiment.
- the application also provides an application program for performing the reading method of the color-coded color two-dimensional image code provided by the embodiment of the present application at runtime.
- the method for reading the color identification type color two-dimensional image code includes:
- the binary bit stream data is decoded to obtain original information, and the reading of the color two-dimensional image code is completed.
- the color two-dimensional image code generated by the method for generating the color identification type color two-dimensional image code provided by the embodiment of the present application can be accurately read and stored. Valid information.
- the reducing a predetermined multiple of each element in the second pixel matrix to obtain a restored data matrix includes:
- the error correction processing comprises:
- the preset elements include:
- a storage medium is further provided, where the storage medium is used to execute the color identification type color two-dimensional image code provided by the embodiment of the present application at runtime. Reading method.
- the method for reading the color identification type color two-dimensional image code includes:
- the binary bit stream data is decoded to obtain original information, and the reading of the color two-dimensional image code is completed.
- the color two-dimensional image code generated by the method for generating the color identification type color two-dimensional image code provided by the embodiment of the present application can be accurately read and stored. Valid information.
- the reducing a predetermined multiple of each element in the second pixel matrix to obtain a restored data matrix includes:
- the error correction processing comprises:
- the preset elements include:
- the description is relatively simple, and the relevant parts can be referred to the description of the method embodiment.
- an electronic device which is suitable for reading color-coded color two-dimensional image code, and the electronic device includes:
- the circuit board is disposed inside the space enclosed by the housing, the processor and the memory are disposed on the circuit board; and the power supply circuit is used for each circuit of the electronic device or The device is powered;
- the memory is for storing executable program code;
- the processor runs the program corresponding to the executable program code by reading the executable program code stored in the memory for performing the following steps:
- the binary bit stream data is decoded to obtain original information, and the reading of the color two-dimensional image code is completed.
- the electronic device may exist in various forms including, but not limited to:
- Mobile communication devices These devices are characterized by mobile communication functions and are mainly aimed at providing voice and data communication.
- Such terminals include: smart phones (such as iPhone), multimedia phones, functional phones, and low-end phones.
- Ultra-mobile personal computer equipment This type of equipment belongs to the category of personal computers, has computing and processing functions, and generally has mobile Internet access.
- Such terminals include: PDAs, MIDs, and UMPC devices, such as the iPad.
- Portable entertainment devices These devices can display and play multimedia content. Such devices include: audio, video players (such as iPod), handheld game consoles, e-books, and smart toys and portable car navigation devices.
- the server consists of a processor, a hard disk, a memory, a system bus, etc.
- the server is similar to a general-purpose computer architecture, but because of the need to provide highly reliable services, processing power and stability High reliability in terms of reliability, security, scalability, and manageability.
- the valid information stored in the color two-dimensional image code generated by the method for generating the color-coded color two-dimensional image code provided by the embodiment of the present application can be accurately read.
- the processor runs a program corresponding to the executable program code by reading executable program code stored in the memory, and the executed each of the second pixel matrix The element is reduced by a predetermined multiple to obtain a restored data matrix, including:
- the error correction processing comprises:
- the preset elements include:
- the description is relatively simple, and the relevant parts can be referred to the description of the method embodiment.
Landscapes
- Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Health & Medical Sciences (AREA)
- Electromagnetism (AREA)
- General Health & Medical Sciences (AREA)
- Toxicology (AREA)
- Artificial Intelligence (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Image Processing (AREA)
Abstract
A generation and reading method and device for a colour identified colour two-dimensional figure code. The generation method comprises: acquiring original information to be encoded, and converting same into binary bit stream data (S101); grouping the binary bit stream data, so that the number of groups obtained from the grouping is the same as elements to be placed into a matrix (S102); according to a pre-set rule, placing each group of data into a matrix for data placement, to obtain an initial data matrix (S103); enlarging each element in the initial data matrix by a pre-determined multiple, to obtain a first pixel matrix (S104); determining a colour corresponding to an element in the first pixel matrix according to a pre-set correlation between elements and colours (S105); and filling the determined colour into a data storage region of a colour two-dimensional figure code to be generated, and filling feature information, which is pre-set for the original information to be encoded, into a feature information region of the present colour two-dimensional figure code, to complete the generation of the colour two-dimensional code (S106). Colour information in a colour two-dimensional figure code generated by means of the method contains effective original information, and is not merely a visual impact.
Description
本申请要求于2016年5月18日提交中国专利局、申请号为201610329538.6、申请名称为“颜色标识型彩色二维图码的生成、识读方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application filed on May 18, 2016, the Chinese Patent Office, the application number is 201610329538.6, and the application name is "color identification type color two-dimensional image generation, reading method and device". The entire contents are incorporated herein by reference.
本申请涉及二维图码领域,特别涉及颜色标识型彩色二维图码的生成、识读方法及装置。The present application relates to the field of two-dimensional graphics, and in particular to a method and apparatus for generating, reading, and reading a color-coded color two-dimensional image.
国内外对二维图码的研究始于20世纪80年代末,在二维图码符号表示技术研究方面已研制出多种码制,常见的有PDF417、QR Code、Code 49等。现实生活中,黑白二维图码为较为常用的一种,具体的,它是在一个矩形空间通过黑、白像素在矩阵中的不同分布进行编码,来记录数据信息的,一般具有数据存储区域和特征信息区域,其中,数据存储区域中黑白像素的分布形式用来存储需要包含在二维图码中的数据信息,特征信息区域用来保存二维图码的特征信息,其中,特征信息包括格式信息、版本信息等数据。The research on two-dimensional code at home and abroad began in the late 1980s. Various code systems have been developed in the research of two-dimensional code symbol representation technology, such as PDF417, QR Code and Code 49. In real life, the black and white two-dimensional image code is a more common one. Specifically, it encodes the data in a rectangular space by different distributions of black and white pixels in the matrix, and generally has a data storage area. And a feature information area, wherein the distribution form of the black and white pixels in the data storage area is used to store data information that needs to be included in the two-dimensional image code, and the feature information area is used to store feature information of the two-dimensional image code, wherein the feature information includes Format information, version information, and other data.
随着人们对视觉效果的要求的提高,矩阵式的彩色二维图码应运而生。所谓彩色二维图码是相对黑白二维图码来定义的,彩色二维图码是一种特殊的二维图码,它既具有普通黑白图码的所有功能,又能呈现出彩色的外观。As people's demands for visual effects increase, matrix-style color two-dimensional image codes emerge. The so-called color two-dimensional image code is defined relative to the black and white two-dimensional image code. The color two-dimensional image code is a special two-dimensional image code, which has all the functions of the ordinary black and white image code, and can display a color appearance. .
虽然目前市场上存在彩色二维图码,但是其仅仅是给用户带来视觉上的冲击,其颜色信息并不包含任何有效信息。Although there are currently two-dimensional color code on the market, it is only a visual impact to the user, and its color information does not contain any valid information.
发明内容Summary of the invention
本申请实施例公开了颜色标识型彩色二维图码的生成、识读方法及装置,用于解决现有彩色二维图码中颜色信息不包含任何有效信息的问题。技术方案如下:The embodiment of the present application discloses a method for generating and reading a color identification type two-dimensional image code, and a device for solving the problem that the color information in the existing color two-dimensional image code does not contain any valid information. The technical solutions are as follows:
第一方面,本申请实施例提供了一种颜色标识型彩色二维图码的生成方法,包括:In a first aspect, an embodiment of the present application provides a method for generating a color identification type color two-dimensional image code, including:
获取待编码的原始信息,并将其转化为二进制比特流数据;
Obtaining the original information to be encoded and converting it into binary bit stream data;
将所述二进制比特流数据进行分组,使分组所得组的数量与待置入矩阵的元素数量相同,其中,每一组数据包含预定位数的所述二进制比特流数据,所述预定位数基于预定颜色模型确定;And grouping the binary bit stream data such that the number of groups obtained by the group is the same as the number of elements to be placed in the matrix, wherein each group of data includes the binary bit stream data of a predetermined number of bits, the predetermined number of bits being based on The predetermined color model is determined;
将所述每一组数据按照预设规则置入所述待置入矩阵中,得到初始数据矩阵;And placing each set of data into the to-be-placed matrix according to a preset rule to obtain an initial data matrix;
将所述初始数据矩阵中每一个元素扩大预定倍数,得到第一像素矩阵,其中,所述预定倍数基于所述预定颜色模型确定;Enlarging each element in the initial data matrix by a predetermined multiple to obtain a first pixel matrix, wherein the predetermined multiple is determined based on the predetermined color model;
根据预设的关于元素与颜色的对应关系,确定所述第一像素矩阵中的元素对应的颜色;Determining, according to a preset correspondence between elements and colors, a color corresponding to an element in the first pixel matrix;
将所确定出的颜色填充入待生成的彩色二维图码的数据存储区域中,并将预先为所述待编码的原始信息设置的特征信息填充入当前的所述彩色二维图码的特征信息区域中,完成彩色二维图码的生成。Filling the determined color into the data storage area of the color two-dimensional image code to be generated, and filling the feature information set in advance for the original information to be encoded into the current feature of the color two-dimensional image code In the information area, the generation of the color two-dimensional image code is completed.
优选的,所述预定颜色模型为RGB模型;Preferably, the predetermined color model is an RGB model;
相应的,所述预定位数为三位,所述预定倍数为255倍。Correspondingly, the predetermined number of bits is three bits, and the predetermined multiple is 255 times.
优选的,所述将所述二进制比特流数据进行分组,包括:Preferably, the grouping the binary bit stream data comprises:
按照预定的遍历顺序,以三位为一组对所述二进制比特流数据进行分组;The binary bit stream data is grouped in groups of three bits according to a predetermined traversal sequence;
判断分组所得组的数量是否与所述待置入矩阵的元素数量相同,如果否,继续按照预定的遍历顺序,以三位为一组对所述二进制比特流数据进行分组,直至满足组的数量要求,其中,所述预定的遍历顺序为:从左到右的顺序或从右到左的顺序;Determining whether the number of groups obtained by the group is the same as the number of elements to be placed in the matrix, and if not, continuing to group the binary bit stream data in groups of three according to a predetermined traversal order until the number of groups is satisfied a request, wherein the predetermined traversal order is: a sequence from left to right or a sequence from right to left;
或者,or,
所述将所述二进制比特流数据进行分组,包括:The grouping the binary bit stream data includes:
按照预定的遍历顺序,以三位为一组对所述二进制比特流数据进行分组;The binary bit stream data is grouped in groups of three bits according to a predetermined traversal sequence;
判断分组所得组的数量是否与所述待置入矩阵的元素数量相同,如果否,将数字0作为所述二进制比特流数据的补充二进制比特流数据,继续对当前分组所剩余的二进制比特流数据进行分组,直至满足组的数量要求,其中,所
述预定的遍历顺序为:从左到右的顺序或从右到左的顺序。Determining whether the number of groups obtained by the group is the same as the number of elements to be placed in the matrix, and if not, using the number 0 as supplementary binary bit stream data of the binary bit stream data, continuing the binary bit stream data remaining for the current packet Grouping until the number of groups is met, where
The predetermined traversal order is: left to right order or right to left order.
优选的,所述将所述每一组数据按照预设规则置入所述待置入矩阵中,得到初始数据矩阵具体为:Preferably, the each set of data is placed in the to-be-placed matrix according to a preset rule, and the initial data matrix is specifically:
将所述每一组数据按照Z字型走向顺次置入所述待置入矩阵中,使所述待置入矩阵中每个元素对应一组数据,得到初始数据矩阵。Each set of data is sequentially placed into the matrix to be placed in a zigzag pattern, so that each element to be placed in the matrix corresponds to a set of data, and an initial data matrix is obtained.
优选的,所述预设的关于元素与颜色的对应关系为:Preferably, the preset relationship between the element and the color is:
元素(0,0,0)对应黑色;元素(0,0,255)对应蓝色;元素(0,255,0)对应绿色;元素(0,255,255)对应青蓝色;元素(255,0,0)对应红色;元素(255,0,255)对应洋红色;元素(255,255,0)对应黄色;元素(255,255,255)对应白色。The element (0,0,0) corresponds to black; the element (0,0,255) corresponds to blue; the element (0,255,0) corresponds to green; the element (0,255,255) corresponds to cyan; element (255 , 0, 0) corresponds to red; elements (255, 0, 255) correspond to magenta; elements (255, 255, 0) correspond to yellow; elements (255, 255, 255) correspond to white.
优选的,所述将所述特征信息区域中的特征信息填充入当前的所述彩色二维图码的特征信息区域中之后,还包括:Preferably, after the feature information in the feature information area is filled into the feature information area of the current color two-dimensional image code, the method further includes:
对所述特征信息区域进行掩模处理。Masking the feature information area.
第二方面,本申请实施例提供了一种颜色标识型彩色二维图码的识读方法,包括:In a second aspect, the embodiment of the present application provides a method for reading a color identification type color two-dimensional image code, including:
获取待识读的彩色二维图码的第二像素矩阵,其中,所述待识读的彩色二维图码为通过上述颜色标识型彩色二维图码的生成方法生成的彩色二维图码;Obtaining a second pixel matrix of the color two-dimensional image code to be read, wherein the color two-dimensional image code to be read is a color two-dimensional image generated by the color identification type color two-dimensional image generation method ;
将所述第二像素矩阵中每一个元素缩小预定倍数,得到还原数据矩阵;Reducing each element in the second pixel matrix by a predetermined multiple to obtain a restored data matrix;
按照生成所述彩色二维图码时所利用的预设规则的逆过程,将所述还原数据矩阵分解成由所述预定位数的二进制比特流数据组成的数据组;And decomposing the restored data matrix into a data group consisting of the predetermined bit number of binary bit stream data according to an inverse process of a preset rule used when generating the color two-dimensional image code;
将所述数据组按照生成所述彩色二维图码时所利用的分组过程的逆过程,还原得到二进制比特流数据;Converting the data set to binary bit stream data according to an inverse process of a grouping process utilized when generating the color two-dimensional code code;
将所述二进制比特流数据进行解码,得到原始信息,完成彩色二维图码的识读。The binary bit stream data is decoded to obtain original information, and the reading of the color two-dimensional image code is completed.
优选的,所述将所述第二像素矩阵中每一个元素缩小预定倍数,得到还
原数据矩阵,包括:Preferably, the reducing each element in the second pixel matrix by a predetermined multiple is obtained.
The original data matrix, including:
对所述第二像素矩阵进行纠错处理;Performing error correction processing on the second pixel matrix;
将纠错处理后的第二像素矩阵中每一个元素缩小预定倍数,确定出还原数据矩阵;Reducing each element in the second pixel matrix after the error correction processing by a predetermined multiple to determine a restored data matrix;
其中,所述纠错处理包括:Wherein, the error correction processing comprises:
根据公式:计算出所述第二像素矩阵中的元素与预设的元素的欧氏距离值r1~r8,其中,x为所述第二像素矩阵中的元素的R值,y为所述第二像素矩阵中的元素的G值,z为所述第二像素矩阵中的元素的B值,n=1,2…8,R、G、B分别为所述预设的元素的R值、G值、B值;According to the formula: Calculating an Euclidean distance value r 1 r r 8 of an element in the second pixel matrix and a preset element, where x is an R value of an element in the second pixel matrix, and y is the second a G value of an element in the pixel matrix, z is a B value of an element in the second pixel matrix, n=1, 2...8, and R, G, and B are respectively R values of the preset element, G Value, B value;
比较所述欧氏距离值r1~r8的大小,用值最小的rn对应的所述预设的元素替换所述第二像素矩阵中的元素,完成纠错处理;Comparing the magnitudes of the Euclidean distance values r 1 to r 8 , replacing the elements in the second pixel matrix with the preset elements corresponding to the smallest value r n , and completing the error correction processing;
其中,所述预设的元素包括:The preset elements include:
(0,0,0)、(0,0,255)、(0,255,0)、(0,255,255)、(255,0,0)、(255,0,255)、(255,255,0)及(255,255,255)。(0,0,0), (0,0,255), (0,255,0), (0,255,255), (255,0,0), (255,0,255), (255 , 255, 0) and (255, 255, 255).
第三方面,本申请实施例提供了一种颜色标识型彩色二维图码的生成装置,包括:In a third aspect, the embodiment of the present application provides a device for generating a color identification type color two-dimensional image code, including:
第一获取模块,用于获取待编码的原始信息,并将其转化为二进制比特流数据;a first acquiring module, configured to acquire original information to be encoded, and convert the same into binary bit stream data;
分组模块,用于将所述二进制比特流数据进行分组,使分组所得组的数量与待置入矩阵的元素数量相同,其中,每一组数据包含预定位数的所述二进制比特流数据,所述预定位数基于预定颜色模型确定;a grouping module, configured to group the binary bit stream data, such that the number of groups obtained by the group is the same as the number of elements to be placed in the matrix, wherein each group of data includes the binary bit stream data of a predetermined number of bits, The predetermined number of bits is determined based on a predetermined color model;
置入模块,用于将所述每一组数据按照预设规则置入所述待置入矩阵中,
得到初始数据矩阵;a placement module, configured to place each set of data into the to-be-placed matrix according to a preset rule,
Obtaining an initial data matrix;
元素扩大模块,用于将所述初始数据矩阵中每一个元素扩大预定倍数,得到第一像素矩阵,其中,所述预定倍数基于所述预定颜色模型确定;An element expansion module, configured to expand each element in the initial data matrix by a predetermined multiple to obtain a first pixel matrix, wherein the predetermined multiple is determined based on the predetermined color model;
颜色确定模块,用于根据预设的关于元素与颜色的对应关系,确定所述第一像素矩阵中的元素对应的颜色;a color determining module, configured to determine, according to a preset correspondence between elements and colors, a color corresponding to an element in the first pixel matrix;
生成模块,用于将所确定出的颜色填充入待生成的彩色二维图码的数据存储区域中,并将预先为所述待编码的原始信息设置的特征信息填充入当前的所述彩色二维图码的特征信息区域中,完成彩色二维图码的生成。a generating module, configured to fill the determined color into a data storage area of the color two-dimensional image code to be generated, and fill the feature information set in advance for the original information to be encoded into the current color second In the feature information area of the Vital code, the generation of the color two-dimensional code is completed.
第四方面,本申请实施例提供了一种颜色标识型彩色二维图码的识读装置,包括:In a fourth aspect, an embodiment of the present application provides a color identification type color two-dimensional image reading device, including:
第二获取模块,用于获取待识读的彩色二维图码的第二像素矩阵,其中,所述待识读的彩色二维图码为通过上述颜色标识型彩色二维图码的生成方法生成的彩色二维图码;a second acquiring module, configured to acquire a second pixel matrix of the color two-dimensional image code to be read, wherein the color two-dimensional image code to be read is a method for generating a color two-dimensional image code by using the color identification type Generated color two-dimensional image code;
元素缩小模块,用于将所述第二像素矩阵中每一个元素缩小预定倍数,得到还原数据矩阵;An element reduction module, configured to reduce each element in the second pixel matrix by a predetermined multiple to obtain a restored data matrix;
分解模块,用于按照生成所述彩色二维图码时所利用的预设规则的逆过程,将所述还原数据矩阵分解成由所述预定位数的二进制比特流数据组成的数据组;a decomposition module, configured to decompose the restored data matrix into a data group consisting of the predetermined bit number of binary bit stream data according to an inverse process of a preset rule used when generating the color two-dimensional image code;
还原模块,用于将所述数据组按照分组过程的逆过程,还原得到二进制比特流数据;a restoration module, configured to restore the data group according to an inverse process of the grouping process to obtain binary bit stream data;
解码模块,用于将所述二进制比特流数据进行解码,得到原始信息,完成彩色二维图码的识读。And a decoding module, configured to decode the binary bit stream data, obtain original information, and complete reading of the color two-dimensional image code.
本申请实施例还提供了一种应用程序,所述应用程序用于在运行时执行权利要求上述的颜色标识型彩色二维图码的生成方法。The embodiment of the present application further provides an application program for executing the method for generating a color identification type color two-dimensional image code according to the above claims at runtime.
本申请实施例还提供了一种存储介质,用于存储应用程序,所述应用程序在运行时用于执行上述的颜色标识型彩色二维图码的生成方法。
The embodiment of the present application further provides a storage medium for storing an application, where the application is used to execute the color identification type color two-dimensional image generation method described above.
本申请实施例还提供了一种电子设备,适用于颜色标识型彩色二维图码的生成,所述电子设备包括:The embodiment of the present application further provides an electronic device, which is suitable for generating a color identification type color two-dimensional image code, and the electronic device includes:
壳体、处理器、存储器、电路板和电源电路,其中,电路板安置在壳体围成的空间内部,处理器和存储器设置在电路板上;电源电路,用于为电子设备的各个电路或器件供电;存储器用于存储可执行程序代码;处理器通过读取存储器中存储的可执行程序代码来运行与可执行程序代码对应的程序,以用于执行以下步骤:a housing, a processor, a memory, a circuit board, and a power supply circuit, wherein the circuit board is disposed inside the space enclosed by the housing, the processor and the memory are disposed on the circuit board; and the power supply circuit is used for each circuit of the electronic device or The device is powered; the memory is for storing executable program code; the processor runs the program corresponding to the executable program code by reading the executable program code stored in the memory for performing the following steps:
获取待编码的原始信息,并将其转化为二进制比特流数据;Obtaining the original information to be encoded and converting it into binary bit stream data;
将所述二进制比特流数据进行分组,使分组所得组的数量与待置入矩阵的元素数量相同,其中,每一组数据包含预定位数的所述二进制比特流数据,所述预定位数基于预定颜色模型确定;And grouping the binary bit stream data such that the number of groups obtained by the group is the same as the number of elements to be placed in the matrix, wherein each group of data includes the binary bit stream data of a predetermined number of bits, the predetermined number of bits being based on The predetermined color model is determined;
将所述每一组数据按照预设规则置入所述待置入矩阵中,得到初始数据矩阵;And placing each set of data into the to-be-placed matrix according to a preset rule to obtain an initial data matrix;
将所述初始数据矩阵中每一个元素扩大预定倍数,得到第一像素矩阵,其中,所述预定倍数基于所述预定颜色模型确定;Enlarging each element in the initial data matrix by a predetermined multiple to obtain a first pixel matrix, wherein the predetermined multiple is determined based on the predetermined color model;
根据预设的关于元素与颜色的对应关系,确定所述第一像素矩阵中的元素对应的颜色;Determining, according to a preset correspondence between elements and colors, a color corresponding to an element in the first pixel matrix;
将所确定出的颜色填充入待生成的彩色二维图码的数据存储区域中,并将预先为所述待编码的原始信息设置的特征信息填充入当前的所述彩色二维图码的特征信息区域中,完成彩色二维图码的生成。Filling the determined color into the data storage area of the color two-dimensional image code to be generated, and filling the feature information set in advance for the original information to be encoded into the current feature of the color two-dimensional image code In the information area, the generation of the color two-dimensional image code is completed.
本申请实施例还提供了一种应用程序,所述应用程序用于在运行时执行上述的颜色标识型彩色二维图码的识读方法。The embodiment of the present application further provides an application program for executing the above-mentioned color identification type color two-dimensional image code reading method at runtime.
本申请实施例还提供了一种存储介质,用于存储应用程序,所述应用程序在运行时用于执行上述的颜色标识型彩色二维图码的识读方法。The embodiment of the present application further provides a storage medium for storing an application, where the application is used to execute the above-mentioned color identification type color two-dimensional image reading method.
本申请实施例还提供了一种电子设备,适用于颜色标识型彩色二维图码的识读,所述电子设备包括:The embodiment of the present application further provides an electronic device, which is suitable for reading color-coded color two-dimensional image code, and the electronic device includes:
壳体、处理器、存储器、电路板和电源电路,其中,电路板安置在壳体
围成的空间内部,处理器和存储器设置在电路板上;电源电路,用于为电子设备的各个电路或器件供电;存储器用于存储可执行程序代码;处理器通过读取存储器中存储的可执行程序代码来运行与可执行程序代码对应的程序,以用于执行以下步骤:a housing, a processor, a memory, a circuit board, and a power supply circuit, wherein the circuit board is disposed in the housing
Inside the enclosed space, the processor and the memory are disposed on the circuit board; the power circuit is used to supply power to each circuit or device of the electronic device; the memory is used to store executable program code; and the processor reads the memory stored in the memory Execute the program code to run the program corresponding to the executable program code for performing the following steps:
获取待识读的彩色二维图码的第二像素矩阵,其中,所述待识读的彩色二维图码为通过上述方法生成的彩色二维图码;Obtaining a second pixel matrix of the color two-dimensional image code to be read, wherein the color two-dimensional image code to be read is a color two-dimensional image code generated by the above method;
将所述第二像素矩阵中每一个元素缩小预定倍数,得到还原数据矩阵;Reducing each element in the second pixel matrix by a predetermined multiple to obtain a restored data matrix;
按照生成所述彩色二维图码时所利用的预设规则的逆过程,将所述还原数据矩阵分解成由所述预定位数的二进制比特流数据组成的数据组;And decomposing the restored data matrix into a data group consisting of the predetermined bit number of binary bit stream data according to an inverse process of a preset rule used when generating the color two-dimensional image code;
将所述数据组按照生成所述彩色二维图码时所利用的分组过程的逆过程,还原得到二进制比特流数据;Converting the data set to binary bit stream data according to an inverse process of a grouping process utilized when generating the color two-dimensional code code;
将所述二进制比特流数据进行解码,得到原始信息,完成彩色二维图码的识读。The binary bit stream data is decoded to obtain original information, and the reading of the color two-dimensional image code is completed.
本方案中,首先获取待编码的原始信息,并将其转化为二进制比特流数据;将所述二进制比特流数据进行分组,使分组所得组的数量与待置入矩阵的元素数量相同,然后将所述每一组数据按照预设规则置入所述待置入矩阵中,得到初始数据矩阵;再将所述初始数据矩阵中每一个元素扩大预定倍数,得到第一像素矩阵后,根据预设的关于元素与颜色的对应关系,确定所述第一像素矩阵中的元素对应的颜色,最后将所确定出的颜色填充入待生成的彩色二维图码的数据存储区域中,并将预先为所述待编码的原始信息设置的特征信息填充入当前的所述彩色二维图码的特征信息区域中,完成彩色二维图码的生成。采用该生成方法生成的彩色二维图码中的颜色信息包含有效的原始信息,而不仅仅是视觉上的冲击。In this solution, first, the original information to be encoded is obtained and converted into binary bit stream data; the binary bit stream data is grouped, so that the number of groups obtained by grouping is the same as the number of elements to be placed in the matrix, and then Each set of data is placed in the to-be-placed matrix according to a preset rule to obtain an initial data matrix; and each element in the initial data matrix is expanded by a predetermined multiple to obtain a first pixel matrix, according to a preset. Determining the color corresponding to the element in the first pixel matrix, and finally filling the determined color into the data storage area of the color two-dimensional image code to be generated, and The feature information set by the original information to be encoded is filled into the feature information area of the current color two-dimensional image code, and the generation of the color two-dimensional image code is completed. The color information in the color two-dimensional code generated by the generation method contains valid original information, not just a visual impact.
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings to be used in the embodiments or the prior art description will be briefly described below. Obviously, the drawings in the following description are only It is a certain embodiment of the present application, and other drawings can be obtained according to the drawings without any creative work for those skilled in the art.
图1为本申请实施例所提供的一种颜色标识型彩色二维图码的生成方法的流程图;1 is a flowchart of a method for generating a color identification type color two-dimensional image code according to an embodiment of the present application;
图2为本申请实施例所提供的一种颜色标识型彩色二维图码的识读方法的流程图;2 is a flowchart of a method for reading a color-coded color two-dimensional image code according to an embodiment of the present application;
图3为本申请实施例所提供的一种颜色标识型彩色二维图码的生成装置的示意图;FIG. 3 is a schematic diagram of a device for generating a color-coded color two-dimensional image code according to an embodiment of the present application; FIG.
图4为本申请实施例所提供的一种颜色标识型彩色二维图码的识读装置的示意图。FIG. 4 is a schematic diagram of a color identification type color two-dimensional image reading device according to an embodiment of the present application.
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application are clearly and completely described in the following with reference to the drawings in the embodiments of the present application. It is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present application without departing from the inventive scope are the scope of the present application.
为了使彩色二维图码中颜色信息包含有效信息,而不仅仅是给人带来视觉上的冲击,本申请实施例提供了颜色标识型彩色二维图码的生成、识读方法及装置。In order to make the color information in the color two-dimensional image code contain the effective information, and not only to bring a visual impact to the human, the embodiment of the present application provides a method and a device for generating and reading the color identification type color two-dimensional image code.
下面首先对本申请实施例所提供的一种颜色标识型彩色二维图码的生成方法进行介绍。A method for generating a color-coded color two-dimensional image code provided by an embodiment of the present application is first introduced.
如图1所示,一种颜色标识型彩色二维图码的生成方法,可以包括:As shown in FIG. 1 , a method for generating a color-coded color two-dimensional image code may include:
S101,获取待编码的原始信息,并将其转化为二进制比特流数据;S101. Acquire original information to be encoded, and convert it into binary bit stream data.
其中,该待编码的原始信息可以为任意需要存储到待生成的彩色二维图码中的信息,例如可以是产品的生产厂家、生产日期、网页的网址链接等。将该待编码的原始信息转化为二进制比特流数据可以通过现有技术实现,在此不做具体限定。例如,若该待编码的原始信息为汉字类型的信息,则可以采用国标法将其转化为二进制比特流数据;若该待编码的原始信息为英文字母类型的信息,则可以采用ASCII码将其转化为二进制比特流数据。The original information to be encoded may be any information that needs to be stored in the color two-dimensional image code to be generated, and may be, for example, a manufacturer of the product, a production date, a web address link of the webpage, and the like. The conversion of the original information to be encoded into the binary bit stream data can be implemented by the prior art, and is not specifically limited herein. For example, if the original information to be encoded is Chinese character type information, it can be converted into binary bit stream data by using the national standard method; if the original information to be encoded is English letter type information, it can be ASCII coded. Converted to binary bitstream data.
S102,将所述二进制比特流数据进行分组,使分组所得组的数量与待置
入矩阵的元素数量相同;S102. Group the binary bit stream data, so that the number of groups obtained by the group is set to be
The number of elements entering the matrix is the same;
其中,每一组数据包含预定位数的二进制比特流数据,该预定位数基于预定颜色模型确定,该预定颜色模型一般可以为RGB模型,相应的,该预定位数即为三位。该待置入矩阵的行数和列数可以根据实际需要生成的彩色二维图码的类型确定,例如,若要生成D9ing码类型的彩色二维图码,则该待置入矩阵即为一个448行,448列的空矩阵,当然并不局限于此。Each of the sets of data includes binary bit stream data of a predetermined number of bits, the predetermined number of bits being determined based on a predetermined color model, which may be an RGB model, and correspondingly, the predetermined number of bits is three bits. The number of rows and columns to be placed in the matrix may be determined according to the type of the color two-dimensional image code actually generated. For example, if a color two-dimensional image code of the D9ing code type is to be generated, the matrix to be placed is one. The empty matrix of 448 rows and 448 columns is of course not limited to this.
具体的,将该二进制比特流数据进行分组的方式一般可以采用以下两种方式中的一种:Specifically, the method for grouping the binary bit stream data may generally be in one of two ways:
第一种方式为:按照预定的遍历顺序,以三位为一组对该二进制比特流数据进行分组,然后判断分组所得组的数量是否与待置入矩阵的元素数量相同,如果否,继续按照预定的遍历顺序,以三位为一组对该二进制比特流数据进行分组,直至满足组的数量要求,其中,该预定的遍历顺序为:从左到右的顺序或从右到左的顺序。The first way is: grouping the binary bit stream data in groups of three according to a predetermined traversal order, and then determining whether the number of groups obtained by the group is the same as the number of elements to be placed in the matrix, and if not, continuing to follow The predetermined traversal sequence groups the binary bit stream data in groups of three until the number of groups is satisfied, wherein the predetermined traversal order is from left to right or from right to left.
需要说明的是,为了将待编码的原始信息全部存储到所要生成的彩色二维图码中,预先确定的该待置入矩阵是可以将全部待编码的原始信息转化的该二进制比特流数据存储进去的,也就是说,上述分组所得组的数量一般不会大于该待置入矩阵的元素数量。It should be noted that, in order to store all the original information to be encoded into the color two-dimensional image code to be generated, the predetermined to-be-placed matrix is the binary bit stream data that can convert all the original information to be encoded. Into, that is, the number of groups obtained by the above grouping is generally not greater than the number of elements to be placed in the matrix.
当判断分组所得组的数量小于该待置入矩阵的元素数量时,则继续按照预定的遍历顺序,以三位为一组对该二进制比特流数据进行分组,直至满足组的数量要求。举例而言,由待编码的原始信息转化的二进制比特流数据为10010001011,按照预定的从左到右的遍历顺序,以三位为一组对该二进制比特流数据进行分组,得到三组数据,分别为:(1,0,0)、(1,0,0)、(0,1,0),剩余两位二进制比特流数据1和1。若待置入矩阵的元素数量为四,由于分别所得的组的数量为三,小于该待置入矩阵的元素数量,则按照从左到右的遍历顺序对该二进制比特流数据继续分组,剩余的两位二进制比特流数据1、1和第一位二进制比特流数据1被分为一组,得到第四组数据(1,1,1),此时分组所得组的数量与该待置入矩阵的元素数量相同,停止分组。当然也可以采用从右到左的遍历顺序对该二进制比特流数据进行分组,具体过程与上述按照从左到右的遍历顺序对该二进制比特流数据进行分组的过程相似,在
此不再进行详细说明。When it is judged that the number of groups obtained by the packet is smaller than the number of elements to be placed in the matrix, the binary bit stream data is further grouped in groups of three bits in accordance with a predetermined traversal order until the number of groups is satisfied. For example, the binary bit stream data converted by the original information to be encoded is 10010001011, and the binary bit stream data is grouped in groups of three bits according to a predetermined left-to-right traversal order to obtain three sets of data. They are: (1,0,0), (1,0,0), (0,1,0), and the remaining two binary bit stream data 1 and 1. If the number of elements to be placed in the matrix is four, since the number of groups respectively obtained is three, which is smaller than the number of elements to be placed in the matrix, the binary bit stream data is further grouped according to the traversal order from left to right, and the remaining The two binary bit stream data 1, 1 and the first bit binary bit stream data 1 are grouped into one group to obtain a fourth group of data (1, 1, 1), and the number of groups obtained by grouping at this time is to be placed The number of elements in the matrix is the same and the grouping is stopped. It is of course also possible to group the binary bit stream data in a traversal sequence from right to left. The specific process is similar to the above process of grouping the binary bit stream data in a traversal order from left to right.
This will not be described in detail.
第二种方式为:按照预定的遍历顺序,以三位为一组对该二进制比特流数据进行分组;判断分组所得组的数量是否与待置入矩阵的元素数量相同,如果否,将数字0作为该二进制比特流数据的补充二进制比特流数据,继续对当前分组所剩余的二进制比特流数据进行分组,直至满足组的数量要求,其中,该预定的遍历顺序为:从左到右的顺序或从右到左的顺序。The second way is: grouping the binary bit stream data in groups of three according to a predetermined traversal order; determining whether the number of groups obtained by the group is the same as the number of elements to be placed in the matrix, and if not, the number is 0. As the supplementary binary bit stream data of the binary bit stream data, the binary bit stream data remaining in the current packet is continued to be grouped until the number of groups is satisfied, wherein the predetermined traversal order is: left to right order or The order from right to left.
如上述说明,分组所得组的数量一般是不会大于该待置入矩阵的元素数量,当判断分组所得组的数量小于该待置入矩阵的元素数量时,则将数字0作为该二进制比特流数据的补充二进制比特流数据,继续对当前分组所剩余的二进制比特流数据进行分组,直至满足组的数量要求。举例而言,由待编码的原始信息转化的二进制比特流数据为10010001011,按照从左到右的遍历顺序,以三位为一组对该二进制比特流数据进行分组,得到三组数据,分别为:(1,0,0)、(1,0,0)、(0,1,0),剩余两位二进制比特流数据1和1。若待置入矩阵的元素数量为四,由于分组所得的组的数量为三,小于该待置入矩阵的元素数量,则将数字0作为该二进制比特流数据的补充二进制比特流数据,继续对当前分组所剩余的二进制比特流数据进行分组,得到第四组数据(1,1,0),此时分组所得组的数量与该待置入矩阵的元素数量相同,停止分组。当然也可以采用从右到左的遍历顺序对该二进制比特流数据进行分组,具体过程与上述按照从左到右的遍历顺序对该二进制比特流数据进行分组的过程相似,在此不再进行详细说明。As described above, the number of groups obtained by grouping is generally not greater than the number of elements to be placed in the matrix. When it is judged that the number of groups obtained by the group is smaller than the number of elements to be placed in the matrix, the number 0 is used as the binary bit stream. The data complements the binary bit stream data and continues to group the remaining binary bit stream data of the current packet until the number of groups is met. For example, the binary bit stream data converted from the original information to be encoded is 10010001011, and the binary bit stream data is grouped in groups of three bits according to the traversal order from left to right, and three sets of data are obtained, respectively. : (1,0,0), (1,0,0), (0,1,0), the remaining two binary bit stream data 1 and 1. If the number of elements to be placed in the matrix is four, since the number of groups obtained by the group is three, which is smaller than the number of elements to be placed in the matrix, the number 0 is used as supplementary binary bit stream data of the binary bit stream data, and continues to The binary bit stream data remaining in the current packet is grouped to obtain a fourth group of data (1, 1, 0). At this time, the number of groups obtained by the group is the same as the number of elements to be placed in the matrix, and the packet is stopped. It is of course also possible to group the binary bit stream data in a traversal sequence from right to left. The specific process is similar to the above process of grouping the binary bit stream data in a traversal order from left to right, and no further details are performed here. Description.
S103,将所述每一组数据按照预设规则置入所述待置入矩阵中,得到初始数据矩阵;S103. The set of data is placed into the to-be-placed matrix according to a preset rule to obtain an initial data matrix.
具体的,可以将每一组数据按照Z字型走向顺次置入该待置入矩阵中,使该待置入矩阵中每个元素对应一组数据,得到初始数据矩阵。例如,对二进制比特流数据进行分组后得到四组数据,分别为:(1,0,0)、(1,0,0)、(0,1,0)和(1,1,0),待置入矩阵为一个二阶的空矩阵,元素数量为四,按照Z字型走向,顺次将第一组数据(1,0,0)置入矩阵的第一行第一列,将
第二组数据(1,0,0)置入矩阵的第二行第一列,将第三组数据(0,1,0)置入矩阵的第一行第二列,将第四组数据(1,1,0)置入矩阵的第二行第二列,得到初始数据矩阵需要说明的是,本申请实施例所给出的Z字型走向的预设规则仅仅作为示例,并不应该构成对本申请实施例的限定,可以理解的是,在实际应用中,该预设规则也可以为根据实际需要预设的其他规则,举例而言:可以将每一组数据顺次置入待置入矩阵的每一行,在此不做具体限定和说明。Specifically, each group of data may be sequentially placed into the to-be-placed matrix according to the Z-shaped direction, so that each element to be placed in the matrix corresponds to a set of data, and an initial data matrix is obtained. For example, grouping binary bitstream data yields four sets of data, namely: (1,0,0), (1,0,0), (0,1,0), and (1,1,0), The matrix to be placed is a second-order empty matrix, and the number of elements is four. According to the z-shaped trend, the first set of data (1, 0, 0) is sequentially placed into the first row and the first column of the matrix. Two sets of data (1, 0, 0) are placed in the first column of the second row of the matrix, and the third set of data (0, 1, 0) is placed in the first row and the second column of the matrix, and the fourth set of data is 1,1,0) placed in the second row and second column of the matrix to get the initial data matrix It should be noted that the preset rule of the Z-shaped direction given in the embodiment of the present application is only an example, and should not be construed as limiting the embodiment of the present application. It can be understood that, in practical applications, the preset rule For example, other rules may be preset according to actual needs. For example, each group of data may be sequentially placed in each row of the matrix to be placed, and no specific limitation or description is provided herein.
S104,将所述初始数据矩阵中每一个元素扩大预定倍数,得到第一像素矩阵;S104. Expand each element in the initial data matrix by a predetermined multiple to obtain a first pixel matrix.
其中,该预定倍数基于该预定颜色模型确定,该预定颜色模型一般为RGB模型,相应的,该预定倍数即为最大灰度级255倍,将该初始数据矩阵中每一个元素扩大255倍,即得到该第一像素矩阵,当然并不局限于此。例如,将上述初始数据矩阵扩大255倍,即得到对应的第一像素矩阵
The predetermined multiple is determined based on the predetermined color model, and the predetermined color model is generally an RGB model. Correspondingly, the predetermined multiple is 255 times the maximum gray level, and each element in the initial data matrix is expanded by 255 times, that is, Obtaining the first pixel matrix is of course not limited thereto. For example, the above initial data matrix Enlarge 255 times to get the corresponding first pixel matrix
S105,根据预设的关于元素与颜色的对应关系,确定所述第一像素矩阵中的元素对应的颜色;S105. Determine, according to a preset correspondence between elements and colors, a color corresponding to an element in the first pixel matrix.
具体的,预设的关于元素与颜色的对应关系可以如下表所示:Specifically, the preset correspondence between elements and colors can be as follows:
序号Serial number | 元素element | 颜色colour |
11 | (0,0,0)(0,0,0) | 黑色black |
22 | (0,0,255)(0,0,255) | 蓝色blue |
33 | (0,255,0)(0,255,0) | 绿色green |
44 | (0,255,255)(0,255,255) | 青蓝色cyan |
55 | (255,0,0)(255,0,0) | 红色red |
66 | (255,0,255)(255,0,255) | 洋红色Magenta |
77 | (255,255,0)(255,255,0) | 黄色yellow |
88 | (255,255,255)(255,255,255) | 白色white |
由于在实际应用中,使用的设备镜头等对颜色的分辨能力可能不同,该预设的关于元素与颜色的对应关系可以根据实际需要进行修改,并不局限于此。Since the resolution of the color of the device lens or the like may be different in practical applications, the corresponding relationship between the element and the color may be modified according to actual needs, and is not limited thereto.
S106,将所确定出的颜色填充入待生成的彩色二维图码的数据存储区域中,并将预先为所述待编码的原始信息设置的特征信息填充入当前的所述彩色二维图码的特征信息区域中,完成彩色二维图码的生成。S106. Fill the determined color into the data storage area of the color two-dimensional image code to be generated, and fill the feature information set in advance for the original information to be encoded into the current color two-dimensional image code. In the feature information area, the generation of the color two-dimensional image code is completed.
可以理解的是,该待生成的彩色二维图码的数据存储区域的像素个数与第一像素矩阵中的元素的数量相同,每行像素的个数与该第一像素矩阵中每行的元素的数量相同,每列像素的个数与该第一像素矩阵中每列的元素的数量相同,该待生成的彩色二维图码的数据存储区域的像素与该第一像素矩阵中的元素存在一一对应关系。确定出该元素对应的颜色后,也就确定出了该待生成的彩色二维图码的数据存储区域中每个位置的像素对应的颜色,例如,上述第一像素矩阵对应的待生成的彩色二维图码的数据存储区域的四个位置的像素所对应的颜色即为将这些颜色按照对应的位置关系填入该待生成的彩色二维图码的数据存储区域即完成对待生成的彩色二维图码的数据存储区域的填充。
It can be understood that the number of pixels in the data storage area of the color two-dimensional image code to be generated is the same as the number of elements in the first pixel matrix, and the number of pixels in each row and each row in the first pixel matrix. The number of elements is the same, the number of pixels in each column is the same as the number of elements in each column in the first pixel matrix, and the pixels of the data storage area of the color two-dimensional image to be generated and the elements in the first pixel matrix There is a one-to-one correspondence. After determining the color corresponding to the element, the color corresponding to the pixel of each position in the data storage area of the color two-dimensional image code to be generated is determined, for example, the first pixel matrix The color corresponding to the pixel at the four positions of the data storage area of the corresponding color two-dimensional image code to be generated is These colors are filled in the data storage area of the color two-dimensional image code to be generated according to the corresponding positional relationship, that is, the filling of the data storage area of the color two-dimensional image code to be generated is completed.
进一步的,该待生成的彩色二维图码的数据存储区域填充完成后,将预先为该待编码的原始信息设置的特征信息填充入当前的彩色二维图码的特征信息区域中,完成彩色二维图码的生成。Further, after the data storage area of the color two-dimensional image code to be generated is filled, the feature information set in advance for the original information to be encoded is filled into the feature information area of the current color two-dimensional image code to complete the color. The generation of two-dimensional code.
需要说明的是,该预先为待编码的原始信息设置的特征信息可以包括格式信息和版本信息,该格式信息和该版本信息可以根据该待生成的彩色二维图码的类型确定,将上述特征信息区域中的特征信息填充入当前的彩色二维图码的特征信息区域中的方式可以采用现有技术,在此不作具体限定。It should be noted that the feature information set in advance for the original information to be encoded may include format information and version information, and the format information and the version information may be determined according to the type of the color two-dimensional image code to be generated, and the foregoing feature is The manner in which the feature information in the information area is filled in the feature information area of the current color two-dimensional image code may be used in the prior art, and is not specifically limited herein.
举例而言,若该待生成的彩色二维图码为D9ing码类型,则根据该待生成的彩色二维图码的行数、列数和纠错等级生成格式信息,采用现有的D9ing码的特征信息填充方式,将该格式信息和预先设置的版本信息填充入当前的彩色二维图码的特征信息区域中。若该待生成的彩色二维图码为QR码类型,则该设置的特征信息中的格式信息表示纠错级别,可以分为L、M、Q、H四个级别;该设置的特征信息中的版本信息即为该QR码类型的该待生成的彩色二维图码的规格,可以采用现有的QR码的40种规格中一种,采用现有的QR码的特征信息填充方式,将该格式信息和该版本信息填充入当前的彩色二维图码的特征信息区域中即可。For example, if the color two-dimensional image code to be generated is a D9ing code type, the format information is generated according to the number of rows, the number of columns, and the error correction level of the color two-dimensional image code to be generated, and the existing D9ing code is used. The feature information filling mode fills the format information and the preset version information into the feature information area of the current color two-dimensional image code. If the color two-dimensional image code to be generated is a QR code type, the format information in the set feature information indicates an error correction level, which can be divided into four levels of L, M, Q, and H; The version information is the specification of the color two-dimensional image code to be generated of the QR code type, and one of the 40 specifications of the existing QR code can be used, and the feature information filling method of the existing QR code is adopted. The format information and the version information may be filled in the feature information area of the current color two-dimensional image code.
进一步需要说明的是,在将该特征信息区域中的特征信息填充入当前的彩色二维图码的特征信息区域中之后,上述方法还可以包括:It should be further noted that, after the feature information in the feature information area is filled in the feature information area of the current color two-dimensional code, the method may further include:
对该特征信息区域进行掩模处理。Masking the feature information area.
具体的掩模处理可以根据实际需要采用现有的掩模处理中的一种,一般是将该特征信息区域中的格式信息区域进行掩模处理,使生成的该彩色二维图码更加美观,同时增加该彩色二维图码的保密性。进一步的,也可以对上述数据存储区域进行掩模处理,以增加该彩色二维图码的美观性,使保密性更好。The specific mask processing may adopt one of the existing mask processing according to actual needs, generally performing mask processing on the format information region in the feature information region, so that the generated color two-dimensional image code is more beautiful. At the same time, the confidentiality of the color two-dimensional image code is increased. Further, mask processing may be performed on the data storage area to increase the aesthetics of the color two-dimensional image code, so that the confidentiality is better.
可见,本方案提供的一种颜色标识型彩色二维图码的生成方法中,首先获取待编码的原始信息,并将其转化为二进制比特流数据;将所述二进制比特流数据进行分组,使分组所得组的数量与待置入矩阵的元素数量相同,然后将所述每一组数据按照预设规则置入所述待置入矩阵中,得到初始数据矩
阵;再将所述初始数据矩阵中每一个元素扩大预定倍数,得到第一像素矩阵后,根据预设的关于元素与颜色的对应关系,确定所述第一像素矩阵中的元素对应的颜色,最后将所确定出的颜色填充入待生成的彩色二维图码的数据存储区域中,并将预先为所述待编码的原始信息设置的特征信息填充入当前的所述彩色二维图码的特征信息区域中,完成彩色二维图码的生成。采用该生成方法生成的彩色二维图码中的颜色信息包含有效的原始信息,而不仅仅是视觉上的冲击。It can be seen that, in the method for generating a color identification type color two-dimensional image code provided by the present scheme, the original information to be encoded is first obtained and converted into binary bit stream data; the binary bit stream data is grouped, so that The number of groups obtained by grouping is the same as the number of elements to be placed in the matrix, and then each set of data is placed into the matrix to be placed according to a preset rule to obtain an initial data moment.
Array; further expanding each element in the initial data matrix by a predetermined multiple to obtain a first pixel matrix, determining a color corresponding to the element in the first pixel matrix according to a preset correspondence relationship between the element and the color, Finally, the determined color is filled into the data storage area of the color two-dimensional image code to be generated, and the feature information set in advance for the original information to be encoded is filled into the current color two-dimensional image code. In the feature information area, the generation of the color two-dimensional map code is completed. The color information in the color two-dimensional code generated by the generation method contains valid original information, not just a visual impact.
基于上述的颜色标识型彩色二维图码的生成方法,本申请实施例还提供了一种颜色标识型彩色二维图码的识读方法。Based on the above method for generating a color-coded color two-dimensional image code, the embodiment of the present application further provides a method for reading a color-coded color two-dimensional image code.
如图2所示,本实施例所提供的一种颜色标识型彩色二维图码的识读方法,可以包括:As shown in FIG. 2, the method for reading a color-coded color two-dimensional image code provided by this embodiment may include:
S201,获取待识读的彩色二维图码的第二像素矩阵;S201. Acquire a second pixel matrix of the color two-dimensional image code to be read;
需要说明的是,该待识读的彩色二维图码为通过本申请实施例上述所提供的颜色标识型彩色二维图码的生成方法所生成的彩色二维图码,获取该待识读的彩色二维图码的第二像素矩阵的方式可以采用任意一种现有的获取方式,在此不做具体限定。It should be noted that the color two-dimensional image code to be read is a color two-dimensional image generated by the method for generating a color-coded color two-dimensional image code provided by the above-mentioned embodiment of the present application, and the to-be-readed is obtained. The manner of the second pixel matrix of the color two-dimensional image code may be any existing acquisition manner, which is not specifically limited herein.
S202,将所述第二像素矩阵中每一个元素缩小预定倍数,得到还原数据矩阵;S202. Reduce each element in the second pixel matrix by a predetermined multiple to obtain a restored data matrix.
其中,该预定倍数基于该待识读的彩色二维图码的颜色模型确定,可以理解的是,该待识读的彩色二维图码的颜色模型与通过上述的彩色二维图码的生成方法所生成的彩色二维图码的颜色模型是一致的,例如,该颜色模型可以是RGB模式的,相应的,该预定倍数即为255倍。Wherein, the predetermined multiple is determined based on a color model of the color two-dimensional image code to be read, and it can be understood that the color model of the color two-dimensional image code to be read and the generation of the color two-dimensional image code through the above The color model of the color two-dimensional image generated by the method is consistent. For example, the color model may be in the RGB mode, and correspondingly, the predetermined multiple is 255 times.
具体的,将该第二像素矩阵中每一个元素缩小预定倍数,得到还原数据矩阵,可以包括:Specifically, reducing each element in the second pixel matrix by a predetermined multiple to obtain a restored data matrix may include:
对该第二像素矩阵进行纠错处理;Performing error correction processing on the second pixel matrix;
该纠错处理具体可以包括:
The error correction processing may specifically include:
根据公式:计算出该第二像素矩阵中的元素与预设的元素的欧氏距离值r1~r8,其中,x为该第二像素矩阵中的元素的R值,y为该第二像素矩阵中的元素的G值,z为该第二像素矩阵中的元素的B值,n=1,2…8,R、G、B分别为该预设的元素的R值、G值、B值;According to the formula: Calculating an Euclidean distance value r 1 r r 8 of an element in the second pixel matrix and a preset element, where x is an R value of an element in the second pixel matrix, and y is in the second pixel matrix The G value of the element, z is the B value of the element in the second pixel matrix, n=1, 2...8, and R, G, and B are respectively the R value, the G value, and the B value of the preset element;
比较该欧氏距离值r1~r8的大小,用值最小的rn对应的预设的元素替换该第二像素矩阵中的元素,完成纠错处理;Comparing the magnitudes of the Euclidean distance values r 1 to r 8 , replacing the elements in the second pixel matrix with the preset elements corresponding to the smallest value r n to complete the error correction processing;
其中,该预设的元素包括:(0,0,0)、(0,0,255)、(0,255,0)、(0,255,255)、(255,0,0)、(255,0,255)、(255,255,0)及(255,255,255)。The preset elements include: (0, 0, 0), (0, 0, 255), (0, 255, 0), (0, 255, 255), (255, 0, 0), ( 255,0,255), (255,255,0) and (255,255,255).
将纠错处理后的第二像素矩阵中每一个元素缩小预定倍数,确定出还原数据矩阵。The element in the second pixel matrix after the error correction processing is reduced by a predetermined multiple to determine a restored data matrix.
举例而言,该第二像素矩阵中的一个元素为(2,0,250),对其进行纠错处理具体为:根据上述公式,将其与预设的八个元素分别进行欧氏距离计算,得到r1~r8分别为:250、6、357、255、356、253、438及439,可以明显的看出r2的值最小,则用元素(0,0,255)替换该第二像素矩阵中的元素(2,0,250),通过同样的方法可以对该第二像素矩阵中的所有元素进行纠错处理,由于在实际应用时获取的该第二像素矩阵可能纯在误差,会导致识读的不准确,进行纠错处理可消除误差,使得到的该第二像素矩阵更加准确。For example, one element in the second pixel matrix is (2, 0, 250), and the error correction processing thereof is specifically: performing Euclidean distance calculation separately from the preset eight elements according to the above formula. Obtaining r 1 to r 8 are: 250, 6, 357, 255, 356, 253, 438, and 439. It can be clearly seen that the value of r 2 is the smallest, and the element is replaced with an element (0, 0, 255). The elements in the two-pixel matrix (2, 0, 250) can be error-corrected by all the elements in the second pixel matrix by the same method, since the second pixel matrix obtained in practical application may be purely error It will lead to inaccuracy of reading, and error correction processing can eliminate the error, so that the obtained second pixel matrix is more accurate.
纠错处理完成后,将该第二像素矩阵中每一个元素缩小预定倍数,例如,上述元素(0,0,255)缩小255倍,得到元素(0,0,1),将该第二像素矩阵中每一个元素都缩小预定倍数后便得到该还原数据矩阵。After the error correction processing is completed, each element in the second pixel matrix is reduced by a predetermined multiple. For example, the above element (0, 0, 255) is reduced by 255 times to obtain an element (0, 0, 1), and the second pixel is obtained. The restored data matrix is obtained by reducing each element in the matrix by a predetermined multiple.
S203,按照生成所述彩色二维图码时所利用的预设规则的逆过程,将所述还原数据矩阵分解成由所述预定位数的二进制比特流数据组成的数据组;S203. Decompose the restored data matrix into a data group consisting of the binary bit stream data of the predetermined number of bits according to an inverse process of a preset rule used when generating the color two-dimensional image code.
需要说明的是,该预定位数基于该待识读的彩色二维图码的颜色模型确定,例如,该待识读的彩色二维图码的颜色模型为RGB模型,相应的,该预
定位数即为三位。It should be noted that the predetermined number of bits is determined based on a color model of the color two-dimensional image code to be read. For example, the color model of the color two-dimensional image code to be read is an RGB model, and correspondingly, the pre-
The number of positions is three.
具体的,如果生成所述彩色二维图码时所利用的预设规则为按照Z字型走向顺次置入待置入矩阵中,则可以将该还原数据矩阵中的元素按照Z字型走向,顺次分解成由该预定位数的二进制比特流数据组成的数据组,使该还原数据矩阵中每个元素对应一组数据,得到该数据组。Specifically, if the preset rule used in generating the color two-dimensional image code is sequentially placed into the matrix to be placed according to the Z-shaped shape, the elements in the restored data matrix may be oriented in a zigzag pattern. And sequentially decomposing into a data group consisting of the predetermined bit number of binary bit stream data, so that each element in the restored data matrix corresponds to a group of data, and the data group is obtained.
例如,该还原数据矩阵为元素数量为四,按照Z字型走向,顺次将第一行第一列的元素(1,0,0),第二行第一列的元素(1,0,0),第一行第二列的元素(0,1,0),第二行第二列的元素(1,1,0)分解出来,得到由三位二进制比特流数据组成的数据组,分别为:(1,0,0)、(1,0,0)、(0,1,0)和(1,1,0)。For example, the restored data matrix is The number of elements is four, according to the z-shaped trend, the first row of the first column of the elements (1,0,0), the second row of the first column of the elements (1,0,0), the first row of The elements of the second column (0, 1, 0), the elements of the second row and the second column (1, 1, 0) are decomposed to obtain a data group consisting of three bits of binary bit stream data, respectively: (1, 0 , 0), (1, 0, 0), (0, 1, 0) and (1, 1, 0).
本领域技术人员可以理解的是,如果生成所述彩色二维图码时所利用的预设规则为其他预设规则,则相应的按照该预设规则的逆过程对还原数据矩阵进行分解处理,在此不做具体说明。It can be understood by those skilled in the art that if the preset rule used in generating the color two-dimensional code is another preset rule, the corresponding reverse process of the preset rule is used to decompose the restored data matrix. No specific explanation will be given here.
S204,将所述数据组按照生成所述彩色二维图码时所利用的分组过程的逆过程,还原得到二进制比特流数据;S204. The data set is restored to obtain binary bit stream data according to an inverse process of a grouping process used when generating the color two-dimensional image code.
具体的,将该数据组按照生成该彩色二维图码时所利用的分组过程的逆过程,还原得到二进制比特流数据的方式,根据生成该彩色二维图码时所利用的分组的方式确定,一般可以采用以下两种方式中的一种:Specifically, the method for restoring the binary bit stream data according to the inverse process of the grouping process used when generating the color two-dimensional image code is determined according to the manner of the group used when generating the color two-dimensional image code. Generally, one of the following two methods can be used:
若生成该彩色二维图码时所利用的分组方式为生成该彩色二维图码时的上述第一种方式,则采用如下方式还原得到二进制比特流数据:If the grouping method used when generating the color two-dimensional image code is the above-mentioned first mode when generating the color two-dimensional image code, the binary bit stream data is restored by the following method:
按照预定的遍历顺序,将该数据组还原为初始二进制比特流数据,其中,该预定的遍历顺序为:从左到右的顺序或从右到左的顺序;Reverting the data set to initial binary bit stream data according to a predetermined traversal order, wherein the predetermined traversal order is: left to right order or right to left order;
判断在生成该彩色二维图码时,分组过程中是否存在继续按照预定的遍历顺序,以三位为一组对该二进制比特流数据进行分组的步骤;
Determining, when generating the color two-dimensional image code, whether there is a step of grouping the binary bit stream data in groups of three according to a predetermined traversal sequence in the grouping process;
如果是,将继续按照预定的遍历顺序,以三位为一组对该二进制比特流数据进行分组的步骤中所用到的二进制比特流数据从初始二进制比特流数据中去除,得到该二进制比特流数据。If so, the binary bit stream data used in the step of grouping the binary bit stream data in groups of three bits is continuously removed from the initial binary bit stream data in accordance with a predetermined traversal order to obtain the binary bit stream data. .
举例而言,该数据组为(1,0,0)、(1,0,0)、(0,1,0)及(1,1,1),按照预定的从左到右的遍历顺序,将四个数据组还原为初始二进制比特流数据100100010111;判断得到,在生成该彩色二维图码时,分组过程中存在继续按照预定的遍历顺序,以三位为一组对该二进制比特流数据进行分组的步骤,将继续按照预定的遍历顺序,以三位为一组对该二进制比特流数据进行分组步骤中所用到的二进制比特流数据1从初始二进制比特流数据100100010111中去除,得到该二进制比特流数据10010001011。For example, the data set is (1,0,0), (1,0,0), (0,1,0), and (1,1,1), according to a predetermined left-to-right traversal order. , the four data sets are restored to the initial binary bit stream data 100100010111; it is determined that, when the color two-dimensional image code is generated, there is a continuation of the predetermined traversal sequence in the grouping process, and the binary bit stream is grouped by three bits. The step of grouping the data, and continuing to remove the binary bit stream data 1 used in the step of grouping the binary bit stream data in groups of three bits from the initial binary bit stream data 100100010111 according to a predetermined traversal order, to obtain the Binary bit stream data 10010001011.
需要说明的是,该遍历顺序与生成该彩色二维图码时的分组过程中所用的遍历顺序是一致的,若生成该彩色二维图码时的分组过程中所用的遍历顺序是从右到左的遍历顺序,则该遍历顺序为从右到左的遍历顺序,具体过程与上述按照从左到右的遍历顺序对该数据组进行还原的过程相似,在此不再进行详细说明。It should be noted that the traversal sequence is consistent with the traversal sequence used in the grouping process when generating the color two-dimensional image code, and the traversal sequence used in the grouping process when generating the color two-dimensional image code is from right to In the left traversal order, the traversal order is a traversal sequence from right to left. The specific process is similar to the above process of restoring the data group in the traversal order from left to right, and will not be described in detail herein.
若生成该彩色二维图码时所利用的分组方式为生成该彩色二维图码时的上述第二种方式,则采用如下方式还原得到二进制比特流数据:If the grouping method used when generating the color two-dimensional image code is the second mode when the color two-dimensional image code is generated, the binary bit stream data is restored by the following method:
按照预定的遍历顺序,将该数据组还原为初始二进制比特流数据,其中,该预定的遍历顺序为:从左到右的顺序或从右到左的顺序;Reverting the data set to initial binary bit stream data according to a predetermined traversal order, wherein the predetermined traversal order is: left to right order or right to left order;
判断在生成该彩色二维图码时,分组过程中是否存在将数字0作为该二进制比特流数据的补充二进制比特流数据,继续对当前分组所剩余的二进制比特流数据进行分组的步骤;Determining, when generating the color two-dimensional image code, whether there is a supplementary binary bit stream data having the number 0 as the binary bit stream data in the grouping process, and continuing to group the remaining binary bit stream data of the current packet;
如果是,将补充二进制比特流数据0从初始二进制比特流数据中去除,得到该二进制比特流数据。If so, the supplemental binary bit stream data 0 is removed from the original binary bit stream data to obtain the binary bit stream data.
举例而言,该数据组为(1,0,0)、(1,0,0)、(0,1,0)及(1,1,0),按照预定的从左到右的遍历顺序,将四个数据组还原为初始二进制比特流数据100100010110;判断得到,在生成该彩色二维图码时,分组过程中存在将数字0作为该二进制比特流数据的补充二进制比特流数据,继续对当前
分组所剩余的二进制比特流数据进行分组的步骤,将补充二进制比特流数据0从初始二进制比特流数据100100010110中去除,得到该二进制比特流数据10010001011。For example, the data set is (1,0,0), (1,0,0), (0,1,0), and (1,1,0), according to a predetermined left-to-right traversal order. Reverting the four data sets to the initial binary bit stream data 100100010110; determining that, when generating the color two-dimensional picture code, there is a supplementary binary bit stream data in which data 0 is used as the binary bit stream data in the grouping process, and continues to Current
The step of grouping the remaining binary bit stream data is performed, and the supplemental binary bit stream data 0 is removed from the initial binary bit stream data 100100010110 to obtain the binary bit stream data 10010001011.
需要说明的是,该遍历顺序与生成该彩色二维图码时的分组过程中所用的遍历顺序是一致的,若生成该彩色二维图码时的分组过程中所用的遍历顺序是从右到左的遍历顺序,则该遍历顺序为从右到左的遍历顺序,具体过程与上述按照从左到右的遍历顺序对该数据组进行还原的过程相似,在此不再进行详细说明。It should be noted that the traversal sequence is consistent with the traversal sequence used in the grouping process when generating the color two-dimensional image code, and the traversal sequence used in the grouping process when generating the color two-dimensional image code is from right to In the left traversal order, the traversal order is a traversal sequence from right to left. The specific process is similar to the above process of restoring the data group in the traversal order from left to right, and will not be described in detail herein.
S205,将所述二进制比特流数据进行解码,得到原始信息,完成彩色二维图码的识读。S205. Decode the binary bit stream data to obtain original information, and complete reading of the color two-dimensional image code.
其中,将该二进制比特流数据进行解码的方式可以采用现有的解码方式,在此不做具体限定,若生成该彩色二维图码时,所用的编码方式为国标法,则可采用现有的与国标法对应的解码方式对该二进制比特流数据进行解码;若生成该彩色二维图码时,所用的编码方式为ASCII码,则可采用现有的与ASCII码对应的解码方式对该二进制比特流数据进行解码。The method for decoding the binary bit stream data may adopt an existing decoding method, and is not specifically limited herein. If the color two-dimensional image code is generated, the coding method used is the national standard method, and the existing existing method may be adopted. The decoding method corresponding to the national standard method decodes the binary bit stream data; if the color two-dimensional image code is generated, the encoding method used is ASCII code, and the existing decoding method corresponding to the ASCII code may be adopted. The binary bit stream data is decoded.
进一步的,在步骤S201之前,上述方法还可以包括:Further, before the step S201, the foregoing method may further include:
对该待识读的彩色二维图码进行图像矫正处理;Performing image correction processing on the color two-dimensional image code to be read;
具体的,该图像矫正处理可以包括:图像增强和去噪操作处理,可以采用现有的灰度增强算法和中值滤波算法等,对该待识读的彩色二维图码进行图像矫正处理可以提高识读的正确率,避免识读错误发生。Specifically, the image correction processing may include: image enhancement and denoising operation processing, and the existing gray enhancement algorithm and median filtering algorithm may be used to perform image correction processing on the color two-dimensional image code to be read. Improve the correct rate of reading and avoid reading errors.
可见,本方案提供的一种颜色标识型彩色二维图码的识读方法,可以准确的识读通过本申请实施例所提供的颜色标识型彩色二维图码的生成方法所生成的彩色二维图码中存储的有效信息。It can be seen that the method for reading a color-coded color two-dimensional image code provided by the present embodiment can accurately read the color two generated by the method for generating the color-coded color two-dimensional image code provided by the embodiment of the present application. Valid information stored in the dimension code.
相应于上述颜色标识型彩色二维图码的生成方法,本申请实施例还提供了一种颜色标识型彩色二维图码的生成装置,如图3所示,所述装置,可以包括:
Corresponding to the method for generating the color-coded color two-dimensional image code, the embodiment of the present application further provides a device for generating a color-coded color two-dimensional image code. As shown in FIG. 3, the device may include:
获取模块310,用于获取待编码的原始信息,并将其转化为二进制比特流数据;The obtaining module 310 is configured to obtain original information to be encoded and convert the data into binary bit stream data.
分组模块320,用于将所述二进制比特流数据进行分组,使分组所得组的数量与待置入矩阵的元素数量相同;a grouping module 320, configured to group the binary bit stream data, so that the number of groups obtained by the group is the same as the number of elements to be placed in the matrix;
其中,每一组数据包含预定位数的该二进制比特流数据,该预定位数基于预定颜色模型确定;Wherein each set of data includes the binary bit stream data of a predetermined number of bits, the predetermined number of bits being determined based on a predetermined color model;
置入模块330,用于将所述每一组数据按照预设规则置入所述待置入矩阵中,得到初始数据矩阵;The placing module 330 is configured to put the each set of data into the to-be-placed matrix according to a preset rule to obtain an initial data matrix;
元素扩大模块340,用于将所述初始数据矩阵中每一个元素扩大预定倍数,得到第一像素矩阵;An element expansion module 340, configured to expand each element in the initial data matrix by a predetermined multiple to obtain a first pixel matrix;
其中,该预定倍数基于该预定颜色模型确定;Wherein the predetermined multiple is determined based on the predetermined color model;
颜色确定模块350,用于根据预设的关于元素与颜色的对应关系,确定所述第一像素矩阵中的元素对应的颜色;a color determining module 350, configured to determine, according to a preset correspondence between elements and colors, a color corresponding to an element in the first pixel matrix;
生成模块360,用于将所确定出的颜色填充入待生成的彩色二维图码的数据存储区域中,并将预先为所述待编码的原始信息设置的特征信息填充入当前的所述彩色二维图码的特征信息区域中,完成彩色二维图码的生成。a generating module 360, configured to fill the determined color into a data storage area of the color two-dimensional image code to be generated, and fill the current color information with the feature information set in advance for the original information to be encoded. In the feature information area of the two-dimensional image code, the generation of the color two-dimensional image code is completed.
可见,本方案提供的一种颜色标识型彩色二维图码的生成装置中,首先获取待编码的原始信息,并将其转化为二进制比特流数据;将所述二进制比特流数据进行分组,使分组所得组的数量与待置入矩阵的元素数量相同,然后将所述每一组数据按照预设规则置入所述待置入矩阵中,得到初始数据矩阵;再将所述初始数据矩阵中每一个元素扩大预定倍数,得到第一像素矩阵后,根据预设的关于元素与颜色的对应关系,确定所述第一像素矩阵中的元素对应的颜色,最后将所确定出的颜色填充入待生成的彩色二维图码的数据存储区域中,并将预先为所述待编码的原始信息设置的特征信息填充入当前的所述彩色二维图码的特征信息区域中,完成彩色二维图码的生成。采用该生成装置生成的彩色二维图码中的颜色信息包含有效的原始信息,而不仅仅是视觉上的冲击。
It can be seen that, in the apparatus for generating a color-coded color two-dimensional image code provided by the present scheme, the original information to be encoded is first obtained and converted into binary bit stream data; the binary bit stream data is grouped, so that The number of groups obtained by grouping is the same as the number of elements to be placed in the matrix, and then each set of data is placed into the matrix to be placed according to a preset rule to obtain an initial data matrix; and then the initial data matrix is Each element is expanded by a predetermined multiple, and after the first pixel matrix is obtained, the color corresponding to the element in the first pixel matrix is determined according to a preset correspondence relationship between the element and the color, and finally the determined color is filled. In the data storage area of the generated color two-dimensional image code, the feature information set in advance for the original information to be encoded is filled into the feature information area of the current color two-dimensional image code to complete the color two-dimensional image. The generation of the code. The color information in the color two-dimensional code generated by the generating device contains valid original information, not just a visual impact.
具体的,该预定颜色模型为RGB模型;Specifically, the predetermined color model is an RGB model;
相应的,该预定位数为三位,该预定倍数为255倍。Correspondingly, the predetermined number of digits is three digits, and the predetermined multiple is 255 times.
具体的,该分组模块320具体用于:Specifically, the grouping module 320 is specifically configured to:
按照预定的遍历顺序,以三位为一组对所述二进制比特流数据进行分组;The binary bit stream data is grouped in groups of three bits according to a predetermined traversal sequence;
判断分组所得组的数量是否与所述待置入矩阵的元素数量相同,如果否,继续按照预定的遍历顺序,以三位为一组对该二进制比特流数据进行分组,直至满足组的数量要求,其中,该预定的遍历顺序为:从左到右的顺序或从右到左的顺序;Determining whether the number of groups obtained by the group is the same as the number of elements to be placed in the matrix, and if not, continuing to group the binary bit stream data in groups of three according to a predetermined traversal order until the number of groups is satisfied , wherein the predetermined traversal order is: left to right order or right to left order;
或者,or,
按照预定的遍历顺序,以三位为一组对该二进制比特流数据进行分组;Binding the binary bit stream data in groups of three bits according to a predetermined traversal sequence;
判断分组所得组的数量是否与该待置入矩阵的元素数量相同,如果否,将数字0作为该二进制比特流数据的补充二进制比特流数据,继续对当前分组所剩余的二进制比特流数据进行分组,直至满足组的数量要求,其中,该预定的遍历顺序为:从左到右的顺序或从右到左的顺序。Determining whether the number of groups obtained by the group is the same as the number of elements to be placed in the matrix, and if not, using the number 0 as supplementary binary bit stream data of the binary bit stream data, continuing to group the remaining binary bit stream data of the current packet Until the number of groups is met, wherein the predetermined traversal order is: left to right order or right to left order.
具体的,该置入模块330具体用于:Specifically, the placement module 330 is specifically configured to:
将该每一组数据按照Z字型走向顺次置入该待置入矩阵中,使该待置入矩阵中每个元素对应一组数据,得到初始数据矩阵。Each set of data is sequentially placed into the to-be-placed matrix according to the Z-shaped direction, so that each element to be placed in the matrix corresponds to a set of data, and an initial data matrix is obtained.
进一步的,该预设的关于元素与颜色的对应关系为:Further, the preset relationship between the element and the color is:
元素(0,0,0)对应黑色;元素(0,0,255)对应蓝色;元素(0,255,0)对应绿色;元素(0,255,255)对应青蓝色;元素(255,0,0)对应红色;元素(255,0,255)对应洋红色;元素(255,255,0)对应黄色;元素(255,255,255)对应白色。The element (0,0,0) corresponds to black; the element (0,0,255) corresponds to blue; the element (0,255,0) corresponds to green; the element (0,255,255) corresponds to cyan; element (255 , 0, 0) corresponds to red; elements (255, 0, 255) correspond to magenta; elements (255, 255, 0) correspond to yellow; elements (255, 255, 255) correspond to white.
更进一步的,本申请实施例所提供的一种颜色标识型彩色二维图码生成装置,还可以包括:Further, a color-coded color two-dimensional image code generating apparatus provided by the embodiment of the present application may further include:
掩模处理模块,用于在将该特征信息区域中的特征信息填充入当前的该彩色二维图码的特征信息区域中之后,对该特征信息区域进行掩模处理。
The mask processing module is configured to perform mask processing on the feature information region after the feature information in the feature information region is filled into the feature information region of the current color two-dimensional image code.
相应于上述颜色标识型彩色二维图码的识读方法,本申请实施例还提供了一种颜色标识型彩色二维图码的识读装置,如图4所示,所述装置,可以包括:Corresponding to the method for reading the color identification type color two-dimensional image code, the embodiment of the present application further provides a color identification type color two-dimensional image code reading device. As shown in FIG. 4, the device may include :
第二获取模块410,用于获取待识读的彩色二维图码的第二像素矩阵;a second acquiring module 410, configured to acquire a second pixel matrix of the color two-dimensional image code to be read;
其中,所述待识读的彩色二维图码为通过本申请实施例所提供的颜色标识型彩色二维图码的生成方法所生成的彩色二维图码。The color two-dimensional image code to be read is a color two-dimensional image code generated by the color identification type color two-dimensional image generation method provided by the embodiment of the present application.
元素缩小模块420,用于将所述第二像素矩阵中每一个元素缩小预定倍数,得到还原数据矩阵;An element reduction module 420, configured to reduce each element in the second pixel matrix by a predetermined multiple to obtain a restored data matrix;
分解模块430,用于按照生成所述彩色二维图码时所利用的预设规则的逆过程,将所述还原数据矩阵分解成由所述预定位数的二进制比特流数据组成的数据组;The decomposition module 430 is configured to decompose the restored data matrix into a data group consisting of the binary bit stream data of the predetermined number of bits according to an inverse process of a preset rule used when generating the color two-dimensional image code;
还原模块440,用于将所述数据组按照分组过程的逆过程,还原得到二进制比特流数据;a restoration module 440, configured to restore the data group according to an inverse process of the grouping process to obtain binary bit stream data;
解码模块450,用于将所述二进制比特流数据进行解码,得到原始信息,完成彩色二维图码的识读。The decoding module 450 is configured to decode the binary bit stream data to obtain original information, and complete reading of the color two-dimensional image code.
可见,本方案提供的一种颜色标识型彩色二维图码的识读装置,可以准确的识读通过本申请实施例所提供的颜色标识型彩色二维图码的生成方法所生成的彩色二维图码中存储的有效信息。It can be seen that the reading device of the color identification type color two-dimensional image code provided by the present embodiment can accurately read the color two generated by the method for generating the color identification type color two-dimensional image code provided by the embodiment of the present application. Valid information stored in the dimension code.
具体的,该元素缩小模块420具体用于:Specifically, the element reduction module 420 is specifically configured to:
对该第五像素矩阵进行纠错处理;Performing error correction processing on the fifth pixel matrix;
将纠错处理后的第二像素矩阵中每一个元素缩小预定倍数,确定出还原数据矩阵;Reducing each element in the second pixel matrix after the error correction processing by a predetermined multiple to determine a restored data matrix;
其中,该纠错处理包括:Wherein, the error correction processing comprises:
根据公式:计算出该第二
像素矩阵中的元素与预设的元素的欧氏距离值r1~r8,其中,x为该第二像素矩阵中的元素的R值,y为该第二像素矩阵中的元素的G值,z为该第二像素矩阵中的元素的B值,n=1,2…8,R、G、B分别为该预设的元素的R值、G值、B值;According to the formula: Calculating an Euclidean distance value r 1 r r 8 of an element in the second pixel matrix and a preset element, where x is an R value of an element in the second pixel matrix, and y is in the second pixel matrix The G value of the element, z is the B value of the element in the second pixel matrix, n=1, 2...8, and R, G, and B are respectively the R value, the G value, and the B value of the preset element;
比较该欧氏距离值r1~r8的大小,用值最小的rn对应的该预设的元素替换该第二像素矩阵中的元素,完成纠错处理;Comparing the magnitudes of the Euclidean distance values r 1 to r 8 , replacing the elements in the second pixel matrix with the preset elements corresponding to the smallest value r n to complete the error correction processing;
该预设的元素包括:The preset elements include:
(0,0,0)、(0,0,255)、(0,255,0)、(0,255,255)、(255,0,0)、(255,0,255)、(255,255,0)及(255,255,255)。(0,0,0), (0,0,255), (0,255,0), (0,255,255), (255,0,0), (255,0,255), (255 , 255, 0) and (255, 255, 255).
进一步的,本申请实施例所提供的一种颜色标识型彩色二维图码的识读装置,还可以包括:Further, the apparatus for reading a color-coded color two-dimensional image code provided by the embodiment of the present application may further include:
图像矫正处理模块,用于对该待识读的彩色二维图码进行图像增强和去噪操作处理。The image correction processing module is configured to perform image enhancement and denoising operation processing on the color two-dimensional image code to be read.
本申请还提供了一种应用程序,所述应用程序用于在运行时执行本申请实施例提供的颜色标识型彩色二维图码的生成方法。其中,颜色标识型彩色二维图码的生成方法包括:The application further provides an application for executing a method for generating a color-coded color two-dimensional image code provided by an embodiment of the present application at runtime. The method for generating the color identification type color two-dimensional image code includes:
获取待编码的原始信息,并将其转化为二进制比特流数据;Obtaining the original information to be encoded and converting it into binary bit stream data;
将所述二进制比特流数据进行分组,使分组所得组的数量与待置入矩阵的元素数量相同,其中,每一组数据包含预定位数的所述二进制比特流数据,所述预定位数基于预定颜色模型确定;And grouping the binary bit stream data such that the number of groups obtained by the group is the same as the number of elements to be placed in the matrix, wherein each group of data includes the binary bit stream data of a predetermined number of bits, the predetermined number of bits being based on The predetermined color model is determined;
将所述每一组数据按照预设规则置入所述待置入矩阵中,得到初始数据矩阵;And placing each set of data into the to-be-placed matrix according to a preset rule to obtain an initial data matrix;
将所述初始数据矩阵中每一个元素扩大预定倍数,得到第一像素矩阵,其中,所述预定倍数基于所述预定颜色模型确定;
Enlarging each element in the initial data matrix by a predetermined multiple to obtain a first pixel matrix, wherein the predetermined multiple is determined based on the predetermined color model;
根据预设的关于元素与颜色的对应关系,确定所述第一像素矩阵中的元素对应的颜色;Determining, according to a preset correspondence between elements and colors, a color corresponding to an element in the first pixel matrix;
将所确定出的颜色填充入待生成的彩色二维图码的数据存储区域中,并将预先为所述待编码的原始信息设置的特征信息填充入当前的所述彩色二维图码的特征信息区域中,完成彩色二维图码的生成。Filling the determined color into the data storage area of the color two-dimensional image code to be generated, and filling the feature information set in advance for the original information to be encoded into the current feature of the color two-dimensional image code In the information area, the generation of the color two-dimensional image code is completed.
可以看出,通过本申请实施例提供的应用程序的运行,生成的彩色二维图码中的颜色信息包含有效信息,而不仅仅是视觉上的冲击。It can be seen that, by the operation of the application provided by the embodiment of the present application, the color information in the generated color two-dimensional code contains valid information, not just a visual impact.
在本申请的一种实现方式中,所述预定颜色模型为RGB模型;In an implementation manner of the application, the predetermined color model is an RGB model;
相应的,所述预定位数为三位,所述预定倍数为255倍。Correspondingly, the predetermined number of bits is three bits, and the predetermined multiple is 255 times.
在本申请的一种实现方式中,所述将所述二进制比特流数据进行分组,包括:In an implementation manner of the application, the grouping the binary bit stream data includes:
按照预定的遍历顺序,以三位为一组对所述二进制比特流数据进行分组;The binary bit stream data is grouped in groups of three bits according to a predetermined traversal sequence;
判断分组所得组的数量是否与所述待置入矩阵的元素数量相同,如果否,继续按照预定的遍历顺序,以三位为一组对所述二进制比特流数据进行分组,直至满足组的数量要求,其中,所述预定的遍历顺序为:从左到右的顺序或从右到左的顺序;Determining whether the number of groups obtained by the group is the same as the number of elements to be placed in the matrix, and if not, continuing to group the binary bit stream data in groups of three according to a predetermined traversal order until the number of groups is satisfied a request, wherein the predetermined traversal order is: a sequence from left to right or a sequence from right to left;
或者,or,
所述将所述二进制比特流数据进行分组,包括:The grouping the binary bit stream data includes:
按照预定的遍历顺序,以三位为一组对所述二进制比特流数据进行分组;The binary bit stream data is grouped in groups of three bits according to a predetermined traversal sequence;
判断分组所得组的数量是否与所述待置入矩阵的元素数量相同,如果否,将数字0作为所述二进制比特流数据的补充二进制比特流数据,继续对当前分组所剩余的二进制比特流数据进行分组,直至满足组的数量要求,其中,所述预定的遍历顺序为:从左到右的顺序或从右到左的顺序。Determining whether the number of groups obtained by the group is the same as the number of elements to be placed in the matrix, and if not, using the number 0 as supplementary binary bit stream data of the binary bit stream data, continuing the binary bit stream data remaining for the current packet The grouping is performed until the number of groups is satisfied, wherein the predetermined traversal order is: left to right order or right to left order.
在本申请的一种实现方式中,所述将所述每一组数据按照预设规则置入所述待置入矩阵中,得到初始数据矩阵具体为:
In an implementation manner of the present application, the data is placed in the to-be-placed matrix according to a preset rule, and the initial data matrix is specifically:
将所述每一组数据按照Z字型走向顺次置入所述待置入矩阵中,使所述待置入矩阵中每个元素对应一组数据,得到初始数据矩阵。Each set of data is sequentially placed into the matrix to be placed in a zigzag pattern, so that each element to be placed in the matrix corresponds to a set of data, and an initial data matrix is obtained.
在本申请的一种实现方式中,所述预设的关于元素与颜色的对应关系为:In an implementation manner of the application, the preset correspondence between the element and the color is:
元素(0,0,0)对应黑色;元素(0,0,255)对应蓝色;元素(0,255,0)对应绿色;元素(0,255,255)对应青蓝色;元素(255,0,0)对应红色;元素(255,0,255)对应洋红色;元素(255,255,0)对应黄色;元素(255,255,255)对应白色。The element (0,0,0) corresponds to black; the element (0,0,255) corresponds to blue; the element (0,255,0) corresponds to green; the element (0,255,255) corresponds to cyan; element (255 , 0, 0) corresponds to red; elements (255, 0, 255) correspond to magenta; elements (255, 255, 0) correspond to yellow; elements (255, 255, 255) correspond to white.
在本申请的一种实现方式中,所述将所述特征信息区域中的特征信息填充入当前的所述彩色二维图码的特征信息区域中之后,还包括:In an implementation manner of the present application, after the feature information in the feature information area is filled into the feature information area of the current color two-dimensional code, the method further includes:
对所述特征信息区域进行掩模处理。Masking the feature information area.
对于应用程序实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。For the application embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiment.
另外,根据本申请的实施例,还提供了一种存储介质,该存储介质用于存储应用程序,该应用程序用于在运行时执行本申请实施例提供的颜色标识型彩色二维图码的识读方法。其中,颜色标识型彩色二维图码的识读方法包括:In addition, according to an embodiment of the present application, a storage medium is further provided, where the storage medium is used to execute the color identification type color two-dimensional image code provided by the embodiment of the present application at runtime. Reading method. The method for reading the color identification type color two-dimensional image code includes:
获取待编码的原始信息,并将其转化为二进制比特流数据;Obtaining the original information to be encoded and converting it into binary bit stream data;
将所述二进制比特流数据进行分组,使分组所得组的数量与待置入矩阵的元素数量相同,其中,每一组数据包含预定位数的所述二进制比特流数据,所述预定位数基于预定颜色模型确定;And grouping the binary bit stream data such that the number of groups obtained by the group is the same as the number of elements to be placed in the matrix, wherein each group of data includes the binary bit stream data of a predetermined number of bits, the predetermined number of bits being based on The predetermined color model is determined;
将所述每一组数据按照预设规则置入所述待置入矩阵中,得到初始数据矩阵;And placing each set of data into the to-be-placed matrix according to a preset rule to obtain an initial data matrix;
将所述初始数据矩阵中每一个元素扩大预定倍数,得到第一像素矩阵,其中,所述预定倍数基于所述预定颜色模型确定;Enlarging each element in the initial data matrix by a predetermined multiple to obtain a first pixel matrix, wherein the predetermined multiple is determined based on the predetermined color model;
根据预设的关于元素与颜色的对应关系,确定所述第一像素矩阵中的元
素对应的颜色;Determining a element in the first pixel matrix according to a preset correspondence between elements and colors
The color corresponding to the prime;
将所确定出的颜色填充入待生成的彩色二维图码的数据存储区域中,并将预先为所述待编码的原始信息设置的特征信息填充入当前的所述彩色二维图码的特征信息区域中,完成彩色二维图码的生成。Filling the determined color into the data storage area of the color two-dimensional image code to be generated, and filling the feature information set in advance for the original information to be encoded into the current feature of the color two-dimensional image code In the information area, the generation of the color two-dimensional image code is completed.
可以看出,通过本申请实施例提供的应用程序的运行,生成的彩色二维图码中的颜色信息包含有效信息,而不仅仅是视觉上的冲击。It can be seen that, by the operation of the application provided by the embodiment of the present application, the color information in the generated color two-dimensional code contains valid information, not just a visual impact.
在本申请的一种实现方式中,所述预定颜色模型为RGB模型;In an implementation manner of the application, the predetermined color model is an RGB model;
相应的,所述预定位数为三位,所述预定倍数为255倍。Correspondingly, the predetermined number of bits is three bits, and the predetermined multiple is 255 times.
在本申请的一种实现方式中,所述将所述二进制比特流数据进行分组,包括:In an implementation manner of the application, the grouping the binary bit stream data includes:
按照预定的遍历顺序,以三位为一组对所述二进制比特流数据进行分组;The binary bit stream data is grouped in groups of three bits according to a predetermined traversal sequence;
判断分组所得组的数量是否与所述待置入矩阵的元素数量相同,如果否,继续按照预定的遍历顺序,以三位为一组对所述二进制比特流数据进行分组,直至满足组的数量要求,其中,所述预定的遍历顺序为:从左到右的顺序或从右到左的顺序;Determining whether the number of groups obtained by the group is the same as the number of elements to be placed in the matrix, and if not, continuing to group the binary bit stream data in groups of three according to a predetermined traversal order until the number of groups is satisfied a request, wherein the predetermined traversal order is: a sequence from left to right or a sequence from right to left;
或者,or,
所述将所述二进制比特流数据进行分组,包括:The grouping the binary bit stream data includes:
按照预定的遍历顺序,以三位为一组对所述二进制比特流数据进行分组;The binary bit stream data is grouped in groups of three bits according to a predetermined traversal sequence;
判断分组所得组的数量是否与所述待置入矩阵的元素数量相同,如果否,将数字0作为所述二进制比特流数据的补充二进制比特流数据,继续对当前分组所剩余的二进制比特流数据进行分组,直至满足组的数量要求,其中,所述预定的遍历顺序为:从左到右的顺序或从右到左的顺序。Determining whether the number of groups obtained by the group is the same as the number of elements to be placed in the matrix, and if not, using the number 0 as supplementary binary bit stream data of the binary bit stream data, continuing the binary bit stream data remaining for the current packet The grouping is performed until the number of groups is satisfied, wherein the predetermined traversal order is: left to right order or right to left order.
在本申请的一种实现方式中,所述将所述每一组数据按照预设规则置入所述待置入矩阵中,得到初始数据矩阵具体为:In an implementation manner of the present application, the data is placed in the to-be-placed matrix according to a preset rule, and the initial data matrix is specifically:
将所述每一组数据按照Z字型走向顺次置入所述待置入矩阵中,使所述
待置入矩阵中每个元素对应一组数据,得到初始数据矩阵。Inserting each set of data into the matrix to be placed in a zigzag manner in a zigzag manner, so that the
Each element to be placed in the matrix corresponds to a set of data, and an initial data matrix is obtained.
在本申请的一种实现方式中,所述预设的关于元素与颜色的对应关系为:In an implementation manner of the application, the preset correspondence between the element and the color is:
元素(0,0,0)对应黑色;元素(0,0,255)对应蓝色;元素(0,255,0)对应绿色;元素(0,255,255)对应青蓝色;元素(255,0,0)对应红色;元素(255,0,255)对应洋红色;元素(255,255,0)对应黄色;元素(255,255,255)对应白色。The element (0,0,0) corresponds to black; the element (0,0,255) corresponds to blue; the element (0,255,0) corresponds to green; the element (0,255,255) corresponds to cyan; element (255 , 0, 0) corresponds to red; elements (255, 0, 255) correspond to magenta; elements (255, 255, 0) correspond to yellow; elements (255, 255, 255) correspond to white.
在本申请的一种实现方式中,所述将所述特征信息区域中的特征信息填充入当前的所述彩色二维图码的特征信息区域中之后,还包括:In an implementation manner of the present application, after the feature information in the feature information area is filled into the feature information area of the current color two-dimensional code, the method further includes:
对所述特征信息区域进行掩模处理。Masking the feature information area.
对于存储介质实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。For the storage medium embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiment.
另外,根据本申请的实施例,还提供了一种电子设备,适用于颜色标识型彩色二维图码的生成,所述电子设备包括:In addition, according to an embodiment of the present application, an electronic device is further provided, which is suitable for generating a color identification type color two-dimensional image code, and the electronic device includes:
壳体、处理器、存储器、电路板和电源电路,其中,电路板安置在壳体围成的空间内部,处理器和存储器设置在电路板上;电源电路,用于为电子设备的各个电路或器件供电;存储器用于存储可执行程序代码;处理器通过读取存储器中存储的可执行程序代码来运行与可执行程序代码对应的程序,以用于执行以下步骤:a housing, a processor, a memory, a circuit board, and a power supply circuit, wherein the circuit board is disposed inside the space enclosed by the housing, the processor and the memory are disposed on the circuit board; and the power supply circuit is used for each circuit of the electronic device or The device is powered; the memory is for storing executable program code; the processor runs the program corresponding to the executable program code by reading the executable program code stored in the memory for performing the following steps:
获取待编码的原始信息,并将其转化为二进制比特流数据;Obtaining the original information to be encoded and converting it into binary bit stream data;
将所述二进制比特流数据进行分组,使分组所得组的数量与待置入矩阵的元素数量相同,其中,每一组数据包含预定位数的所述二进制比特流数据,所述预定位数基于预定颜色模型确定;And grouping the binary bit stream data such that the number of groups obtained by the group is the same as the number of elements to be placed in the matrix, wherein each group of data includes the binary bit stream data of a predetermined number of bits, the predetermined number of bits being based on The predetermined color model is determined;
将所述每一组数据按照预设规则置入所述待置入矩阵中,得到初始数据矩阵;And placing each set of data into the to-be-placed matrix according to a preset rule to obtain an initial data matrix;
将所述初始数据矩阵中每一个元素扩大预定倍数,得到第一像素矩阵,
其中,所述预定倍数基于所述预定颜色模型确定;Enlarging each element in the initial data matrix by a predetermined multiple to obtain a first pixel matrix,
Wherein the predetermined multiple is determined based on the predetermined color model;
根据预设的关于元素与颜色的对应关系,确定所述第一像素矩阵中的元素对应的颜色;Determining, according to a preset correspondence between elements and colors, a color corresponding to an element in the first pixel matrix;
将所确定出的颜色填充入待生成的彩色二维图码的数据存储区域中,并将预先为所述待编码的原始信息设置的特征信息填充入当前的所述彩色二维图码的特征信息区域中,完成彩色二维图码的生成。Filling the determined color into the data storage area of the color two-dimensional image code to be generated, and filling the feature information set in advance for the original information to be encoded into the current feature of the color two-dimensional image code In the information area, the generation of the color two-dimensional image code is completed.
在本实施例中,该电子设备可以以多种形式存在,包括但不限于:In this embodiment, the electronic device may exist in various forms including, but not limited to:
(1)移动通信设备:这类设备的特点是具备移动通信功能,并且以提供话音、数据通信为主要目标。这类终端包括:智能手机(例如iPhone)、多媒体手机、功能性手机以及低端手机等。(1) Mobile communication devices: These devices are characterized by mobile communication functions and are mainly aimed at providing voice and data communication. Such terminals include: smart phones (such as iPhone), multimedia phones, functional phones, and low-end phones.
(2)超移动个人计算机设备:这类设备属于个人计算机的范畴,有计算和处理功能,一般也具备移动上网特性。这类终端包括:PDA、MID和UMPC设备等,例如iPad。(2) Ultra-mobile personal computer equipment: This type of equipment belongs to the category of personal computers, has computing and processing functions, and generally has mobile Internet access. Such terminals include: PDAs, MIDs, and UMPC devices, such as the iPad.
(3)便携式娱乐设备:这类设备可以显示和播放多媒体内容。该类设备包括:音频、视频播放器(例如iPod),掌上游戏机,电子书,以及智能玩具和便携式车载导航设备。(3) Portable entertainment devices: These devices can display and play multimedia content. Such devices include: audio, video players (such as iPod), handheld game consoles, e-books, and smart toys and portable car navigation devices.
(4)服务器:提供计算服务的设备,服务器的构成包括处理器、硬盘、内存、***总线等,服务器和通用的计算机架构类似,但是由于需要提供高可靠的服务,因此在处理能力、稳定性、可靠性、安全性、可扩展性、可管理性等方面要求较高。(4) Server: A device that provides computing services. The server consists of a processor, a hard disk, a memory, a system bus, etc. The server is similar to a general-purpose computer architecture, but because of the need to provide highly reliable services, processing power and stability High reliability in terms of reliability, security, scalability, and manageability.
(5)其他具有数据交互功能的电子装置。(5) Other electronic devices with data interaction functions.
可以看出,本申请实施例提供的方案中,生成的彩色二维图码中的颜色信息包含有效信息,而不仅仅是视觉上的冲击。It can be seen that, in the solution provided by the embodiment of the present application, the color information in the generated color two-dimensional image code contains valid information, not just a visual impact.
在本申请的一种实现方式中,所述预定颜色模型为RGB模型;In an implementation manner of the application, the predetermined color model is an RGB model;
相应的,所述预定位数为三位,所述预定倍数为255倍。
Correspondingly, the predetermined number of bits is three bits, and the predetermined multiple is 255 times.
在本申请的一种实现方式中,上述处理器通过读取存储器中存储的可执行程序代码来运行与可执行程序代码对应的程序,所执行的所述将所述二进制比特流数据进行分组,包括:In an implementation manner of the present application, the processor runs a program corresponding to the executable program code by reading executable program code stored in the memory, and the performing the binary bit stream data is grouped, include:
按照预定的遍历顺序,以三位为一组对所述二进制比特流数据进行分组;The binary bit stream data is grouped in groups of three bits according to a predetermined traversal sequence;
判断分组所得组的数量是否与所述待置入矩阵的元素数量相同,如果否,继续按照预定的遍历顺序,以三位为一组对所述二进制比特流数据进行分组,直至满足组的数量要求,其中,所述预定的遍历顺序为:从左到右的顺序或从右到左的顺序;Determining whether the number of groups obtained by the group is the same as the number of elements to be placed in the matrix, and if not, continuing to group the binary bit stream data in groups of three according to a predetermined traversal order until the number of groups is satisfied a request, wherein the predetermined traversal order is: a sequence from left to right or a sequence from right to left;
或者,or,
所述将所述二进制比特流数据进行分组,包括:The grouping the binary bit stream data includes:
按照预定的遍历顺序,以三位为一组对所述二进制比特流数据进行分组;The binary bit stream data is grouped in groups of three bits according to a predetermined traversal sequence;
判断分组所得组的数量是否与所述待置入矩阵的元素数量相同,如果否,将数字0作为所述二进制比特流数据的补充二进制比特流数据,继续对当前分组所剩余的二进制比特流数据进行分组,直至满足组的数量要求,其中,所述预定的遍历顺序为:从左到右的顺序或从右到左的顺序。Determining whether the number of groups obtained by the group is the same as the number of elements to be placed in the matrix, and if not, using the number 0 as supplementary binary bit stream data of the binary bit stream data, continuing the binary bit stream data remaining for the current packet The grouping is performed until the number of groups is satisfied, wherein the predetermined traversal order is: left to right order or right to left order.
在本申请的一种实现方式中,上述处理器通过读取存储器中存储的可执行程序代码来运行与可执行程序代码对应的程序,所执行的所述将所述每一组数据按照预设规则置入所述待置入矩阵中,得到初始数据矩阵具体为:In an implementation manner of the present application, the processor runs a program corresponding to the executable program code by reading executable program code stored in the memory, and the performing the each group of data according to the preset The rule is placed in the matrix to be placed, and the initial data matrix is obtained as follows:
将所述每一组数据按照Z字型走向顺次置入所述待置入矩阵中,使所述待置入矩阵中每个元素对应一组数据,得到初始数据矩阵。Each set of data is sequentially placed into the matrix to be placed in a zigzag pattern, so that each element to be placed in the matrix corresponds to a set of data, and an initial data matrix is obtained.
在本申请的一种实现方式中,所述预设的关于元素与颜色的对应关系为:In an implementation manner of the application, the preset correspondence between the element and the color is:
元素(0,0,0)对应黑色;元素(0,0,255)对应蓝色;元素(0,255,0)对应绿色;元素(0,255,255)对应青蓝色;元素(255,0,0)对应红色;元素(255,0,255)对应洋红色;元素(255,255,0)对应黄色;元素(255,255,255)对应白色。The element (0,0,0) corresponds to black; the element (0,0,255) corresponds to blue; the element (0,255,0) corresponds to green; the element (0,255,255) corresponds to cyan; element (255 , 0, 0) corresponds to red; elements (255, 0, 255) correspond to magenta; elements (255, 255, 0) correspond to yellow; elements (255, 255, 255) correspond to white.
在本申请的一种实现方式中,上述处理器通过读取存储器中存储的可执行程序代码来运行与可执行程序代码对应的程序,所执行的所述将所述特征
信息区域中的特征信息填充入当前的所述彩色二维图码的特征信息区域中之后,还包括:In an implementation manner of the present application, the processor runs a program corresponding to the executable program code by reading executable program code stored in the memory, and the executed feature is performed.
After the feature information in the information area is filled in the feature information area of the current color two-dimensional image code, the method further includes:
对所述特征信息区域进行掩模处理。Masking the feature information area.
对于电子设备实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。For the electronic device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiment.
本申请还提供了一种应用程序,该应用程序用于在运行时执行本申请实施例提供的颜色标识型彩色二维图码的识读方法。其中,颜色标识型彩色二维图码的识读方法包括:The application also provides an application program for performing the reading method of the color-coded color two-dimensional image code provided by the embodiment of the present application at runtime. The method for reading the color identification type color two-dimensional image code includes:
获取待识读的彩色二维图码的第二像素矩阵,其中,所述待识读的彩色二维图码为通过上述方法生成的彩色二维图码;Obtaining a second pixel matrix of the color two-dimensional image code to be read, wherein the color two-dimensional image code to be read is a color two-dimensional image code generated by the above method;
将所述第二像素矩阵中每一个元素缩小预定倍数,得到还原数据矩阵;Reducing each element in the second pixel matrix by a predetermined multiple to obtain a restored data matrix;
按照生成所述彩色二维图码时所利用的预设规则的逆过程,将所述还原数据矩阵分解成由所述预定位数的二进制比特流数据组成的数据组;And decomposing the restored data matrix into a data group consisting of the predetermined bit number of binary bit stream data according to an inverse process of a preset rule used when generating the color two-dimensional image code;
将所述数据组按照生成所述彩色二维图码时所利用的分组过程的逆过程,还原得到二进制比特流数据;Converting the data set to binary bit stream data according to an inverse process of a grouping process utilized when generating the color two-dimensional code code;
将所述二进制比特流数据进行解码,得到原始信息,完成彩色二维图码的识读。The binary bit stream data is decoded to obtain original information, and the reading of the color two-dimensional image code is completed.
可以看出,通过本申请实施例提供的应用程序的运行,可以准确的识读通过本申请实施例所提供的颜色标识型彩色二维图码的生成方法所生成彩色二维图码中存储的有效信息。It can be seen that, by using the application program provided by the embodiment of the present application, the color two-dimensional image code generated by the method for generating the color identification type color two-dimensional image code provided by the embodiment of the present application can be accurately read and stored. Valid information.
在本申请的一种实现方式中,所述将所述第二像素矩阵中每一个元素缩小预定倍数,得到还原数据矩阵,包括:In an implementation manner of the present application, the reducing a predetermined multiple of each element in the second pixel matrix to obtain a restored data matrix includes:
对所述第二像素矩阵进行纠错处理;Performing error correction processing on the second pixel matrix;
将纠错处理后的第二像素矩阵中每一个元素缩小预定倍数,确定出还原
数据矩阵;Reducing each element in the second pixel matrix after the error correction processing by a predetermined multiple to determine the reduction
Data matrix
其中,所述纠错处理包括:Wherein, the error correction processing comprises:
根据公式:计算出所述第二像素矩阵中的元素与预设的元素的欧氏距离值r1~r8,其中,x为所述第二像素矩阵中的元素的R值,y为所述第二像素矩阵中的元素的G值,z为所述第二像素矩阵中的元素的B值,n=1,2…8,R、G、B分别为所述预设的元素的R值、G值、B值;According to the formula: Calculating an Euclidean distance value r 1 r r 8 of an element in the second pixel matrix and a preset element, where x is an R value of an element in the second pixel matrix, and y is the second a G value of an element in the pixel matrix, z is a B value of an element in the second pixel matrix, n=1, 2...8, and R, G, and B are respectively R values of the preset element, G Value, B value;
比较所述欧氏距离值r1~r8的大小,用值最小的rn对应的所述预设的元素替换所述第二像素矩阵中的元素,完成纠错处理;Comparing the magnitudes of the Euclidean distance values r 1 to r 8 , replacing the elements in the second pixel matrix with the preset elements corresponding to the smallest value r n , and completing the error correction processing;
其中,所述预设的元素包括:The preset elements include:
(0,0,0)、(0,0,255)、(0,255,0)、(0,255,255)、(255,0,0)、(255,0,255)、(255,255,0)及(255,255,255)。(0,0,0), (0,0,255), (0,255,0), (0,255,255), (255,0,0), (255,0,255), (255 , 255, 0) and (255, 255, 255).
对于应用程序实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。For the application embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiment.
另外,根据本申请的实施例,还提供了一种存储介质,该存储介质用于存储应用程序,该应用程序用于在运行时执行本申请实施例提供的颜色标识型彩色二维图码的识读方法。其中,颜色标识型彩色二维图码的识读方法包括:In addition, according to an embodiment of the present application, a storage medium is further provided, where the storage medium is used to execute the color identification type color two-dimensional image code provided by the embodiment of the present application at runtime. Reading method. The method for reading the color identification type color two-dimensional image code includes:
获取待识读的彩色二维图码的第二像素矩阵,其中,所述待识读的彩色二维图码为通过上述方法生成的彩色二维图码;Obtaining a second pixel matrix of the color two-dimensional image code to be read, wherein the color two-dimensional image code to be read is a color two-dimensional image code generated by the above method;
将所述第二像素矩阵中每一个元素缩小预定倍数,得到还原数据矩阵;Reducing each element in the second pixel matrix by a predetermined multiple to obtain a restored data matrix;
按照生成所述彩色二维图码时所利用的预设规则的逆过程,将所述还原数据矩阵分解成由所述预定位数的二进制比特流数据组成的数据组;
And decomposing the restored data matrix into a data group consisting of the predetermined bit number of binary bit stream data according to an inverse process of a preset rule used when generating the color two-dimensional image code;
将所述数据组按照生成所述彩色二维图码时所利用的分组过程的逆过程,还原得到二进制比特流数据;Converting the data set to binary bit stream data according to an inverse process of a grouping process utilized when generating the color two-dimensional code code;
将所述二进制比特流数据进行解码,得到原始信息,完成彩色二维图码的识读。The binary bit stream data is decoded to obtain original information, and the reading of the color two-dimensional image code is completed.
可以看出,通过本申请实施例提供的应用程序的运行,可以准确的识读通过本申请实施例所提供的颜色标识型彩色二维图码的生成方法所生成彩色二维图码中存储的有效信息。It can be seen that, by using the application program provided by the embodiment of the present application, the color two-dimensional image code generated by the method for generating the color identification type color two-dimensional image code provided by the embodiment of the present application can be accurately read and stored. Valid information.
在本申请的一种实现方式中,所述将所述第二像素矩阵中每一个元素缩小预定倍数,得到还原数据矩阵,包括:In an implementation manner of the present application, the reducing a predetermined multiple of each element in the second pixel matrix to obtain a restored data matrix includes:
对所述第二像素矩阵进行纠错处理;Performing error correction processing on the second pixel matrix;
将纠错处理后的第二像素矩阵中每一个元素缩小预定倍数,确定出还原数据矩阵;Reducing each element in the second pixel matrix after the error correction processing by a predetermined multiple to determine a restored data matrix;
其中,所述纠错处理包括:Wherein, the error correction processing comprises:
根据公式:计算出所述第二像素矩阵中的元素与预设的元素的欧氏距离值r1~r8,其中,x为所述第二像素矩阵中的元素的R值,y为所述第二像素矩阵中的元素的G值,z为所述第二像素矩阵中的元素的B值,n=1,2…8,R、G、B分别为所述预设的元素的R值、G值、B值;According to the formula: Calculating an Euclidean distance value r 1 r r 8 of an element in the second pixel matrix and a preset element, where x is an R value of an element in the second pixel matrix, and y is the second a G value of an element in the pixel matrix, z is a B value of an element in the second pixel matrix, n=1, 2...8, and R, G, and B are respectively R values of the preset element, G Value, B value;
比较所述欧氏距离值r1~r8的大小,用值最小的rn对应的所述预设的元素替换所述第二像素矩阵中的元素,完成纠错处理;Comparing the magnitudes of the Euclidean distance values r 1 to r 8 , replacing the elements in the second pixel matrix with the preset elements corresponding to the smallest value r n , and completing the error correction processing;
其中,所述预设的元素包括:The preset elements include:
(0,0,0)、(0,0,255)、(0,255,0)、(0,255,255)、(255,0,0)、(255,0,255)、(255,255,0)及(255,255,255)。
(0,0,0), (0,0,255), (0,255,0), (0,255,255), (255,0,0), (255,0,255), (255 , 255, 0) and (255, 255, 255).
对于存储介质实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。For the storage medium embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiment.
另外,根据本申请的实施例,还提供了一种电子设备,适用于颜色标识型彩色二维图码的识读,所述电子设备包括:In addition, according to an embodiment of the present application, an electronic device is further provided, which is suitable for reading color-coded color two-dimensional image code, and the electronic device includes:
壳体、处理器、存储器、电路板和电源电路,其中,电路板安置在壳体围成的空间内部,处理器和存储器设置在电路板上;电源电路,用于为电子设备的各个电路或器件供电;存储器用于存储可执行程序代码;处理器通过读取存储器中存储的可执行程序代码来运行与可执行程序代码对应的程序,以用于执行以下步骤:a housing, a processor, a memory, a circuit board, and a power supply circuit, wherein the circuit board is disposed inside the space enclosed by the housing, the processor and the memory are disposed on the circuit board; and the power supply circuit is used for each circuit of the electronic device or The device is powered; the memory is for storing executable program code; the processor runs the program corresponding to the executable program code by reading the executable program code stored in the memory for performing the following steps:
获取待识读的彩色二维图码的第二像素矩阵,其中,所述待识读的彩色二维图码为通过上述方法生成的彩色二维图码;Obtaining a second pixel matrix of the color two-dimensional image code to be read, wherein the color two-dimensional image code to be read is a color two-dimensional image code generated by the above method;
将所述第二像素矩阵中每一个元素缩小预定倍数,得到还原数据矩阵;Reducing each element in the second pixel matrix by a predetermined multiple to obtain a restored data matrix;
按照生成所述彩色二维图码时所利用的预设规则的逆过程,将所述还原数据矩阵分解成由所述预定位数的二进制比特流数据组成的数据组;And decomposing the restored data matrix into a data group consisting of the predetermined bit number of binary bit stream data according to an inverse process of a preset rule used when generating the color two-dimensional image code;
将所述数据组按照生成所述彩色二维图码时所利用的分组过程的逆过程,还原得到二进制比特流数据;Converting the data set to binary bit stream data according to an inverse process of a grouping process utilized when generating the color two-dimensional code code;
将所述二进制比特流数据进行解码,得到原始信息,完成彩色二维图码的识读。The binary bit stream data is decoded to obtain original information, and the reading of the color two-dimensional image code is completed.
在本实施例中,该电子设备可以以多种形式存在,包括但不限于:In this embodiment, the electronic device may exist in various forms including, but not limited to:
(1)移动通信设备:这类设备的特点是具备移动通信功能,并且以提供话音、数据通信为主要目标。这类终端包括:智能手机(例如iPhone)、多媒体手机、功能性手机以及低端手机等。(1) Mobile communication devices: These devices are characterized by mobile communication functions and are mainly aimed at providing voice and data communication. Such terminals include: smart phones (such as iPhone), multimedia phones, functional phones, and low-end phones.
(2)超移动个人计算机设备:这类设备属于个人计算机的范畴,有计算和处理功能,一般也具备移动上网特性。这类终端包括:PDA、MID和UMPC设备等,例如iPad。
(2) Ultra-mobile personal computer equipment: This type of equipment belongs to the category of personal computers, has computing and processing functions, and generally has mobile Internet access. Such terminals include: PDAs, MIDs, and UMPC devices, such as the iPad.
(3)便携式娱乐设备:这类设备可以显示和播放多媒体内容。该类设备包括:音频、视频播放器(例如iPod),掌上游戏机,电子书,以及智能玩具和便携式车载导航设备。(3) Portable entertainment devices: These devices can display and play multimedia content. Such devices include: audio, video players (such as iPod), handheld game consoles, e-books, and smart toys and portable car navigation devices.
(4)服务器:提供计算服务的设备,服务器的构成包括处理器、硬盘、内存、***总线等,服务器和通用的计算机架构类似,但是由于需要提供高可靠的服务,因此在处理能力、稳定性、可靠性、安全性、可扩展性、可管理性等方面要求较高。(4) Server: A device that provides computing services. The server consists of a processor, a hard disk, a memory, a system bus, etc. The server is similar to a general-purpose computer architecture, but because of the need to provide highly reliable services, processing power and stability High reliability in terms of reliability, security, scalability, and manageability.
(5)其他具有数据交互功能的电子装置。(5) Other electronic devices with data interaction functions.
可以看出,本实施例中,可以准确的识读通过本申请实施例所提供的颜色标识型彩色二维图码的生成方法所生成彩色二维图码中存储的有效信息。It can be seen that, in this embodiment, the valid information stored in the color two-dimensional image code generated by the method for generating the color-coded color two-dimensional image code provided by the embodiment of the present application can be accurately read.
在本申请的一种实现方式中,上述处理器通过读取存储器中存储的可执行程序代码来运行与可执行程序代码对应的程序,所执行的所述将所述第二像素矩阵中每一个元素缩小预定倍数,得到还原数据矩阵,包括:In an implementation manner of the present application, the processor runs a program corresponding to the executable program code by reading executable program code stored in the memory, and the executed each of the second pixel matrix The element is reduced by a predetermined multiple to obtain a restored data matrix, including:
对所述第二像素矩阵进行纠错处理;Performing error correction processing on the second pixel matrix;
将纠错处理后的第二像素矩阵中每一个元素缩小预定倍数,确定出还原数据矩阵;Reducing each element in the second pixel matrix after the error correction processing by a predetermined multiple to determine a restored data matrix;
其中,所述纠错处理包括:Wherein, the error correction processing comprises:
根据公式:计算出所述第二像素矩阵中的元素与预设的元素的欧氏距离值r1~r8,其中,x为所述第二像素矩阵中的元素的R值,y为所述第二像素矩阵中的元素的G值,z为所述第二像素矩阵中的元素的B值,n=1,2…8,R、G、B分别为所述预设的元素的R值、G值、B值;According to the formula: Calculating an Euclidean distance value r 1 r r 8 of an element in the second pixel matrix and a preset element, where x is an R value of an element in the second pixel matrix, and y is the second a G value of an element in the pixel matrix, z is a B value of an element in the second pixel matrix, n=1, 2...8, and R, G, and B are respectively R values of the preset element, G Value, B value;
比较所述欧氏距离值r1~r8的大小,用值最小的rn对应的所述预设的元素
替换所述第二像素矩阵中的元素,完成纠错处理;Comparing the magnitudes of the Euclidean distance values r 1 to r 8 , replacing the elements in the second pixel matrix with the preset elements corresponding to the smallest value r n , and completing the error correction processing;
其中,所述预设的元素包括:The preset elements include:
(0,0,0)、(0,0,255)、(0,255,0)、(0,255,255)、(255,0,0)、(255,0,255)、(255,255,0)及(255,255,255)。(0,0,0), (0,0,255), (0,255,0), (0,255,255), (255,0,0), (255,0,255), (255 , 255, 0) and (255, 255, 255).
对于电子设备实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。For the electronic device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiment.
需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should be noted that, in this context, relational terms such as first and second are used merely to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply such entities or operations. There is any such actual relationship or order between them. Furthermore, the term "comprises" or "comprises" or "comprises" or any other variations thereof is intended to encompass a non-exclusive inclusion, such that a process, method, article, or device that comprises a plurality of elements includes not only those elements but also Other elements, or elements that are inherent to such a process, method, item, or device. An element that is defined by the phrase "comprising a ..." does not exclude the presence of additional equivalent elements in the process, method, item, or device that comprises the element.
本说明书中的各个实施例均采用相关的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于装置实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。The various embodiments in the present specification are described in a related manner, and the same or similar parts between the various embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiment.
本领域普通技术人员可以理解实现上述方法实施方式中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,所述的程序可以存储于计算机可读取存储介质中,这里所称得的存储介质,如:ROM/RAM、磁碟、光盘等。One of ordinary skill in the art can understand that all or part of the steps in implementing the above method embodiments can be completed by a program to instruct related hardware, and the program can be stored in a computer readable storage medium, which is referred to herein. Storage media such as ROM/RAM, disk, CD, etc.
以上所述仅为本申请的较佳实施例而已,并非用于限定本申请的保护范围。凡在本申请的精神和原则之内所作的任何修改、等同替换、改进等,均包含在本申请的保护范围内。
The above description is only the preferred embodiment of the present application, and is not intended to limit the scope of the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application are included in the scope of the present application.
Claims (16)
- 一种颜色标识型彩色二维图码的生成方法,其特征在于,包括:A method for generating a color identification type color two-dimensional image code, comprising:获取待编码的原始信息,并将其转化为二进制比特流数据;Obtaining the original information to be encoded and converting it into binary bit stream data;将所述二进制比特流数据进行分组,使分组所得组的数量与待置入矩阵的元素数量相同,其中,每一组数据包含预定位数的所述二进制比特流数据,所述预定位数基于预定颜色模型确定;And grouping the binary bit stream data such that the number of groups obtained by the group is the same as the number of elements to be placed in the matrix, wherein each group of data includes the binary bit stream data of a predetermined number of bits, the predetermined number of bits being based on The predetermined color model is determined;将所述每一组数据按照预设规则置入所述待置入矩阵中,得到初始数据矩阵;And placing each set of data into the to-be-placed matrix according to a preset rule to obtain an initial data matrix;将所述初始数据矩阵中每一个元素扩大预定倍数,得到第一像素矩阵,其中,所述预定倍数基于所述预定颜色模型确定;Enlarging each element in the initial data matrix by a predetermined multiple to obtain a first pixel matrix, wherein the predetermined multiple is determined based on the predetermined color model;根据预设的关于元素与颜色的对应关系,确定所述第一像素矩阵中的元素对应的颜色;Determining, according to a preset correspondence between elements and colors, a color corresponding to an element in the first pixel matrix;将所确定出的颜色填充入待生成的彩色二维图码的数据存储区域中,并将预先为所述待编码的原始信息设置的特征信息填充入当前的所述彩色二维图码的特征信息区域中,完成彩色二维图码的生成。Filling the determined color into the data storage area of the color two-dimensional image code to be generated, and filling the feature information set in advance for the original information to be encoded into the current feature of the color two-dimensional image code In the information area, the generation of the color two-dimensional image code is completed.
- 如权利要求1所述的方法,其特征在于,所述预定颜色模型为RGB模型;The method of claim 1 wherein said predetermined color model is an RGB model;相应的,所述预定位数为三位,所述预定倍数为255倍。Correspondingly, the predetermined number of bits is three bits, and the predetermined multiple is 255 times.
- 如权利要求2所述的方法,其特征在于,所述将所述二进制比特流数据进行分组,包括:The method of claim 2 wherein said grouping said binary bitstream data comprises:按照预定的遍历顺序,以三位为一组对所述二进制比特流数据进行分组;The binary bit stream data is grouped in groups of three bits according to a predetermined traversal sequence;判断分组所得组的数量是否与所述待置入矩阵的元素数量相同,如果否,继续按照预定的遍历顺序,以三位为一组对所述二进制比特流数据进行分组,直至满足组的数量要求,其中,所述预定的遍历顺序为:从左到右的顺序或从右到左的顺序;Determining whether the number of groups obtained by the group is the same as the number of elements to be placed in the matrix, and if not, continuing to group the binary bit stream data in groups of three according to a predetermined traversal order until the number of groups is satisfied a request, wherein the predetermined traversal order is: a sequence from left to right or a sequence from right to left;或者, Or,所述将所述二进制比特流数据进行分组,包括:The grouping the binary bit stream data includes:按照预定的遍历顺序,以三位为一组对所述二进制比特流数据进行分组;The binary bit stream data is grouped in groups of three bits according to a predetermined traversal sequence;判断分组所得组的数量是否与所述待置入矩阵的元素数量相同,如果否,将数字0作为所述二进制比特流数据的补充二进制比特流数据,继续对当前分组所剩余的二进制比特流数据进行分组,直至满足组的数量要求,其中,所述预定的遍历顺序为:从左到右的顺序或从右到左的顺序。Determining whether the number of groups obtained by the group is the same as the number of elements to be placed in the matrix, and if not, using the number 0 as supplementary binary bit stream data of the binary bit stream data, continuing the binary bit stream data remaining for the current packet The grouping is performed until the number of groups is satisfied, wherein the predetermined traversal order is: left to right order or right to left order.
- 如权利要求1所述的方法,其特征在于,所述将所述每一组数据按照预设规则置入所述待置入矩阵中,得到初始数据矩阵具体为:The method according to claim 1, wherein the each set of data is placed in the to-be-placed matrix according to a preset rule, and the initial data matrix is specifically:将所述每一组数据按照Z字型走向顺次置入所述待置入矩阵中,使所述待置入矩阵中每个元素对应一组数据,得到初始数据矩阵。Each set of data is sequentially placed into the matrix to be placed in a zigzag pattern, so that each element to be placed in the matrix corresponds to a set of data, and an initial data matrix is obtained.
- 如权利要求1所述的方法,其特征在于,所述预设的关于元素与颜色的对应关系为:The method of claim 1 wherein said predetermined correspondence between elements and colors is:元素(0,0,0)对应黑色;元素(0,0,255)对应蓝色;元素(0,255,0)对应绿色;元素(0,255,255)对应青蓝色;元素(255,0,0)对应红色;元素(255,0,255)对应洋红色;元素(255,255,0)对应黄色;元素(255,255,255)对应白色。The element (0,0,0) corresponds to black; the element (0,0,255) corresponds to blue; the element (0,255,0) corresponds to green; the element (0,255,255) corresponds to cyan; element (255 , 0, 0) corresponds to red; elements (255, 0, 255) correspond to magenta; elements (255, 255, 0) correspond to yellow; elements (255, 255, 255) correspond to white.
- 如权利要求1所述的方法,其特征在于,所述将所述特征信息区域中的特征信息填充入当前的所述彩色二维图码的特征信息区域中之后,还包括:The method of claim 1, wherein the filling the feature information in the feature information area into the feature information area of the current color two-dimensional image code further comprises:对所述特征信息区域进行掩模处理。Masking the feature information area.
- 一种颜色标识型彩色二维图码的识读方法,其特征在于,包括:A method for reading a color identification type color two-dimensional image code, comprising:获取待识读的彩色二维图码的第二像素矩阵,其中,所述待识读的彩色二维图码为通过权利要求1所述方法生成的彩色二维图码;Obtaining a second pixel matrix of the color two-dimensional image code to be read, wherein the color two-dimensional image code to be read is a color two-dimensional image code generated by the method of claim 1;将所述第二像素矩阵中每一个元素缩小预定倍数,得到还原数据矩阵;Reducing each element in the second pixel matrix by a predetermined multiple to obtain a restored data matrix;按照生成所述彩色二维图码时所利用的预设规则的逆过程,将所述还原数据矩阵分解成由所述预定位数的二进制比特流数据组成的数据组;And decomposing the restored data matrix into a data group consisting of the predetermined bit number of binary bit stream data according to an inverse process of a preset rule used when generating the color two-dimensional image code;将所述数据组按照生成所述彩色二维图码时所利用的分组过程的逆过程, 还原得到二进制比特流数据;The data set is subjected to an inverse process of a grouping process utilized when generating the color two-dimensional code, Restore to obtain binary bit stream data;将所述二进制比特流数据进行解码,得到原始信息,完成彩色二维图码的识读。The binary bit stream data is decoded to obtain original information, and the reading of the color two-dimensional image code is completed.
- 如权利要求7所述的方法,其特征在于,所述将所述第二像素矩阵中每一个元素缩小预定倍数,得到还原数据矩阵,包括:The method according to claim 7, wherein the reducing the each of the elements in the second pixel matrix by a predetermined multiple to obtain a restored data matrix comprises:对所述第二像素矩阵进行纠错处理;Performing error correction processing on the second pixel matrix;将纠错处理后的第二像素矩阵中每一个元素缩小预定倍数,确定出还原数据矩阵;Reducing each element in the second pixel matrix after the error correction processing by a predetermined multiple to determine a restored data matrix;其中,所述纠错处理包括:Wherein, the error correction processing comprises:根据公式:计算出所述第二像素矩阵中的元素与预设的元素的欧氏距离值r1~r8,其中,x为所述第二像素矩阵中的元素的R值,y为所述第二像素矩阵中的元素的G值,z为所述第二像素矩阵中的元素的B值,n=1,2…8,R、G、B分别为所述预设的元素的R值、G值、B值;According to the formula: Calculating an Euclidean distance value r 1 r r 8 of an element in the second pixel matrix and a preset element, where x is an R value of an element in the second pixel matrix, and y is the second a G value of an element in the pixel matrix, z is a B value of an element in the second pixel matrix, n=1, 2...8, and R, G, and B are respectively R values of the preset element, G Value, B value;比较所述欧氏距离值r1~r8的大小,用值最小的rn对应的所述预设的元素替换所述第二像素矩阵中的元素,完成纠错处理;Comparing the magnitudes of the Euclidean distance values r 1 to r 8 , replacing the elements in the second pixel matrix with the preset elements corresponding to the smallest value r n , and completing the error correction processing;其中,所述预设的元素包括:The preset elements include:(0,0,0)、(0,0,255)、(0,255,0)、(0,255,255)、(255,0,0)、(255,0,255)、(255,255,0)及(255,255,255)。(0,0,0), (0,0,255), (0,255,0), (0,255,255), (255,0,0), (255,0,255), (255 , 255, 0) and (255, 255, 255).
- 一种颜色标识型彩色二维图码的生成装置,其特征在于,包括:A device for generating a color identification type color two-dimensional image code, comprising:第一获取模块,用于获取待编码的原始信息,并将其转化为二进制比特流数据; a first acquiring module, configured to acquire original information to be encoded, and convert the same into binary bit stream data;分组模块,用于将所述二进制比特流数据进行分组,使分组所得组的数量与待置入矩阵的元素数量相同,其中,每一组数据包含预定位数的所述二进制比特流数据,所述预定位数基于预定颜色模型确定;a grouping module, configured to group the binary bit stream data, such that the number of groups obtained by the group is the same as the number of elements to be placed in the matrix, wherein each group of data includes the binary bit stream data of a predetermined number of bits, The predetermined number of bits is determined based on a predetermined color model;置入模块,用于将所述每一组数据按照预设规则置入所述待置入矩阵中,得到初始数据矩阵;a placing module, configured to put each set of data into the to-be-placed matrix according to a preset rule, to obtain an initial data matrix;元素扩大模块,用于将所述初始数据矩阵中每一个元素扩大预定倍数,得到第一像素矩阵,其中,所述预定倍数基于所述预定颜色模型确定;An element expansion module, configured to expand each element in the initial data matrix by a predetermined multiple to obtain a first pixel matrix, wherein the predetermined multiple is determined based on the predetermined color model;颜色确定模块,用于根据预设的关于元素与颜色的对应关系,确定所述第一像素矩阵中的元素对应的颜色;a color determining module, configured to determine, according to a preset correspondence between elements and colors, a color corresponding to an element in the first pixel matrix;生成模块,用于将所确定出的颜色填充入待生成的彩色二维图码的数据存储区域中,并将预先为所述待编码的原始信息设置的特征信息填充入当前的所述彩色二维图码的特征信息区域中,完成彩色二维图码的生成。a generating module, configured to fill the determined color into a data storage area of the color two-dimensional image code to be generated, and fill the feature information set in advance for the original information to be encoded into the current color second In the feature information area of the Vital code, the generation of the color two-dimensional code is completed.
- 一种颜色标识型彩色二维图码的识读装置,其特征在于,包括:A color identification type color two-dimensional image reading device, comprising:第二获取模块,用于获取待识读的彩色二维图码的第二像素矩阵,其中,所述待识读的彩色二维图码为通过权利要求1所述方法生成的彩色二维图码;a second acquiring module, configured to acquire a second pixel matrix of the color two-dimensional image code to be read, wherein the color two-dimensional image code to be read is a color two-dimensional image generated by the method of claim 1. code;元素缩小模块,用于将所述第二像素矩阵中每一个元素缩小预定倍数,得到还原数据矩阵;An element reduction module, configured to reduce each element in the second pixel matrix by a predetermined multiple to obtain a restored data matrix;分解模块,用于按照生成所述彩色二维图码时所利用的预设规则的逆过程,将所述还原数据矩阵分解成由所述预定位数的二进制比特流数据组成的数据组;a decomposition module, configured to decompose the restored data matrix into a data group consisting of the predetermined bit number of binary bit stream data according to an inverse process of a preset rule used when generating the color two-dimensional image code;还原模块,用于将所述数据组按照分组过程的逆过程,还原得到二进制比特流数据;a restoration module, configured to restore the data group according to an inverse process of the grouping process to obtain binary bit stream data;解码模块,用于将所述二进制比特流数据进行解码,得到原始信息,完成彩色二维图码的识读。And a decoding module, configured to decode the binary bit stream data, obtain original information, and complete reading of the color two-dimensional image code.
- 一种应用程序,其特征在于,所述应用程序用于在运行时执行权利要求1-6任一项所述的颜色标识型彩色二维图码的生成方法。An application program for executing the method for generating a color-coded color two-dimensional image code according to any one of claims 1 to 6 at runtime.
- 一种存储介质,其特征在于,用于存储应用程序,所述应用程序在 运行时用于执行权利要求1-6任一项所述的颜色标识型彩色二维图码的生成方法。A storage medium, characterized in that it is used to store an application, and the application is A method for generating a color-coded color two-dimensional image code according to any one of claims 1 to 6 during operation.
- 一种电子设备,其特征在于,适用于颜色标识型彩色二维图码的生成,所述电子设备包括:An electronic device, which is suitable for the generation of a color-coded color two-dimensional image code, the electronic device comprising:壳体、处理器、存储器、电路板和电源电路,其中,电路板安置在壳体围成的空间内部,处理器和存储器设置在电路板上;电源电路,用于为电子设备的各个电路或器件供电;存储器用于存储可执行程序代码;处理器通过读取存储器中存储的可执行程序代码来运行与可执行程序代码对应的程序,以用于执行以下步骤:a housing, a processor, a memory, a circuit board, and a power supply circuit, wherein the circuit board is disposed inside the space enclosed by the housing, the processor and the memory are disposed on the circuit board; and the power supply circuit is used for each circuit of the electronic device or The device is powered; the memory is for storing executable program code; the processor runs the program corresponding to the executable program code by reading the executable program code stored in the memory for performing the following steps:获取待编码的原始信息,并将其转化为二进制比特流数据;Obtaining the original information to be encoded and converting it into binary bit stream data;将所述二进制比特流数据进行分组,使分组所得组的数量与待置入矩阵的元素数量相同,其中,每一组数据包含预定位数的所述二进制比特流数据,所述预定位数基于预定颜色模型确定;And grouping the binary bit stream data such that the number of groups obtained by the group is the same as the number of elements to be placed in the matrix, wherein each group of data includes the binary bit stream data of a predetermined number of bits, the predetermined number of bits being based on The predetermined color model is determined;将所述每一组数据按照预设规则置入所述待置入矩阵中,得到初始数据矩阵;And placing each set of data into the to-be-placed matrix according to a preset rule to obtain an initial data matrix;将所述初始数据矩阵中每一个元素扩大预定倍数,得到第一像素矩阵,其中,所述预定倍数基于所述预定颜色模型确定;Enlarging each element in the initial data matrix by a predetermined multiple to obtain a first pixel matrix, wherein the predetermined multiple is determined based on the predetermined color model;根据预设的关于元素与颜色的对应关系,确定所述第一像素矩阵中的元素对应的颜色;Determining, according to a preset correspondence between elements and colors, a color corresponding to an element in the first pixel matrix;将所确定出的颜色填充入待生成的彩色二维图码的数据存储区域中,并将预先为所述待编码的原始信息设置的特征信息填充入当前的所述彩色二维图码的特征信息区域中,完成彩色二维图码的生成。Filling the determined color into the data storage area of the color two-dimensional image code to be generated, and filling the feature information set in advance for the original information to be encoded into the current feature of the color two-dimensional image code In the information area, the generation of the color two-dimensional image code is completed.
- 一种应用程序,其特征在于,所述应用程序用于在运行时执行权利要求7-8任一项所述的颜色标识型彩色二维图码的识读方法。An application program for performing the reading method of the color-coded color two-dimensional image code according to any one of claims 7-8 at runtime.
- 一种存储介质,其特征在于,用于存储应用程序,所述应用程序在运行时用于执行权利要求7-8任一项所述的颜色标识型彩色二维图码的识读方法。A storage medium for storing an application, the application being used at runtime to perform the reading method of the color-coded color two-dimensional image code according to any one of claims 7-8.
- 一种电子设备,其特征在于,适用于颜色标识型彩色二维图码的识读,所述电子设备包括: An electronic device, characterized in that it is suitable for reading color-coded color two-dimensional image code, the electronic device comprising:壳体、处理器、存储器、电路板和电源电路,其中,电路板安置在壳体围成的空间内部,处理器和存储器设置在电路板上;电源电路,用于为电子设备的各个电路或器件供电;存储器用于存储可执行程序代码;处理器通过读取存储器中存储的可执行程序代码来运行与可执行程序代码对应的程序,以用于执行以下步骤:a housing, a processor, a memory, a circuit board, and a power supply circuit, wherein the circuit board is disposed inside the space enclosed by the housing, the processor and the memory are disposed on the circuit board; and the power supply circuit is used for each circuit of the electronic device or The device is powered; the memory is for storing executable program code; the processor runs the program corresponding to the executable program code by reading the executable program code stored in the memory for performing the following steps:获取待识读的彩色二维图码的第二像素矩阵,其中,所述待识读的彩色二维图码为通过权利要求1所述方法生成的彩色二维图码;Obtaining a second pixel matrix of the color two-dimensional image code to be read, wherein the color two-dimensional image code to be read is a color two-dimensional image code generated by the method of claim 1;将所述第二像素矩阵中每一个元素缩小预定倍数,得到还原数据矩阵;Reducing each element in the second pixel matrix by a predetermined multiple to obtain a restored data matrix;按照生成所述彩色二维图码时所利用的预设规则的逆过程,将所述还原数据矩阵分解成由所述预定位数的二进制比特流数据组成的数据组;And decomposing the restored data matrix into a data group consisting of the predetermined bit number of binary bit stream data according to an inverse process of a preset rule used when generating the color two-dimensional image code;将所述数据组按照生成所述彩色二维图码时所利用的分组过程的逆过程,还原得到二进制比特流数据;Converting the data set to binary bit stream data according to an inverse process of a grouping process utilized when generating the color two-dimensional code code;将所述二进制比特流数据进行解码,得到原始信息,完成彩色二维图码的识读。 The binary bit stream data is decoded to obtain original information, and the reading of the color two-dimensional image code is completed.
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610329538.6 | 2016-05-18 | ||
CN201610329538.6A CN106022431B (en) | 2016-05-18 | 2016-05-18 | Method and device for generating, recognizing and reading color two-dimensional graph code of color identification type |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2017198189A1 true WO2017198189A1 (en) | 2017-11-23 |
Family
ID=57097868
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2017/084880 WO2017198189A1 (en) | 2016-05-18 | 2017-05-18 | Generation and reading method and device for colour identified colour two-dimensional figure code |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN106022431B (en) |
WO (1) | WO2017198189A1 (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109948766A (en) * | 2019-03-29 | 2019-06-28 | 北京印刷学院 | The composite coloured anti-fake two-dimension code of multi-code and its generation and reading method |
CN111353321A (en) * | 2020-02-24 | 2020-06-30 | 口碑(上海)信息技术有限公司 | Data generating and analyzing method and device, computer storage medium and electronic device |
CN111915683A (en) * | 2020-07-27 | 2020-11-10 | 湖南大学 | Image position calibration method, intelligent device and storage medium |
US20220327302A1 (en) * | 2019-03-13 | 2022-10-13 | Hangzhou Biobank Biotech Inc. | Data matrix code, generating method and device thereof, and decoding method and device thereof |
Families Citing this family (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106022431B (en) * | 2016-05-18 | 2022-05-03 | 北京鼎九信息工程研究院有限公司 | Method and device for generating, recognizing and reading color two-dimensional graph code of color identification type |
CN109784451B (en) * | 2017-11-13 | 2022-03-18 | 卓望数码技术(深圳)有限公司 | Method and device for expanding two-dimensional code coding capacity by using multiple colors |
CN108460441A (en) * | 2018-02-01 | 2018-08-28 | 王伟 | Double Z two-dimension code structures |
CN114692800A (en) * | 2020-12-29 | 2022-07-01 | 华为技术有限公司 | Two-dimensional code generation method and related equipment |
CN112669296B (en) * | 2020-12-31 | 2023-09-26 | 江苏南高智能装备创新中心有限公司 | Defect detection method, device and equipment of numerical control punch die based on big data |
CN117560402B (en) * | 2024-01-12 | 2024-04-19 | 凌锐蓝信科技(北京)有限公司 | SD-WAN-based system and method for industrial security isolation and data exchange |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101047771A (en) * | 2006-03-31 | 2007-10-03 | 胡鹏飞 | Method for transmitting data form computer to hand mobile equipment with photo taking function |
CN101197004A (en) * | 2007-12-25 | 2008-06-11 | 深圳矽感科技有限公司 | Two-dimension bar code and its coding and decoding method |
CN103259621A (en) * | 2013-04-12 | 2013-08-21 | 江苏圆坤二维码研究院有限公司 | Encoding method and device of colorized three-dimensional codes and application method and system of colorized three-dimensional codes |
CN104657768A (en) * | 2015-03-20 | 2015-05-27 | 华中科技大学 | Colorful three-dimensional code structure and colorful three-dimensional code reading method |
CN106022431A (en) * | 2016-05-18 | 2016-10-12 | 北京鼎九信息工程研究院有限公司 | Method and device for generating and reading color two-dimensional diagram code of color identification type |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101149813B (en) * | 2007-07-13 | 2012-02-29 | 中兴通讯股份有限公司 | Matrix type colorful two-dimensional bar code encoding and decoding method |
CN101159028B (en) * | 2007-08-20 | 2015-05-13 | 中兴通讯股份有限公司 | Multiple graphics matrix type two-dimension bar code implementing method and device |
CN102243712B (en) * | 2010-05-14 | 2014-01-29 | 上海彩码信息科技有限公司 | Generation method and system thereof for colored bar code, and analytic method and system thereof for colored bar code |
CN102592160B (en) * | 2012-01-17 | 2014-08-13 | 浙江工商大学 | Character two-dimension code encoding and decoding method for short message |
EP2629245A3 (en) * | 2012-02-16 | 2013-08-28 | Acreo Swedish ICT AB | Datamatrix code arrangement including a display and method for manufacturing the same |
CN103377390B (en) * | 2012-04-26 | 2016-12-07 | 阿里巴巴集团控股有限公司 | The generation of Quick Response Code, recognition methods and device |
-
2016
- 2016-05-18 CN CN201610329538.6A patent/CN106022431B/en active Active
-
2017
- 2017-05-18 WO PCT/CN2017/084880 patent/WO2017198189A1/en active Application Filing
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101047771A (en) * | 2006-03-31 | 2007-10-03 | 胡鹏飞 | Method for transmitting data form computer to hand mobile equipment with photo taking function |
CN101197004A (en) * | 2007-12-25 | 2008-06-11 | 深圳矽感科技有限公司 | Two-dimension bar code and its coding and decoding method |
CN103259621A (en) * | 2013-04-12 | 2013-08-21 | 江苏圆坤二维码研究院有限公司 | Encoding method and device of colorized three-dimensional codes and application method and system of colorized three-dimensional codes |
CN104657768A (en) * | 2015-03-20 | 2015-05-27 | 华中科技大学 | Colorful three-dimensional code structure and colorful three-dimensional code reading method |
CN106022431A (en) * | 2016-05-18 | 2016-10-12 | 北京鼎九信息工程研究院有限公司 | Method and device for generating and reading color two-dimensional diagram code of color identification type |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20220327302A1 (en) * | 2019-03-13 | 2022-10-13 | Hangzhou Biobank Biotech Inc. | Data matrix code, generating method and device thereof, and decoding method and device thereof |
CN109948766A (en) * | 2019-03-29 | 2019-06-28 | 北京印刷学院 | The composite coloured anti-fake two-dimension code of multi-code and its generation and reading method |
CN109948766B (en) * | 2019-03-29 | 2022-04-08 | 北京印刷学院 | Multi-code composite color anti-counterfeiting two-dimensional code and generation and reading method thereof |
CN111353321A (en) * | 2020-02-24 | 2020-06-30 | 口碑(上海)信息技术有限公司 | Data generating and analyzing method and device, computer storage medium and electronic device |
CN111353321B (en) * | 2020-02-24 | 2023-11-10 | 口碑(上海)信息技术有限公司 | Data generation and analysis method and device, computer storage medium and electronic equipment |
CN111915683A (en) * | 2020-07-27 | 2020-11-10 | 湖南大学 | Image position calibration method, intelligent device and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN106022431B (en) | 2022-05-03 |
CN106022431A (en) | 2016-10-12 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2017198189A1 (en) | Generation and reading method and device for colour identified colour two-dimensional figure code | |
WO2017198188A1 (en) | Generation and reading method and device for synthetic colour two-dimensional figure code | |
KR102057510B1 (en) | Coding and Recognition Method of Dot Matrix QR Codes | |
CN105447546B (en) | The two dimensional code and its coding and decoding methods and equipment of embeddable large scale figure | |
CN106815544B (en) | A kind of information concealing method based on two dimensional code | |
CN102147873B (en) | Method and system for generating color code as well as method and system for analyzing color code | |
US8265407B2 (en) | Method for coding and decoding 3D data implemented as a mesh model | |
CN103400174A (en) | Encoding method, decoding method and system of two-dimensional code | |
CN109754046B (en) | Two-dimensional code, encoding method, decoding method, device and equipment of two-dimensional code | |
CN102724668A (en) | Method and system for sharing WIFI (wireless fidelity) network information on basis of two-dimensional code graphs | |
CN105550969A (en) | Method for watermarking a three-dimensional object | |
CN110475038B (en) | Character and picture generating type hiding and recovering method combined with minimum closure coding | |
CN103577861B (en) | Bar code structure and bar code encoding method | |
CN103544516A (en) | Two-dimensional code encoding and decoding method, two-dimensional code encoder and two-dimensional code decoder | |
CN110097159B (en) | QR code security authentication method and system based on Hamming code | |
CN104239926A (en) | Child straying preventing clothes based on two-dimension code technology | |
Ramya et al. | Improved color QR codes for real time applications with high embedding capacity | |
WO2024113874A1 (en) | Encoding method and decoding method for annular 2-dimensional bar code | |
CN109214486B (en) | Three-dimensional code, three-dimensional code generation method and device, and three-dimensional code identification method and device | |
Qian et al. | Constructive steganography using texture synthesis | |
CN109376825B (en) | Two-dimensional code generation method and device | |
CN112418374B (en) | Information code generation method | |
CN104715442A (en) | Hamming-code-based quantum image watermarking method | |
CN108108267B (en) | Data recovery method and device | |
CN109450460A (en) | A kind of parameter identification method of RS code and the concatenated code of convolutional code |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 17798752 Country of ref document: EP Kind code of ref document: A1 |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 17798752 Country of ref document: EP Kind code of ref document: A1 |