[go: up one dir, main page]

CN110610219B - A color ring two-dimensional code and its generation and decoding method - Google Patents

A color ring two-dimensional code and its generation and decoding method Download PDF

Info

Publication number
CN110610219B
CN110610219B CN201910740414.0A CN201910740414A CN110610219B CN 110610219 B CN110610219 B CN 110610219B CN 201910740414 A CN201910740414 A CN 201910740414A CN 110610219 B CN110610219 B CN 110610219B
Authority
CN
China
Prior art keywords
ring
dimensional code
color
white
data
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.)
Active
Application number
CN201910740414.0A
Other languages
Chinese (zh)
Other versions
CN110610219A (en
Inventor
易馥旺
翟广涛
朱泽昊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Jiao Tong University
Original Assignee
Shanghai Jiao Tong University
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Shanghai Jiao Tong University filed Critical Shanghai Jiao Tong University
Priority to CN201910740414.0A priority Critical patent/CN110610219B/en
Publication of CN110610219A publication Critical patent/CN110610219A/en
Application granted granted Critical
Publication of CN110610219B publication Critical patent/CN110610219B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K19/00Record carriers for use with machines and with at least a part designed to carry digital markings
    • G06K19/06Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code
    • G06K19/06009Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code with optically detectable marking
    • G06K19/06037Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code with optically detectable marking multi-dimensional coding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K19/00Record carriers for use with machines and with at least a part designed to carry digital markings
    • G06K19/06Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code
    • G06K19/06009Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code with optically detectable marking
    • G06K19/06046Constructional details
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K19/00Record carriers for use with machines and with at least a part designed to carry digital markings
    • G06K19/06Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code
    • G06K19/06009Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code with optically detectable marking
    • G06K19/06046Constructional details
    • G06K19/0614Constructional details the marking being selective to wavelength, e.g. color barcode or barcodes only visible under UV or IR
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K19/00Record carriers for use with machines and with at least a part designed to carry digital markings
    • G06K19/06Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code
    • G06K2019/06215Aspects not covered by other subgroups
    • G06K2019/06225Aspects not covered by other subgroups using wavelength selection, e.g. colour code
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K19/00Record carriers for use with machines and with at least a part designed to carry digital markings
    • G06K19/06Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code
    • G06K2019/06215Aspects not covered by other subgroups
    • G06K2019/06243Aspects not covered by other subgroups concentric-code

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Compression Of Band Width Or Redundancy In Fax (AREA)

Abstract

本发明公开了一种彩色环形二维码及其生成和解码方法,该二维码包括黑白的定位区,所述定位区包含一个实心圆和位于所述实心圆外的第一圆环、第二圆环,所述第一圆环和所述第二圆环为两个同心圆环;彩色的数据区,所述数据区是一个与所述定位区同心的第三圆环,所述定位区位于所述第三圆环内侧,所述第三圆环上划分多个数据块。该二维码生成方法为:将数据流转换为四进制数,根据四进制数与颜色对应关系,为多个数据块上色。解码时先找到定位区的中心,然后在极坐标下进行扫描解码。本发明通过采用颜色编码和基于扫描的解码方法,新的二维码在达到基本信息容量同时,可以有效地提高图像抗畸变能力。

Figure 201910740414

The invention discloses a color annular two-dimensional code and a method for generating and decoding the same. The two-dimensional code includes a black and white positioning area, and the positioning area includes a solid circle and a first ring and a second ring located outside the solid circle. Two rings, the first ring and the second ring are two concentric rings; for the colored data area, the data area is a third ring concentric with the positioning area, the positioning The area is located inside the third ring, and the third ring is divided into a plurality of data blocks. The two-dimensional code generation method is as follows: converting a data stream into a quaternary number, and coloring a plurality of data blocks according to the corresponding relationship between the quaternary number and the color. When decoding, first find the center of the positioning area, and then scan and decode in polar coordinates. By adopting the color coding and the decoding method based on scanning, the new two-dimensional code can effectively improve the anti-distortion capability of the image while reaching the basic information capacity.

Figure 201910740414

Description

一种彩色环形二维码及其生成和解码方法A color ring two-dimensional code and its generation and decoding method

技术领域technical field

本发明涉及二维码领域,特别涉及一种彩色环形二维码及其生成和解码方法。The invention relates to the field of two-dimensional codes, in particular to a color annular two-dimensional code and a method for generating and decoding the same.

背景技术Background technique

近年来,二维码的应用越来越来广泛,尤其是在移动支付和在线社交等领域。由于其较大的信息容量和快速的识别,在人们的日常生活中得到了迅速的普及。尽管目前二维码已经得到了大范围的推广,在许多场景下现有二维码仍有一定的局限性,最突出的就是二维码的抗图像畸变的能力不足。事实上,以QR Code为代表的矩阵型二维码的正确识别建立在一个基础上:二维码被打印在一个平整的平面上。如果二维码所在的平面发生了凸起或凹陷,例如二维码被打印在球体上,二维码的识别率会大幅下降。对于柱体、椎体等的曲面甚至织物等非刚体的表面,二维码的识别能力非常有限。公告号为CN103793735A的中国发明专利就提出了一种新的圆形二维条码及其编码解码方法来提高二维码抗图像畸变能力。但是该二维码以圆环为数据单位,数据密度很低,同时通过不同灰度值来编码数据,对二维码读取设备的精度要求高,故而该二维码实际应用受限。所以现阶段二维码的应用主要集中在平整表面上的识别。In recent years, the application of QR codes has become more and more extensive, especially in the fields of mobile payment and online social networking. Due to its large information capacity and fast identification, it has been rapidly popularized in people's daily life. Although two-dimensional codes have been widely promoted, in many scenarios, existing two-dimensional codes still have certain limitations. The most prominent one is the lack of anti-image distortion capabilities of two-dimensional codes. In fact, the correct recognition of the matrix two-dimensional code represented by QR Code is based on a foundation: the two-dimensional code is printed on a flat surface. If the plane on which the QR code is located is convex or concave, such as when the QR code is printed on a sphere, the recognition rate of the QR code will drop significantly. For curved surfaces such as cylinders, cones, and even non-rigid surfaces such as fabrics, the recognition ability of QR codes is very limited. The Chinese invention patent with the announcement number CN103793735A proposes a new circular two-dimensional barcode and its encoding and decoding method to improve the anti-image distortion ability of the two-dimensional code. However, the two-dimensional code uses a ring as the data unit, and the data density is very low. At the same time, the data is encoded by different grayscale values, which requires high precision of the two-dimensional code reading device, so the practical application of the two-dimensional code is limited. Therefore, the application of two-dimensional codes at this stage mainly focuses on the identification of flat surfaces.

随着物联网的发展,对于二维码在各种物体上的识别的需求在不断增加,二维码的低成本和高信息量的特点使其相对于RFID芯片有较大的优势。因此,如果能够大幅提升二维码的抗图像畸变能力,二维码的应用将会得到更大的扩展。With the development of the Internet of Things, the demand for the identification of two-dimensional codes on various objects is increasing. The low-cost and high-information characteristics of two-dimensional codes make them have great advantages over RFID chips. Therefore, if the anti-image distortion capability of the two-dimensional code can be greatly improved, the application of the two-dimensional code will be further expanded.

发明内容SUMMARY OF THE INVENTION

本发明针对上述现有技术中存在的问题,提出一种彩色环形二维码及其生成和解码方法,采用颜色编码和新的解码方法,在可以达到基本的信息容量的同时,有效地提高图像抗畸变能力。Aiming at the problems existing in the above-mentioned prior art, the present invention proposes a color annular two-dimensional code and a method for generating and decoding the same. By adopting color coding and a new decoding method, the basic information capacity can be achieved, and the image quality can be effectively improved. Distortion resistance.

为解决上述技术问题,本发明是通过如下技术方案实现的。In order to solve the above technical problems, the present invention is achieved through the following technical solutions.

根据本发明的第一方面,提供一种彩色环形二维码,所述二维码包括:According to a first aspect of the present invention, there is provided a color ring two-dimensional code, the two-dimensional code comprising:

黑白相间的定位区,所述定位区包含一个实心圆和位于所述实心圆外的第一圆环、第二圆环,所述第一圆环和所述第二圆环为两个同心圆环;A black and white positioning area, the positioning area includes a solid circle and a first ring and a second ring located outside the solid circle, and the first ring and the second ring are two concentric circles ring;

彩色的数据区,所述数据区是一个与所述定位区同心的第三圆环,所述定位区位于所述第三圆环内侧,所述第三圆环上划分多个数据块。A colored data area, the data area is a third circular ring concentric with the positioning area, the positioning area is located inside the third circular ring, and the third circular ring is divided into a plurality of data blocks.

较佳地,所述的定位区,其中:Preferably, the positioning area, wherein:

所述实心圆是黑色,所述第一圆环为白色,所述第二圆环为黑色,所述实心圆外侧依次接一白一黑的所述第一圆环、所述第二圆环;或者The solid circle is black, the first ring is white, the second ring is black, and the outer side of the solid circle is sequentially connected to the first and second rings, which are white and one black. ;or

所述实心圆是白色,所述第一圆环为黑色,所述第二圆环为白色,所述实心圆外侧依次接一黑一白的所述第一圆环、所述第二圆环。The solid circle is white, the first ring is black, the second ring is white, and the outer side of the solid circle is followed by a black and a white first and second rings. .

较佳地,所述第一圆环、所述第二圆环的圆环环宽相同。进一步的,所述第一圆环、所述第二圆环的圆环环宽为所述实心圆直径的1/3。Preferably, the ring widths of the first ring and the second ring are the same. Further, the ring width of the first ring and the second ring is 1/3 of the diameter of the solid circle.

较佳地,所述第三圆环是一个角度多等分的圆环,形成多个相等的数据块,其中一个所述数据块为白色,作为数据读取的起始点,其他所述数据块分别用红、绿、蓝和黄四种颜色编码,分别编码为0、1、2和3,相邻所述数据块颜色不同。Preferably, the third ring is a ring with multiple equal angles, forming a plurality of equal data blocks, wherein one of the data blocks is white as the starting point of data reading, and the other data blocks are They are respectively coded with four colors of red, green, blue and yellow, and are respectively coded as 0, 1, 2 and 3, and the adjacent data blocks have different colors.

较佳地,所述第三圆环是一个角度16等分的圆环,且内径等于所述第二圆环的外径,环宽大于或等于所述实心圆直径的1/3。Preferably, the third ring is a ring with an angle bisected by 16, and the inner diameter is equal to the outer diameter of the second ring, and the ring width is greater than or equal to 1/3 of the diameter of the solid circle.

根据本发明的第二方面,提供一种彩色环形二维码的生成方法,所述方法:将数据流转换为四进制数,并跳过相邻四进制字节相同的结果,根据四进制数与颜色对应关系,往数据区的第三圆环中的多个数据块上色。According to a second aspect of the present invention, there is provided a method for generating a color circular two-dimensional code, the method: converting a data stream into a quaternary number, and skipping the same result of adjacent quaternary bytes, according to the four There is a corresponding relationship between the base number and the color, and the multiple data blocks in the third circle of the data area are colored.

根据本发明的第三方面,提供一种彩色环形二维码的解码方法,包括:According to a third aspect of the present invention, there is provided a decoding method for a color ring two-dimensional code, comprising:

S1:将原始彩色环形二维码图片的彩色像素进行颜色转换,当定位区的实心圆为黑色时,彩色像素转换为白色;当定位区的实心圆为白色时,彩色像素转换为黑色;S1: Convert the color pixels of the original color ring QR code image, when the solid circle in the positioning area is black, the color pixels are converted to white; when the solid circle in the positioning area is white, the color pixels are converted to black;

S2:扫描S1处理后的二维码图片,找到定位区中心;S2: Scan the QR code image processed by S1 to find the center of the positioning area;

S3:以定位区中心为坐标原点,将原始彩色环形二维码图片转换到极坐标系下;S3: Taking the center of the positioning area as the coordinate origin, convert the original color ring QR code image to the polar coordinate system;

S4:沿所述极坐标系的r轴扫描找到数据区,沿所述极坐标系的φ轴扫描解码数据区。S4: Scan along the r-axis of the polar coordinate system to find the data area, and scan the decoded data area along the φ-axis of the polar coordinate system.

较佳地,所述方法在S1之前,还包括对原始彩色环形二维码图片进行白平衡处理。Preferably, before S1, the method further includes performing white balance processing on the original color circular two-dimensional code picture.

较佳地,所述方法在S1之后,还包括对图像依次进行灰度化、二值化、高斯滤波处理。Preferably, after S1, the method further includes performing grayscale, binarization, and Gaussian filtering on the image in sequence.

较佳地,S3中,所述沿所述极坐标系的r轴扫描找到数据区是指每一行像素扫描时,遇到的第一个彩色像素即认定为所述数据区的像素采样点。Preferably, in S3, the scanning along the r-axis of the polar coordinate system to find the data area means that when each row of pixels is scanned, the first color pixel encountered is identified as the pixel sampling point of the data area.

较佳地,所述沿所述极坐标系的φ轴扫描解码数据区是指沿所述极坐标系的φ轴识别每行的像素采样点的颜色,遇到颜色跳变即判定到达新的数据块。Preferably, the scanning of the decoded data area along the φ axis of the polar coordinate system refers to identifying the color of the pixel sampling points of each row along the φ axis of the polar coordinate system, and when a color jump is encountered, it is determined that a new pixel is reached. data block.

相较于现有技术,本发明的优点是:Compared with the prior art, the advantages of the present invention are:

本发明上述的彩色环形二维码通过采用颜色编码,新的二维码的信息容量较传统环形二维码有所提升。The above-mentioned color ring two-dimensional code of the present invention adopts color coding, and the information capacity of the new two-dimensional code is improved compared with the traditional ring two-dimensional code.

本发明上述的彩色环形二维码的解码方法,采用基于扫描的解码方法能够提升二维码的抗图像畸变能力,在应对桶形失真、枕形失真、透视失真以及打印在不规则几何体上导致的失真,都有更好的解码效果。The above-mentioned decoding method of the color ring two-dimensional code of the present invention can improve the anti-image distortion ability of the two-dimensional code by using the scanning-based decoding method, and can deal with barrel distortion, pincushion distortion, perspective distortion and printing on irregular geometry. distortion, there is a better decoding effect.

附图说明Description of drawings

下面结合附图对本发明的实施方式作进一步说明:Embodiments of the present invention are further described below in conjunction with the accompanying drawings:

图1为本发明一实施例的彩色环形二维码结构图;1 is a structural diagram of a color ring two-dimensional code according to an embodiment of the present invention;

图2为本发明一实施例彩色环形二维码的解码流程图;Fig. 2 is the decoding flow chart of the color annular two-dimensional code according to an embodiment of the present invention;

图3为本发明一较优实施例彩色环形二维码的解码流程图;Fig. 3 is a decoding flow chart of a color ring two-dimensional code according to a preferred embodiment of the present invention;

图4为本发明一较优实施例极坐标系下的二维码图像;4 is a two-dimensional code image in a polar coordinate system according to a preferred embodiment of the present invention;

图5为本发明另一较优实施例的的彩色环形二维码结构图;5 is a structural diagram of a color ring two-dimensional code according to another preferred embodiment of the present invention;

标号说明:1-实心圆,2-第一圆环,3-第二圆环,4-第三圆环,5-数据块,501-白色数据块,502-黑色数据块。Label description: 1-solid circle, 2-first circle, 3-second circle, 4-third circle, 5-data block, 501-white data block, 502-black data block.

具体实施方式Detailed ways

下面结合具体实施例对本发明进行详细说明。以下实施例将有助于本领域的技术人员进一步理解本发明,但不以任何形式限制本发明。应当指出的是,对本领域的普通技术人员来说,在不脱离本发明构思的前提下,还可以做出若干变形和改进。这些都属于本发明的保护范围。The present invention will be described in detail below with reference to specific embodiments. The following examples will help those skilled in the art to further understand the present invention, but do not limit the present invention in any form. It should be noted that, for those skilled in the art, several modifications and improvements can be made without departing from the concept of the present invention. These all belong to the protection scope of the present invention.

参照图1所示,为本发明一实施例中的彩色环形二维码示意图,图中所示的彩色环形二维码包括:黑白相间的定位区和彩色的数据区,定位区包含一个实心圆1位于实心圆1外的第一圆环2、第二圆环3,第一圆环2和第二圆环3为两个同心圆环;数据区是一个与定位区同心的第三圆环4,定位区位于第三圆环4内侧,第三圆环4上划分多个数据块5。Referring to Figure 1, it is a schematic diagram of a colored annular two-dimensional code in an embodiment of the present invention. The colored annular two-dimensional code shown in the figure includes: a black and white positioning area and a colored data area, and the positioning area includes a solid circle 1 The first ring 2 and the second ring 3 are located outside the solid circle 1. The first ring 2 and the second ring 3 are two concentric rings; the data area is a third ring that is concentric with the positioning area 4. The positioning area is located inside the third circular ring 4 , and the third circular ring 4 is divided into a plurality of data blocks 5 .

在图1所示的实施例中,定位区的实心圆1是黑色,第一圆环2为白色,第二圆环3为黑色,实心圆1外侧依次接一白一黑的第一圆环2、第二圆环3,即,黑色实心圆1位于最里面,然后第一圆环2外套在黑色实心圆1外,第二圆环3在外套在第一圆环2外。在较优实施例中,第一圆环2、第二圆环3的圆环环宽相同,第一圆环2、第二圆环3的圆环环宽为实心圆1直径的1/3。第三圆环4外套在第二圆环3外,实心圆1以及三个圆环均同心设置。在图1所示的实施例中,第三圆环4是一个角度16等分的圆环,形成16个相等的数据块5,其中一个为白色数据块501,白色数据块501作为数据读取的起始点,其他15个数据块5分别用红、绿、蓝和黄四种颜色编码,分别编码为0、1、2和3,相邻数据块5颜色不同。In the embodiment shown in FIG. 1 , the solid circle 1 of the positioning area is black, the first ring 2 is white, the second ring 3 is black, and the outer side of the solid circle 1 is followed by a white and a black first ring 2. The second ring 3, that is, the black solid circle 1 is located at the innermost position, then the first ring 2 is covered outside the black solid circle 1, and the second ring 3 is covered outside the first ring 2. In a preferred embodiment, the ring widths of the first ring 2 and the second ring 3 are the same, and the ring width of the first ring 2 and the second ring 3 is 1/3 of the diameter of the solid circle 1 . The third ring 4 is sheathed outside the second ring 3, and the solid circle 1 and the three rings are concentrically arranged. In the embodiment shown in FIG. 1 , the third ring 4 is a ring divided by 16 equal angles, forming 16 equal data blocks 5, one of which is a white data block 501, and the white data block 501 is read as data The other 15 data blocks 5 are coded with four colors of red, green, blue and yellow, which are respectively coded as 0, 1, 2 and 3, and the adjacent data blocks 5 have different colors.

以上实施例中,采用的是16等分的圆环,在其他实施例中,也可以是其他等分,一般等分为4的倍数,等分越多,数据密度越大,对扫码设备的分辨率要求越高;等分越少,对扫码设备的分辨率要求越低,但数据密度也会变低。上述实施例中优选16等分,此时信息容量为107数量级,可以保证数据密度和传统的几种小尺寸二维码的数据密度差不多,例如同尺寸下Micro QR Code数据量为105、DataMatrix为106,即保证数据密度的最小等分。同样的,在其他实施例中,也可以是其他的颜色,颜色用的越多,对设备的分辨率要求越高,所以为达到基本的信息容量,上述实施例优选用四种颜色编码。进一步的,像素的颜色由RGB三通道组成的三元数表示,识别颜色时,通常根据颜色的三元数所处的范围来确定,例如(255,0,0)左右范围内识别为红色。当采用红绿蓝黄四色组合时,解码不用涉及数据具体所在范围,只需比较三元数之间的相对大小即可判定是四色中的哪一种。例如红色通道的值(第一个数)远大于绿色通道的值(第二个数)和蓝色通道的值(第三个数),就认为是红色,绿色蓝色同理,黄色是蓝色的补色,第一个数和第二个数数值接近,远大于第三个数,即判定为黄色。这样设计的解码方法更简洁,稳定性更高。因此,上述实施例采用红绿蓝黄四种颜色能够提升二维码的数据量到现有常见小尺寸二维码的水平,同时稳定性最高。In the above embodiment, a ring with 16 equal parts is used. In other embodiments, it can also be other equal parts. Generally, the equal parts are divided into multiples of 4. The more equal parts, the greater the data density. The higher the resolution requirement is; the fewer the equal divisions, the lower the resolution requirement for the scanning device, but the data density will also be lower. In the above-mentioned embodiment, it is preferably divided into 16 equal parts, and the information capacity is of the order of 10 7 at this time, which can ensure that the data density is similar to the data density of several traditional small-sized two-dimensional codes. For example, the data volume of Micro QR Code under the same size is 10 5 The DataMatrix is 10 6 , that is, the smallest equal division that guarantees the data density. Similarly, in other embodiments, other colors can also be used. The more colors are used, the higher the resolution requirements of the device are. Therefore, in order to achieve basic information capacity, the above embodiment preferably uses four color codes. Further, the color of a pixel is represented by a ternary number composed of three RGB channels. When identifying a color, it is usually determined according to the range of the ternary number of the color. For example, it is recognized as red within the range of (255,0,0). When the combination of red, green, blue, and yellow is used, the decoding does not need to involve the specific range of the data. It only needs to compare the relative size of the ternary to determine which of the four colors is. For example, the value of the red channel (the first number) is much larger than the value of the green channel (the second number) and the value of the blue channel (the third number), it is considered to be red, green and blue are the same, and yellow is blue The complementary color of the color, the first number and the second number are close in value, far greater than the third number, that is, it is judged as yellow. The decoding method designed in this way is simpler and more stable. Therefore, using the four colors of red, green, blue and yellow in the above embodiment can increase the data volume of the two-dimensional code to the level of the existing common small-sized two-dimensional code, and at the same time has the highest stability.

在较优实施例中,第三圆环4是一个角度16等分的圆环,且内径等于第二圆环3的外径,环宽大于或等于实心圆1直径的1/3。In a preferred embodiment, the third ring 4 is a ring bisected by 16 angles, and the inner diameter is equal to the outer diameter of the second ring 3 , and the ring width is greater than or equal to 1/3 of the diameter of the solid circle 1 .

以上实施例中,二维码的实心圆和圆环采用的1:1:3:1:1的直径比例,当然,在其他实施例中,也可以是其他比例,例如1:1:4:1:1也可以,只是定位区尺寸会更大一些。1:1:3:1:1的直径比例是一个比较优选比值。In the above embodiment, the diameter ratio of the solid circle and the ring of the two-dimensional code is 1:1:3:1:1. Of course, in other embodiments, it can also be other ratios, such as 1:1:4: 1:1 is also possible, but the size of the positioning area will be larger. A diameter ratio of 1:1:3:1:1 is a more preferred ratio.

在本发明另一较优实施例中,提供一种彩色环形二维码的生成方法,具体的:首先生成一个环形二维码模板,包括黑白的定位区和彩色的数据区,具体结构如上实施例中的彩色环形二维码。然后进行数据的转换,以数据410720541为例,首先将其转换为4进制数120132301210131,检查发现无相邻字节相同,按0、1、2、3分别对应红、绿、蓝、黄,得到数据区颜色序列为“绿蓝红绿黄蓝黄红绿蓝绿红绿黄绿”,在白色数据块501后逆时针按照颜色序列上色。In another preferred embodiment of the present invention, a method for generating a color circular two-dimensional code is provided. Specifically, a circular two-dimensional code template is first generated, including a black and white positioning area and a color data area. The specific structure is implemented as above. The colored circular QR code in the example. Then convert the data, take the data 410720541 as an example, first convert it into a quaternary number 120132301210131, check that no adjacent bytes are the same, press 0, 1, 2, 3 to correspond to red, green, blue, yellow, respectively, The obtained color sequence of the data area is "green blue red green yellow blue yellow red green blue green red green yellow green", after the white data block 501 is colored counterclockwise according to the color sequence.

在本发明另一实施例中,提供上述彩色环形二维码的解码方法。参照图2所示,解码方法可以按如下步骤进行:In another embodiment of the present invention, a decoding method for the above-mentioned color ring two-dimensional code is provided. Referring to Figure 2, the decoding method can be performed as follows:

S1:将原始彩色环形二维码图片的彩色像素都转换为白色;S1: Convert the color pixels of the original color ring QR code image to white;

S2:扫描S1处理后的二维码图片,找到定位区的中心;由于定位区的两个圆环和实心圆是同心的,所以定位区中心和实心圆圆心是一样的;定位时扫描每一行像素,如果像素的颜色比例是黑:白:黑:白:黑=1:1:3:1:1,则认为是定位区。S2: Scan the QR code image processed by S1 to find the center of the positioning area; since the two rings in the positioning area are concentric with the solid circle, the center of the positioning area and the solid circle are the same; scan each line during positioning Pixel, if the color ratio of the pixel is black:white:black:white:black=1:1:3:1:1, it is considered as the positioning area.

S3:以S2得到的定位区中心为坐标原点,将原始彩色环形二维码图片转换到极坐标系下;S3: Take the center of the positioning area obtained by S2 as the coordinate origin, and convert the original color ring QR code image to the polar coordinate system;

S4:沿极坐标系的r轴扫描找到数据区,沿极坐标系的φ轴扫描解码数据区;其中:沿r轴扫描找到数据区是指每一行像素扫描时,遇到的第一个彩色像素即认定为数据区的像素采样点;扫描解码数据区是指沿极坐标的φ轴识别每行的像素采样点的颜色,遇到颜色跳变即判定到达新的数据块5。S4: Scan along the r-axis of the polar coordinate system to find the data area, and scan the decoded data area along the φ-axis of the polar coordinate system; among them: Scanning along the r-axis to find the data area refers to the first color encountered when scanning each row of pixels. The pixel is identified as the pixel sampling point of the data area; the scanning and decoding data area refers to identifying the color of the pixel sampling point of each row along the φ axis of the polar coordinate, and it is determined that a new data block 5 is reached when the color jumps.

从白色数据块501开始依序读取数据区的每个数据块5的颜色后,再根据颜色和4进制数的对应关系即可得到4进制数据,再转换为10进制数,即可得到原始数据。After reading the color of each data block 5 in the data area in sequence starting from the white data block 501, the quaternary data can be obtained according to the corresponding relationship between the color and the quaternary number, and then converted into a decimal number, that is, Raw data is available.

图4是极坐标系下的二维码图像,横轴是r轴,纵轴是φ轴,每一行的像素颜色顺序都是黑、白、黑、彩色(或者白色,只在白色数据块的几行是白色,图中的最后几行)、其他颜色(由于二维码周围可能有各种颜色,这里用其他颜色代替表示),扫描遇到的第一个彩色像素作为数据区的像素采样。实际中对于区分数据区中的白色像素和第二圆环的白色像素,增加了一个设定,当第二次遇到白色像素时认为是数据块的白色像素,如最后几行,颜色顺序是黑、白、黑、白,第二次白的像素才是数据块的像素。Figure 4 is a two-dimensional code image in polar coordinate system, the horizontal axis is the r axis, the vertical axis is the phi axis, and the pixel color order of each row is black, white, black, color (or white, only in the white data block. Several lines are white, the last lines in the figure), other colors (because there may be various colors around the QR code, which are represented by other colors here), the first color pixel encountered by the scan is used as the pixel sampling of the data area . In practice, a setting is added to distinguish the white pixels in the data area from the white pixels in the second ring. When the white pixel is encountered for the second time, it is considered as the white pixel of the data block. For example, the last few lines, the color order is Black, white, black, white, the second white pixel is the pixel of the data block.

在本发明另一较优实施例中,提供上述彩色环形二维码的解码方法。参照图3所示,解码方法可以按如下步骤进行:In another preferred embodiment of the present invention, a decoding method for the above-mentioned color ring two-dimensional code is provided. Referring to Figure 3, the decoding method can be performed as follows:

S1:对彩色环形二维码图片进行图像预处理;图像预处理包括白平衡,白平衡可以去除光照对图像颜色的影响;S1: Perform image preprocessing on the color ring QR code image; image preprocessing includes white balance, which can remove the influence of light on image color;

S2:将S1预处理后的二维码图片的彩色像素都转换为白色;进一步的,在转换成白色后,还可以依次进行图像的灰度化、二值化、高斯滤波处理;灰度化和二值化是为了方便后续定位操作,高斯滤波是为了消除一些图像的噪声;S2: Convert the color pixels of the two-dimensional code image preprocessed by S1 to white; further, after converting to white, grayscale, binarization, and Gaussian filtering of the image can be performed in turn; grayscale And binarization is to facilitate subsequent positioning operations, and Gaussian filtering is to eliminate noise in some images;

S3:扫描S2处理后的二维码图片,找到定位区的中心;S3: Scan the QR code image processed by S2 to find the center of the positioning area;

S4:以S3得到的定位区中心为坐标原点,将原始彩色环形二维码图片转换到极坐标系下;S4: Take the center of the positioning area obtained in S3 as the coordinate origin, and convert the original color ring QR code image to the polar coordinate system;

S5:沿极坐标系的r轴扫描找到数据区,沿极坐标系的φ轴扫描解码数据区;该步骤与图2所示实施例相同,不再赘述。S5: Scan along the r-axis of the polar coordinate system to find the data area, and scan the decoded data area along the φ-axis of the polar coordinate system; this step is the same as the embodiment shown in FIG. 2 and will not be repeated.

参照图5所示,为本发明另一较优实施例中的彩色环形二维码示意图,包括:黑白相间的定位区和彩色的数据区,定位区包含一个实心圆1位于实心圆1外的第一圆环2、第二圆环3,第一圆环2和第二圆环3为两个同心圆环;数据区是一个与定位区同心的第三圆环4,定位区位于第三圆环4内侧,第三圆环4上划分多个数据块5。与图1所示不同之处在于:定位区的实心圆1是白色,第一圆环2为黑色,第二圆环3为白色,实心圆1外侧依次接一黑一白的第一圆环2、第二圆环3,即,白色实心圆1位于最里面,然后黑色的第一圆环2外套在白色实心圆1外,白色的第二圆环3在外套在黑色的第一圆环2外。第三圆环4是一个角度16等分的圆环,形成16个相等的数据块5,其中一个为黑色数据块502,黑色数据块502作为数据读取的起始点,其他15个数据块5分别用红、绿、蓝和黄四种颜色编码,分别编码为0、1、2和3,相邻数据块5颜色不同。其他设置于图1所示实施例相同,不再赘述。5, it is a schematic diagram of a color ring two-dimensional code in another preferred embodiment of the present invention, including: a black and white positioning area and a colored data area, and the positioning area includes a solid circle 1 located outside the solid circle 1. The first ring 2, the second ring 3, the first ring 2 and the second ring 3 are two concentric rings; the data area is a third ring 4 concentric with the positioning area, and the positioning area is located in the third ring. Inside the ring 4 , a plurality of data blocks 5 are divided on the third ring 4 . The difference from Fig. 1 is: the solid circle 1 of the positioning area is white, the first ring 2 is black, the second ring 3 is white, and the outer side of the solid circle 1 is followed by a black and a white first ring. 2. The second ring 3, that is, the white solid circle 1 is located in the innermost, then the black first ring 2 is covered outside the white solid circle 1, and the white second ring 3 is covered in the black first ring 2 outside. The third ring 4 is a ring divided by 16 equal angles, forming 16 equal data blocks 5, one of which is a black data block 502, and the black data block 502 is used as the starting point of data reading, and the other 15 data blocks 5 They are coded with four colors of red, green, blue and yellow respectively, which are coded as 0, 1, 2 and 3 respectively, and the adjacent data blocks 5 have different colors. Other settings are the same as those in the embodiment shown in FIG. 1 , and will not be described again.

对应图5所示的彩色环形二维码,提供彩色环形二维码的解码方法,包括:Corresponding to the color ring two-dimensional code shown in Figure 5, a decoding method for the color ring two-dimensional code is provided, including:

S1:对彩色环形二维码图片进行白平衡预处理,白平衡是为了去除光照对图像颜色的影响;S1: Preprocess the color ring QR code image with white balance. The white balance is to remove the influence of light on the color of the image;

S2:将S1预处理后的二维码图片的彩色像素都转换为黑色;进一步的,在转换成黑色后,还可以依次进行图像的灰度化、二值化、高斯滤波处理;灰度化和二值化是为了方便后续定位操作,高斯滤波是为了消除一些图像的噪声;S2: Convert the color pixels of the two-dimensional code image preprocessed by S1 to black; further, after converting to black, grayscale, binarization, and Gaussian filtering of the image can be performed in turn; grayscale And binarization is to facilitate subsequent positioning operations, and Gaussian filtering is to eliminate noise in some images;

S3:扫描S2处理后的二维码图片,找到定位区的中心;S3: Scan the QR code image processed by S2 to find the center of the positioning area;

S4:以S3得到的定位区中心为坐标原点,将原始彩色环形二维码图片转换到极坐标系下;S4: Take the center of the positioning area obtained in S3 as the coordinate origin, and convert the original color ring QR code image to the polar coordinate system;

S5:沿极坐标系的r轴扫描找到数据区,沿极坐标系的φ轴扫描解码数据区;该步骤与图2所示实施例相同。S5: Scan along the r-axis of the polar coordinate system to find the data area, and scan the decoded data area along the φ-axis of the polar coordinate system; this step is the same as the embodiment shown in FIG. 2 .

以上没有详细描述的部分,可以参照图1-3所示实施例中的技术实现,这对于本领域技术人员来说,是容易实现的,不再赘述。Parts not described in detail above can be implemented with reference to the technologies in the embodiments shown in FIGS. 1-3 , which are easy to implement for those skilled in the art and will not be repeated here.

本发明上述实施例提出的二维码数据区仅为一个圆环,通过等分圆环划分数据区,提高了数据密度,同时通过坐标系的转换和颜色编码,解码算法的复杂度更低,对设备的精度要求更低。背景技术中CN103793735A的二维码数据区需要多个圆环,且最外层需要两个圆环来分隔二维码周围像素干扰,而本发明的二维码仅需一个圆环,且通过彩色转白色或黑色的操作,使得数据区可以在定位时复用为静止区,起到分隔二维码周围像素干扰的功能,而不用多加两个圆环,使得二维码的数据密度进一步提升。举例来说,本发明上述的二维码的最大数据量约为2*107,在其他条件一样的情况下,相同数据量的上述CN103793735A的二维码,尺寸是本发明二维码的19.75倍。The two-dimensional code data area proposed by the above embodiments of the present invention is only a circular ring, and the data area is divided by dividing the circular ring equally, which improves the data density. The precision requirements for the equipment are lower. In the background art, the two-dimensional code data area of CN103793735A needs multiple rings, and the outermost layer needs two rings to separate the pixel interference around the two-dimensional code, while the two-dimensional code of the present invention only needs one ring, and the color The operation of turning white or black allows the data area to be reused as a static area during positioning, which functions to separate pixel interference around the two-dimensional code without adding two more rings, which further improves the data density of the two-dimensional code. For example, the maximum data size of the above-mentioned two-dimensional code of the present invention is about 2*10 7 . Under the same other conditions, the size of the two-dimensional code of CN103793735A with the same data amount is 19.75 of the two-dimensional code of the present invention. times.

综上本发明上述实施例,通过采用颜色编码和基于扫描的解码方法,新的二维码在达到基本信息容量同时,可以有效地提高图像抗畸变能力。To sum up the above embodiments of the present invention, by using color coding and scanning-based decoding methods, the new two-dimensional code can effectively improve the anti-distortion capability of the image while achieving the basic information capacity.

此处公开的仅为本发明的优选实施例,本说明书选取并具体描述这些实施例,是为了更好地解释本发明的原理和实际应用,并不是对本发明的限定。任何本领域技术人员在说明书范围内所做的修改和变化,均应落在本发明所保护的范围内。Only preferred embodiments of the present invention are disclosed herein, and the present specification selects and specifically describes these embodiments to better explain the principles and practical applications of the present invention, rather than limiting the present invention. Any modifications and changes made by those skilled in the art within the scope of the description should fall within the protection scope of the present invention.

Claims (10)

1. A colored annular two-dimensional code which characterized in that: the two-dimensional code includes:
the positioning area comprises a solid circle, a first circular ring and a second circular ring, wherein the first circular ring and the second circular ring are positioned outside the solid circle, and the first circular ring and the second circular ring are two concentric circular rings;
the colored data area is a third circular ring concentric with the positioning area, the positioning area is positioned on the inner side of the third circular ring, a plurality of data blocks are divided on the third circular ring, and the colors of the adjacent data blocks are different;
wherein:
the decoding method of the two-dimensional code comprises the following steps:
s1: color conversion is carried out on color pixels of the original color annular two-dimensional code picture, and when the solid circle of the positioning area is black, the color pixels are converted into white; when the solid circle of the positioning area is white, the color pixel is converted into black;
s2: scanning the two-dimensional code picture processed by the S1 to find the center of the positioning area;
s3: converting the color two-dimensional code picture into a polar coordinate system by taking the center of the positioning area as the origin of coordinates;
s4: and scanning along the r axis of the polar coordinate system to find a data area, and scanning along the phi axis of the polar coordinate system to decode the data area.
2. The color annular two-dimensional code according to claim 1, wherein: the positioning region, wherein:
the solid circle is black, the first ring is white, the second ring is black, and the first ring and the second ring which are white and black are sequentially connected to the outer side of the solid circle; or
The solid circle is white, the first ring is black, the second ring is white, and the outer side of the solid circle is sequentially connected with the first ring and the second ring which are black and white.
3. The color annular two-dimensional code according to claim 2, wherein: the widths of the first circular ring and the second circular ring are the same.
4. The color annular two-dimensional code according to claim 2, wherein: the ring width of the first ring and the second ring is 1/3 of the diameter of the solid circle.
5. The color annular two-dimensional code according to claim 1, wherein: the third ring is a ring with multiple equal angles, and a plurality of equal data blocks are formed, wherein one data block is white and serves as a starting point of data reading, and the other data blocks are respectively coded by four colors of red, green, blue and yellow, and are respectively coded as 0, 1, 2 and 3.
6. The color annular two-dimensional code according to claim 5, wherein: the third ring is a ring with an angle 16 equal to the outer diameter of the second ring, and the width of the third ring is greater than or equal to 1/3 the diameter of the solid circle.
7. A method for generating a color annular two-dimensional code according to any one of claims 1-6, wherein: and converting the data stream into a quad number, skipping the result that adjacent quad bytes are the same, and coloring a plurality of data blocks in a third ring of the data area according to the corresponding relation between the quad number and the color.
8. A method for decoding a color annular two-dimensional code according to any one of claims 1 to 6, characterized in that: the method further includes, before S1, white balancing the original color annular two-dimensional code picture.
9. The method for decoding color annular two-dimensional code according to claim 8, wherein: after S1, the method further includes performing graying, binarization, and gaussian filtering on the image in sequence.
10. The method for decoding color annular two-dimensional code according to claim 8, wherein: in the step S3, the first step,
the step of scanning along the r axis of the polar coordinate system to find the data area means that when each line of pixels is scanned, the first color pixel encountered is regarded as the pixel sampling point of the data area;
the step of scanning the decoded data area along the phi axis of the polar coordinate system refers to identifying the color of the pixel sampling point of each row along the phi axis of the polar coordinate system, and when color jump occurs, the new data block is judged to arrive.
CN201910740414.0A 2019-08-12 2019-08-12 A color ring two-dimensional code and its generation and decoding method Active CN110610219B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910740414.0A CN110610219B (en) 2019-08-12 2019-08-12 A color ring two-dimensional code and its generation and decoding method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910740414.0A CN110610219B (en) 2019-08-12 2019-08-12 A color ring two-dimensional code and its generation and decoding method

Publications (2)

Publication Number Publication Date
CN110610219A CN110610219A (en) 2019-12-24
CN110610219B true CN110610219B (en) 2020-11-06

Family

ID=68889783

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910740414.0A Active CN110610219B (en) 2019-08-12 2019-08-12 A color ring two-dimensional code and its generation and decoding method

Country Status (1)

Country Link
CN (1) CN110610219B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113255636B (en) * 2020-02-13 2023-08-04 宁波吉利汽车研究开发有限公司 A positioning method, device, equipment and storage medium based on ring coding
CN114912475B (en) * 2021-02-07 2024-11-08 华为技术有限公司 QR code recognition method and related device
CN113435559B (en) * 2021-08-27 2021-12-14 深圳企业云科技股份有限公司 Label anti-transfer method based on computer vision recognition

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104794518A (en) * 2015-05-06 2015-07-22 矽照光电(厦门)有限公司 Color two-dimension code generating method and device
CN106156823A (en) * 2016-06-23 2016-11-23 安徽易泰格智能技术有限公司 A kind of colorful digital sequence Quick Response Code and method for anti-counterfeit thereof

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1885311A (en) * 2006-05-29 2006-12-27 深圳矽感科技有限公司 Two-dimensional code, encoding and decoding method thereof
CN103793735B (en) * 2014-01-28 2017-02-15 河海大学 Circular two-dimensional bar code and encoding and decoding method thereof
CN106447001A (en) * 2016-09-19 2017-02-22 华南农业大学 Circular two-dimensional code, circular two-dimensional code coding method and application thereof
CN107590522B (en) * 2017-08-23 2020-08-21 阿里巴巴集团控股有限公司 Identification code generation and identification method and device
CN110096920B (en) * 2019-04-22 2022-05-17 浙江大学滨海产业技术研究院 High-precision high-speed positioning label and positioning method for visual servo
CN110084080B (en) * 2019-04-28 2021-07-09 上海快仓自动化科技有限公司 Two-dimensional code identification and generation method and device, two-dimensional code and trolley

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104794518A (en) * 2015-05-06 2015-07-22 矽照光电(厦门)有限公司 Color two-dimension code generating method and device
CN106156823A (en) * 2016-06-23 2016-11-23 安徽易泰格智能技术有限公司 A kind of colorful digital sequence Quick Response Code and method for anti-counterfeit thereof

Also Published As

Publication number Publication date
CN110610219A (en) 2019-12-24

Similar Documents

Publication Publication Date Title
CN110610219B (en) A color ring two-dimensional code and its generation and decoding method
CN103177279B (en) Four-dimensional color bar code for high capacity data encoding and decoding
KR101348494B1 (en) Optical symbol, article to which the optical symbol is attached, method for attaching optical symbol to article, optical symbol decoding method, related device, and related program
JP4016342B2 (en) Apparatus and method for code recognition
US9111161B2 (en) Four dimensional (4D) color barcode for high capacity data encoding and decoding
US11216631B2 (en) Contrast edge barcodes
Grillo et al. High capacity colored two dimensional codes
US20160098625A1 (en) Readable matrix code
CN103559473A (en) Method and system using feature images to achieve printing stock security
Taveerad et al. Development of color QR code for increasing capacity
Galiyawala et al. To increase data capacity of QR code using multiplexing with color coding: An example of embedding speech signal in QR code
JP2007272601A (en) Image processor, control method and computer program
JP2009516259A (en) Video image code, apparatus and method for generating or decoding video image code
WO2011108605A1 (en) Method for creating and method for decoding two-dimensional colour code
WO2010031110A1 (en) Data storage device and encoding/decoding methods
CN109215016A (en) A kind of recognition positioning method of coding maker
Querini et al. Color classifiers for 2D color barcodes
Zhang et al. Aesthetic QR codes based on two-stage image blending
Lee et al. A new data transfer method via signal-rich-art code images captured by mobile devices
JP4404224B2 (en) Optical recognition code recognition apparatus, method and program
KR102660603B1 (en) Detection of high-resolution, machine-readable tags using a mosaic image sensor
JP2019008564A (en) Multiplexed code, multiplexed code reader, multiplexed code reading method, and program
Pang et al. CodeCube: A multi-layer color barcode for mobile social applications
CN109978814B (en) White point detection method and computer system
CN118504599B (en) Color bar identification code, identification code identification and decoding method and electronic equipment

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
GR01 Patent grant
GR01 Patent grant