Movatterモバイル変換


[0]ホーム

URL:


CN106156684A - A two-dimensional code recognition method and device - Google Patents

A two-dimensional code recognition method and device
Download PDF

Info

Publication number
CN106156684A
CN106156684ACN201610514040.7ACN201610514040ACN106156684ACN 106156684 ACN106156684 ACN 106156684ACN 201610514040 ACN201610514040 ACN 201610514040ACN 106156684 ACN106156684 ACN 106156684A
Authority
CN
China
Prior art keywords
dimensional code
code
dimensional
image
processing
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.)
Granted
Application number
CN201610514040.7A
Other languages
Chinese (zh)
Other versions
CN106156684B (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.)
Nanjing University of Science and Technology
Original Assignee
Nanjing University of Science and Technology
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 Nanjing University of Science and TechnologyfiledCriticalNanjing University of Science and Technology
Priority to CN201610514040.7ApriorityCriticalpatent/CN106156684B/en
Publication of CN106156684ApublicationCriticalpatent/CN106156684A/en
Application grantedgrantedCritical
Publication of CN106156684BpublicationCriticalpatent/CN106156684B/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Classifications

Landscapes

Abstract

Translated fromChinese

本发明涉及一种二维码识别方法及装置,方法包括:通过两个摄像头从不同角度同时采集二维码图片;对采集的两张二维码图片进行预处理;对预处理后的二维码图片进行二维码分割处理,提取出二维码;根据两张二维码的边缘扭曲情况对二维码所处的贴面进行判定与计算,获得校正公式,使用校正公式对二维码进行图像校正,将其还原为标准形状的二维码;记录两张标准形状二维码编码区信息,根据其中一个编码区中黑像素点对另一个编码区进行补充处理,得到可识别二维码;提取可识别二维码中的二维码信息。本发明可以在二维码扭曲变形、光照不均情况下较好的还原出图像并提取出二维码信息,极大的提高了对二维码的读取能力。

The invention relates to a two-dimensional code recognition method and device. The method includes: simultaneously collecting two-dimensional code pictures from different angles through two cameras; preprocessing the two collected two-dimensional code pictures; and preprocessing the two-dimensional code pictures Carry out the two-dimensional code segmentation process to extract the two-dimensional code; judge and calculate the veneer where the two-dimensional code is located according to the edge distortion of the two two-dimensional codes, obtain the correction formula, and use the correction formula to perform image correction on the two-dimensional code. Restore it to a two-dimensional code with a standard shape; record the coding area information of two standard-shaped two-dimensional codes, and perform supplementary processing on the other coding area according to the black pixels in one of the coding areas to obtain a recognizable two-dimensional code; Identify the QR code information in the QR code. The invention can better restore the image and extract the two-dimensional code information under the condition of two-dimensional code distortion and uneven illumination, and greatly improves the reading ability of the two-dimensional code.

Description

Translated fromChinese
一种二维码识别方法及装置A two-dimensional code recognition method and device

技术领域technical field

本发明涉及二维码识别技术,特别是一种二维码识别方法及装置。The invention relates to two-dimensional code recognition technology, in particular to a two-dimensional code recognition method and device.

背景技术Background technique

二维码(dimensional barcode),又称二维条码,是在一维条码的基础上扩展出的一种具有可读性的条码,是用某种特定的几何图形按一定规律在平面二维方向上分布的黑白相间的图形记录数据符号信息,在代码编制上利用构成计算机内部逻辑基础的“0”、“1”比特流的概念,使用若干个与二进制相对应的几何形体来表示文字数值信息,通过图象输入设备或光电扫描设备自动识读以实现信息自动处理。Two-dimensional barcode, also known as two-dimensional barcode, is a readable barcode extended on the basis of one-dimensional barcode. The black-and-white graphics distributed on the computer record data symbol information, and use the concepts of "0" and "1" bit streams that form the internal logical basis of the computer in the coding, and use several geometric shapes corresponding to binary to represent the text value information , Automatic reading through image input equipment or photoelectric scanning equipment to realize automatic processing of information.

常用的二维码码制有Data Matrix,Maxi Code,Aztec,QR Code等,其中QR Code(Quick Response Code,快速响应编码)矩阵码是目前最为流行的码制,它具有信息容量大、可靠性高、可表示汉字及图像多种文字信息、保密防伪性强等优点。QR码呈正方形,黑白两色,三个角落印有“回”字的正方图案,其中,该印有“回”字的正方图案为QR码的定位码,利用三个定位码即可定位一个QR码。Commonly used two-dimensional code systems include Data Matrix, Maxi Code, Aztec, QR Code, etc. Among them, QR Code (Quick Response Code, Quick Response Code) matrix code is currently the most popular code system, which has large information capacity and reliability. High, can represent Chinese characters and images of a variety of text information, strong security and anti-counterfeiting advantages. The QR code is square, black and white, and the three corners are printed with a square pattern with the word "Hui". QR code.

