|
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 codeLooking 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 informationAs 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 informationIn 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:
Step 3. Reading the data headerTo 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:
Step 4. Applying the mask to the headerAfter 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 DataAfter 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:
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
|