CN103065177B - Coding method and system of two-dimension code - Google Patents
Coding method and system of two-dimension code Download PDFInfo
- Publication number
- CN103065177B CN103065177B CN201210543653.5A CN201210543653A CN103065177B CN 103065177 B CN103065177 B CN 103065177B CN 201210543653 A CN201210543653 A CN 201210543653A CN 103065177 B CN103065177 B CN 103065177B
- Authority
- CN
- China
- Prior art keywords
- character
- color
- color value
- value
- dimension code
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
Landscapes
- Information Transfer Between Computers (AREA)
- Color Image Communication Systems (AREA)
Abstract
The invention provides a coding method and a system of a two-dimension code, the method comprises the steps of a client-side converting characters into a byte digital group of corresponding to character utf-8 code, confirming the corresponding color value of the characters in accordance with a first preset strategy, portraying the color value in the two-dimension code data region, forming a two-dimension code image and sending the image to a server, the server reading and analyzing the two-dimension code image under process, obtaining the color value of the two-dimension code image, inquiring a color section table, and obtaining the corresponding characters, wherein the server confirming the color section table on the basis of the corresponding color value of the characters and a in accordance with second preset strategy.
Description
Technical field
The invention belongs to instant messaging field, particularly relate to a kind of Quick Response Code coding method and system.
Background technology
Along with the develop rapidly of society, science and technology is applied in the life of people more and more.At present, in the process of circulation of extensive stock, for increasing information capacity, many commodity can identify Quick Response Code, and compared to bar code before, Quick Response Code can hold more Word message.The mainly black and white color lump combination of current Quick Response Code, the character capacity that can store is less, greatly reduces Quick Response Code actual application value.
Summary of the invention
The invention provides a kind of Quick Response Code coding method and system to solve the problem.
The invention provides a kind of Quick Response Code coding method, comprise the following steps.Character conversion is become the byte array corresponding to utf-8 coding of character by client, according to the color value that the first preset strategy determination character is corresponding, and described color value is plotted in two-dimensional code data region, forms two-dimension code image and be sent to server.Described server reads and resolves pending two-dimension code image, obtains described pending two-dimension code image color value and inquires about color interval table, obtains corresponding character.Wherein, the color value that described server is corresponding according to character, according to the second preset strategy, determines color interval table.
The invention provides a kind of Quick Response Code coded system, comprise client and server, server described in described client's side link.Described client, for character conversion is become character utf-8 coding corresponding to byte array, according to the color value that the first preset strategy determination character is corresponding, and described color value is plotted in two-dimensional code data region, forms two-dimension code image and be sent to server.Described server, for reading and resolving pending two-dimension code image, obtains described pending two-dimension code image color value and inquires about color interval table, obtains corresponding character.Also for the color value corresponding according to character, according to the second preset strategy, determine color interval table.
Compared to prior art, according to Quick Response Code coding method provided by the invention and system, character conversion is become the byte array corresponding to utf-8 coding of character by client, according to the color value that the first preset strategy determination character is corresponding, and described color value is plotted in two-dimensional code data region, form two-dimension code image and be sent to server.The two-dimension code image that multiple color is formed extends Quick Response Code capacity greatly.Described server reads and resolves pending two-dimension code image, obtains described pending two-dimension code image color value and inquires about color interval table, obtains corresponding character.Wherein, the color value that described server is corresponding according to character, according to the second preset strategy, determines color interval table.So, effectively extend 2 D code information amount, improve actual application value.
Accompanying drawing explanation
Accompanying drawing described herein is used to provide a further understanding of the present invention, and form a application's part, schematic description and description of the present invention, for explaining the present invention, does not form inappropriate limitation of the present invention.In the accompanying drawings:
Figure 1 shows that the process flow diagram of the Quick Response Code coding method that preferred embodiment according to the present invention provides,
Figure 2 shows that the schematic diagram of the Quick Response Code coded system that preferred embodiment according to the present invention provides.
Embodiment
Hereinafter also describe the present invention in detail with reference to accompanying drawing in conjunction with the embodiments.It should be noted that, when not conflicting, the embodiment in the application and the feature in embodiment can combine mutually.
Figure 1 shows that the process flow diagram of the Quick Response Code coding method that preferred embodiment according to the present invention provides.As shown in Figure 1, the Quick Response Code coding method that preferred embodiment of the present invention provides comprises step 101 ~ 102.
Step 101: character conversion is become the byte array corresponding to utf-8 coding of character by client, according to the color value that the first preset strategy determination character is corresponding, and described color value is plotted in two-dimensional code data region, form two-dimension code image and be sent to server.
Specifically, computing machine bottom has character and unique utf-8 coding corresponding to described character, and wherein the byte array length corresponding to utf-8 coding of each character is 3, and the value of bits per inch value is between 1 ~ 255.For partial character, the byte array formats corresponding to utf-8 coding of described computing machine bottom character and character is such as shown in table 1.
Character | The byte array corresponding to utf-8 coding of character |
You | 230,130,168 |
Good | 229,165,189 |
Not | 230,156,170 |
Fly | 233,163,158 |
Table 1
3 byte array values corresponding to utf-8 coding of described character correspond respectively to R, G and B value of color.In this, described first preset strategy is, if byte array three numerical value corresponding to utf-8 coding of single character are a, b and c, wherein, R, G and B value of described a, b and c difference corresponding color, then color value=65536*R+256*G+B=65536*a+256*b+c that described character is corresponding.Described color value is converted to sexadecimal by the decimal system after calculating color value corresponding to described character by described client, and color is plotted in two-dimensional code data region formation two-dimension code image.
Step 102: described server reads and resolves pending two-dimension code image, obtains described pending two-dimension code image color value and inquires about color interval table, obtains corresponding character, wherein, the color value that described server is corresponding according to character, according to the second preset strategy, determines color interval table.
Specifically, described second preset strategy is, if the color value that single character is corresponding is Sn, then the color value interval of Sn is Sn-(Sn-S (n-1))/2 to Sn+ (S (n+1)-Sn)/2, when wherein n gets 1, corresponding color value interval is 0 to s1+ (s2-s1)/2, n when getting maximal value, and corresponding color value interval is Sn-(Sn-S (n-1))/2 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, then the maximal value of n is 6000.Described server stores color interval table, described color interval table comprises character and color value corresponding to described character is interval.
For example, if the packets of information that client need store in two-dimension code image containing a word used for translation, eh, a Sha and A Si character, byte array corresponding to described four character utf-8 encode is respectively a word used for translation (229,144,150), (229,149,138), Sha (229,151,132) and Ah (233,152,191).If the color value that described four characters are corresponding is respectively S1, S2, S3 and S4, then client 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.Corresponding color is plotted in two-dimensional code data region after described S1 ~ S4 is converted to hexadecimal values respectively by described client respectively, sends to server after forming two-dimension code image.In the present embodiment, described two-dimension code image also comprises the color of other character and correspondence, for ease of illustrating, only for above-mentioned four characters.
Described server stores color interval table, in the present embodiment, server determines S1(correspondence " a word used for translation " character according to the second preset strategy) color value interval be 0 to 15044758+(15046026-15044758)/2, namely 0 to 15045391.Calculate S2(correspondence " " character respectively) color value interval be 15045392 to 15046278, S3(correspondences " Sha " character) color value interval be 15046279 to 15177761.In this, if S5 is 15508991, then S4(correspondence " Ah "'s character) color value interval be 15177762 to S4+(S5-S4)/2, namely 15177762 to 15408991.The color value that described color interval table comprises all characters of character repertoire and correspondence is interval, and for four of the present embodiment characters, between described chromatic zones, sheet format is such as shown in table 2.
Character | Corresponding color value is interval |
A word used for translation | 0~15045391(15044758) |
? | 15045392~15046278(15046026) |
Sha | 15046279~15177761(15046532) |
Ah | 15177762~15408991(15308991) |
Table 2
If server reads and resolves a certain color in described two-dimension code image corresponding data region, after obtaining the hexadecimal code of described color, converting decimal system color value to is 15044900.The color interval table that described server lookup self stores, determine that described color value 15044900 is in interval 0 ~ 15045391, corresponding " a word used for translation " character, then server obtains this character is a word used for translation.Similarly, server can obtain other character successively, and detailed process repeats no more.
Figure 2 shows that the schematic diagram of the Quick Response Code coded system that preferred embodiment according to the present invention provides.As shown in Figure 2, the Quick Response Code coded system that present pre-ferred embodiments provides comprises client 201 and server 202, and described client 201 connects described server 202.Described client 201, for character conversion is become character utf-8 coding corresponding to byte array, according to the color value that the first preset strategy determination character is corresponding, and described color value is plotted in two-dimensional code data region, forms two-dimension code image and be sent to server 202.Described server 202, for reading and resolving pending two-dimension code image, obtains described pending two-dimension code image color value and inquires about color interval table, obtains corresponding character.Also for the color value corresponding according to character, according to the second preset strategy, determine color interval table.About the operating process of said system with described in said method, therefore repeat no more in this.
In sum, the Quick Response Code coding method provided according to present pre-ferred embodiments and system, character conversion is become the byte array corresponding to utf-8 coding of character by client, according to the color value that the first preset strategy determination character is corresponding, and described color value is plotted in two-dimensional code data region, form two-dimension code image and be sent to server.The two-dimension code image that multiple color is formed extends Quick Response Code capacity greatly.Described server reads and resolves pending two-dimension code image, obtains described pending two-dimension code image color value and inquires about color interval table, obtains corresponding character.Wherein, the color value that described server is corresponding according to character, according to the second preset strategy, determines color interval table.So, effectively extend 2 D code information amount, improve 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 amendment done, equivalent replacement, improvement etc., all should be included within protection scope of the present invention.
Claims (2)
1. a Quick Response Code coding method, is characterized in that, comprises the following steps:
Character conversion is become the byte array corresponding to utf-8 coding of character by client, according to the color value that the first preset strategy determination character is corresponding, and described color value is plotted in two-dimensional code data region, forms two-dimension code image and be sent to server;
Described server reads and resolves pending two-dimension code image, obtains described pending two-dimension code image color value and inquires about color interval table, obtains corresponding character,
Wherein, the color value that described server is corresponding according to character, according to the second preset strategy, determines color interval table;
Described first preset strategy is, if byte array three numerical value corresponding to utf-8 coding of single character are a, b and c, wherein, R, G and B value of described a, b and c difference corresponding color, then color value=65536*R+256*G+B=65536*a+256*b+c that described character is corresponding;
Described second preset strategy is, if the color value that single character is corresponding is Sn, then the color value interval of Sn is Sn-(Sn-S (n-1))/2 to Sn+ (S (n+1)-Sn)/2, when wherein n gets 1, corresponding color value interval is 0 to s1+ (s2-s1)/2, when n gets maximal value, corresponding color value interval is Sn-(Sn-S (n-1))/2 to 255*255*255=16581375, wherein, described maximal value refers to all character sums in character repertoire.
2. method according to claim 1, is characterized in that, described server stores color interval table, and described color interval table comprises character and color value corresponding to described character is interval.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210543653.5A CN103065177B (en) | 2012-12-14 | 2012-12-14 | Coding method and system of two-dimension code |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210543653.5A CN103065177B (en) | 2012-12-14 | 2012-12-14 | Coding method and system of two-dimension code |
Publications (2)
Publication Number | Publication Date |
---|---|
CN103065177A CN103065177A (en) | 2013-04-24 |
CN103065177B true CN103065177B (en) | 2015-05-27 |
Family
ID=48107800
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201210543653.5A Expired - Fee Related CN103065177B (en) | 2012-12-14 | 2012-12-14 | Coding method and system of two-dimension code |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103065177B (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105117758A (en) * | 2015-08-31 | 2015-12-02 | 武汉大学 | Colored two-dimensional code based mobile platform security communication method |
CN107423797B (en) * | 2017-07-31 | 2020-11-06 | 成都新得利电子有限公司 | Anti-counterfeiting code information generation method |
CN112395830A (en) * | 2019-07-31 | 2021-02-23 | 腾讯科技(深圳)有限公司 | Form processing method based on Wan Guo code and related device |
CN111353321B (en) * | 2020-02-24 | 2023-11-10 | 口碑(上海)信息技术有限公司 | Data generation and analysis method and device, computer storage medium and electronic equipment |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1818935A (en) * | 2006-03-17 | 2006-08-16 | 北京紫光捷通科技有限公司 | Two-dimensional code construction based on hexadecimal coding |
CN1862525A (en) * | 2005-05-11 | 2006-11-15 | 上海迪比特实业有限公司 | Code conversion method |
CN102117419A (en) * | 2011-02-23 | 2011-07-06 | 深圳市融创天下科技发展有限公司 | Method, device, system and terminal equipment for generating and recognizing two-dimension code |
CN102243712A (en) * | 2010-05-14 | 2011-11-16 | 上海彩码信息科技有限公司 | Generation method and system thereof for colored bar code, and analytic method and system thereof for colored bar code |
-
2012
- 2012-12-14 CN CN201210543653.5A patent/CN103065177B/en not_active Expired - Fee Related
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1862525A (en) * | 2005-05-11 | 2006-11-15 | 上海迪比特实业有限公司 | Code conversion method |
CN1818935A (en) * | 2006-03-17 | 2006-08-16 | 北京紫光捷通科技有限公司 | Two-dimensional code construction based on hexadecimal coding |
CN102243712A (en) * | 2010-05-14 | 2011-11-16 | 上海彩码信息科技有限公司 | Generation method and system thereof for colored bar code, and analytic method and system thereof for colored bar code |
CN102117419A (en) * | 2011-02-23 | 2011-07-06 | 深圳市融创天下科技发展有限公司 | Method, device, system and terminal equipment for generating and recognizing two-dimension code |
Also Published As
Publication number | Publication date |
---|---|
CN103065177A (en) | 2013-04-24 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103065177B (en) | Coding method and system of two-dimension code | |
CN101222476B (en) | Expandable markup language file editor, file transferring method and system | |
KR102071764B1 (en) | Picture coding and decoding methods and devices | |
CN104657698B (en) | A kind of color 2 D code decoding method for carrying several black and white Quick Response Codes | |
US20080048044A1 (en) | Barcode Encoding and Decoding | |
KR100664005B1 (en) | Enhancement of database performance in a domain name system | |
CN114286102A (en) | Binary image compression coding and decoding method based on Base62 coding | |
CN1237821C (en) | Image information transfer method and image information processor | |
CN102523367A (en) | Real-time image compression and reduction method based on plurality of palettes | |
CN107145730A (en) | DICOM medical images file reads adaption system | |
CN103020686B (en) | A kind of Quick Response Code colour coding method and system | |
CN109819254B (en) | Lossy image compression transmission method and system | |
CN112468613A (en) | Industrial internet identification analysis method and system based on Handle identification analysis system | |
CN103020685B (en) | A kind of Quick Response Code coding extending method and system | |
CN102982046B (en) | A kind of web data compression and storage method and system | |
CN103034835B (en) | Two-dimensional code processing method and two-dimensional code client-side | |
CN110830466A (en) | Method and device for framing DL/T645 protocol message based on XML | |
CN107343203B (en) | JPEG lossless compression method based on OPEN-EXR image | |
US20210014540A1 (en) | Method and system for codec of visual feature data | |
CN107872441B (en) | Method and device for generating equipment attribute configuration file | |
CN105024923B (en) | The method and device that message category based on XMPP extension message is realized | |
CN102752601A (en) | Transmission method of M-JPEG images and recovery method of data packet dropout of receiving terminal | |
CN110298017B (en) | Method and device for processing coded data and computer storage medium | |
CN103020667B (en) | The method and system that a kind of 2 D code information expands | |
CN102843345A (en) | Remote communication method and computer program product thereof |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
C56 | Change in the name or address of the patentee | ||
CP01 | Change in the name or title of a patent holder |
Address after: Suzhou City, Jiangsu province 215121 Fengting Avenue Suzhou Industrial Park No. 666 Weiting Intelligent Industrial Park Building 8 Patentee after: Kuo Di education and science company limited Address before: Suzhou City, Jiangsu province 215121 Fengting Avenue Suzhou Industrial Park No. 666 Weiting Intelligent Industrial Park Building 8 Patentee before: Suzhou Kuodi Network Technology Co., Ltd. |
|
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20150527 Termination date: 20191214 |
|
CF01 | Termination of patent right due to non-payment of annual fee |