现有部分企业已使用产品二维码管理方式,将二维码与各工位对应,各工位完成后的半成品在指定区域进行贴码并流入生产线供后者使用。多工位完成后,对指定区域的多个二维码进行识别,将多个二维码信息有选择地整合为一个二维码并贴附或喷涂在产品或外包装上,供内部其他部门、或者消费者使用。At present, some enterprises have used the product QR code management method to correspond the QR code to each station. After the completion of each station, the semi-finished products are labeled in the designated area and flow into the production line for the latter to use. After the completion of the multi-station, identify multiple QR codes in the designated area, selectively integrate the information of multiple QR codes into one QR code and attach or spray on the product or outer packaging for other internal departments , or consumer use.

现有二维码识别方法使用的是单摄像头,二维码识别装置为单摄像头装置,在面对二维码光照不均时,无法识别二维码,需要人为调整光源或二维码位置才能解决该现象。同样,在面对二维码图片扭曲变形时,现有二维码识别方法及装置仅可以识别出形变较小的二维码,如果形变过大则无法识别二维码。The existing two-dimensional code recognition method uses a single camera, and the two-dimensional code recognition device is a single-camera device. When faced with uneven illumination of the two-dimensional code, the two-dimensional code cannot be recognized, and it is necessary to manually adjust the light source or the position of the two-dimensional code. Solve this phenomenon. Similarly, when the two-dimensional code picture is distorted and deformed, the existing two-dimensional code recognition method and device can only recognize the two-dimensional code with a small deformation, and if the deformation is too large, the two-dimensional code cannot be recognized.

发明内容Contents of the invention

本发明的目的在于提供一种能够在二维码图片扭曲变形、光照不均的情况下读取出二维码信息的二维码识别方法及装置。The object of the present invention is to provide a two-dimensional code recognition method and device capable of reading two-dimensional code information under the conditions of distorted two-dimensional code picture and uneven illumination.

实现本发明目的的技术方案为:一种二维码识别方法,包括以下步骤:The technical solution for realizing the object of the present invention is: a two-dimensional code recognition method, comprising the following steps:

通过两个摄像头从不同角度同时采集二维码图片;Simultaneously capture QR code pictures from different angles through two cameras;

对采集的两张二维码图片进行预处理;Preprocess the two collected QR code images;

对预处理后的二维码图片进行二维码分割处理,提取出二维码;Carry out two-dimensional code segmentation processing on the preprocessed two-dimensional code image, and extract the two-dimensional code;

根据两张二维码的边缘扭曲情况对二维码所处的贴面进行判定与计算,获得校正公式,使用校正公式对二维码进行图像校正,将其还原为标准形状的二维码;According to the edge distortion of the two two-dimensional codes, determine and calculate the veneer where the two-dimensional codes are located, obtain the correction formula, use the correction formula to correct the image of the two-dimensional code, and restore it to a standard shape of the two-dimensional code;

记录两张标准形状二维码编码区信息,根据其中一个编码区中黑像素点对另一个编码区进行补充处理,得到可识别二维码;Record the coding area information of two standard-shaped two-dimensional codes, and perform supplementary processing on the other coding area according to the black pixels in one coding area to obtain a recognizable two-dimensional code;

提取可识别二维码中的二维码信息。Extract the QR code information in the identifiable QR code.

一种二维码识别装置,包括:A two-dimensional code recognition device, comprising:

两个摄像头,用于从不同角度同时采集二维码图片;Two cameras, used to simultaneously capture QR code pictures from different angles;

图像预处理模块,用于对采集的两张二维码图片进行预处理;The image preprocessing module is used to preprocess the two two-dimensional code images collected;

二维码分割处理模块,用于对预处理后的二维码图片进行二维码分割处理,提取出二维码;The two-dimensional code segmentation processing module is used to perform two-dimensional code segmentation processing on the preprocessed two-dimensional code image to extract the two-dimensional code;

二维码校正模块,用于根据两张二维码的边缘扭曲情况对二维码所处的贴面进行判定与计算,获得校正公式,使用校正公式对二维码进行图像校正,将其还原为标准形状的二维码;The two-dimensional code correction module is used to judge and calculate the veneer of the two-dimensional code according to the edge distortion of the two two-dimensional codes, obtain the correction formula, use the correction formula to correct the image of the two-dimensional code, and restore it to the standard QR code of the shape;

二维码互补模块,用于记录两张标准形状二维码编码区信息,根据其中一个编码区中黑像素点对另一个编码区进行补充处理,得到可识别二维码;The two-dimensional code complementary module is used to record the information of two standard-shaped two-dimensional code coding areas, and perform supplementary processing on the other coding area according to the black pixels in one of the coding areas to obtain a recognizable two-dimensional code;

二维码信息提取模块,用于提取可识别二维码中的二维码信息。The two-dimensional code information extraction module is used for extracting the two-dimensional code information in the recognizable two-dimensional code.

与现有技术相比,本发明的显著优点为:Compared with prior art, remarkable advantage of the present invention is:

(1)本发明可以在二维码发生光照不均时还原出较好的图像并提取出二维码信息;(1) The present invention can restore a better image and extract the two-dimensional code information when the two-dimensional code is unevenly illuminated;

