QR code
≈ 15 min read
Names in other languages
No names in other languages are held for this entry yet.
Article bodies are English and are not machine-translated. A name in another language is not a translation of the article.
of the English Wikipedia main page|alt=A QR code for the URL of the English Wikipedia main page|250x250px A QR code, short for quick-response code, is a type of two-dimensional matrix barcode invented in 1994 by Masahiro Hara of the Japanese company Denso Wave for labelling automobile parts. It features white ("0") and black ("1") squares within a square grid featuring fiducial markers on the corners, readable by imaging devices like cameras, and processed using Reed–Solomon error correction until the image can be appropriately interpreted. The required data is then extracted from patterns that are present in both the horizontal and the vertical components of the QR image. Whereas a barcode is a machine-readable optical image that contains information specific to the labeled item, the QR code contains the data for a locator, an identifier, and web tracking. To store data efficiently, QR codes use four standardized modes of encoding: numeric, alphanumeric, byte or binary, and kanji. Compared to standard UPC barcodes, the QR labeling system was applied beyond the automobile industry because of faster reading of the optical image and greater data-storage capacity in applications such as product tracking, item identification, time tracking, document management, and general marketing.…
of the English Wikipedia main page|alt=A QR code for the URL of the English Wikipedia main page|250x250px]] A QR code, short for quick-response code, is a type of two-dimensional matrix barcode invented in 1994 by Masahiro Hara of the Japanese company Denso Wave for labelling automobile parts. It features white ("0") and black ("1") squares within a square grid featuring fiducial markers on the corners, readable by imaging devices like cameras, and processed using Reed–Solomon error correction until the image can be appropriately interpreted. The required data is then extracted from patterns that are present in both the horizontal and the vertical components of the QR image. Whereas a barcode is a machine-readable optical image that contains information specific to the labeled item, the QR code contains the data for a locator, an identifier, and web tracking. To store data efficiently, QR codes use four standardized modes of encoding: numeric, alphanumeric, byte or binary, and kanji. Compared to standard UPC barcodes, the QR labeling system was applied beyond the automobile industry because of faster reading of the optical image and greater data-storage capacity in applications such as product tracking, item identification, time tracking, document management, and general marketing. QR codes are used in a broad context, including both commercial tracking applications and convenience-oriented applications aimed at mobile phone users (termed mobile tagging). QR codes may be used to display text to the user, to open a webpage on the user's device, to add a vCard contact to the user's device, to open a Uniform Resource Identifier (URI), to connect to a wireless network, to compose an email or text message, or as a method of payment. === Loyalty programs=== QR codes have been used by various retail outlets that have loyalty programs. Sometimes these programs are accessed with a app that is loaded onto a phone and includes a process triggered by a QR code scan. The QR codes for loyalty programs tend to be found printed on the receipt for a purchase or on the products themselves. Users in these schemes collect award points by scanning a code. File:Qr-1.svg|Version 1 (21×21). Content: "Ver1". File:Qr-2.svg|Version 2 (25×25). Content: "Version 2". File:Qr-3.svg|Version 3 (29×29). Content: "Version 3 QR Code". File:Qr-4.svg|Version 4 (33×33). Content: "Version 4 QR Code, up to 50 char". File:Qr-code-ver-10.svg|Version 10 (57×57). Content: "VERSION 10 QR CODE, UP TO 174 CHAR AT H LEVEL, WITH 57X57 MODULES AND PLENTY OF ERROR CORRECTION TO GO AROUND. NOTE THAT THERE ARE ADDITIONAL TRACKING BOXES" (actually encoded in all capital letters). (Tracking boxes are more commonly called alignment patterns.) File:QR Code Version 25.svg|Version 25 (117×117). Content: 1,269 characters of ASCII text describing QR codes. File:Qr-code-ver-40.svg|Version 40 (177×177). Content: "Version 40 QR Code can contain up to 1852 chars ..." (and followed by four paragraphs of ASCII text describing QR codes). The text refers to a QR Code with a "Level H" error correction. Other levels provide higher capacity. QR codes use Reed–Solomon error correction over the finite field \mathbb{F}_{256} or , the elements of which are encoded as bytes of 8 bits; the byte b_7b_6b_5b_4b_3b_2b_1b_0 with a standard numerical value \textstyle\sum_{i=0}^7 b_i 2^i encodes the field element \textstyle\sum_{i=0}^7 b_i \alpha^i where \alpha \in \mathbb{F}_{256} is taken to be a primitive element satisfying \alpha^8 + \alpha^4 + \alpha^3 + \alpha^2 + 1 = 0 . The primitive polynomial is x^8 + x^4 + x^3 + x^2 + 1 , corresponding to the polynomial number 285, with initial root = 0 to obtain generator polynomials. The Reed–Solomon code uses one of 37 different polynomials over \mathbb{F}_{256} , with degrees ranging from 7 to 68, depending on how many error correction bytes the code adds. It is implied by the form of Reed–Solomon used (systematic BCH view) that these polynomials are all of the form \prod_{i=0}^{n-1} (x - \alpha^i) . However, the rules for selecting the degree n are specific to the QR standard. For example, the generator polynomial used for the Version 1 QR code (21×21), when 7 error correction bytes are used, is: g(x)= x^7+\alpha^{87}x^6+\alpha^{229}x^5+\alpha^{146}x^4+\alpha^{149}x^3+\alpha^{238}x^2+\alpha^{102}x+\alpha^{21} . This is obtained by multiplying the first seven terms: g(x)=(x+1)(x+\alpha)(x+\alpha^2)(x+\alpha^3)(x+\alpha^4)(x+\alpha^5)(x+\alpha^6) . The same may also be expressed using decimal coefficients (over \mathbb{F}_{256} ), as: g(x)= x^7+127x^6+122x^5+154x^4+164x^3+11x^2+68x+117 . The highest power of x in the polynomial (the degree n , of the polynomial) determines the number of error correction bytes. In this case, the degree is 7. When discussing the Reed–Solomon code phase there is some risk for confusion, in that the QR ISO/IEC standard uses the term codeword for the elements of \mathbb{F}_{256} , which with respect to the Reed–Solomon code are symbols, whereas it uses the term block for what with respect to the Reed–Solomon code are the codewords. The number of data versus error correction bytes within each block depends on (i) the version (side length) of the QR symbol and (ii) the error correction level, of which there are four. The higher the error correction level, the less the storage capacity. The following table lists the approximate error correction capability at each of the four levels: In larger QR symbols, the message is broken up into several Reed–Solomon code blocks. The block size is chosen so that no attempt is made at correcting more than 15 errors per block; this limits the complexity of the decoding algorithm. The code blocks are then interleaved together, making it less likely that localized damage to a QR symbol will overwhelm the capacity of any single block. The Version 1 QR symbol with level L error correction, for example, consists of a single error correction block with a total of 26 code bytes (made of 19 message bytes and seven error correction bytes). It can correct up to 2 byte errors. Hence, this code is known as a (26,19,2) error correction code over . It is also sometimes represented in short, as a (26,19) code. Due to error correction, it is possible to create artistic QR codes with embellishments to make them more readable or attractive to the human eye, and to incorporate colors, logos, and other features into the QR code block; the embellishments are treated as errors, but the codes still scan correctly. It is also possible to design artistic QR codes without reducing the error correction capacity by manipulating the underlying mathematical constructs. ====Format information and masking==== The format information records two things: the error correction level and the mask pattern used for the symbol. Masking is used to break up patterns in the data area that might confuse a scanner, such as large blank areas or misleading features that look like the locator marks. The mask patterns are defined on a grid that is repeated as necessary to cover the whole symbol. Modules corresponding to the dark areas of the mask are inverted. The 5-bit format information is protected from errors with a BCH code, and two complete copies are included in each QR symbol. A (15,5) triple error-correcting BCH code over is used, having the generator polynomial g(x)=x^{10}+x^8+x^5+x^4+x^2+x+1 . It can correct at most 3 bit errors out of the 5 data bits. There are a total of 15 bits in this BCH code (10 bits are added for error correction). This 15-bit code is itself X-ORed with a fixed 15-bit mask pattern (101010000010010) to prevent an all-zero string. ====Error correction bytes==== To obtain the error correction (EC) bytes for a message "www.wikipedia.org", the following procedure may be carried out: The message is 17 bytes long; hence it can be encoded using a (26,19,2) Reed-Solomon code to fit in a Ver1 (21×21) symbol, which has a maximum capacity of 19 bytes (for L-level error correction). The generator polynomial specified for the (26,19,2) code is: g(x)= x^7+127x^6+122x^5+154x^4+164x^3+11x^2+68x+117 , which may also be written in the form of a matrix of decimal coefficients: [1 127 122 154 164 11 68 117] The 17-byte-long message "www.wikipedia.org" as hexadecimal coefficients (ASCII values), denoted by M1 through M17 is: [77 77 77 2E 77 69 6B 69 70 65 64 69 61 2E 6F 72 67] The encoding mode is "Byte encoding". Hence the 'Enc' field is [0100] (4 bits). The length of the above message is 17 bytes; hence the 'Len' field is [00010001] (8 bits). The 'End' field is the end-of-message marker [0000] (4 bits). The message code word (without EC bytes) is of the form: ['Enc' 'Len' w w w . w i k i p e d i a . o r g 'End'] Substituting the hexadecimal values, it can be expressed as: [4 11 77 77 77 2E 77 69 6B 69 70 65 64 69 61 2E 6F 72 67 0] This is rearranged as 19-byte blocks of 8 bits each: [ 41 17 77 77 72 E7 76 96 B6 97 06 56 46 96 12 E6 F7 26 70 ] Using the procedure for Reed-Solomon systematic encoding, the 7 EC bytes obtained (E1 through E7, as shown in the symbol) which are the coefficients (in decimal) of the remainder after polynomial division are: [ 174 173 239 6 151 143 37 ] or in hexadecimal values: [ AE AD EF 06 97 8F 25 ] These 7 EC bytes are then appended to the 19-byte message. The resulting coded message has 26 bytes (in hexadecimal): [ 41 17 77 77 72 E7 76 96 B6 97 06 56 46 96 12 E6 F7 26 70 AE AD EF 06 97 8F 25 ] Note: The bit values shown in the Ver1 QR symbol below do not match the above values, as the symbol has been masked using a mask pattern (001). ====Message placement==== The message dataset is placed from right to left in a zigzag pattern, as shown below. In larger symbols, this is complicated by the presence of the alignment patterns and the use of multiple interleaved error-correction blocks. File:QR Format Information.svg|Meaning of format information. In the above figure, the format information is protected by a (15,5) BCH code, which can correct up to 3 bit errors. The total length of the code is 15 bits, of which 5 are data bits (2 EC level + 3 mask pattern) and 10 are extra bits for error correction. The format mask pattern for these 15 bits is: [101010000010010]. Note that we map the masked values directly to their meaning here, in contrast to image 4 "Levels & Masks" where the mask pattern numbers are the result of putting the 3rd to 5th mask bit, [101], over the 3rd to 5th format info bit of the QR code. File:QR Character Placement.svg|Message placement within a Ver 1 QR symbol (21×21). The message is encoded using a (255,248) Reed Solomon code (shortened to (26,19) code by using "padding") that can correct up to 2-byte errors. A total of 26 code-words consist of 7 error-correction bytes and 17 data bytes, in addition to the "Len" (8 bit field), "Enc" (4 bit field), and "End" (4 bit field). The symbol is capable of level L error correction. The EC level is 01(L), and the mask pattern is 001. Hence the first 5 bits of the format information are 01001 (without the format mask). After masking, the 5 bits become 11100, as seen here. File:QR Ver3 Codeword Ordering.svg|Larger symbol (Ver 3, 29×29) illustrating interleaved blocks. The message has 26 data bytes and is encoded using two Reed-Solomon code blocks. Each block is a (255,233) Reed Solomon code (shortened to a (35,13) code), which can correct up to 11-byte errors in a single burst, containing 13 data bytes and 22 error-correction bytes appended to the data bytes. The two 35-byte Reed-Solomon code blocks are interleaved (resulting in a total of 70 code bytes), so it can correct up to 22-byte errors. The symbol achieves level H error correction. The general structure of a QR encoding is as a sequence of 4-bit indicators with payload length dependent on the indicator mode (e.g. byte encoding payload length is dependent on the first byte). Note: Character Count Indicator depends on how many modules are in a QR code (Symbol Version). ECI Assignment number Size: 8 × 1 bits if ECI Assignment Bitstream starts with '0' 8 × 2 bits if ECI Assignment Bitstream starts with '10' 8 × 3 bits if ECI Assignment Bitstream starts with '110' Encoding modes can be mixed as needed within a QR symbol. (e.g., a URL with a long string of alphanumeric characters ) [ Mode Indicator][ Mode bitstream ] --> [ Mode Indicator][ Mode bitstream ] --> etc... --> [ 0000 End of message (Terminator) ] After every indicator that selects an encoding mode is a length field that tells how many characters are encoded in that mode. The number of bits in the length field depends on the encoding and the symbol version. Alphanumeric encoding mode stores a message more compactly than the byte mode can, but cannot store lowercase letters and has only a limited selection of punctuation marks, which are sufficient for rudimentary web addresses. Two characters are coded in an 11-bit value by this formula: V = 45 × C 1 + C 2 This has the exception that the last character in an alphanumeric string with an odd length is read as a 6-bit value instead. File:QR Code Model 1 Example.svg|Model 1 QR code example File:Model 1 QR Version 2 Layout.svg|Model 1 QR code functional regions File:Micro QR Example.svg|Micro QR code example File:Micro QR Version 3M Layout.svg|Micro QR code functional regions File:Rectangular Micro QR Code Example R17x43.svg|Rectangular Micro QR Code (rMQR Code) example File:iQRCode.svg|iQR code example File:Frame QR Code.png|Frame QR example File:Wiki-FQRC.png|Frame QR code example with a circular frame and the Wikipedia logo composed into its interior
Text derived from https://en.wikipedia.org/w/index.php?oldid=1378381073 under CC BY-SA 4.0; modifications have been made.