Researc on te Anti-perspective Correction Algoritm of QR Barcode Jianua Li, Yi-Wen Wang, YiJun Wang,Yi Cen, Guoceng Wang Key Laboratory of Electronic Tin Films and Integrated Devices University of Electronic Science and Tecnology of Cina Journal of Digital Cengdu Cina 610054 Information Management Information engineer Scool of Nancang University Nancang Cina 330031) {Jianua703, wgc19890113}@163.com,{wangyijun007, cenyi261}@gmail.com, yiwen@uestc.edu.cn ABSTRACT: 2-D (2-dimension) bar code as many advantages compared wit 1-D bar code, so it as many prevalent applications in recent days. However, tere re several factors tat affecting te sampling process, tey lead to a certain degree of deformation towards te 2-D bar code. Furtermore, tis deformation may too severe for 2-D bar code to be recognized. Generally, te main stream of twisted correcting is based on te approac of control-point transformation. So ow to locate te control point accurately becomes a key factor in 2-D bar code correcting. Tis paper develops a QR barcode searcing grap and gets te precise location of control point. Experiment sows tat our algoritm as good efficiency and accuracy. Categories and Subject Descriptors I.3.3 [Picture/Image Generation]; Display Algoritms: I.4.10 [Image Representation] General Terms: Barcode, Image Processing Algoritms Keywords: QR Code, Perspective Transformation, Image Correction, Searcing Grapics, Line Fitting Received: 11 January 2013; Revised 3 Marc 2013, Accepted 12 Marc 2013 1. Introduction Compared wit one-dimensional bar code, 2-D barcode as advantages suc as ig information density, ig security, and strong error correction capability. In recent years, it as gotten more and more attention [1]. 2-D barcode is subject to kinds of distortions wic may result in a degeneration of quality during acquisition. Deformation of 2D barcode includes barrel distortion caused by te acquisition device itself. Skew distortion, perspective distortion, scale distortion and oter geometric distortions, tose distortions are caused by te relative rotation angle between te optical axis and te bar code plane, te relative angle and te difference between te distance and bar code plane bending and oter factors. In order to improve te recognition rate of te bar code, deformation correction is prerequisite. D Angelo et al. proposed an objective quality metric for geometrically distorted [2]. Due to wideangle conûguration of te camera lens, Vijayan Asari and Tsai proposed aradial lens distortion model wic describes a 2-D correction tecnique [3, 4]. Baggenstoss used a Polynomial tecnique to correct deformed by comparing te deformed s wit te un-deformed s [5]. Ricetin used te zerocurvature points of teir contours to solve te inverse perspective problem [6]. Kutulakos and Dyer proposed a metod for recovering surface sape from te occluding contour using an active observer [7]. In te process of 2-D bar code recognition, distorted barcode s obtained by acquisition device are te result of te superposition of various factors. According to different factors wic cause distortion, we can use corresponding metods to correct distortions. 202 Journal of Digital Information Management Volume 11 Number 3 June 2013
Tis approac can obtain a good correction effect. However, tis approac will greatly increase te time of processing, and as no practical value. From te practical application point of view, distortion caused by eac factor alone is not serious, so we can ignore specific factor tat lead to distortion. In recent years, scolars in te field of bar code processing begin to seek tose algoritms wic can meet te actual needs and ave good efficiency. Kato and Tan proposed te special point of te QR barcode transformation, but ad no detailed description of specific metod [8]. Liu and oter scolars ave proposed linear correction metod, wic uses te metod of scanning and get four vertices of te peripery, but tese metods as poor noise immunity and limited accuracy [9, 10]. Liu Ning-Zong et al. reduce te amount of computation by improving te metod of calculation, under te assumptions tat te four vertices of te s ave already existed [11]. is a square; te corresponding edge of two s in one edge of te square is in a line. 2.2 Te parallel lines analysis in te perspective From te caracteristics of te perspective projection transformation, points in a straigt line in te scene are still in a straigt line after perspective projection transformation. Wen te angle of te observation plane is different to scene plane, parallel lines in te scene will converge on te vanising point after perspective transformation. It means tat, tere is a certain degree of cange in te angle between two Parallel lines after perspective projection transformation. Let spacing, lengt l parallel line, wit te angle of te optical axis θ, as is sown in Figure 2, in te plane perpendicular to te lens, l can be decomposed a rectangle in te direction of te optical axis direction, and te lengt of te rectangle is l cos θ, te eigt of te rectangle is. In tis paper, we use anti-perspective transformation metod based on a fixed point, wic was proposed by Ricetin et al. [6], Kutulakos and Dyer [7], we accurately select te four feature points of te peripery as control points of anti-perspective transformation and compare te effects wit related algoritms. Te results sow tat our proposed algoritm as better performance, to meet te requirements of te bar code recognition. 2.Te basis of algoritm z z + L cos θ Figure 2. Angular variation of Parallel straigt line after perspective 2.1. Descriptions on QR code features Figure 1. QR code cart searcing grapics code word module blank region positioning grapics AS is sown in Figure 1, QR Code composes by blank region, searcing grapics, correcting grapics, positioning grapics, code word module. Te blank region is distributed in te region of te around wit four modules widt, mainly in order to isolate te area and te complex background of te bar code. searcing grapics respectively located in te upper left, top rigt, and te lower left corner of te symbol, top rigt, and te lower left corner, and te module widt ratio is 1:1:3:1:1. According to te mutual positional relationsip of searcing grapics, te position and orientation of te symbols can be determined. Te overall QR Code α 1 = arctan z α 2 = arctan Here z is te sum of object distance and distance, and te angle cange of two straigt lines after perspective as follows: α 3 = arctan z arctan (2) From te standards of 2D bar code, te Side lengt of l searcing grapics of QR code is l, line widt is =, 8 and z is te sum of te object distance and distance, z >> l,from (1) (2), we can get: α 1 = arctan z α 2 z α 2 = arctan α 2 Angle difference α 3 leaded by perspective: lcos α 3 = α 1 α 2 0 z ( ) (1) (3) (4) (5) Journal of Digital Information Management Volume 11 Number 3 June 2013 203
finding te positioning point of QR determine fitting line corresponding to feature building te line determining to feature building te line determined by te indivual searcing grapics determined Boundary lines: L1 L2 determined Boundary lines: L3 L4 Obtaining te vertices of te getting te corrected by inverse perspective transformation Figure 3. Te algoritm processes cart 3. Anti-perspective algoritm process Te accuracy of te correction is determined by te precise extent of te s of te four vertex position [5]. Te analysis in introduction sows tat many scolars ave proposed te metod of getting te four vertex of te. In tis paper, we make correction basing on te caracteristics grapics of te QR Code. Te algoritm processes is sown in Figure 3. 3.1. Finding te positioning point of QR In te entire, we Searc te segments wose corresponding ratio in te orizontal and vertical directions is 1:1:3:1:1, and set its center as te center of te searcing grapic. 3.2 Determine fitting line corresponding to Feature From te position relationsip of searcing grapics in te QR Code in Figure 1, we can get edges of searcing grapics wic need to be scanned. As is sown in Figure 4: For tree searcing grapics, te corresponding edges wic need to be scanned are as follows: a 1, 1, a 2, 1, b 1, 2, b 1, 3, c 1, 3, c 1, 4. b1, 3 b1, 2 b1, 3 c1, 4 c2, 4 a1, 2 a1, 1 a2, 1 Figure 4. Determine te scan line according to searcing grapics center 3.3 Building te line determined by two Feature We can learn from te caracteristics of QR Code and te corresponding dimension tose segments a 1, 1, b 1, 2 are in a line. From te perspective principle, te point in a straigt line is still in a straigt line after perspective. 204 Journal of Digital Information Management Volume 11 Number 3 June 2013
Taking into account te discrete nature of te scan points, we select scan segments a 1, 1, b 1, 2 and connect te distribution median point along te Y axis, to get te line L2.Similarly, according to segments b 1, 3, c 1, 3, we get line L3. 3.4 Building te line determined by te individual searcing grapics For straigt line along te edge of a 1, 1 and c 1, 4, we can fit a straigt line along te scanning point. However, te date obtained by corresponding edge of searcing graps is less and large discrete, wic will affect te accuracy of correction. From te formula (5) and te basic caracteristics of te QR Code, te edges a 1, 1, a 2, 1 of searcing grapics a remain parallel in te same direction after perspective transformation. Tus we can fit a straigt line using te corresponding points in tose two straigt lines. Because of te edge a 1, 1 of searcing grapic is more susceptible to noise tan edge a 2, 1, after several fitting experiments, we set te angle weigting of a 1, 1 to 0.6 and te angle weigting of external linear to 0.4. We suppose te angle determined by a 1, 1 is β 1, te Angle determined by a 2, 1 is β 2, te angle of te final fitting straigt line is: β = 0.4 β + 0.6 β (6) 1 2 We rank te scanned point of edge a 1, 1 according to teir X coordinate, and coose te middle value as te linear fitting point P a. We get fitting straigt lines L 1 from te straigt line angle β and P a. Similarly, a fitting straigt line L 4 can be obtained by searcing grapics C. 3.5. Obtaining te vertices of te We intersect te straigt lines L 1, L 2, L 3, L 4 obtained by searcing grapics C, D, and take te corresponding point of intersection as four vertices p 1, p 2, p 3, p 4 of obtained deformation s. L2 p2 p3 L3 Figure 5. Determine te vertex 3.6 Getting te corrected by inverse perspective transformation Take te average value of distance between four intersections p 1, p 2, p 3, p 4 as te side lengt of te corrected QR Code, and get te corrected by use of te anti-perspective correction algoritm of four standard points. L1 p1 p4 L4 Figure 6. Corrected of Anti-perspective 4.Te Analysis Of Final Results To validate te performance of te algoritm, we apply te algoritm to pieces of QR s of different sizes wic ave perspective transformation, and compare te effect of processing time and recognition rate to oter algoritms. In table 1, Algoritm 1 is te algoritm proposed by Liu et al [11], Algoritm 2 is te algoritm proposed by Liu Hui- Juan et al. [9], and Algoritm 3 is our proposed algoritm. Algoritm Image Processing Recognition types size time / ms rate Algoritm 1 320 240 308 86% 640 480 724 92% Algoritm 2 320 240 500 94% 640 480 1300 93% Algoritm 3 320 240 359 96% 640 480 410 94% Table 1. Comparison of various algoritms Table 1 sows te average time consumption for processing different processing algoritms on te 50 s. As is sown in Table 1, te performance of our proposed algoritm is stable and efficiency. 5. Conclusions Tis paper proposes a correction algoritm for te QR Code perspective deformation, tis algoritm makes fitting for te edge of bar code in two kinds of circumstances. Te edges composed by two searcing grapics are constituted by midpoint Connection of corresponding searcing grapics edges. Bar code edges wic determined by a single VF grapics fit a straigt line in te same criteria after perspective deformation according to te parallel lines adjacent to te smaller distance. We analyze te effect of correction after te perspective deformation, and find tat recognition rate is very ig. Wat s more, we compare our proposed algoritm wit oter algoritms proposed by oter scolars, and te results sow tat our proposed algoritm as a good efficiency and iger accuracy. Reference [1] Kato, H., Tan, K. T. (2007). Pervasive 2D barcodes for camera pone applications,ieee Trans. Pervasive Computing, 6 (4) 76-85. Journal of Digital Information Management Volume 11 Number 3 June 2013 205
[2] D Angelo, A., Li, ZH. P., Barni, M. (2010). A full-reference quality metric for geometrically distorted Images, IEEE Trans. Image Processing, 19 (4) 867-881. [3] Vijayan Asari, K., Kumar, S., Radakrisnan, D. (1999). A new approac for nonlinear distortion correction in endoscopic s based on least squares estimation IEEE Trans. Medical,18 (4) 345-354. [4] Tsai, R. Y. (1986). An efficient and accurate camera calibration tecnique for 3D macine vision, IEEE Trans. Computer Vision Pattern Recognition, p.364-374, June. [5] Baggenstoss, P. M. (2004). mage distortion analysis using polynomial series expansion, IEEE Trans. Pattern analysis and macine intelligence, 26 (11) Nov. [6] Ricetin, M., Dome, M., Lapreste, J. T., Rives, G. (1999). Inverse perspective transform using zero curvature contour points : application to te localization of some generalized cylinders from a single view, IEEE Trans. Pattern analysis and macine intelligence,13 (2), Feb. [7] Kutulakos, K. N., Dyer, C. R. (1992). Recovering sape by purposive viewpoint adjustment, IEEE Proc. Computer vision and pattern recognition, p.16-22. [8] Kato, H., Tan, K. T. (2007). Pervasive 2D barcodes for camera pone applications, IEEE Pervasive computing,p. 76-85. [9] Liu, H. J. (2006). Location and segmentation of quick response code, Journal of electronic measurement and instrument, 1 (20) 32-35. [10] Z. Y. Fan, Fan, J., Z. W. Liu. (2008). Recognition of PDF 417 barcode on captured imaages, Journal of BeiJing institute of tecnology, 12 (28) 1088-1092. [11] Z, N., Liu, H. Y., You, Sun, N. (2010). Recognition of data matrix two-dimensional bar code based on mobile pones, Journal of and grapics, 2, p.287-293, Feb. 206 Journal of Digital Information Management Volume 11 Number 3 June 2013