(2)现有技术仅可在二维码形变较小的情况下识别二维码信息,当二维码发生较大形变时则无法识别二维码信息,本发明可以在二维码发生扭曲变形时较好的还原出图像并提取出二维码信息。(2) The existing technology can only recognize two-dimensional code information when the deformation of the two-dimensional code is small. When the two-dimensional code is greatly deformed, the two-dimensional code information cannot be recognized. When deforming, it can better restore the image and extract the two-dimensional code information.

附图说明Description of drawings

图1为本发明识别方法的流程图。Fig. 1 is a flowchart of the identification method of the present invention.

图2为本发明识别装置的模块图。Fig. 2 is a block diagram of the identification device of the present invention.

具体实施方式detailed description

为了便于理解本发明,下面结合识别方法的流程图以及识别装置的模块图,对本发明进行详细的说明。In order to facilitate the understanding of the present invention, the present invention will be described in detail below in combination with the flow chart of the recognition method and the block diagram of the recognition device.

结合图1,本发明的一种二维码识别方法,包括以下步骤:In conjunction with Fig. 1, a kind of two-dimensional code recognition method of the present invention comprises the following steps:

通过两个摄像头从不同角度同时采集二维码图片;Simultaneously capture QR code pictures from different angles through two cameras;

对采集的两张二维码图片进行预处理;Preprocess the two collected QR code images;

对预处理后的二维码图片进行二维码分割处理,提取出二维码;Carry out two-dimensional code segmentation processing on the preprocessed two-dimensional code image, and extract the two-dimensional code;

根据两张二维码的边缘扭曲情况对二维码所处的贴面进行判定与计算,获得校正公式,使用校正公式对二维码进行图像校正,将其还原为标准形状的二维码;According to the edge distortion of the two two-dimensional codes, determine and calculate the veneer where the two-dimensional codes are located, obtain the correction formula, use the correction formula to correct the image of the two-dimensional code, and restore it to a standard shape of the two-dimensional code;

记录两张标准形状二维码编码区信息,根据其中一个编码区中黑像素点对另一个编码区进行补充处理,得到可识别二维码;Record the coding area information of two standard-shaped two-dimensional codes, and perform supplementary processing on the other coding area according to the black pixels in one coding area to obtain a recognizable two-dimensional code;

提取可识别二维码中的二维码信息。Extract the QR code information in the identifiable QR code.

进一步的,预处理包括图像灰度化处理、图像二值化处理和图像去噪处理。Further, the preprocessing includes image grayscale processing, image binarization processing and image denoising processing.

进一步的,分割处理的过程为:Further, the process of segmentation processing is:

检测二维码上的三个位置探测图形,确定二维码位置;Detect the three position detection patterns on the two-dimensional code to determine the position of the two-dimensional code;

对二维码进行图像孔洞填充,使二维码在同一连通域内;Carry out image hole filling on the two-dimensional code, so that the two-dimensional code is in the same connected domain;

进行边缘检测,提取出二维码。Perform edge detection and extract the QR code.

进一步的,校正处理过程为Further, the correction process is

检测二维码关键点;Detect the key points of the QR code;

根据二维码关键点进行二维码边缘拟合和二维码贴面拟合;Perform QR code edge fitting and QR code veneer fitting according to the key points of the QR code;

确定校正公式,并通过校正公式校正二维码,得到标准形状的二维码。The correction formula is determined, and the two-dimensional code is corrected by the correction formula to obtain a two-dimensional code with a standard shape.

结合图2,本发明还提供一种二维码识别装置,包括:With reference to Fig. 2, the present invention also provides a two-dimensional code recognition device, including:

两个摄像头,用于从不同角度同时采集二维码图片;Two cameras, used to simultaneously capture QR code pictures from different angles;

图像预处理模块,用于对采集的两张二维码图片进行预处理;The image preprocessing module is used to preprocess the two two-dimensional code images collected;

二维码分割处理模块,用于对预处理后的二维码图片进行二维码分割处理,提取出二维码;The two-dimensional code segmentation processing module is used to perform two-dimensional code segmentation processing on the preprocessed two-dimensional code image to extract the two-dimensional code;

二维码校正模块,用于根据两张二维码的边缘扭曲情况对二维码所处的贴面进行判定与计算,获得校正公式,使用校正公式对二维码进行图像校正,将其还原为标准形状的二维码;The two-dimensional code correction module is used to judge and calculate the veneer of the two-dimensional code according to the edge distortion of the two two-dimensional codes, obtain the correction formula, use the correction formula to correct the image of the two-dimensional code, and restore it to the standard QR code of the shape;

二维码互补模块,用于记录两张标准形状二维码编码区信息,根据其中一个编码区中黑像素点对另一个编码区进行补充处理,得到可识别二维码;The two-dimensional code complementary module is used to record the information of two standard-shaped two-dimensional code coding areas, and perform supplementary processing on the other coding area according to the black pixels in one of the coding areas to obtain a recognizable two-dimensional code;

