1. Two-dimensional code definition:
A QR code (2-dimensional Bar code) is a black-and-white graphic that distributes data symbols in a plane (two-dimensional direction) by a certain geometry. It refers to the one-dimensional bar code based on the expansion of another dimension of the readability of the bar code, the use of black and white rectangular pattern to represent the binary data, the device is scanned to obtain the information contained therein. The width of one-dimensional barcode records data, and its length is not recorded. The length and width of the two-dimensional barcode are recorded in the data. Two-dimensional barcode has a one-dimensional barcode does not have "anchor point" and "fault tolerance mechanism." The fault-tolerant mechanism can correctly restore the information on the bar code even if it does not recognize all the barcodes, or if the bar code is defaced.
2. Category:
There are many kinds of two-dimensional barcode, the two-dimensional bar code developed by different organizations have different structure and writing and reading methods. The common QR codes are: PDF417 code, QR Code, Han letter code, color barcode, quick mark Code, data matrix
One-dimensional code two-dimensional code
One-dimensional barcode--code 128 more common two-dimensional barcode--QR code
Information is included only in horizontal vertical information
3. Positioning markers
Two-dimensional barcode usually has a specific positioning mark (such as the QR code for three large positioning points), through the positioning of the code reader to identify the correct interpretation, so the two-dimensional bar code regardless of the direction of reading can be identified.
4. Features
Two-dimensional bar code than one-dimensional barcode record data volume more. It can also record more complex data, such as links, web links, etc.
5.QR yards
QR Code (the full name is the fast Response matrix code; English: Quick Response Code) is a two-dimensional bar code, in 1994 by the Japanese Denso wave company invented. The QR code from the English quick response is quick to respond because the inventor wants the QR codes to allow the content to be decoded quickly. QR codes use four standardized encoding modes (numbers, alphanumeric, byte (binary), and kanji) to store data. QR codes are most commonly found in Japan and are currently the most popular two-dimensional barcode in Japan. QR code compared to ordinary barcode can store more data, and do not need to be like a regular barcode in the scan requires a straight line alignment scanner. Therefore, its application scope has been extended to include product tracking, item identification, document management, marketing and other aspects.
(1) Introduction
QR Code is square, the common is black and white two colors. In 3 corners, there is a square pattern with smaller, like "back" characters. These 3 are to help decode the software positioning pattern, the user does not need to be aligned, regardless of the angle of scanning, the data can still be read correctly.
The standard JIS X 0510 of the Japanese QR code was released in January 1999, and its corresponding ISO standard iso/iec18004 was approved in June 2000. According to Denso Wave's website data, the QR code is an open standard, the QR Code of the specification is open, although the patent rights held by Denso Wave, but will not be run.
In addition to the standard QR code, there is a format called "Micro-QR Code", which is a reduced version of the QR Code standard, designed primarily for applications that cannot handle larger scans. Micro-QR codes also have multiple standards and can store up to 35 characters.
(2) Technical characteristics
such as when a qrcode the basic structure, wherein:
Position detection graphics, position detection graphic separators, positioning graphics:
For the two-dimensional code positioning, for each QR code, the location is fixed existence, but the size of the specification will be different;
Correction Graphics: The specification determines the number and position of the corrected graph;
Format information: Indicates the error correction level of the two-dimensional code, divided into L, M, Q, H;
Version information: That is, two-dimensional code specifications, QR code symbols have a total of 40 specifications of the matrix (generally black and white), from 21x21 (version 1), to 177x177 (version 40), each version of the symbol than the previous version of each side of the addition of 4 modules.
QR code A total of 40 sizes. The official name is version versions. Version 1 is a matrix of x 21, version 2 is a matrix of x 25, version 3 is the size of 29, each additional Version will increase the size of 4, the formula is: (V-1) + (V is the version number) Max Ver Sion 40, (40-1) *4+21 = 177, so the highest is a square of 177 x 177.
Data and Error correction code word: The actual saved QR code information, and error correction code word (for correcting the errors caused by the two-dimensional code corruption).
(3) Storage
The QR Code provides a total of 40 different versions of the structure of the storage density, corresponding to the graph "version Information", version 1 is 21*21 pixels, the length of a version of each liter increases by 4 pixels, the largest version 40 is 177*177 pixels.
QR code maximum data Capacity (for version 40) |
Digital |
Up to 7089 characters |
Letters |
Up to 4296 characters |
Binary number (8bit) |
Up to 2953 bytes |
Japanese man/Katakana |
Up to 1,817 characters (with shift JIS) |
Chinese man |
Up to 984 characters (with UTF-8) |
|
Up to 1,800 characters (using big5/gb2312) provide 40 different versions of the storage density structure, corresponding to the graph "version Information", version 1 is 21x21 pixels, the length of each machine is increased by 4 pixels, the largest version of 40 is 177x177 pixels. |
For different versions of the QR code, the capacity is also different. In theory, the content can be compressed to save 7,089 digits, 4,296 letters and numbers of mixed characters, 2,953 8-bit bytes of data, 1817 Chinese characters; In the above we see that the QR code of different versions is a different matrix, the version is over, It means the larger the capacity. About capacity calculation I did not find the more authoritative algorithm, here in the first version of the calculation, the first version (21X21) format is as follows:
Only yellow is the content of the stored data, in the first version only 217 (21X21-8*9*3-8) The number of space to store data, and the useful data is 217-1 end of data flag = 216, in 216bit
216BIT/8 = 27Byte can only store 27Byte of data in the QR Code of version one (less if there is more fault tolerance), of course, at different levels of fault tolerance, there is also a change in capacity.
Therefore, the QR Code of version 1 will probably be able to tolerate more than 10 characters.
(4) fault-tolerant capability
QR code is fault-tolerant, QR code graphics if damaged, can still be read by the machine, up to 7%~30% area damage can still be read. Therefore, the QR code can be widely used in the transport of the outer box.
Relatively, the higher the fault tolerance rate, the larger the QR Code graphics area. So the general tradeoff is to use 15% fault-tolerant capabilities.
Error correction capacity |
L Level |
7% of Loadline can be modified |
M level |
15% of Loadline can be modified |
Q level |
25% of Loadline can be modified |
H level |
30% of Loadline can be modified |
(5) coding
The QR code supports the following encodings:
Numeric mode digital code, from 0 to 9. If the number of numbers that need to be encoded is not a multiple of 3, then the last remaining 1 or 2 digits will be converted to 4 or 7bits, then each of the other 3 digits will be 10,12,14bits, how long it takes to look at the size of the two-dimensional Code (table 3 below illustrates this)
Alphanumeric mode character encoding. Includes 0-9, uppercase A to Z (no lowercase), and the symbol $% * +–. /: Include spaces. These characters are mapped into a single character index table. As shown below: (where the SP is a space, Char is a character, value is its index value) encoding the process is to group the character 22, and then turn to the following table of 45, and then into the binary of the 11bits, if there is a single, then turn into 6bits binary. The number of encoding modes and characters needs to be 9, 11, or 13 binary according to different Version sizes (table 3 in the tables below)
byte mode, byte-encoded, can be 0-255 iso-8859-1 characters. Some QR code scanners can automatically detect if a UTF-8 is encoded.
6. Encoding Process
A brief coding process:
1. Data analysis: Determine the encoded character type, converted to a symbolic character by the corresponding character set, select the error-correcting level, the higher the error-correcting level, the smaller the capacity of the real data under the condition of certain specification.
2. Data encoding: Convert data characters to bit streams, each 8 bits of a code word, the whole form a code sequence of data. Actually know this data code word sequence to know the data content of the two-dimensional code.
Data can be encoded in a pattern for more efficient decoding, for example: 01234567 encoding (version 1-h) for data:
1) Group: 012 345 67
2) turn into binary: 012→0000001100
345→0101011001
67→1000011
3) turn into sequence: 0000001100 0101011001 1000011
4) Number of characters turn into binary: 8→0000001000
5) Add mode indicator (digital) 0001:0001 0000001000 0000001100 0101011001 1000011
For letters, Chinese, Japanese, and so on only the way of grouping, mode and other content is different. The basic method is consistent
3. Error Correction Code
According to the need to block the above code word sequence, and according to the error correction level and block code word, generate error correction code word, and the error correction code word added to the data code word sequence, become a new sequence.
In the case of two-dimensional code and error correction level, in fact, it can accommodate the total number of code and error correction code Word count is also determined, such as: Version 10, error correction level H, a total capacity of 346 code words, of which 224 error correction code word.
This means that about 1/3 of the code word in the QR code area is redundant. For these 224 error correcting code words, it can correct 112 substitution errors (such as black and white upside down) or 224 read errors (unreadable or not decoded).
This error correction capacity is: 112/346=32.4%
4. Construct the final data information:
Placing the resulting sequence in the order of the blocks, as determined by the specification
According to the provisions of the data block, and then the calculation of each block, the corresponding error-correcting code block, the error-correcting code word block in order to form a sequence, added to the original data code word sequence behind.
such as: D1, D12, D23, D35, D2, D13, D24, D36, ... D11, D22, D33, D45, D34, D46, E1, E23,e45, E67, E2, E24, E46, E68, ...
5. Construct The matrix:
Put the probe graphics, separators, positioning graphics, correction graphics, and code word modules into the matrix.
Populate the area of the corresponding specification's QR code matrix with the complete sequence above
6. Masking: The mask graphic is used for the coded area of the symbol, so that the dark and light (black and white) areas in the two-dimensional code graph can be optimally distributed.
An algorithm that does not study the students who are interested can continue.
7. Format and version information: Generate format and version information into the appropriate area.
Version 7-40 contains version information, and no version information is all 0. The two locations on the QR code contain the version information, which is redundant.
Version information A total of 18 bits, the 6x3 matrix, where 6 bits when the data is, such as version number 8, data bits of information when 001000, followed by 12 bits is corrected dislocation.
Reference:
The details and principles of the generation of two-dimensional codes
QR code generation principle (i)
Two-dimensional codes
. NET QRCode qr code (i)--basic knowledge