QR Code Demystified - Part 2

Matcha Design - Tuesday, May 31, 2011

下一个重要的事情是QR码的结构. 下图显示了一个QR符号的不同部分的名称. Then I'll go over each one in more detail. 记住,下面如果我提到某物的一个副本是原件,另一个副本是复制品, 这只是为了方便这样考虑,因为数据是相同的, it makes no difference which is placed first. 下面我将说明哪些信息存储在不同的部分中, 但我不会详细讲这些信息是如何编码的. 我将在后面几周解释,并在完成不同部分时添加链接.

Finder Pattern
“发现者”图案是在除右下角以外的符号的所有角落里的颜色交替的同心圆正方形. 它们被解码器用来识别QR码,并确定方向. 中心是一个3x3的黑色正方形,周围是一个一厚的白色盒子, which is surrounded by a one-thick black box, making the full pattern 7x7 modules. 图案的侧面不被放置在符号的边缘被一个模块的空白包围. Additionally, 一个黑色模块位于左下模块周围白色区域的右上角的右边(换句话说), 8 modules in from the far left and 7 from the bottom).

Alignment Pattern
Used in symbols of version 2 and higher, 放置对齐模式是为了帮助解码器调整符号中的倾斜. Without them, 对于解码器来说,要确定如何将一张歪斜的照片转换成它所解码的虚拟数据网格则要困难得多. 排列图案是像取景器图案一样的同心方块, but the center is a single black module. It's surrounded by a one-thick white box, which is surrounded by a one-thick black box, with no white space outside of that. 更高的版本在符号上放置了更多的对齐模式. More details on that later.

Timing Pattern
黑色和白色模块的交替条纹垂直和水平地位于取景器模式之间. 从取景器图案最里面的黑色角落开始, 定时模式向相邻的查找器模式交替值. 因此,计时模式有两行——其中一行在两个顶部查找器模式之间水平运行, 还有一个在两个左侧取景器模式之间垂直运行.

qr-sample.png

Format Data
QR符号中的数据通过在特定位置上反转模块被屏蔽(稍后会详细介绍).为了让解码器知道哪些模块要反向读取, the selected mask is stored twice, along with the error correction version. 在格式信息被编码到15位之后,它被放置在符号中两次. The first copy starts on the far left, 就在左上方取景器图案周围的白色空间的正下方. (Row 8, Column 0, 第一个(最高阶)位放在这个位置, and subsequent bits are placed to the right. 在这种方式中,跳过计时模式的模块, two more bits are placed to the right, 然后数据“转”了发现者模式的空白区域. The module from the other timing pattern is also skipped, 其余模块垂直放置,直到第15位(最低顺序), or 1s place) is placed on the top row of the symbol. 第二个副本从底部开始,就在左下角查找器模式周围的空白区域的右边. (Last Row, Column 8, 零索引)位按顺序(从最高到最低顺序)沿着空白位置向上放置,直到到达取景器模式角落的黑色模块. 否则将进入该位置的位被立即放置在右上查找器模式周围的留白的左下下方. (7th Column from last, Row 8, zero-indexed) Subsequent bits are placed to the right, with the final bit located in the last column.

Version Data
版本数据只是指出正在使用的版本. 它需要18个模块,并位于符号的顶部, to the left of the top-right finder pattern. It is 3 modules wide and 6 modules high. 一个副本被放置在符号的左边, just above the bottom-right finder pattern. It is 3 modules high and 6 modules wide. 编码沿NW - SE对角线镜像. If building an encoder, 可以通过将按行和列排列的信息放在原始位置,并将行号和列号倒置来存储版本数据. (假设左上角是[0,0])换句话说,它位于 module[x][y] in the original could be placed in module[y][x] for the duplicate.

Data and Error Correction
After the data is encoded (see part 3)采用纠错算法,以确保即使符号的部分被模糊或弄脏(see part 4). 编码后的数据和错误校正信息存储在上面提到的任何其他内容都不会使用的模块中.

Mandatory Blank Space
QR规范要求一个空间等于四个模块的宽度围绕符号为空白, 防止同一表面上其他物体的干扰. 如果文本或图像放置得离符号太近, they might be interpreted as part of the symbol itself. 尽管符号通常可以用少于4个模块的间隙来阅读, following the specification exactly is never a bad idea.

如果你觉得这篇文章有帮助或者想要跟上未来的更新, 使用文章顶部和底部的链接分享它. In the coming weeks, 我们将了解数据的各个部分是如何编码的, how much data can be stored in a symbol, how to apply the error correction, and more. 最后,我将公布完成的二维码生成器,开启了整个项目. 如果您在此期间有任何问题,请与我们联系 Twitter or Facebook. And be sure to Follow or Like us while you're at it!

About Matcha Design
九游会客户端是一家全方位服务的创意机构 web designprintidentitybrandinginterface designvideo productionstill photography and motion design. 利用我们对卓越的热情,多元文化背景,还有 award winning practices, we consistently provide high-quality, custom, 以创新的解决方案满足客户多样化的市场需求. For more information, visit www.MatchaDesign.com.