二维码信息提取模块,用于提取可识别二维码中的二维码信息。The two-dimensional code information extraction module is used for extracting the two-dimensional code information in the recognizable two-dimensional code.

所述预处理包括图像灰度化处理、图像二值化处理和图像去噪处理。The preprocessing includes image grayscale processing, image binarization processing and image denoising processing.

所述二维码分割处理模块的分割处理过程为:The segmentation process of the two-dimensional code segmentation processing module is:

检测二维码上的三个位置探测图形,确定二维码位置;Detect the three position detection patterns on the two-dimensional code to determine the position of the two-dimensional code;

对二维码进行图像孔洞填充,使二维码在同一连通域内;Carry out image hole filling on the two-dimensional code, so that the two-dimensional code is in the same connected domain;

最后进行边缘检测,提取出二维码。Finally, edge detection is performed to extract the two-dimensional code.

下面结合具体实施例对本发明作进一步说明。The present invention will be further described below in conjunction with specific examples.

实施例Example

如图1所示,本实施例的二维码识别方法包括以下步骤:As shown in Figure 1, the two-dimensional code recognition method of the present embodiment comprises the following steps:

第一步,采集二维码图片The first step is to collect the QR code picture

使用两个摄像头从不同角度拍摄对二维码进行拍摄,本实施例的两个摄像头分别在距二维码平面法线正负二十度。Two cameras are used to shoot the two-dimensional code from different angles, and the two cameras in this embodiment are respectively at plus or minus 20 degrees from the normal line of the two-dimensional code plane.

第二步,预处理The second step, preprocessing

在获得含有二维码的图片之后,对二维码图片进行图像预处理,图像预处理包括图像灰度化处理、图像二值化处理和图像去噪处理。After the picture containing the two-dimensional code is obtained, image preprocessing is performed on the two-dimensional code picture, and the image preprocessing includes image grayscale processing, image binarization processing and image denoising processing.

含有二维码的图像以彩色图像形式显示。然而,实际的二维码区域只是由深浅交错的模块组成,彩色图像没有特别的意义。经过灰度化以及二值化处理后的图像需要的计算时间和计算空间更少,可以大大提高处理速度。图像去噪处理可以降低图片噪声,使二维码图片变得更加平滑,便于后面对二维码的分割处理以及对二维码的识读工作,可以大大增强对二维码的识别能力。Images containing QR codes are displayed as color images. However, the actual two-dimensional code area is only composed of modules with interlaced shades, and the color image has no special meaning. The image processed by grayscale and binarization requires less computing time and computing space, which can greatly improve the processing speed. Image denoising processing can reduce image noise and make the QR code image smoother, which is convenient for subsequent segmentation processing of QR codes and reading of QR codes, and can greatly enhance the recognition ability of QR codes.

图像预处理是为二维码的提取工作做准备,该处理步骤有利于提高装置的处理速度以及增强装置对二维码的识别能力。Image preprocessing is to prepare for the extraction of two-dimensional codes, and this processing step is conducive to improving the processing speed of the device and enhancing the ability of the device to recognize two-dimensional codes.

第三步,分割处理The third step, split processing

对预处理后的二维码图片进行二维码分割处理,主要过程为:Carry out two-dimensional code segmentation processing on the preprocessed two-dimensional code image, the main process is:

首先检测二维码上的三个位置探测图形,确定二维码位置;First detect the three position detection patterns on the two-dimensional code to determine the position of the two-dimensional code;

然后对二维码进行图像孔洞填充,使二维码在同一连通域内;Then fill the image holes of the two-dimensional code so that the two-dimensional code is in the same connected domain;

最后进行边缘检测,提取出二维码。Finally, edge detection is performed to extract the two-dimensional code.

分割处理的作用是根据二维码的边缘将二维码从图片中分割出来,便于后续针对二维码进行处理。The function of segmentation processing is to separate the two-dimensional code from the picture according to the edge of the two-dimensional code, so as to facilitate subsequent processing on the two-dimensional code.

第四步,校正处理The fourth step, correction processing

在获得两张二维码之后,首先判断二维码是否有扭曲变形的情况出现,如果二维码并不是矩形,那么将对二维码进行校正处理,根据两张二维码图片的边缘扭曲情况对二维码所处的贴面进行判定与计算,再根据计算出的结果获得校正公式,使用公式对二维码进行图像校正,将其还原为规范的二维码。具体过程如下:After obtaining the two QR codes, first judge whether the two-dimensional codes are distorted or not. If the two-dimensional codes are not rectangular, then the two-dimensional codes will be corrected. The veneer where the code is located is judged and calculated, and then the correction formula is obtained according to the calculated result, and the image correction of the two-dimensional code is performed using the formula to restore it to a standardized two-dimensional code. The specific process is as follows:

首先,检测两张二维码的关键点,关键点包括二维码边缘角点及位置探测图形角点。First, detect the key points of the two QR codes, including the edge corners of the QR code and the corner points of the position detection graphics.

