基于改进Canny算子和Hough变换的QR码图像校正
2017-10-12刘琳琳梁雪慧
刘琳琳,梁雪慧
(天津理工大学 自动化学院,天津 300384)
基于改进Canny算子和Hough变换的QR码图像校正
刘琳琳,梁雪慧
(天津理工大学 自动化学院,天津 300384)
在QR码图像的识别中,图像的倾斜会给整个识别过程带来一定程度的误差。考虑到传统Canny算子检测对于去除局部噪声的效果并不是很理想,提出了一种基于自适应中值滤波的Canny算子边缘检测方法,再结合Hough变换标识出直线段并计算出倾斜角度,最后用双线性插值算法对QR码图像进行旋转校正。将其在Matlab平台上进行验证实验,结果表明,改进的Canny算法有效地去除了图像噪声,并能够准确地完成了QR码图像的旋转校正。
QR码;Canny算子;边缘检测;Hough变换;旋转校正
Abstract:In recognition of the QR code image,the inclination of the image will bring a certain degree of error to the whole recognition process.The effect of traditional detection of Canny operator for the removal of the local noise works not well.Considering this situation,a kind of adaptive median filtering method for edge detection of Canny operator is proposed,it identifies the line segment and calculate the tilt angle with the Hough transform.Finally,the bilinear interpolation algorithm is used to rotate the QR code image.To be verified experimentally on Matlab platform,the results show that the improved Canny algorithm effectively eliminates image noise and completes the rotation correction QR code image accurately.
Key words:QR code;Canny operator;edge detection;Hough transform;rotation correction
随着电子支付方式的广泛应用,手机QR码作为新兴的电子支付媒介在各个行业领域受到普遍关注。以天津地铁即将投入使用的云购票机为背景,其针对手机屏幕上的QR二维码进行扫码兑票,但人工采集图像过程中难免会引入一些噪声甚至图像的倾斜,因此在整个QR码图像识别系统中,最初要对QR码图像进行图像预处理。由于传统的Canny算子在进行QR码图像的边缘检测时,对局部噪声不能有效去除,这将会影响图像的校正效果甚至整个识别结果[1-2]。为提高QR码图像识别的准确性,提出了一种改进的QR码图像校正方法,在QR码图像进行Canny算子边缘检测时采用自适应中值滤波方法进行去噪处理,然后结合Hough变换实现QR码图像的旋转校正[3]。
1 Canny算子边缘检测原理
Canny边缘检测的基本思想就是首先选择一种高斯滤波器对图像进行平滑滤波,然后采用非极值抑制技术进行处理得到最后的边缘图像。……
