Summary of the invention
The invention provides a kind of Quick Response Code coding extending method and system to address the above problem.
The invention provides a kind of Quick Response Code coding extending method, comprise the following steps.The Quick Response Code maker becomes encode corresponding byte array send to strategic server of the utf-8 of character by character conversion, described strategic server is determined the color value that character is corresponding and is notified described Quick Response Code maker according to the first preset strategy, described Quick Response Code maker is plotted in the Quick Response Code data area by described color value, forms two-dimension code image.Demoder reads and resolves pending two-dimension code image, obtains described pending two-dimension code image color value and sends to described strategic server, and described strategic server inquiry color interval table, obtain corresponding character and send to demoder.Wherein, the color value that described strategic server is corresponding according to character, according to the second preset strategy, determine the color interval table.
The invention provides a kind of Quick Response Code coding expanding system, comprise Quick Response Code maker, strategic server and demoder, described Quick Response Code maker connects described strategic server, and described strategic server connects described demoder.Described Quick Response Code maker, for encode corresponding byte array send to strategic server of the utf-8 that character conversion is become to character, also be plotted in the Quick Response Code data area for the notice according to strategic server by color value, forms two-dimension code image.Described strategic server, for determining the color value that character is corresponding and notify described Quick Response Code maker according to the first preset strategy; Also, for the color value corresponding according to character, according to the second preset strategy, determine the color interval table.Described demoder, for reading and resolve pending two-dimension code image, obtain described pending two-dimension code image color value and send to described strategic server.Described strategic server, for the described pending two-dimension code image color value sent according to described demoder, inquiry color interval table, obtain corresponding character and send to demoder.
Compared to prior art, according to Quick Response Code coding extending method provided by the invention and system, the Quick Response Code maker becomes encode corresponding byte array send to strategic server of the utf-8 of character by character conversion, described strategic server is determined the color value that character is corresponding and is notified described Quick Response Code maker according to the first preset strategy, described Quick Response Code maker is plotted in the Quick Response Code data area by described color value, forms two-dimension code image.The two-dimension code image that multiple color forms has been expanded the Quick Response Code capacity greatly.Demoder reads and resolves pending two-dimension code image, obtains described pending two-dimension code image color value and sends to described strategic server, and described strategic server inquiry color interval table, obtain corresponding character and send to demoder.Wherein, the color value that described strategic server is corresponding according to character, according to the second preset strategy, determine the color interval table.So, effectively expand the 2 D code information amount, improved actual application value.
Embodiment
Hereinafter with reference to accompanying drawing, also describe the present invention in detail in conjunction with the embodiments.It should be noted that, in the situation that do not conflict, embodiment and the feature in embodiment in the application can combine mutually.
Figure 1 shows that the process flow diagram of the Quick Response Code coding extending method that preferred embodiment according to the present invention provides.As shown in Figure 1, the Quick Response Code coding extending method that preferred embodiment of the present invention provides comprises step 101 ~ 102.
Step 101: the Quick Response Code maker becomes encode corresponding byte array send to strategic server of the utf-8 of character by character conversion, described strategic server is determined the color value that character is corresponding and is notified described Quick Response Code maker according to the first preset strategy, described Quick Response Code maker is plotted in the Quick Response Code data area by described color value, forms two-dimension code image.
Particularly, the computing machine bottom has character and unique utf-8 coding corresponding to described character, and wherein the utf-8 of each character corresponding byte array length of encoding is 3, and the value of bits per inch value is between 1 ~ 255.Take partial character as example, and the utf-8 of described computing machine bottom character and character encodes corresponding byte array form for example shown in table 1.
Character |
The utf-8 of the character corresponding byte array of encoding |
You |
230,130,168 |
Good |
229,165,189 |
Not |
230,156,170 |
Fly |
233,163,158 |
Table 1
The utf-8 of described character corresponding 3 the byte array values of encoding correspond respectively to R, G and the B value of color.In this, described the first preset strategy is that if the utf-8 of single character encodes corresponding byte array, three numerical value are a, b and c, wherein, described a, b and c be R, G and the B value of corresponding color respectively, color value=65536*R+256*G+B that described character is corresponding=65536*a+256*b+c.After described strategic server calculates the color value that described character is corresponding and notifies the Quick Response Code maker, described Quick Response Code maker is converted to sexadecimal by described color value by the decimal system, and color is plotted in to Quick Response Code data area formation two-dimension code image.
Step 102: demoder reads and resolves pending two-dimension code image, obtain described pending two-dimension code image color value and send to described strategic server, described strategic server inquiry color interval table, obtain corresponding character and send to demoder, wherein, the color value that described strategic server is corresponding according to character, according to the second preset strategy, determine the color interval table.
Particularly, described the second preset strategy is, if the color value that single character is corresponding is Sn, the color value of Sn interval is Sn-(Sn-S (n-1))/2 to Sn+ (S (n+1)-Sn)/2, n gets 1 o'clock, corresponding color value interval is 0 to s1+ (s2-s1)/2, and when n gets maximal value, corresponding color value interval is that Sn-(Sn-S (n-1))/2 is to 255*255*255=16581375.Wherein, the maximal value that described n is corresponding is all character sums in character repertoire, if Chinese characters in common use and other character add up to 6000, the maximal value of n is 6000.Described strategic server storage color interval table, described color interval table comprises character and color value interval corresponding to described character.
For example, if the Quick Response Code maker need be in two-dimension code image canned data comprise a word used for translation, eh, Sha and A Si character, described four character utf-8 corresponding byte array of encoding is respectively a word used for translation (229,144,150), (229,149,138), Sha (229,151,132) and Ah (233,152,191), the Quick Response Code maker sends to respectively strategic server by the described character utf-8 corresponding byte array of encoding.If described four color values corresponding to character are respectively S1, S2, S3 and S4, strategic server calculates S1=65536*229+256*144+150=15044758 according to the first preset strategy, S2=65536*229+256*149+138=15046026, S3=65536*229+256*151+132=15046532, S4=65536*233+256*152+191=15308991, and send to the Quick Response Code maker.Described Quick Response Code maker is plotted in respectively the Quick Response Code data area by corresponding color after described S1 ~ S4 is converted to respectively to sexadecimal numerical value, forms two-dimension code image.In the present embodiment, described two-dimension code image also comprises other character and corresponding color, and for ease of explanation, above-mentioned four characters of only take are example.
Described strategic server storage color interval table, in the present embodiment, strategic server is determined corresponding " a word used for translation " character of S1(according to the second preset strategy) the color value interval be 0 to 15044758+(15046026-15044758)/2,0 to 15045391.Calculate respectively S2(correspondence " " character) the color value interval be 15045392 to 15046278, S3(corresponding " Sha " characters) the color value interval be 15046279 to 15177761.In this, if S5 is 15508991, S4(corresponding " Ah "'s character) the color value interval be 15177762 to S4+(S5-S4)/2,15177762 to 15408991.Described color interval table comprises all characters of character repertoire and corresponding color value interval, and four characters of the present embodiment of take are example, and between described chromatic zones, the sheet format example is as shown in table 2.
Character |
Corresponding color value interval |
A word used for translation |
0~15045391(15044758) |
? |
15045392~15046278(15046026) |
Sha |
15046279~15177761(15046532) |
Ah |
15177762~15408991(15308991) |
Table 2
If demoder reads and resolve a certain color in described two-dimension code image corresponding data zone, after obtaining the hexadecimal code of described color, convert decimal system color value to and be 15044900 and send to strategic server.The color interval table of described strategic server inquiry self storage, determine that described color value 15044900 is in interval 0 ~ 15045391, corresponding " a word used for translation " character, and to obtain this character be a word used for translation to strategic server, and send to demoder.Similarly, strategic server can obtain successively other character and send to demoder, and detailed process repeats no more.
Figure 2 shows that the schematic diagram of the Quick Response Code coding expanding system that preferred embodiment according to the present invention provides.As shown in Figure 2, the Quick Response Code coding expanding system that preferred embodiment of the present invention provides comprises Quick Response Code maker 201, strategic server 202 and demoder 203, described Quick Response Code maker 201 connects described strategic server 202, and described strategic server 202 connects described demoder 203.Described Quick Response Code maker 201, for character conversion being become to encode corresponding byte array send to strategic server 202 of the utf-8 of character, also for the notice according to strategic server 202, color value is plotted in to the Quick Response Code data area, forms two-dimension code image.Described strategic server 202, for determining the color value that character is corresponding and notify described Quick Response Code maker 201 according to the first preset strategy; Also, for the color value corresponding according to character, according to the second preset strategy, determine the color interval table.Described demoder 203, for reading and resolve pending two-dimension code image, obtain described pending two-dimension code image color value and send to described strategic server 202.Described strategic server 202, for the described pending two-dimension code image color value sent according to described demoder 203, inquiry color interval table, obtain corresponding character and send to demoder 203.Operating process about said system is described with above-mentioned method, therefore repeat no more in this.
In sum, Quick Response Code coding extending method and system that according to the present invention, preferred embodiment provides, the Quick Response Code maker becomes encode corresponding byte array send to strategic server of the utf-8 of character by character conversion, described strategic server is determined the color value that character is corresponding and is notified described Quick Response Code maker according to the first preset strategy, described Quick Response Code maker is plotted in the Quick Response Code data area by described color value, forms two-dimension code image.The two-dimension code image that multiple color forms has been expanded the Quick Response Code capacity greatly.Demoder reads and resolves pending two-dimension code image, obtains described pending two-dimension code image color value and sends to described strategic server, and described strategic server inquiry color interval table, obtain corresponding character and send to demoder.Wherein, the color value that described strategic server is corresponding according to character, according to the second preset strategy, determine the color interval table.So, effectively expand the 2 D code information amount, improved actual application value.
The foregoing is only the preferred embodiments of the present invention, be not limited to the present invention, for a person skilled in the art, the present invention can have various modifications and variations.Within the spirit and principles in the present invention all, any modification of doing, be equal to replacement, improvement etc., within all should being included in protection scope of the present invention.