二维码边缘角点的检测方法为:因为图像扭曲使得二维码图像各部分的伸缩比例有变化,三个位置探测图形之间的距离变化比例也会不相同,找出相距最长的两个位置探测图形连接成一条直线,并求出直线的斜率,用与该直线平行的两条直线和垂直的两条直线分别从四个方向逼近二维码区域,直到直线与二维码相切,求出四条直线与二维码区域的切点,即为二维码边缘角点。The detection method of the edge corners of the two-dimensional code is as follows: because the image is distorted, the expansion and contraction ratio of each part of the two-dimensional code image changes, and the distance change ratio between the three position detection graphics will also be different. Find the two with the longest distance. The two position detection patterns are connected into a straight line, and the slope of the straight line is calculated, and two straight lines parallel to the straight line and two vertical straight lines are used to approach the two-dimensional code area from four directions, until the straight line is tangent to the two-dimensional code , find the tangent point between the four straight lines and the QR code area, which is the edge corner of the QR code.

位置探测图形角点的检测方法为:以位置探测图形的中心为种子点,利用区域增长算法,求出该位置探测图形中心所在的连通阈,并令该区域为白色;然后以中心点为种子点,利用区域增长算法,求出该位置探测图形中心所在的连通阈,并令该区域为黑色;再以中心点为种子点,利用区域增长算法,求出该位置探测图形中心所在的连通阈,即得到一个位置探测图形,即得到位置探测图形角点。The detection method of the corner point of the position detection graph is as follows: take the center of the position detection graph as the seed point, use the region growth algorithm to find the connectivity threshold where the center of the position detection graph is located, and make the region white; then use the center point as the seed point point, use the region growing algorithm to find the connectivity threshold where the center of the position detection graph is located, and make the region black; then use the center point as the seed point, use the region growth algorithm to find the connectivity threshold where the center of the position detection graph is located , that is, a position detection graph is obtained, that is, a corner point of the position detection graph is obtained.

然后进行二维码边缘拟合,上面己经找到二维码关键点,再用最小二乘法曲线拟合每条边上的关键点,得到边缘拟合线,将二维码边缘提取出。Then carry out the edge fitting of the two-dimensional code. The key points of the two-dimensional code have been found above, and then the key points on each side are fitted with the least squares curve to obtain the edge fitting line, and the edge of the two-dimensional code is extracted.

再进行二维码贴面拟合,通过上述我们求出的两组扭曲二维码上的关键点包括:二维码边缘角点,位置探测图形的角点,及四条边的拟合曲线,拟合出二维码贴面形状。Then carry out two-dimensional code veneer fitting, the key points on the two sets of distorted two-dimensional codes obtained through the above include: the corner points of the two-dimensional code edge, the corner points of the position detection graphics, and the fitting curves of the four sides, Fit the shape of the two-dimensional code veneer.

再确定校正公式,我们将要得到的图像称为理想图,先用积分的方法,求出拟合贴面上同一条边上每两个相邻关键点的距离,累加得到四条拟合曲线的长度,由于二维码发生非线性形变,每条边的形变大小不相同,我们将四条边的均值作为理想图的边长,根据理想图的边长L,求出扭曲二维码每条边的伸缩系数kt=L/Lt,t=1,2,3,4。Lt为四条拟合曲线的长度;将拟合贴面上的关键点作为理想图的对应点,求出拟合贴面上的关键点在拟合曲面上距离各边的长度,通过伸缩系数再求出相应的理想图上的对应点。假定理想图中的点(x’,y’),在拟合贴面中对应坐标为(x,y),(x,y)与(x’,y’)之间的映射关系为:其中i取0到m,j取0到n,m为图像横坐标最大值,n为纵坐标最大值,k为变量,m≥k≥i,(x,y)为拟合贴面上的点,uij、vij为坐标点(x,y)的校正参数,基于这n对对应点数据用最小二乘法辨识出式中的校正参数,从而确定校正公式。Then determine the correction formula. We call the image to be obtained an ideal image. First, use the integral method to find the distance between every two adjacent key points on the same side of the fitting veneer, and accumulate the lengths of the four fitting curves. , due to the non-linear deformation of the two-dimensional code, the deformation of each side is different. We take the average of the four sides as the side length of the ideal graph, and calculate the length of each side of the twisted two-dimensional code according to the side length L of the ideal graph. Expansion coefficient kt =L/Lt , t=1,2,3,4. Lt is the length of the four fitting curves; the key points on the fitting surface are taken as the corresponding points of the ideal graph, and the lengths of the key points on the fitting surface from each side on the fitting surface are calculated, and the expansion coefficient Find the corresponding points on the corresponding ideal graph. Assuming that the point (x', y') in the ideal map corresponds to (x, y) in the fitting surface, the mapping relationship between (x, y) and (x', y') is: Among them, i ranges from 0 to m, j ranges from 0 to n, m is the maximum value of the abscissa of the image, n is the maximum value of the ordinate, k is a variable, m≥k≥i, (x, y) is the fitting surface point, uij , vij are the correction parameters of the coordinate point (x, y), based on the n pairs of corresponding point data, use the least square method to identify the correction parameters in the formula, so as to determine the correction formula.

