CN107563477A - Quick Response Code and its generation method and device - Google Patents
Quick Response Code and its generation method and device Download PDFInfo
- Publication number
- CN107563477A CN107563477A CN201710618727.XA CN201710618727A CN107563477A CN 107563477 A CN107563477 A CN 107563477A CN 201710618727 A CN201710618727 A CN 201710618727A CN 107563477 A CN107563477 A CN 107563477A
- Authority
- CN
- China
- Prior art keywords
- area
- dimensional code
- information
- type
- data information
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 19
- 238000012937 correction Methods 0.000 claims abstract description 70
- 238000012545 processing Methods 0.000 claims description 17
- 238000007405 data analysis Methods 0.000 claims description 4
- 230000000873 masking effect Effects 0.000 claims description 4
- 238000010586 diagram Methods 0.000 description 11
- 239000011159 matrix material Substances 0.000 description 5
- 230000005540 biological transmission Effects 0.000 description 2
- 230000001788 irregular Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000004458 analytical method Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000015572 biosynthetic process Effects 0.000 description 1
- 238000011109 contamination Methods 0.000 description 1
- 230000007812 deficiency Effects 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000009826 distribution Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000002310 reflectometry Methods 0.000 description 1
Landscapes
- Error Detection And Correction (AREA)
Abstract
Description
技术领域technical field
本发明涉及信息技术领域,尤其涉及一种二维码及其生成方法和装置。The present invention relates to the field of information technology, in particular to a two-dimensional code and its generating method and device.
背景技术Background technique
随着信息技术的飞速发展,二维码在日常生活中广泛应用,比如,信息获取、网站跳转、广告推送、防伪溯源、优惠促销、会员管理、手机支付等领域,由于它比传统的条形码能存更多的信息,也能表示更多的数据类型,越来越受关注。With the rapid development of information technology, two-dimensional codes are widely used in daily life, such as information acquisition, website jump, advertisement push, anti-counterfeiting traceability, preferential promotion, member management, mobile payment and other fields. It can store more information and represent more data types, which is attracting more and more attention.
现有技术中,二维码有多个种类,常用的是矩阵式二维码(又称棋盘式二维码)它是在一个矩形空间通过黑、白像素在矩阵中的不同分布进行编码。在矩阵相应元素位置上,用点(方点、圆点或其他形状)的出现表示二进制“1”,点的不出现表示二进制的“0”,点的排列组合确定了矩阵式二维码所代表的意义。矩阵式二维条码是建立在计算机图像处理技术、组合编码原理等基础上的一种新型图形符号自动识读处理码制。最具有代表性的矩阵式二维码是QR码,QR码读取速度快,呈正方形,只有黑白两色。在4个角落的其中3个,印有较小,像“回”字的的正方图案。这3个是帮助解码软件定位的图案,使用者不需要对准,无论以任何角度扫描,资料仍可正确被读取。因此被广泛应用。In the prior art, there are many types of two-dimensional codes, among which matrix two-dimensional codes (also known as checkerboard two-dimensional codes) are commonly used, which are coded in a rectangular space through different distributions of black and white pixels in the matrix. On the corresponding element position of the matrix, the appearance of a dot (square dot, dot or other shape) represents a binary "1", and the absence of a dot represents a binary "0". representative meaning. The matrix two-dimensional barcode is a new type of graphic symbol automatic reading and processing code system based on computer image processing technology and combined coding principles. The most representative matrix two-dimensional code is the QR code. The QR code is fast to read, square in shape, and only black and white. In 3 of the 4 corners, there is a smaller square pattern that looks like the word "Hui". These 3 patterns are used to help the decoding software to locate. The user does not need to align, and the data can still be read correctly regardless of the scanning angle. Therefore it is widely used.
但是,现有技术中的QR码也有其自身的缺点和不足,主要在于其缺乏强鲁棒性。在它破损一个角的情况很难读取其中的信息,破损两个角则100%无法读取信息,这就会影响消费者的扫码识读。尤其是在农产品运输、销售过程中二维码标签更容易受到污染或者缺角破损。所以,开发一种鲁棒性更强的二维码显得非常重要。However, the QR code in the prior art also has its own shortcomings and deficiencies, mainly due to its lack of strong robustness. It is difficult to read the information if one corner is damaged, and 100% cannot read the information when two corners are damaged, which will affect consumers' scanning and reading. Especially in the process of transportation and sales of agricultural products, two-dimensional code labels are more likely to be polluted or damaged. Therefore, it is very important to develop a more robust QR code.
发明内容Contents of the invention
(一)要解决的技术问题(1) Technical problems to be solved
本发明的目的是提供一种二维码及其生成方法和装置,解决了现有技术中的二维码标签由于受到污染或者缺角破损而导致无法读取其中的信息的问题。The object of the present invention is to provide a two-dimensional code and its generation method and device, which solves the problem that the information in the two-dimensional code label in the prior art cannot be read due to contamination or missing corners.
(二)技术方案(2) Technical solutions
为了解决上述技术问题,一方面,本发明提供一种二维码,包括,边框区、二维码码图和空白区,所述二维码码图包括格式版本信息区、定位区、校正区和数据信息编码区。In order to solve the above technical problems, on the one hand, the present invention provides a two-dimensional code, including a border area, a two-dimensional code map and a blank area, and the two-dimensional code map includes a format version information area, a positioning area, and a correction area and data information coding area.
进一步地,所述格式版本信息区的数量至少为三个。Further, the number of the format version information areas is at least three.
进一步地,所述格式版本信息区位于二维码的角上。Further, the format version information area is located at the corner of the two-dimensional code.
进一步地,所述格式版本信息区至少包含二维码的行列数信息、版本类型信息、纠错等级信息和掩模类型信息中的一种。Further, the format version information area includes at least one of row and column number information of the two-dimensional code, version type information, error correction level information and mask type information.
进一步地,所述边框区是至少一个模块单元宽的黑色边框,它将整个所述二维码码图包围起来。Further, the frame area is a black frame with a width of at least one module unit, which encloses the entire two-dimensional code pattern.
进一步地,所述定位区由一条黑白色交替构成的宽度为模块单位宽的一行水平定位图案和一列垂直定位图案组成,所述水平定位图案和所述垂直定位图案分别位于二维码码图的第六行和第六列。Further, the positioning area is composed of a row of horizontal positioning patterns and a column of vertical positioning patterns with a width of a module unit width alternately formed of black and white. The horizontal positioning patterns and the vertical positioning patterns are respectively located on the two-dimensional code map. Sixth row and sixth column.
进一步地,所述校正区由“回”形结构组成,所述“回”形结构由三个黑白色相间的同心正方形重叠构成。Further, the correction area is composed of a "back"-shaped structure, and the "back"-shaped structure is formed by overlapping three black and white concentric squares.
进一步地,所述空白区包围在所述边框区的外面,由一个至少三个模块单元宽的白边框构成。Further, the blank area is surrounded by the outside of the frame area, and is composed of a white frame with a width of at least three module units.
另一方面,本发明提供一种生成上述二维码的方法,包括:In another aspect, the present invention provides a method for generating the above-mentioned two-dimensional code, including:
接收输入数据信息,根据所述输入数据信息确定二维码的编码字符类型、版本类型、纠错等级和掩模类型,生成空白区、边框区、定位区和校正区;Receiving input data information, determining the coded character type, version type, error correction level and mask type of the two-dimensional code according to the input data information, and generating blank areas, frame areas, positioning areas and correction areas;
根据所述编码字符类型、所述版本类型和所述纠错等级对所述输入数据信息进行编码,生成数据信息码字序列;Encoding the input data information according to the encoded character type, the version type and the error correction level to generate a data information codeword sequence;
对所述编码字符类型、所述版本类型、所述纠错等级和所述掩模类型进行编码,生成格式版本信息码字序列;Encoding the coded character type, the version type, the error correction level and the mask type to generate a format version information codeword sequence;
对所述数据信息码字序列进行掩模处理,生成数据信息编码区,对所述格式版本信息码字序列进行掩模处理,生成格式版本信息区。Mask processing is performed on the data information code word sequence to generate a data information coding area, and mask processing is performed on the format version information code word sequence to generate a format version information area.
再一方面,本发明提供一种生成上述二维码的装置,包括:In another aspect, the present invention provides a device for generating the above-mentioned two-dimensional code, including:
输入数据分析模块,用于接收输入数据信息,根据所述输入数据信息确定二维码的编码字符类型、版本类型、纠错等级和掩模类型,生成空白区、边框区、定位区和校正区;The input data analysis module is used to receive input data information, determine the encoded character type, version type, error correction level and mask type of the two-dimensional code according to the input data information, and generate blank areas, border areas, positioning areas and correction areas ;
数据信息编码模块,用于根据所述编码字符类型、所述版本类型和所述纠错等级对所述输入数据信息进行编码,生成数据信息码字序列;A data information encoding module, configured to encode the input data information according to the encoded character type, the version type and the error correction level to generate a data information codeword sequence;
格式版本信息编码模块,用于对所述编码字符类型、所述版本类型、所述纠错等级和所述掩模类型进行编码,生成格式版本信息码字序列;A format version information encoding module, configured to encode the encoded character type, the version type, the error correction level, and the mask type to generate a format version information codeword sequence;
掩模模块,用于对所述数据信息码字序列进行掩模处理,生成数据信息编码区,对所述格式版本信息码字序列进行掩模处理,生成格式版本信息区。The masking module is configured to perform mask processing on the data information code word sequence to generate a data information coding area, and perform mask processing on the format version information code word sequence to generate a format version information area.
(三)有益效果(3) Beneficial effects
本发明提供的二维码及其生成方法和装置,通过设计包括边框区、二维码码图和空白区的二维码,所述二维码码图包括格式版本信息区、定位区、校正区和数据信息编码区。使二维码标签在部分受到污染或者缺角破损的情况下,依然能读取其中的信息,提高了二维码标签的鲁棒性。The two-dimensional code and its generation method and device provided by the present invention, by designing a two-dimensional code including a frame area, a two-dimensional code map and a blank area, the two-dimensional code map includes a format version information area, a positioning area, a correction area and data information encoding area. The information in the two-dimensional code label can still be read even when the two-dimensional code label is partially polluted or the missing corner is damaged, which improves the robustness of the two-dimensional code label.
附图说明Description of drawings
图1为依照本发明实施例的二维码结构示意图;FIG. 1 is a schematic diagram of a two-dimensional code structure according to an embodiment of the present invention;
图2为依照本发明实施例的生成二维码的方法示意图;FIG. 2 is a schematic diagram of a method for generating a two-dimensional code according to an embodiment of the present invention;
图3为依据本发明实施例的生成二维码的具体流程图;FIG. 3 is a specific flowchart of generating a two-dimensional code according to an embodiment of the present invention;
图4为依据本发明实施例的二维码的解码具体流程图;FIG. 4 is a specific flow chart of decoding a two-dimensional code according to an embodiment of the present invention;
图5为依照本发明实施例的生成二维码的装置示意图。Fig. 5 is a schematic diagram of an apparatus for generating a two-dimensional code according to an embodiment of the present invention.
具体实施方式detailed description
为了使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments It is a part of embodiments of the present invention, but not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts fall within the protection scope of the present invention.
实施例1:Example 1:
图1为依照本发明实施例的二维码结构示意图,如图1所示,本发明实施例提供一种二维码,包括,边框区10、二维码码图和空白区60,所述二维码码图包括格式版本信息区20、定位区30、校正区40和数据信息编码区50。FIG. 1 is a schematic diagram of a two-dimensional code structure according to an embodiment of the present invention. As shown in FIG. 1 , an embodiment of the present invention provides a two-dimensional code, including a frame area 10, a two-dimensional code map and a blank area 60, the The two-dimensional code diagram includes a format version information area 20 , a positioning area 30 , a correction area 40 and a data information encoding area 50 .
具体的,所述边框区10用于保护二维码码图以及协助扫描软件定位二维码并变换坐标系。所述格式版本信息区20包括二维码的格式和版本信息等。定位区30用来确定二维码码图中的模块的坐标。校正区40用于对不规则的图像失真进行校正。数据信息编码区50用于承载二维码所携带的信息,由数据码字和纠错码字构成。空白区60位于整个二维码的最外圈用来保护整个二维码。Specifically, the frame area 10 is used to protect the two-dimensional code image and assist the scanning software to locate the two-dimensional code and transform the coordinate system. The format version information area 20 includes the format and version information of the two-dimensional code and the like. The positioning area 30 is used to determine the coordinates of the modules in the two-dimensional code diagram. The correction area 40 is used to correct irregular image distortion. The data information coding area 50 is used to carry the information carried by the two-dimensional code, and is composed of a data code word and an error correction code word. The blank area 60 is located at the outermost circle of the entire two-dimensional code to protect the entire two-dimensional code.
进一步地,所述格式版本信息区20的数量至少为三个。Further, the number of the format version information areas 20 is at least three.
具体的,所述格式版本信息区20包含了二维码码图的行数列数、纠错等级和掩模信息,每个所述格式版本信息区20都包含了完整的格式信息,即使二维码收到缺角或污染,只要包含一份完整的格式信息,仍然可以被准确识读。Specifically, the format version information area 20 includes the number of rows and columns of the two-dimensional code diagram, error correction level and mask information, and each of the format version information areas 20 includes complete format information, even if the two-dimensional Even if the code is missing or contaminated, it can still be read accurately as long as it contains a complete format information.
进一步地,所述格式版本信息区20位于二维码的角上。Further, the format version information area 20 is located at the corner of the two-dimensional code.
具体的,所述格式版本信息区20位于二维码的三个角上,每个角上都包含了完整的格式信息。Specifically, the format version information area 20 is located at three corners of the two-dimensional code, and each corner contains complete format information.
进一步地,所述格式版本信息区20至少包含二维码的行列数信息、版本类型信息、纠错等级信息和掩模类型信息中的一种。Further, the format version information area 20 includes at least one of row and column number information of the two-dimensional code, version type information, error correction level information and mask type information.
进一步地,所述边框区是至少一个模块单元宽的黑色边框,它将整个所述二维码码图包围起来。Further, the frame area is a black frame with a width of at least one module unit, which encloses the entire two-dimensional code pattern.
具体的,所述边框区是至少一个模块宽的黑色边框模块,它将整个二维码码图包围起来,根据二维码的版本生成空白的码图,在二维码码图的最外一圈填入黑色模块,生成边框。它用于保护二维码码图以及协助扫描软件定位二维码,并变换坐标系。他代替了现有技术中的QR码图的左上、左下、右上三个角的位置探测区域,释放了码图的空间。Specifically, the frame area is a black frame module with a width of at least one module, which surrounds the entire two-dimensional code map, and generates a blank code map according to the version of the two-dimensional code. The circle is filled with black modules to generate a border. It is used to protect the two-dimensional code map and assist the scanning software to locate the two-dimensional code and transform the coordinate system. It replaces the position detection areas at the upper left, lower left and upper right corners of the QR code image in the prior art, releasing the space of the code image.
进一步地,所述定位区30由一条黑白色交替构成的宽度为模块单位宽的一行水平定位图案和一列垂直定位图案组成,所述水平定位图案和所述垂直定位图案分别位于二维码码图的第六行和第六列。Further, the positioning area 30 is composed of a row of horizontal positioning patterns and a column of vertical positioning patterns with a width of a module unit width alternately formed by black and white. The horizontal positioning patterns and the vertical positioning patterns are respectively located on the two-dimensional code map. The sixth row and sixth column of .
具体的,所述水平和垂直定位图形分别为一个模块宽的一行和一列。它们由黑色白色模块交替构成,水平和垂直定位图形位于上部的两个格式版本信息区20域之间,它们的位置是二维码码图的第六行和第六列。它的作用是用来确定二维码码图中的模块的坐标。Specifically, the horizontal and vertical positioning graphics are respectively one row and one column wide of one module. They are alternately composed of black and white modules, and the horizontal and vertical positioning figures are located between the two upper format version information areas 20, and their positions are the sixth row and the sixth column of the two-dimensional code diagram. Its function is to determine the coordinates of the modules in the QR code diagram.
进一步地,所述校正区40由“回”形结构组成,所述“回”形结构由三个黑白色相间的同心正方形重叠构成。Further, the correction area 40 is composed of a "back"-shaped structure, and the "back"-shaped structure is formed by overlapping three black and white concentric squares.
具体的,每个所述校正区40可看作是3个重叠的同心正方形,它们是由5*5,3*3和1*1的黑白色模块构成。而所述校正区40的数量则由二维码的版本号决定。由于校正区40图形可以对不规则的图像失真进行校正,所以在新型二维的码识别的过程中校正区40图形起到了非常重要的作用。Specifically, each of the correction areas 40 can be regarded as three overlapping concentric squares, which are composed of 5*5, 3*3 and 1*1 black and white modules. The number of the correction areas 40 is determined by the version number of the two-dimensional code. Since the pattern of the correction area 40 can correct irregular image distortion, the pattern of the correction area 40 plays a very important role in the process of recognizing the new two-dimensional code.
进一步地,所述空白区60包围在所述边框区的外面,由一个至少三个模块单元宽的白边框构成。Further, the blank area 60 is surrounded by the outside of the frame area, and is composed of a white frame with a width of at least three module units.
具体的,所述空白区60为环绕在二维码四周不小于三各模块单元宽的区域,其反射率应与白色模块单元相同。需要说明的是,由于空白区60为白色,而图1中的底纹也是白色,所以图1中的空白区和图片底纹没有区分开来。Specifically, the blank area 60 is an area around the two-dimensional code that is not less than three module units wide, and its reflectivity should be the same as that of the white module unit. It should be noted that since the blank area 60 is white, and the shading in FIG. 1 is also white, the blank area in FIG. 1 is not distinguished from the shading of the picture.
本发明实施例提供的二维码,通过设计包括边框区、二维码码图和空白区的二维码,所述二维码码图包括格式版本信息区、定位区、校正区和数据信息编码区,使二维码标签在部分受到污染或者缺角破损的情况下,依然能读取其中的信息,提高了二维码标签的鲁棒性。The two-dimensional code provided by the embodiment of the present invention is designed by designing a two-dimensional code including a frame area, a two-dimensional code map and a blank area, and the two-dimensional code map includes a format version information area, a positioning area, a correction area and data information The coding area enables the information in the two-dimensional code label to be read even when the two-dimensional code label is partially polluted or the missing corner is damaged, which improves the robustness of the two-dimensional code label.
实施例2:Example 2:
图2为依照本发明实施例的生成二维码的方法示意图,如图2所示,本发明实施例提供一种生成上述实施例中二维码的方法,包括:Fig. 2 is a schematic diagram of a method for generating a two-dimensional code according to an embodiment of the present invention. As shown in Fig. 2, an embodiment of the present invention provides a method for generating a two-dimensional code in the above embodiment, including:
步骤S10、接收输入数据信息,根据所述输入数据信息确定二维码的编码字符类型、版本类型、纠错等级和掩模类型,生成空白区、边框区、定位区和校正区;Step S10, receiving input data information, determining the encoded character type, version type, error correction level and mask type of the two-dimensional code according to the input data information, and generating blank areas, frame areas, positioning areas and correction areas;
步骤S20、根据所述编码字符类型、所述版本类型和所述纠错等级对所述输入数据信息进行编码,生成数据信息码字序列;Step S20, encoding the input data information according to the encoded character type, the version type and the error correction level to generate a data information codeword sequence;
步骤S30、对所述编码字符类型、所述版本类型、所述纠错等级和所述掩模类型进行编码,生成格式版本信息码字序列;Step S30, encoding the encoded character type, the version type, the error correction level and the mask type to generate a format version information codeword sequence;
步骤S40、对所述数据信息码字序列进行掩模处理,生成数据信息编码区,对所述格式版本信息码字序列进行掩模处理,生成格式版本信息区。Step S40, performing masking processing on the data information codeword sequence to generate a data information coding area, and performing masking processing on the format version information codeword sequence to generate a format version information area.
具体的,首先对输入的数据流进行分析,对编码字符类型和版本纠错模式进行确定。二维码有几种不同编码模式,这几种编码模式使得不同的字符子集转换为符号字符的效率也不同。如果用户没有指定需要使用的具体符号和纠错版本,则应该默认选择与数据最匹配的版本。Specifically, firstly, the input data stream is analyzed, and the coded character type and version error correction mode are determined. Two-dimensional codes have several different encoding modes, and these encoding modes make different character subsets convert to symbolic characters with different efficiencies. If the user does not specify a specific symbol and error correction version to use, the version that best matches the data should be selected by default.
在网络传输中或者图像解码中很容易会产生数据丢失或者传输有误的情况。为了保证数据的完整性,就需要在编码端采用写入冗余纠错码,将码字序列按需要进行分块,使得纠错码字与数据块相对应。通过RS纠错算法生成纠错码字,在数据码字序列之后添加纠错码字,当符号损坏时,可以通过纠错得到完整的数据。Data loss or transmission errors are likely to occur during network transmission or image decoding. In order to ensure the integrity of the data, it is necessary to write redundant error correction codes at the encoding end, and divide the codeword sequence into blocks as required, so that the error correction codewords correspond to the data blocks. The error correction codeword is generated by the RS error correction algorithm, and the error correction codeword is added after the data codeword sequence. When the symbol is damaged, the complete data can be obtained through error correction.
根据所述编码字符类型、所述版本类型和所述纠错等级对所述输入数据信息进行编码,生成数据信息码字序列。Encoding the input data information according to the encoded character type, the version type and the error correction level to generate a data information codeword sequence.
按如下步骤构造最终的数据信息码字序列。Construct the final data information codeword sequence as follows.
a、根据版本和纠错等级将数据码字序列分为块;a. Divide the data codeword sequence into blocks according to the version and error correction level;
b、对每一块数据码字,分别计算出该块的纠错码字;b. For each block of data codewords, respectively calculate the error correction codeword of the block;
c、最终的序列中包含每一块对应的数据码字和纠错码字。c. The final sequence includes the data codeword and error correction codeword corresponding to each block.
所述格式版本信息区将格式信息和版本信息按照一定的拼装方法结合成一个数据位流,并按照相应的规则填入二维码码图的三个区域。格式版本信息码字序列包含内容如下:包含行数、列数、版本信息、纠错等级和数据信息的掩模方案。生成格式版本信息码字序列。The format version information area combines format information and version information into a data bit stream according to a certain assembly method, and fills in the three regions of the two-dimensional code map according to corresponding rules. The content of the format version information codeword sequence is as follows: a mask scheme including row number, column number, version information, error correction level and data information. Generate format version information code word sequence.
在二维码码图中加入掩模信息是为了提高识读码时的可靠性,并且避免形成校正区域功能模块的二进制位流。按下面的步骤进行处理,可以满足掩模的目的。The purpose of adding mask information to the two-dimensional code map is to improve the reliability of reading the code, and to avoid the formation of the binary bit stream of the functional module of the correction area. According to the following steps, the purpose of the mask can be satisfied.
a、对功能图形不采用掩模处理;a. Do not use mask processing for functional graphics;
b、将数据信息与设计好特定的8个掩模图形进行异或操作;b. Carry out XOR operation between the data information and the designed 8 specific mask patterns;
c、评估每个结果,选择其中效果最好的图形。c. Evaluate each result and select the graphic with the best effect.
所述功能图形包括边框区、空白区、定位区和校正区。The functional graphics include frame area, blank area, positioning area and correction area.
最后,对所述数据信息码字序列进行掩模处理,生成数据信息编码区,对所述格式版本信息码字序列进行掩模处理,生成格式版本信息区Finally, mask processing is performed on the data information code word sequence to generate a data information coding area, and mask processing is performed on the format version information code word sequence to generate a format version information area
图3为依据本发明实施例的生成二维码的具体流程图,如图3所示,首先,使用者首先输入编码信息,系统自动判断是否超出二维码最大的版本容量;之后系统对数据进行分析,选用合适的编码方式进行信息编码,并根据信息量的大小选用合适的版本和纠错模式;接下来进行数据信息的编码,形成数据位流,并按照相应的版本进行分块;针对每一块的数据位流,通过RS算法生成相应的纠错码字;在数据码字序列之后添加纠错码字,形成了最终给的码字序列,包括生成数据信息码字序列和格式版本信息码字序列,并将其填入空白码图;最后在三个角上分别置入格式版本信息和相应的纠错信息并进行掩模;最后对输入的数据信息码字序列进行掩模。Fig. 3 is the specific flow chart of generating two-dimensional code according to the embodiment of the present invention, as shown in Fig. 3, at first, the user first inputs coding information, and the system automatically judges whether to exceed the maximum version capacity of two-dimensional code; Carry out analysis, select an appropriate encoding method for information encoding, and select an appropriate version and error correction mode according to the size of the information; then encode the data information to form a data bit stream, and divide it into blocks according to the corresponding version; for For each block of data bit stream, the corresponding error correction codeword is generated by the RS algorithm; the error correction codeword is added after the data codeword sequence to form the final codeword sequence, including the generated data information codeword sequence and format version information Code word sequence, and fill it into the blank code map; finally, put format version information and corresponding error correction information in the three corners and mask; finally, mask the input data information code word sequence.
图4为依据本发明实施例的二维码的解码具体流程图,如图4所示,二维码的解码方法概括为以下流程:Fig. 4 is a specific flow chart of decoding a two-dimensional code according to an embodiment of the present invention. As shown in Fig. 4, the decoding method of a two-dimensional code is summarized as the following flow:
(1)在二维码的解码过程中,首先通过边框区定位并识别码图符号图像;(1) In the decoding process of the two-dimensional code, first locate and identify the symbol image of the code map through the frame area;
(2)识读格式版本信息(去除掩模并完成格式信息的纠错,识别纠错等级和掩模图形),之后识读版本信息,确定符号的版本;(2) Read the format version information (remove the mask and complete the error correction of the format information, identify the error correction level and mask graphics), and then read the version information to determine the version of the symbol;
(3)用掩模图形对编码区域的位图进行异或操作去除掩模(掩模图形之前已经从格式信息中得出);(3) Carry out XOR operation to the bitmap of the coded area with the mask pattern to remove the mask (the mask pattern has been drawn from the format information before);
(4)根据模块排列规则,识读符号字符,恢复信息数据和纠错码字;(4) According to the module arrangement rules, read symbol characters, restore information data and error correction code words;
(5)用与纠错级别信息相对应的纠错码字检测并纠错;(5) detecting and correcting errors with error correction codewords corresponding to the error correction level information;
(6)根据模式指示符和字符计数指示符将数据码字划分为多个部分;(6) divide the data codeword into a plurality of parts according to the mode indicator and the character count indicator;
(7)按照相应的模式译码得出信息。(7) Decoding according to the corresponding mode to obtain information.
本发明实施例提供的生成二维码的方法,通过生成包括边框区、二维码码图和空白区的二维码,所述二维码码图包括格式版本信息区、定位区、校正区和数据信息编码区,使二维码标签在部分受到污染或者缺角破损的情况下,依然能读取其中的信息,提高了二维码标签的鲁棒性。The method for generating a two-dimensional code provided in an embodiment of the present invention generates a two-dimensional code including a frame area, a two-dimensional code map and a blank area, and the two-dimensional code map includes a format version information area, a positioning area, and a correction area And the data information coding area, so that the information in the two-dimensional code label can still be read even when the two-dimensional code label is partially polluted or the missing corner is damaged, which improves the robustness of the two-dimensional code label.
实施例3:Example 3:
图5为依照本发明实施例的生成二维码的装置示意图,如图5所示,本发明实施例提供一种生成实施例1中所述的二维码的装置,包括输入数据分析模块100、数据信息编码模块200、格式版本信息编码模块300和掩模模块400,其中,FIG. 5 is a schematic diagram of a device for generating a two-dimensional code according to an embodiment of the present invention. As shown in FIG. 5 , an embodiment of the present invention provides a device for generating a two-dimensional code described in Embodiment 1, including an input data analysis module 100 , data information encoding module 200, format version information encoding module 300 and mask module 400, wherein,
输入数据分析模块100用于接收输入数据信息,根据所述输入数据信息确定二维码的编码字符类型、版本类型、纠错等级和掩模类型,生成空白区、边框区、定位区和校正区;The input data analysis module 100 is used to receive input data information, determine the encoded character type, version type, error correction level and mask type of the two-dimensional code according to the input data information, and generate blank areas, frame areas, positioning areas and correction areas ;
数据信息编码模块200用于根据所述编码字符类型、所述版本类型和所述纠错等级对所述输入数据信息进行编码,生成数据信息码字序列;The data information encoding module 200 is configured to encode the input data information according to the encoded character type, the version type and the error correction level to generate a data information codeword sequence;
格式版本信息编码模块300用于对所述编码字符类型、所述版本类型、所述纠错等级和所述掩模类型进行编码,生成格式版本信息码字序列;The format version information encoding module 300 is used to encode the coded character type, the version type, the error correction level and the mask type to generate a format version information codeword sequence;
掩模模块400用于对所述数据信息码字序列进行掩模处理,生成数据信息编码区,对所述格式版本信息码字序列进行掩模处理,生成格式版本信息区。The mask module 400 is configured to perform mask processing on the data information codeword sequence to generate a data information coding area, and perform mask processing on the format version information codeword sequence to generate a format version information area.
本发明实施例提供的生成二维码的装置,通过生成包括边框区、二维码码图和空白区的二维码,所述二维码码图包括格式版本信息区、定位区、校正区和数据信息编码区,使二维码标签在部分受到污染或者缺角破损的情况下,依然能读取其中的信息,提高了二维码标签的鲁棒性。The device for generating a two-dimensional code provided in an embodiment of the present invention generates a two-dimensional code including a frame area, a two-dimensional code map and a blank area, and the two-dimensional code map includes a format version information area, a positioning area, and a correction area And the data information coding area, so that the information in the two-dimensional code label can still be read even when the two-dimensional code label is partially polluted or the missing corner is damaged, which improves the robustness of the two-dimensional code label.
最后应说明的是:以上实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的精神和范围。Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: it can still be Modifications are made to the technical solutions described in the foregoing embodiments, or equivalent replacements are made to some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the various embodiments of the present invention.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710618727.XA CN107563477A (en) | 2017-07-26 | 2017-07-26 | Quick Response Code and its generation method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710618727.XA CN107563477A (en) | 2017-07-26 | 2017-07-26 | Quick Response Code and its generation method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN107563477A true CN107563477A (en) | 2018-01-09 |
Family
ID=60974840
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710618727.XA Pending CN107563477A (en) | 2017-07-26 | 2017-07-26 | Quick Response Code and its generation method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107563477A (en) |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108320005A (en) * | 2018-02-06 | 2018-07-24 | 佛山市南方数据科学研究院 | A kind of character is automatically converted to two-dimension code pattern system |
CN108875872A (en) * | 2018-06-25 | 2018-11-23 | 中国联合网络通信集团有限公司 | Two dimensional code and two dimensional code generating means |
CN109740715A (en) * | 2018-12-30 | 2019-05-10 | 尤尼泰克(嘉兴)信息技术有限公司 | A kind of two-dimensional code data area method for drafting of high discrimination |
CN111079463A (en) * | 2019-10-22 | 2020-04-28 | 福建新大陆支付技术有限公司 | Method for generating contaminated two-dimensional code for software test |
CN111191756A (en) * | 2020-04-12 | 2020-05-22 | 田庆 | Rectangular two-dimensional code |
CN111709506A (en) * | 2020-06-12 | 2020-09-25 | 北京思特奇信息技术股份有限公司 | Customized label generation method and system |
WO2022228157A1 (en) * | 2021-04-30 | 2022-11-03 | 华为技术有限公司 | Two-dimensional code encoding and decoding methods, electronic device |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102081747A (en) * | 2011-01-24 | 2011-06-01 | 广州宽度信息技术有限公司 | Two-dimensional bar code |
US20110290879A1 (en) * | 2010-06-01 | 2011-12-01 | Fujian Newland Computer Co., Ltd. | Qr barcode decoding chip and decoding method thereof |
CN102999772A (en) * | 2012-11-14 | 2013-03-27 | 韩偲铭 | Novel array-type two-dimension code encoding and decoding methods |
CN103413160A (en) * | 2013-08-30 | 2013-11-27 | 北京慧眼智行科技有限公司 | Method, device and system for encoding and decoding |
-
2017
- 2017-07-26 CN CN201710618727.XA patent/CN107563477A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20110290879A1 (en) * | 2010-06-01 | 2011-12-01 | Fujian Newland Computer Co., Ltd. | Qr barcode decoding chip and decoding method thereof |
CN102081747A (en) * | 2011-01-24 | 2011-06-01 | 广州宽度信息技术有限公司 | Two-dimensional bar code |
CN102999772A (en) * | 2012-11-14 | 2013-03-27 | 韩偲铭 | Novel array-type two-dimension code encoding and decoding methods |
CN103413160A (en) * | 2013-08-30 | 2013-11-27 | 北京慧眼智行科技有限公司 | Method, device and system for encoding and decoding |
Non-Patent Citations (1)
Title |
---|
LIHUINE, pages 1 - 14, Retrieved from the Internet <URL:https://www.doc88.com/p-503795629659.html> * |
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108320005A (en) * | 2018-02-06 | 2018-07-24 | 佛山市南方数据科学研究院 | A kind of character is automatically converted to two-dimension code pattern system |
CN108875872A (en) * | 2018-06-25 | 2018-11-23 | 中国联合网络通信集团有限公司 | Two dimensional code and two dimensional code generating means |
CN108875872B (en) * | 2018-06-25 | 2021-04-02 | 中国联合网络通信集团有限公司 | Two-dimensional code and two-dimensional code generation device |
CN109740715A (en) * | 2018-12-30 | 2019-05-10 | 尤尼泰克(嘉兴)信息技术有限公司 | A kind of two-dimensional code data area method for drafting of high discrimination |
CN111079463A (en) * | 2019-10-22 | 2020-04-28 | 福建新大陆支付技术有限公司 | Method for generating contaminated two-dimensional code for software test |
CN111191756A (en) * | 2020-04-12 | 2020-05-22 | 田庆 | Rectangular two-dimensional code |
CN111709506A (en) * | 2020-06-12 | 2020-09-25 | 北京思特奇信息技术股份有限公司 | Customized label generation method and system |
WO2022228157A1 (en) * | 2021-04-30 | 2022-11-03 | 华为技术有限公司 | Two-dimensional code encoding and decoding methods, electronic device |
EP4318307A4 (en) * | 2021-04-30 | 2024-09-18 | Huawei Technologies Co., Ltd. | METHOD FOR ENCODING AND DECODING TWO-DIMENSIONAL CODES, ELECTRONIC DEVICE |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107563477A (en) | Quick Response Code and its generation method and device | |
CN102243712B (en) | Generation method and system thereof for colored bar code, and analytic method and system thereof for colored bar code | |
CN104899630B (en) | The coding/decoding method of colored QR codes | |
TWI693551B (en) | Two-dimensional code generation method, decoding method and device | |
CN102147873B (en) | Method and system for generating color code as well as method and system for analyzing color code | |
JP5848464B2 (en) | Two-dimensional code, two-dimensional code creation system and analysis program | |
EP2393037B1 (en) | Data matrix decoding chip and decoding method thereof | |
CN112926715B (en) | Two-dimensional code generation and decoding method, device and equipment | |
CN107545289A (en) | The coding method of matrix two-dimensional code and coding/decoding method | |
US11843395B2 (en) | Coding pattern, coding and reading methods for same, calibration board, and calibration method | |
CN104143200B (en) | The frame type coding and intelligent identification Method of a kind of additional information of images | |
CN101908125A (en) | QR code barcode decoding chip and its decoding method | |
CN105447546A (en) | Two-dimensional code capable of being embedded with large-ratio graph as well as coding and decoding method and device therefor | |
CN101908128B (en) | Aztec Code bar code decoding chip and decoding method thereof | |
KR20170005006A (en) | Two-dimensional code, and two-dimensional-code analysis system | |
CN109101855B (en) | Lost positioning frame two-dimensional code identification method based on opencv | |
CN107563475A (en) | A kind of coding method of Quick Response Code and device | |
CN108073966A (en) | A kind of conversion method of Quick Response Code and hole horizontal and vertical parity check code | |
CN107247985A (en) | Coding, positioning and the recognition methods of New Two Dimensional code | |
CN101303742B (en) | Micro Chinese Sensible Code and Its Symbol Generation Method | |
CN110991589A (en) | Two-dimensional code and encryption method thereof | |
CN206946820U (en) | A kind of two-dimension code label | |
CN117273044B (en) | Lattice diagram construction method and lattice diagram identification method | |
CN112187284B (en) | Coding method, coding pattern, coding pattern reading method and shooting device | |
CN100504912C (en) | Method for generating two-dimensional barcode symbols |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20180109 |
|
RJ01 | Rejection of invention patent application after publication |