Internet review - Lite Web-master Graphics Games Freeware Time Christmas Bible
Logotypes Fonts Heraldry Icons Graphics Photo
QR Code Generators

Read QR code

Sometimes there are situations when you need to read the QR code, and the smartphone is not at hand. What to do? It only comes to the head to try to read by hand. If someone has encountered such situations or who are just interested in how the QR code is read by machines, this article will help you to understand this problem.

The article deals with the basic features of QR codes and the method of deciphering information without using computers.

 The solution of the problem of direct reading of information from the QR-image will be considered using the example of two codes.

To understand how to extract data from the code, you need to understand the algorithm. There are several standards in the QR code family, their basic principles can be found in the specifications. Briefly explain: the data that needs to be coded is divided into blocks, depending on the encoding mode. Blocked data are added with a header indicating the mode and the number of blocks. There are also such regimes in which a more complex structure of information placement is used. These modes will not be considered, in view of the fact that it is not advisable to extract information manually from them. However, based on the principles that are described below, you can adapt and to these modes.

 In the case of incorrect reading of data in QR, special codes are used that can correct errors in reading. This is the so-called Reed-Solomon codes. The principle of calculating codes, as well as correcting errors in blocks of information, will not be considered, this is the topic of a separate article. Corrective error codes Reed-Solomon (RS) are recorded after all information data. This greatly simplifies the task of directly reading information: you can simply read the data without touching the codes. As practice shows, usually most of the QR-matrix is ​​occupied by corrective RS-codes.
 
 According to the standard, data with RS-codes before recording in the picture is "mixed". Special masks are used for this purpose. There are 8 algorithms, among which the best one is selected. The selection criteria are based on a system of penalties, which can also be read in the specification.

 The "mixed" data is recorded in a special sequence in a template picture, where technical information for the decoding devices is added. Based on the described algorithm, we can distinguish the scheme for extracting data from the QR code:

 Here, the green felt-tip underlines the points that you will need to implement when you directly read the code. The remaining items can be omitted because the person is reading.

Step 0. QR code

Looking at the pictures, you can see a few distinct areas.
These areas are used to detect QR code.
These data are not of interest from the point of view of recorded information, but they need to be deleted or simply remember their location so that they do not interfere. The rest of the code field already contains useful information.
It can be divided into two parts: system information and data. There is also information about the version of the code.
The maximum amount of data that can be written to the code depends on the version of the code. With the upgrade version - special blocks are added, for example as here:

On them you can find out and understand what version of QR is in front of you.
Cods of high versions are usually also impractical to read manually.

The location of the system information is shown in the picture:

The system information is duplicated, which allows to significantly reduce the probability of errors when detecting code and reading.
System information is 15 bits of data, among which the first 5 is useful information, and the remaining 10 are BCH (15,5) code that allows you to correct errors in system data. To the class of BCH codes include and RS codes.
Note ATTENTION that in the figure, two 15-bit strips do not intersect.

Step 1. Reading 5 bits of system information

As already mentioned, only the first 5 bits are of interest. Of which 2 bits indicate the level of error correction, and the remaining 3 bits indicate which mask of the available 8 is applied to the data. In the QR codes considered, the system information contains:

Step 2. Mask for system information

In addition to the already announced schemes of protection of system information, in addition, a static mask is applied, which is applied to any system information.
It looks like: 101010000010010.
Since only the first 5 bits are of interest, the mask can be shortened and easily remembered: 10101 (ten-one-one).
After applying the "exclusive or" operation (xor), we get the information.

 Possible error correction levels:

L 01
M 00
Q 11
H 10

Possible masks:

000 (i + j) mod 2=0
001 i mod 2=0
010 j mod 3=0
011 (i + j) mod 3=0
100 ((i div 2) + (j div 3)) mod 2=0
101 (i j) mod 2 + (i j) mod 3=0
110 ((i j) mod 2 + (i j) mod 3) mod 2=0
111 ((i+j) mod 2 + (i j) mod 3) mod 2=0

Step 3. Reading the data header

To understand what data to deal with, you must first read the 4-bit header, which contains information about the mode. Specificity of data reading is shown in the picture:

List of possible modes:

ECI 0111
Numerical 0001
Alphanumeric 0010
8-bit (byte) 0100
Kanji 1000
Structured addition 0011
FNC1 0101 (1st position)
1001 (2nd position)

Step 4. Applying the mask to the header

After extracting the 4 bits describing the mode, you need to apply a mask to them.
In our case two masks are used for the two codes. The mask is determined by the expression given in the table above. If this expression reduces to TRUE (true) for a bit with the coordinates (i, j), then the bit is inverted, otherwise everything remains unchanged. The origin in the upper left corner is (0,0). Looking at the expressions, you can see in them patterns. For the considered QR codes, the masks will look like this:

We get the following modes:

Step 5. Reading Data

After receiving the data on the mode, you can start reading the information. It must be stipulated that it is most interesting to read numerical and alphanumeric data, since they are easily interpreted. But also do not be afraid of 8-bit. It can also be easily interpreted information. For example, many online QR text generators are encoded in this mode, using ASCII. Another reason why you should initially read the mode is that the number of data packets depends on it. Which also depends on the version of the code. For versions from the first to the ninth blocks length for more readable modes:

Numerical 10 bits/4 bits
Alphanumeric 9 bit
8-bit (byte) 8 bits

The first block after the mode pointer is the number of characters. For numeric mode, the number is encoded in the next 10 bits, and for the 8-bit mode in 8 bits (I apologize for the tautology).

The figure shows that in the left QR code, as it was noted, the number 5 is recorded. This is seen by the number of characters and the subsequent 4 bits. In numeric mode, along with 10-bit blocks, 4-bit blocks are used to save space, if in a 10-bit volume it is not necessary. In the right code, 4 characters are encrypted. At the moment it is not known what is encrypted in it. Therefore, it is necessary to proceed to reading the next column to extract all 4 blocks of information.

The figure shows that all 4 packages are ASCII Latin letters that form the word "habr"

Naturally the best way is to get the phone out of your pocket and, pointing the camera at the QR-picture, read all the information. However, in urgent cases, the described technique can be useful. Of course, you can not keep all the pointers of modes and mask types, as well as ASCII characters, in your head, but you can remember the popular combinations (at least those that are discussed in the article).

Specification:

BS ISO/IEC 18004:2006. Information technology. Automatic identification and data capture techniques. QR Code 2005 bar code symbology specification. London: BSI. 2007. p. 126. ISBN 978-0-580-67368-9.

P.S. Observe resource rules and conditions Creative Commons Attribution 3.0 Unported (CC BY 3.0)

About QR code

Making a QR code
QR Code Generator in our country Generator QR code vector Google QR code Unusual QR code
Read the QR code
QR scanners



Mobile version

Terms of publication of the article
Advertising
About us
Graphics

Fonts
Logos
Brandbooks
Pictogramms
Heraldry

Popular

Check a website level
A website registration
How to creat a website
#1 on Google
Online Translators
Password

Internet top

©2005-2024, Web studio Ph4 - Internet Catalog for user, web-master and designer v. 6.0.3