最后通过校正公式校正二维码,根据二维码贴面的形状对二维码进行坐标映射变换,先将二维码关键点校正到标准位置,然后再校正二维码其他部分。Finally, the two-dimensional code is corrected by the correction formula, and the coordinate mapping transformation is performed on the two-dimensional code according to the shape of the two-dimensional code veneer. First, the key points of the two-dimensional code are corrected to the standard position, and then the other parts of the two-dimensional code are corrected.

上述校正处理使本发明可以在二维码发生扭曲变形情况下还原出较好的图像并提取出二维码信息。The above correction process enables the present invention to restore a better image and extract two-dimensional code information when the two-dimensional code is distorted and deformed.

第五步,补充处理The fifth step, supplementary processing

记录两张标准形状二维码编码区信息,根据其中一个编码区中黑像素点对另一个编码区进行补充处理,得到可识别二维码;假设二维码图片出现了光照不均匀现象,出现反光亮斑,通过两个摄像头从不同角度对二维码进行拍摄,采集两张不同光照分布的二维码图片,使用另一张二维码图片的同一位置处的二维码信息去填补该图片,获得一张质量较好的可识别的二维码图片。该处理步骤使本发明装置可以在二维码发生光照不均情况下还原出较好的图像并提取出二维码信息。Record the information of two standard-shaped two-dimensional code coding areas, and perform supplementary processing on the other coding area according to the black pixels in one of the coding areas to obtain a recognizable two-dimensional code; assuming that the two-dimensional code picture has uneven illumination, there will be Reflective bright spots, two cameras are used to shoot the two-dimensional code from different angles, collect two two-dimensional code pictures with different light distribution, and use the two-dimensional code information at the same position of the other two-dimensional code picture to fill the picture, Obtain a recognizable QR code picture with good quality. This processing step enables the device of the present invention to restore a better image and extract two-dimensional code information when the two-dimensional code is unevenly illuminated.

第六步,从上一步得到的可识别二维码中提取二维码信息。The sixth step is to extract the two-dimensional code information from the recognizable two-dimensional code obtained in the previous step.

Claims (7)

Translated fromChinese
1.一种二维码识别方法,其特征在于,包括以下步骤:1. A two-dimensional code identification method, is characterized in that, comprises the following steps:通过两个摄像头从不同角度同时采集二维码图片;Simultaneously capture QR code pictures from different angles through two cameras;对采集的两张二维码图片进行预处理;Preprocess the two collected QR code images;对预处理后的二维码图片进行二维码分割处理,提取出二维码;Carry out two-dimensional code segmentation processing on the preprocessed two-dimensional code image, and extract the two-dimensional code;根据两张二维码的边缘扭曲情况对二维码所处的贴面进行判定与计算,获得校正公式,使用校正公式对二维码进行图像校正,将其还原为标准形状的二维码;According to the edge distortion of the two two-dimensional codes, determine and calculate the veneer where the two-dimensional codes are located, obtain the correction formula, use the correction formula to correct the image of the two-dimensional code, and restore it to a standard shape of the two-dimensional code;记录两张标准形状二维码编码区信息,根据其中一个编码区中黑像素点对另一个编码区进行补充处理,得到可识别二维码;Record the coding area information of two standard-shaped two-dimensional codes, and perform supplementary processing on the other coding area according to the black pixels in one coding area to obtain a recognizable two-dimensional code;提取可识别二维码中的二维码信息。Extract the QR code information in the identifiable QR code.2.根据权利要求1所述的二维码识别方法,其特征在于,预处理包括图像灰度化处理、图像二值化处理和图像去噪处理。2. The two-dimensional code recognition method according to claim 1, wherein the preprocessing includes image grayscale processing, image binarization processing and image denoising processing.3.根据权利要求1所述的二维码识别方法,其特征在于,分割处理的过程为:3. two-dimension code identification method according to claim 1, is characterized in that, the process of segmentation processing is:检测二维码上的三个位置探测图形,确定二维码位置;Detect the three position detection patterns on the two-dimensional code to determine the position of the two-dimensional code;对二维码进行图像孔洞填充,使二维码在同一连通域内;Carry out image hole filling on the two-dimensional code, so that the two-dimensional code is in the same connected domain;进行边缘检测,提取出二维码。Perform edge detection and extract the QR code.4.根据权利要求1所述的二维码识别方法,其特征在于,校正处理过程为:4. The two-dimensional code recognition method according to claim 1, wherein the correction process is:检测二维码关键点;Detect the key points of the QR code;根据二维码关键点进行二维码边缘拟合和二维码贴面拟合;Perform QR code edge fitting and QR code veneer fitting according to the key points of the QR code;确定校正公式,并通过校正公式校正二维码,得到标准形状的二维码。The correction formula is determined, and the two-dimensional code is corrected by the correction formula to obtain a two-dimensional code with a standard shape.5.一种二维码识别装置,其特征在于,包括:5. A two-dimensional code recognition device, characterized in that, comprising:两个摄像头,用于从不同角度同时采集二维码图片;Two cameras, used to simultaneously capture QR code pictures from different angles;图像预处理模块,用于对采集的两张二维码图片进行预处理;The image preprocessing module is used to preprocess the two two-dimensional code images collected;二维码分割处理模块,用于对预处理后的二维码图片进行二维码分割处理,提取出二维码;The two-dimensional code segmentation processing module is used to perform two-dimensional code segmentation processing on the preprocessed two-dimensional code image to extract the two-dimensional code;二维码校正模块,用于根据两张二维码的边缘扭曲情况对二维码所处的贴面进行判定与计算,获得校正公式,使用校正公式对二维码进行图像校正,将其还原为标准形状的二维码;The two-dimensional code correction module is used to judge and calculate the veneer of the two-dimensional code according to the edge distortion of the two two-dimensional codes, obtain the correction formula, use the correction formula to correct the image of the two-dimensional code, and restore it to the standard QR code of the shape;二维码互补模块,用于记录两张标准形状二维码编码区信息,根据其中一个编码区中黑像素点对另一个编码区进行补充处理,得到可识别二维码;The two-dimensional code complementary module is used to record the coding area information of two standard-shaped two-dimensional codes, and perform supplementary processing on the other coding area according to the black pixels in one of the coding areas to obtain a recognizable two-dimensional code;二维码信息提取模块,用于提取可识别二维码中的二维码信息。The two-dimensional code information extraction module is used for extracting the two-dimensional code information in the recognizable two-dimensional code.6.根据权利要求5所述的二维码识别装置,其特征在于,预处理包括图像灰度化处理、图像二值化处理和图像去噪处理。6 . The two-dimensional code recognition device according to claim 5 , wherein the preprocessing includes image grayscale processing, image binarization processing and image denoising processing.7.根据权利要求5所述的二维码识别装置,其特征在于,所述二维码分割处理模块的分割处理过程为:7. The two-dimensional code recognition device according to claim 5, wherein the segmentation process of the two-dimensional code segmentation processing module is:检测二维码上的三个位置探测图形,确定二维码位置;Detect the three position detection patterns on the two-dimensional code to determine the position of the two-dimensional code;对二维码进行图像孔洞填充,使二维码在同一连通域内;Carry out image hole filling on the two-dimensional code, so that the two-dimensional code is in the same connected domain;最后进行边缘检测,提取出二维码。Finally, edge detection is performed to extract the two-dimensional code.
CN201610514040.7A2016-06-302016-06-30A kind of two-dimensional code identification method and deviceActiveCN106156684B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN201610514040.7ACN106156684B (en)2016-06-302016-06-30A kind of two-dimensional code identification method and device

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN201610514040.7ACN106156684B (en)2016-06-302016-06-30A kind of two-dimensional code identification method and device

