QR code generation principle (I)

Source: Internet
Author: User

1. What is a QR code?

QR codes are a type of matrix QR codes. They are developed by Denso and standardized by JIS and ISO. The QR code can be seen on many occasions. I will post a picture to show it:

If this image is decoded correctly, you should see my name and email address.

Ii. Features of QR codes

Speaking of the characteristics of QR codes, the first is high-speed reading (QR code is taken from the first letter of "Quick Response"). The reading speed experience comes from a software on my mobile phone, as shown in the above Code diagram, it takes about three seconds from camera shooting to decoding to display content, and there is no requirement on camera angle;

Second, high capacity and high density. Theoretically, after the content is compressed, it can store 7089 numbers, 4296 letters and numbers, 2953 8-byte data, and 1817 Chinese characters;

Third, it supports error correction. The error correction process is relatively complex and I have not yet fully understood it. According to the instructions in the QR code standard documentation, there are four levels of error correction:

  • Level L: a maximum of 7% errors can be corrected;
  • Level M: a maximum of 15% errors can be corrected;
  • Level Q: a maximum of 25% errors can be corrected;
  • Level H: a maximum of 30% errors can be corrected;

The fourth is structured. A seemingly rule-free image actually has a strict definition of the region, it is a QR map structure in Mode 2 and Version 1 (the "Mode" and "version" of the QR code will be described later ):

In the matrix of 21*21, black and white areas are specified as fixed locations in the QR code specification, known as the finder pattern and the timing pattern ). Image Search and positioning graphics are used to help the decoder determine the coordinates of specific symbols in the image.

The yellow area is used to save the encoded data content and error correction information code.

The blue area is used to identify the error correction level (that is, Level L to level H) and the so-called "mask pattern". This area is called "format information ).

5. scalability. The structure append feature of the QR code enables a QR code to be divided into multiple QR codes. On the contrary, the data of multiple QR codes can be combined into a single QR code.

 

 

3. QR code mode and version

We have mentioned the QR code model and version ). QR codes are divided into two modes: model1 and model2. model1 is the initial definition of QR codes, and model2 is an extension of model1. Currently, model2 is widely used, all the instructions in this article are only used for model2.

The size of a QR image is defined as version. The version number ranges from 1 to 40. Version 1 is a 21*21 matrix. Each time a version number is added, four modules are added to the matrix size. Therefore, version 40 is a matrix of 177*177. (The higher the version, the more content stored, and the stronger the error correction capability ).

3. Supported QR codes

QR codes support mixed encoding of numbers, numbers, and characters, 8-bit bytecode, and multi-byte characters including Chinese characters. Where:

Number: each of the three digits is compressed into 10 bits.

Combination of letters and numbers: each two is a group, compressed into 11bit.

8-bit bytes of data: stored directly without compression.

Multi-byte characters: each character is compressed into 13 BITs.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.