Publications (2)

Publication NumberPublication Date
CN106156684Atrue CN106156684A (en)2016-11-23
CN106156684B CN106156684B (en)2019-01-18

Family

ID=57349766

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN201610514040.7AActiveCN106156684B (en)2016-06-302016-06-30A kind of two-dimensional code identification method and device

Country Status (1)

CountryLink
CN (1)CN106156684B (en)

Cited By (10)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN107145810A (en)*2017-04-262017-09-08南京理工大学 An all-round barcode recognition device and method
CN107180216A (en)*2017-06-072017-09-19福州觉感视觉软件科技有限公司A kind of generation and recognition methods of Quick Response Code and the Quick Response Code
CN107679432A (en)*2017-09-272018-02-09努比亚技术有限公司A kind of scan method, terminal and storage medium
CN107818283A (en)*2017-11-022018-03-20深圳天珑无线科技有限公司Quick Response Code image pickup method, mobile terminal and computer-readable recording medium
CN108197521A (en)*2017-12-312018-06-22南京理工大学A kind of leggy Quick Response Code obtains identification device and method
CN108563972A (en)*2018-03-092018-09-21广东欧珀移动通信有限公司Graphic code recognition methods, device, mobile terminal and storage medium
CN109190436A (en)*2018-07-302019-01-11努比亚技术有限公司A kind of two-dimensional code identification method, mobile terminal and storage medium
CN109492451A (en)*2018-10-302019-03-19维沃移动通信有限公司A kind of coded image recognition methods and mobile terminal
CN110309687A (en)*2019-07-052019-10-08华中科技大学 Method and device for correcting a two-dimensional code image
CN112069852A (en)*2020-09-072020-12-11凌云光技术股份有限公司Low-quality two-dimensional code information extraction method and device based on run-length coding

Citations (5)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN1334544A (en)*2000-04-062002-02-06精工爱普生株式会社Two-dimension code reading method, information recording medium and two-dimension code reading device
EP1770604A1 (en)*2004-07-222007-04-04Matsushita Electric Industrial Co., Ltd.Multicolored two-dimensional barcode, image display apparatus thereof, information terminal apparatus, display method, decoding method, information communication system, and information communication method
CN103400131A (en)*2013-08-162013-11-20徐宁Correction device and method for image identification
CN204967989U (en)*2015-10-102016-01-13南京比邻软件有限公司High -speed dynamic optical wand of twin -lens
CN105701434A (en)*2015-12-302016-06-22广州卓德信息科技有限公司Image correction method for two-dimensional code distorted image

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN1334544A (en)*2000-04-062002-02-06精工爱普生株式会社Two-dimension code reading method, information recording medium and two-dimension code reading device
EP1770604A1 (en)*2004-07-222007-04-04Matsushita Electric Industrial Co., Ltd.Multicolored two-dimensional barcode, image display apparatus thereof, information terminal apparatus, display method, decoding method, information communication system, and information communication method
CN103400131A (en)*2013-08-162013-11-20徐宁Correction device and method for image identification
CN204967989U (en)*2015-10-102016-01-13南京比邻软件有限公司High -speed dynamic optical wand of twin -lens
CN105701434A (en)*2015-12-302016-06-22广州卓德信息科技有限公司Image correction method for two-dimensional code distorted image

Cited By (13)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN107145810A (en)*2017-04-262017-09-08南京理工大学 An all-round barcode recognition device and method
CN107180216B (en)*2017-06-072020-06-30福州觉感视觉软件科技有限公司Two-dimensional code generation and identification method
CN107180216A (en)*2017-06-072017-09-19福州觉感视觉软件科技有限公司A kind of generation and recognition methods of Quick Response Code and the Quick Response Code
CN107679432A (en)*2017-09-272018-02-09努比亚技术有限公司A kind of scan method, terminal and storage medium
CN107818283A (en)*2017-11-022018-03-20深圳天珑无线科技有限公司Quick Response Code image pickup method, mobile terminal and computer-readable recording medium
CN108197521A (en)*2017-12-312018-06-22南京理工大学A kind of leggy Quick Response Code obtains identification device and method
CN108563972A (en)*2018-03-092018-09-21广东欧珀移动通信有限公司Graphic code recognition methods, device, mobile terminal and storage medium
CN108563972B (en)*2018-03-092021-11-16Oppo广东移动通信有限公司Graphic code identification method and device, mobile terminal and storage medium
CN109190436A (en)*2018-07-302019-01-11努比亚技术有限公司A kind of two-dimensional code identification method, mobile terminal and storage medium
CN109492451A (en)*2018-10-302019-03-19维沃移动通信有限公司A kind of coded image recognition methods and mobile terminal
CN110309687A (en)*2019-07-052019-10-08华中科技大学 Method and device for correcting a two-dimensional code image
CN112069852A (en)*2020-09-072020-12-11凌云光技术股份有限公司Low-quality two-dimensional code information extraction method and device based on run-length coding
CN112069852B (en)*2020-09-072023-12-12凌云光技术股份有限公司Low-quality two-dimensional code information extraction method and device based on run-length coding

Also Published As

Publication numberPublication date
CN106156684B (en)2019-01-18

Similar Documents

PublicationPublication DateTitle
CN106156684A (en) A two-dimensional code recognition method and device
CN111259899B (en)Code spraying character detection method
CN108416355B (en) A collection method of industrial field production data based on machine vision
CN108846401A (en)Commodity detect terminal, method, system and computer equipment, readable medium
CN101916364B (en)Adaptive dial digital identification method
CN112434544A (en)Cigarette carton code detection and identification method and device
CN106056020B (en)A kind of bar code detection recognition method and system based on NI Vision Builder for Automated Inspection
CN107145810A (en) An all-round barcode recognition device and method
CN104424457A (en)Method for identifying two-dimensional code under the condition of nonlinear distortion
CN101807257A (en)Method for identifying information of image tag
CN105260694B (en)A kind of two-dimension code area localization method based on multistage key extraction with analysis
CN104463795A (en)Processing method and device for dot matrix type data matrix (DM) two-dimension code images
CN103294980A (en)Micro-QR (Quick Response) code recognition method based on picture processing
CN102629322A (en)Character feature extraction method based on stroke shape of boundary point and application thereof
CN106169080A (en)A kind of combustion gas index automatic identifying method based on image
CN107403124A (en)A kind of barcode detection recognition methods of view-based access control model image
CN104657728B (en)Processing in Barcode Recognizing System based on computer vision
CN108197521A (en)A kind of leggy Quick Response Code obtains identification device and method
CN107122775A (en)A kind of Android mobile phone identity card character identifying method of feature based matching
CN105335744A (en)One-dimensional code region location based on image backbone extraction strip distribution features
CN110969164A (en)Low-illumination imaging license plate recognition method and device based on deep learning end-to-end
CN108427954B (en)Label information acquisition and recognition system
CN103116890B (en)A kind of intelligent search matching process based on video image
CN119379539B (en)Image stitching method, system and readable storage medium
CN104346596A (en)Identification method and identification device for QR (Quick Response) code

Legal Events

DateCodeTitleDescription
C06Publication
PB01Publication
C10Entry into substantive examination
SE01Entry into force of request for substantive examination
GR01Patent grant
GR01Patent grant

[8]ページ先頭

©2009-2025 Movatter.jp