Hindawi Publishing CorporationMathematical Problems in EngineeringVolume 2013 Article ID 848276 10 pageshttpdxdoiorg1011552013848276
Research Article2D Barcode Image Decoding
Jeng-An Lin and Chiou-Shann Fuh
Department of Computer Science and Information Engineering National Taiwan University Taipei 106 Taiwan
Correspondence should be addressed to Chiou-Shann Fuh fuhcsientuedutw
Received 17 June 2013 Revised 25 October 2013 Accepted 16 November 2013
Academic Editor Chung-Hao Chen
Copyright copy 2013 J-A Lin and C-S Fuh This is an open access article distributed under the Creative Commons AttributionLicense which permits unrestricted use distribution and reproduction in any medium provided the original work is properlycited
Barcode technology is one of the most important parts of Automatic Identification and Data Capture (AIDC) Quick Responsecode (QR code) is one of the most popular types of two-dimensional barcodes How to decode various QR code images efficientlyand accurately is a challenge In this paper we revise the traditional decoding procedure by proposing a serial of carefully designedpreprocessing methods The decoding procedure consists of image binarization QR code extraction perspective transformationand resampling and error correction By these steps we can recognize different types of QR code images The experiment resultsshow that our method has better accuracy than Google open-source 1D2D barcode image processing library Zxing-21 Moreoverwe evaluate the execution time for different-size images Our method can decode these images in real time
1 Introduction
Barcode technology is one of the most important parts ofAutomatic Identification and Data Capture (AIDC) we canobtain decoded data through analysis of a barcode Accordingto the encoding type of barcodes we divide barcode into twocategories one-dimensional barcode and two-dimensionalbarcode One-dimensional barcode typically consists of vary-ing the widths and spacings of parallel lines Moreover two-dimensional barcode is a graphical image that stores infor-mation both horizontally and vertically Two-dimensionalbarcode compared with the one-dimensional barcode has thefollowing advantages (1)high data capacity (2)no additionalstorages (3) error correction ability
Quick Response code (QR code) is one of the mostpopular types of two-dimensional barcodes developed inJapan by Denso Corporation in 1994 Although QR codewas first designed for the automotive industry QR codes arenow used over much wider range of applications includingcommercial tracking transport ticketing website UniformResource Locator (URL) and identity verification QR codehas several advantages First QR code has strong errorcorrecting capability which can restore 30 data for themaximum error correction level Second QR code canbe scanned from any direction because the proportion of
position detection patterns is not changed with the scanningdirection Third QR code supports different encoding typesand versions We can choose an appropriate encoding typeand version to reduce the size of QR code image
Although there exist many commercial programs for QRcode decoding inventing more robust QR code decodingstrategy still attracts many attentions from researchers Manyworks are proposed recently In [1 2] Belussi and Hirataproposed a fast component-based two-stage approach fordetecting QR codes in arbitrarily acquired images More-over Ohbuchi et al [3] and Liu et al [4] focused on enablingmobile phone to recognize QR code under poor conditionsin real time For decoding QR code image correctly andefficiently we confront some challenges as follows (1)Whenwe capture QR code images using a phone camera in nonuni-form background or uneven light it might affect the decodedresult (2)The shooting angle might cause perspective distor-tion to restore a distorted QR image is an important issuefor decoding QR code images (3)Decoding QR code imagesneeds a sequence of sophisticated image processing How toreduce the complexity of image processing and maintain thedecoding accuracy rate is also a challenge
In this paper we focus on revising preprocessingmethodsin the traditional decoding procedure that is straightfor-ward but still have much improving potential to overcome
2 Mathematical Problems in Engineering
the above challenges The decoding steps consist of imagebinarization QR code extraction perspective transformationand resampling and error correction In image binarizationwe use a modified local threshold method to resolve thenonuniform background and uneven light problems OurQR code extraction algorithm uses the position detectionpatterns ofQR code efficiently and accurately to locate theQRcode position After locating theQR code position we restorea distorted image through perspective transformation andresample Finally we get the corrected data by Reed-Solomonerror correction algorithm
2 Related Work
QR code recognition technology has been studied in pastyears We can simply divide the recognition into two stepsimage preprocessing and QR code extraction
In image preprocessing some researchers focus on imagedenoising [5] or camera shaking [6] In order to improvethe performance of low resolution QR-code recognitiona previous work [7] uses the super-resolution techniquethat generates a high resolution image from multiple low-resolution images Moreover some researchers use differentbinarizations to improve the nonuniform background anduneven light problems [8 9]
In QR code extraction researchers propose several dif-ferent methods to locate and extract the QR code of imagesSome researchers use the feature of finder pattern to findrough QR code position [10ndash12] After estimating the QRcodersquos four corners using the rough QR code position theyeffectively extract the QR code of images In research [6 13]they use edge detection to find possible rough barcode areaThenmorphological dilation and closing are used to generatemore compact regions Finally the position of QR code ofimages can be detected
Although these researches have their contributions thereare some shortcomings we can improve In [5] researchersonly focus on image denosing but locating QR code positionis an important part of QR decoding They did not proposetheir method to process this problem Previous works [6 710] need enormous calculation Their methods are difficultto decode QR code image in real time In research [9] theirbinarizaiton method needs to know the version of QR codein advance In this paper we propose a decoding method toimprove the deficiencies in previous work
3 Background
31 Perspective Transformation QR code images may bedistorted due to camera perspective projection Thereforewe use perspective transformation to restore the distortedQR code images The general representation of a perspectivetransformation [14] is
[119909101584011991010158401199081015840] = [119906 V 1][
[
11988611
11988612
11988613
11988621
11988622
11988623
11988631
11988632
11988633
]
]
(1)
where 119909 = 11990910158401199081015840 and 119910 = 11991010158401199081015840 In (1) each original
coordinate (119906 V) can be transformed to a new coordinate (119909119910) by using the 3 by 3 matrix Based on (1) 119909 and 119910 can bewritten as
119909 =1199091015840
1199081015840=11988611119906 + 11988621V + 11988631
11988613119906 + 11988623V + 11988633
119910 =1199101015840
1199081015840=11988612119906 + 11988622V + 11988632
11988613119906 + 11988623V + 11988633
(2)
Without loss of generality the 3 by 3 matrix can benormalized so that 119886
33= 1 Equation (2) can be rewritten
as119909 = 11988611119906 + 11988621V + 11988631minus 11988613119906119909 minus 119886
23V119909
119910 = 11988612119906 + 11988622V + 11988632minus 11988613119906119910 minus 119886
23V119910
(3)
Applying four pairs of correspondence points to (3) wecan get a linear system as follows
[[[[[[[[[[
[
1199060
1199061
1199062
1199063
0
0
0
0
V0
V1
V2
V3
0
0
0
0
1
1
1
1
0
0
0
0
0
0
0
0
1199060
1199061
1199062
1199063
0
0
0
0
V0
V1
V2
V3
0
0
0
0
1
1
1
1
minus11990601199090
minus11990611199091
minus11990621199092
minus11990631199093
minus11990601199100
minus11990611199101
minus11990621199102
minus11990631199103
minusV01199090
minusV11199091
minusV21199092
minusV31199093
minusV01199100
minusV11199101
minusV21199102
minusV31199103
]]]]]]]]]]
]
times
[[[[[[[[[[
[
11988611
11988621
11988631
11988612
11988622
11988632
11988613
11988623
]]]]]]]]]]
]
=
[[[[[[[[[[
[
1199090
1199091
1199092
1199093
1199100
1199101
1199102
1199103
]]]]]]]]]]
]
(4)
The value of unknown coefficients will be determined bysolving the linear system in (4)
32 Reed-Solomon Error Correction Reed-Solomon codesare nonbinary cyclic error-correcting codes [15] In QRcode decoding procedures we might obtain some errorinformation because of distorted images or inappropriatebinarization Reed-Solomon codes help us to correct the errorinformationThe general decoding algorithm [16] of RS codesconsists of computing the syndromes determining an errorlocator polynomial and solving the error values
For computing the syndromes the received message isviewed as the coefficients of a polynomial 119878(119909)
119878 (119909) =
119899minus1
sum119894=0
119903119894119909119894 (5)
where 119903119894is the received message at position 119894 Therefore the
syndromes (1198780 1198781 119878
2119905minus1) are defined as
1198780= 119878 (120572
0) 119878
1= 119878 (120572
1) 119878
2119905minus1= 119878 (120572
2119905minus1) (6)
Mathematical Problems in Engineering 3
Image BinarizationFinder
patterns
Alignment pattern
Estimate version
Perspectivetransformation
QR code extraction
Reed-Solomonerror correction
Decodedtext
Figure 1 QR code decoding procedure
where 2119905 is equal to the number of codewords available forerror correction and 120572 is the primitive element on the Galoisfield Syndrome polynomial is defined as
119878 (119909) =
2119905minus1
sum119894=0
119878119894119909119894 (7)
After computing syndrome polynomial we use Euclideanalgorithm to construct the error locator polynomial and errorevaluator polynomial Error locator polynomial can be usedto find the error positions Error evaluator polynomial is usedto find the error values The Euclidean algorithm is based onthe key equation in
Ω (119909) = 119878 (119909) Λ (119909) (mod1199092119905) (8)
Given only 119878(119909) and 119905 we want to obtain the error locatorpolynomial Λ(119909) and the error evaluator polynomial Ω(119909)Equation (8) means that
120579(119909)1199092119905+ 119878 (119909) Λ (119909) = Ω (119909) (9)
for some polynomial 120579(119909) Finally we can use Euclideanalgorithm to generate the error locator polynomial and errorevaluator polynomial
For solving the error values Forneyrsquos algorithm isselected The error values for a Reed-Solomon code arecomputed by
119890119894119896= minus
Ω(119883minus1119896)
Λ1015840 (119883minus1119896) (10)
where 119890119894119896is the corrected value at position 119894
119896 119883minus1119896
is theroot of Λ(119909) at position 119896 and Λ1015840(119909) is the formal derivativeof Λ(119909) By (10) we obtain the corrected data of QR codeimages
4 The Proposed Method
Wedesign aQR code recognition procedure for decodingQRcode accurately and rapidly First we propose a new local
binarization method to overcome images with uneven lightand nonuniform background problems And then we usethree finder patterns and an alignment pattern of QR codeefficiently to locate the QR code position After locating QRcode position we resample QR code image by perspectivetransformation Finally we get the corrected data by Reed-Solomon error correction algorithm Figure 1 illustrates theprocedure
41 Binarization Binarization is an important process foraccurately recognizing black-and-white module in QR codeimages Therefore we propose a new binarization method toimprove the recognition of images with nonuniform back-ground and uneven light Our method is a local thresholdalgorithm based on Sauvolarsquos method [8] We decomposeeach image into a series of blocks and then calculate athreshold 119879
1for each block using
1198791(119909 119910) = mean (119909 119910)
times [1 + (standard deviation (119909 119910)
119877)]
(11)
The default 119877 is 1250 For each block we convolve withthe kernel in (12) to calculate a threshold 119879
2 By using the
threshold 1198792 we split each block into bright area and dark
area Figures 2 and 3 shows that our method can achieve thesame performance with less computing cost compared withmodified Sauvolarsquos method [8]
119862 =1
10[
[
1 1 1
1 2 1
1 1 1
]
]
(12)
119891 (119860 119861 119862) = (119861 sdot 119909 minus 119860 sdot 119909) (119862 sdot 119910 minus 119860 sdot 119910)
minus (119861 sdot 119910 minus 119860 sdot 119910) (119862 sdot 119909 minus 119860 sdot 119909) (13)
42 Estimating Version QR code extraction is responsiblefor searching QR code area in images QR code extractionconsists of searching finder patterns estimating version and
4 Mathematical Problems in Engineering
Figure 2 An uneven light image [17]
Figure 3 Binary image using our method
searching alignment pattern We use the proportion of finderpatterns to locate the QR code position After searching threefinder patterns we use the distance between these patterns toestimate version Finally we develop a connected-componentmethod to search alignment pattern accurately
421 Searching Finder Patterns In searching finder patternswe need to determine the upper left lower left and upperright finder patterns in the QR code First we scan the binaryimage horizontally to find all points matching the ratios1 1 3 1 1 For each point matching the ratios we checkits vertical direction Finally we have collected all points inimages matching the ratios 1 1 3 1 1 both horizontally andvertically
After collecting points we merge points in the samefinder pattern If the number of finder patterns is morethan three we filter out some inappropriate points First wecalculate the angle between three points If the maximumangle is greater than a threshold 119879
1or the minimum angle is
less than a threshold 1198792 the points will be filtered And then
we identify the direction of finder patterns The maximumangle corresponding to the finder pattern is the upper left
Figure 4 Red line is the width of finder pattern and blue line is theestimated width
finder pattern Finally we use cross product in (13) todetermine the lower left and upper right finder patternswhere119860 is the upper left finder pattern 119861 and119862 are the otherfinder patterns and 119860 sdot 119909 and 119860 sdot 119910 represent the 119909 and 119910
coordinate of119860 If119891(119860 119861 119862) lt 0 then119861 is upper right finderpattern and 119862 is lower left finder pattern
422 Estimating Version After searching three finder pat-terns we can estimate version using module size and thedistance between two finder patterns Module size can becalculated by
Module size = Width of finder pattern7
(14)
We calculate version by
Version
=((Euclidean distance (119891
1 1198912) Module size) minus 10)
4
(15)
where 1198911is upper left finder pattern and 119891
2is upper right
finder pattern We can get rough version by (15) but (15)misjudges the version when QR code image is rotated Weoverestimate the width of finder pattern in rotated image inFigure 4
As a result we underestimate the version of QR codeimage Therefore we revise (15) to be
Version
=(Euclidean distance (119891
1 1198912) Module size lowast cos 120579 minus 10)
4
(16)
where 120579 is the angle between blue line and red line in Figure 4We estimate version more accurately by (16) and thus beforeperspective transformation
Mathematical Problems in Engineering 5
Table 1 Eight coordinates used for perspective transformation (119863 =
17 + 4lowastversion)
Function patternof QR code
Originalcoordinate
Normalizedcoordinate
Upper left finder pattern (1199090 1199100) (35 35)
Upper right finder pattern (1199091 1199101) (119863-35 35)
Lower left finder pattern (1199092 1199102) (35119863-35)
Lower right alignment pattern (1199093 1199103) (119863-65119863-65)
Table 2 Result of resampling
Original image Normalized image
43 Searching Alignment Pattern Low resolution image orinappropriate binarization method will result in the defor-mation of alignment pattern Therefore we propose a newsearching alignment method to overcome the problem Firstwe roughly locate the alignment pattern using three finderpatterns Moreover we extract subimage with a specifiedradius in Figure 5 We calculate the connected componentin the subimage both black pixels and white pixels Aftercalculating the connected component we get two images inFigures 6(b) and 6(c)
For each connected component of black pixel 119862119894in
Figure 6(b) we check its border pixels If all border pixels are
Table 3 Test images
Set 1
Set 2
Set 3
Set 4
Set 5
Set 6
adjacent to the same connected component of white pixel 1198621015840119895
in Figure 6(c) then we check all border pixels in 1198621015840119895 Once
all border pixels in 1198621015840119895are adjacent to the same black pixel
connected component 119862119896in Figure 6(b) these components
possibly contain alignment pattern Finally we calculate thecentroid of 119862
119894as the centroid of alignment pattern
6 Mathematical Problems in Engineering
Table 4 Comparison between our method and Zxing-21
Our method Zxing-21Set 1 2020 1720
Set 2 3234 3034
Set 3 3842 3842
Set 4 3648 3648
Set 5 1919 1919
Set 6 1515 1515
Total 160178 155178
Table 5 Images we successfully recognize and Zxing-21 fails
44 Perspective Transformation After estimating the ver-sion and locating the centroid of three finder patterns andalignment pattern we resample QR code image throughperspective transformation The eight coordinates can bepresented as shown in Table 1
To avoid the appearance of cracks and holes we useinverse warping in perspective transformation First wecalculate a transformation 119879 from normalized coordinate tooriginal coordinate For each pixel in normalize image wecalculate its corresponding location in original image usingthe transformation 119879 Finally we copy the pixel value oforiginal image to the normalized image Table 2 shows ourresampling results
Figure 5 We extract blue rectangle to find the alignment pattern(radius = 30 pixels)
5 Experiment Result
Experimental environment
(1) CPU Intel core i5-3210M CPU 250GHz(2) memory 4GB(3) OS Windows 7(4) programming language Java
In this section we conduct several experiments to evalu-ate the performance First we compare the accuracy betweenour QR code decoding algorithm and 2D barcode imageprocessing library (Zxing) [17] The experiment result showsthat our decoding algorithm has better accuracy than ZxingAnd then we use different sizes of images to evaluate thedecoding time The experiment results show our methoddecoding images in real time Moreover we implement a QRcode scanner on Android phoneWe test the decoding abilityof somedefaced imagesThe experiment result shows that ourQR code scanner successfully decodes these images
51 Image Source Our test images in Table 3 are fromGoogleopen-source 1D2D barcode image processing library Zxing-21 [17] The images are classified into six data sets a totalof 178 images The first data set contains low resolution QRcode images The second data set contains trademark QRcode image The skew QR code images are included in thethird data setThe fourth data set contains distorted QR codeimages Uneven light QR code images are included in the fifthdata setsThe sixth data set contains rotated QR code images
52 Accuracy Analysis We compare the accuracy betweenour decoding algorithm and Google open-source 1D2Dbarcode image processing library Zxing-21 [17] Table 4shows the results
In 178 test images there are 8 images in Table 5 that wesuccessfully recognize andZxing-21 failsMoreover there are3 images in Table 6 that Zxing-21 successfully recognizes andour method fails
The accuracy of our method is about 90 and that ofZxing-21 is only 87Ourmethod has better recognition rate
Mathematical Problems in Engineering 7
Table 6 Images Zxing-21 successfully recognizes and our method fails
(a) (b) (c)
Figure 6 (a) Extracted image in Figure 5 (b) found connected components of black pixels (c) found connected components of white pixels
Table 7 The execution time between our method and Zxing fordecoding different-size images
Our method Zxing320 lowast 240 214ms 139ms640 lowast 480 312ms 190ms800 lowast 600 375ms 237ms1024 lowast 768 448ms 264ms
in Sets 1 and 2 Zxing-21 cannot accurately locate the align-ment pattern because of the low resolution or inappropriatebinarization Our method improves the problem so that wehave better result
53 Efficiency Analysis In this section we show the exe-cution time between our method and Zxing for decodingdifferent sizes of QR code images We use four different sizesof QR code images to calculate the execution time Each sizecontains five images Table 7 shows the results
Our method needs more decoding time than Zxing butour method still can decode QR code images in real timeWeonly need 448 milliseconds for decoding resolution 1024 lowast
768 pixel images
54 Comparison of Different Barcode Applications We imple-ment a QR code scanner on Android phone Moreover wecollect four popular barcode scanners from Google Playand iOS market We compare the decoding ability of some
defaced images Table 8 shows the result Our application cansuccessfully decode all test images Our application has thebest result of these applications in these images The reasonfor our better results is that two steps of the binarizationstage in our method will get a more appropriate thresholdto split each block into bright area and dark area Moreovercomparedwith current applications our new searching align-ment method could handle a large deformation of alignmentpattern as the result of inappropriate binarization and lowresolution which can be observed in sample images
6 Conclusion
In this paper our carefully designed preprocessing methodsimprove the accuracy of the traditional decoding procedureAlthough refined steps improve accuracy at the expense ofincreased decoding time [21] the QR code still can meetthe real-time requirement The decoding steps consist ofimage binarization QR code extraction perspective trans-formation and error correction We efficiently resolve thenon-uniform background and uneven light problems byusing a modified local threshold algorithm In QR codeextraction we use the position detection patterns of QR codeefficiently and accurately to locate theQR code position Afterlocating the QR code position we restore a distorted imagethrough perspective transformation and resampling Finallywe get the corrected data by Reed-Solomon error correctionalgorithm
In the experiment we compare the accuracy betweenour method and Zxing The experiment result shows our
8 Mathematical Problems in Engineering
Table 8 Comparison of different barcode scanner applications
Our Zxing [17] Quickmark [18] Bakodo [19] BarCodeScan [20]
O O X X X
O X X X X
O X O O O
O X O O O
O O O O X
O O O O X
Mathematical Problems in Engineering 9
Table 8 Continued
Our Zxing [17] Quickmark [18] Bakodo [19] BarCodeScan [20]
O X O O O
O X O O O
O X X X X
O X X X X
Total 1010 310 610 610 410
method to have better accuracy than Zxing Moreover weuse different-size images to calculate the execution time Theexperiment shows that our method can efficiently decodeimages All images can be decoded in less than one second
References
[1] L F F Belussi and N S T Hirata ldquoFast component-basedQR code detection in arbitrarily acquired imagesrdquo Journal ofMathematical Imaging and Vision vol 45 no 3 pp 277ndash2922013
[2] L F F Belussi and N S T Hirata ldquoFast QR code detection inarbitrarily acquired imagesrdquo in Proceedings of the Conferenceon Graphics Patterns and Images (SIBGRAPI rsquo11) pp 281ndash288Maceio Brazil August 2011
[3] E Ohbuchi H Hanaizumi and L A Hock ldquoBarcode readersusing the camera device inmobile phonesrdquo in Proceedings of theInternational Conference onCyberworlds (CW rsquo04) pp 260ndash265Tokyo Japan November 2004
[4] Y Liu J Yang and M Liu ldquoRecognition of QR Code withmobile phonesrdquo in Proceedings of the Chinese Control andDecision Conference (CCDC rsquo08) pp 203ndash206 Yantai ChinaJuly 2008
[5] C C Lin and M S Chen A general scheme for QR-code imagedenoising on the camera phone [MS thesis] Department ofElectrical Engineering National Taiwan University 2009
[6] C-H Chu D-N Yang andM-S Chen ldquoImage stablization for2Dbarcode in handheld devicesrdquo inProceedings of the 15thACMInternational Conference onMultimedia (MM rsquo07) pp 697ndash706September 2007
[7] Y Kato D Deguchi T Takahashi I Ide and H Murase ldquoLowresolution QR-code recognition by applying super-resolutionusing the property of QR-codesrdquo in Proceedings of the 11thInternational Conference on Document Analysis and Recognition(ICDAR rsquo11) pp 992ndash996 September 2011
[8] J J Zhou Y F Liu and P Li ldquoResearch on binarization ofQR code imagerdquo in Proceedings of the International Conferenceon Multimedia Technology (ICMT rsquo10) pp 1ndash4 Ningbo ChinaOctober 2010
[9] Z Xiong H Cuiqun L Guodong and L Zhijun ldquoA binariza-tion method of quick response code imagerdquo in Proceedings ofthe 2nd International Conference on Signal Processing Systems(ICSPS rsquo10) vol 3 pp 317ndash320 Dalian China July 2010
[10] Y H Chang C H Chu and M S Chen A general scheme forextracting QR code from a non-uniform background in camera
10 Mathematical Problems in Engineering
phones and applications [MS thesis] Department of ElectricalEngineering National Taiwan University 2007
[11] C Y Lai and M S Chen Extracting QR Code from a non-uniform background image in embedded mobile phones [MSthesis] Department of Electrical Engineering National TaiwanUniversity 2007
[12] Y L Pan and M S Chen 2D barcodes from images with spatialdistortion [MS thesis] Department of Electrical EngineeringNational Taiwan University 2008
[13] D Munoz-Mejias I Gonzalez-Diaz and F Diaz-De-Maria ldquoAlow-complexity pre-processing system for restoring low-qualityQR code imagesrdquo IEEE Transactions on Consumer Electronicsvol 57 no 3 pp 1320ndash1328 2011
[14] P S Heckbert Fundamentals of texture mapping and imagewarping [MS thesis] Department of Electrical EngineeringUniversity of California Berkeley Calif USA 1989
[15] Wikipedia ldquoReed-Solomon Error Correctionrdquo 2013httpenwikipediaorgwikiReed-Solomon error correction
[16] T K Moon Error Correction Coding Mathematical Methodsand Algorithms Wiley New York NY USA 2005
[17] S Owen ldquoZxing (ldquoZebra Crossingrdquo)rdquo 2013 httpscodegooglecompzxing
[18] SimpleAct ldquoQuickMarkrdquo 2013 httpwwwquickmarkcomtw
[19] A Dougla ldquoBakodordquo 2013 httpbakodo[20] PGiudicelli ldquoBarcode-Scannerrdquo 2013 httpsitunesapplecom
twappbarcode-scannerid478602171mt=8[21] T Falas and H Kashani ldquoTwo-dimensional bar-code decoding
with camera-equippedmobile phonesrdquo in Proceedings of the 5thAnnual IEEE International Conference on Pervasive Computingand Communications Workshops (PerCom Workshops rsquo07) pp597ndash600 New York NY USA March 2007
Impact Factor 173028 Days Fast Track Peer ReviewAll Subject Areas of ScienceSubmit at httpwwwtswjcom
Hindawi Publishing Corporation httpwwwhindawicom Volume 2013Hindawi Publishing Corporation httpwwwhindawicom Volume 2013
The Scientific World Journal
2 Mathematical Problems in Engineering
the above challenges The decoding steps consist of imagebinarization QR code extraction perspective transformationand resampling and error correction In image binarizationwe use a modified local threshold method to resolve thenonuniform background and uneven light problems OurQR code extraction algorithm uses the position detectionpatterns ofQR code efficiently and accurately to locate theQRcode position After locating theQR code position we restorea distorted image through perspective transformation andresample Finally we get the corrected data by Reed-Solomonerror correction algorithm
2 Related Work
QR code recognition technology has been studied in pastyears We can simply divide the recognition into two stepsimage preprocessing and QR code extraction
In image preprocessing some researchers focus on imagedenoising [5] or camera shaking [6] In order to improvethe performance of low resolution QR-code recognitiona previous work [7] uses the super-resolution techniquethat generates a high resolution image from multiple low-resolution images Moreover some researchers use differentbinarizations to improve the nonuniform background anduneven light problems [8 9]
In QR code extraction researchers propose several dif-ferent methods to locate and extract the QR code of imagesSome researchers use the feature of finder pattern to findrough QR code position [10ndash12] After estimating the QRcodersquos four corners using the rough QR code position theyeffectively extract the QR code of images In research [6 13]they use edge detection to find possible rough barcode areaThenmorphological dilation and closing are used to generatemore compact regions Finally the position of QR code ofimages can be detected
Although these researches have their contributions thereare some shortcomings we can improve In [5] researchersonly focus on image denosing but locating QR code positionis an important part of QR decoding They did not proposetheir method to process this problem Previous works [6 710] need enormous calculation Their methods are difficultto decode QR code image in real time In research [9] theirbinarizaiton method needs to know the version of QR codein advance In this paper we propose a decoding method toimprove the deficiencies in previous work
3 Background
31 Perspective Transformation QR code images may bedistorted due to camera perspective projection Thereforewe use perspective transformation to restore the distortedQR code images The general representation of a perspectivetransformation [14] is
[119909101584011991010158401199081015840] = [119906 V 1][
[
11988611
11988612
11988613
11988621
11988622
11988623
11988631
11988632
11988633
]
]
(1)
where 119909 = 11990910158401199081015840 and 119910 = 11991010158401199081015840 In (1) each original
coordinate (119906 V) can be transformed to a new coordinate (119909119910) by using the 3 by 3 matrix Based on (1) 119909 and 119910 can bewritten as
119909 =1199091015840
1199081015840=11988611119906 + 11988621V + 11988631
11988613119906 + 11988623V + 11988633
119910 =1199101015840
1199081015840=11988612119906 + 11988622V + 11988632
11988613119906 + 11988623V + 11988633
(2)
Without loss of generality the 3 by 3 matrix can benormalized so that 119886
33= 1 Equation (2) can be rewritten
as119909 = 11988611119906 + 11988621V + 11988631minus 11988613119906119909 minus 119886
23V119909
119910 = 11988612119906 + 11988622V + 11988632minus 11988613119906119910 minus 119886
23V119910
(3)
Applying four pairs of correspondence points to (3) wecan get a linear system as follows
[[[[[[[[[[
[
1199060
1199061
1199062
1199063
0
0
0
0
V0
V1
V2
V3
0
0
0
0
1
1
1
1
0
0
0
0
0
0
0
0
1199060
1199061
1199062
1199063
0
0
0
0
V0
V1
V2
V3
0
0
0
0
1
1
1
1
minus11990601199090
minus11990611199091
minus11990621199092
minus11990631199093
minus11990601199100
minus11990611199101
minus11990621199102
minus11990631199103
minusV01199090
minusV11199091
minusV21199092
minusV31199093
minusV01199100
minusV11199101
minusV21199102
minusV31199103
]]]]]]]]]]
]
times
[[[[[[[[[[
[
11988611
11988621
11988631
11988612
11988622
11988632
11988613
11988623
]]]]]]]]]]
]
=
[[[[[[[[[[
[
1199090
1199091
1199092
1199093
1199100
1199101
1199102
1199103
]]]]]]]]]]
]
(4)
The value of unknown coefficients will be determined bysolving the linear system in (4)
32 Reed-Solomon Error Correction Reed-Solomon codesare nonbinary cyclic error-correcting codes [15] In QRcode decoding procedures we might obtain some errorinformation because of distorted images or inappropriatebinarization Reed-Solomon codes help us to correct the errorinformationThe general decoding algorithm [16] of RS codesconsists of computing the syndromes determining an errorlocator polynomial and solving the error values
For computing the syndromes the received message isviewed as the coefficients of a polynomial 119878(119909)
119878 (119909) =
119899minus1
sum119894=0
119903119894119909119894 (5)
where 119903119894is the received message at position 119894 Therefore the
syndromes (1198780 1198781 119878
2119905minus1) are defined as
1198780= 119878 (120572
0) 119878
1= 119878 (120572
1) 119878
2119905minus1= 119878 (120572
2119905minus1) (6)
Mathematical Problems in Engineering 3
Image BinarizationFinder
patterns
Alignment pattern
Estimate version
Perspectivetransformation
QR code extraction
Reed-Solomonerror correction
Decodedtext
Figure 1 QR code decoding procedure
where 2119905 is equal to the number of codewords available forerror correction and 120572 is the primitive element on the Galoisfield Syndrome polynomial is defined as
119878 (119909) =
2119905minus1
sum119894=0
119878119894119909119894 (7)
After computing syndrome polynomial we use Euclideanalgorithm to construct the error locator polynomial and errorevaluator polynomial Error locator polynomial can be usedto find the error positions Error evaluator polynomial is usedto find the error values The Euclidean algorithm is based onthe key equation in
Ω (119909) = 119878 (119909) Λ (119909) (mod1199092119905) (8)
Given only 119878(119909) and 119905 we want to obtain the error locatorpolynomial Λ(119909) and the error evaluator polynomial Ω(119909)Equation (8) means that
120579(119909)1199092119905+ 119878 (119909) Λ (119909) = Ω (119909) (9)
for some polynomial 120579(119909) Finally we can use Euclideanalgorithm to generate the error locator polynomial and errorevaluator polynomial
For solving the error values Forneyrsquos algorithm isselected The error values for a Reed-Solomon code arecomputed by
119890119894119896= minus
Ω(119883minus1119896)
Λ1015840 (119883minus1119896) (10)
where 119890119894119896is the corrected value at position 119894
119896 119883minus1119896
is theroot of Λ(119909) at position 119896 and Λ1015840(119909) is the formal derivativeof Λ(119909) By (10) we obtain the corrected data of QR codeimages
4 The Proposed Method
Wedesign aQR code recognition procedure for decodingQRcode accurately and rapidly First we propose a new local
binarization method to overcome images with uneven lightand nonuniform background problems And then we usethree finder patterns and an alignment pattern of QR codeefficiently to locate the QR code position After locating QRcode position we resample QR code image by perspectivetransformation Finally we get the corrected data by Reed-Solomon error correction algorithm Figure 1 illustrates theprocedure
41 Binarization Binarization is an important process foraccurately recognizing black-and-white module in QR codeimages Therefore we propose a new binarization method toimprove the recognition of images with nonuniform back-ground and uneven light Our method is a local thresholdalgorithm based on Sauvolarsquos method [8] We decomposeeach image into a series of blocks and then calculate athreshold 119879
1for each block using
1198791(119909 119910) = mean (119909 119910)
times [1 + (standard deviation (119909 119910)
119877)]
(11)
The default 119877 is 1250 For each block we convolve withthe kernel in (12) to calculate a threshold 119879
2 By using the
threshold 1198792 we split each block into bright area and dark
area Figures 2 and 3 shows that our method can achieve thesame performance with less computing cost compared withmodified Sauvolarsquos method [8]
119862 =1
10[
[
1 1 1
1 2 1
1 1 1
]
]
(12)
119891 (119860 119861 119862) = (119861 sdot 119909 minus 119860 sdot 119909) (119862 sdot 119910 minus 119860 sdot 119910)
minus (119861 sdot 119910 minus 119860 sdot 119910) (119862 sdot 119909 minus 119860 sdot 119909) (13)
42 Estimating Version QR code extraction is responsiblefor searching QR code area in images QR code extractionconsists of searching finder patterns estimating version and
4 Mathematical Problems in Engineering
Figure 2 An uneven light image [17]
Figure 3 Binary image using our method
searching alignment pattern We use the proportion of finderpatterns to locate the QR code position After searching threefinder patterns we use the distance between these patterns toestimate version Finally we develop a connected-componentmethod to search alignment pattern accurately
421 Searching Finder Patterns In searching finder patternswe need to determine the upper left lower left and upperright finder patterns in the QR code First we scan the binaryimage horizontally to find all points matching the ratios1 1 3 1 1 For each point matching the ratios we checkits vertical direction Finally we have collected all points inimages matching the ratios 1 1 3 1 1 both horizontally andvertically
After collecting points we merge points in the samefinder pattern If the number of finder patterns is morethan three we filter out some inappropriate points First wecalculate the angle between three points If the maximumangle is greater than a threshold 119879
1or the minimum angle is
less than a threshold 1198792 the points will be filtered And then
we identify the direction of finder patterns The maximumangle corresponding to the finder pattern is the upper left
Figure 4 Red line is the width of finder pattern and blue line is theestimated width
finder pattern Finally we use cross product in (13) todetermine the lower left and upper right finder patternswhere119860 is the upper left finder pattern 119861 and119862 are the otherfinder patterns and 119860 sdot 119909 and 119860 sdot 119910 represent the 119909 and 119910
coordinate of119860 If119891(119860 119861 119862) lt 0 then119861 is upper right finderpattern and 119862 is lower left finder pattern
422 Estimating Version After searching three finder pat-terns we can estimate version using module size and thedistance between two finder patterns Module size can becalculated by
Module size = Width of finder pattern7
(14)
We calculate version by
Version
=((Euclidean distance (119891
1 1198912) Module size) minus 10)
4
(15)
where 1198911is upper left finder pattern and 119891
2is upper right
finder pattern We can get rough version by (15) but (15)misjudges the version when QR code image is rotated Weoverestimate the width of finder pattern in rotated image inFigure 4
As a result we underestimate the version of QR codeimage Therefore we revise (15) to be
Version
=(Euclidean distance (119891
1 1198912) Module size lowast cos 120579 minus 10)
4
(16)
where 120579 is the angle between blue line and red line in Figure 4We estimate version more accurately by (16) and thus beforeperspective transformation
Mathematical Problems in Engineering 5
Table 1 Eight coordinates used for perspective transformation (119863 =
17 + 4lowastversion)
Function patternof QR code
Originalcoordinate
Normalizedcoordinate
Upper left finder pattern (1199090 1199100) (35 35)
Upper right finder pattern (1199091 1199101) (119863-35 35)
Lower left finder pattern (1199092 1199102) (35119863-35)
Lower right alignment pattern (1199093 1199103) (119863-65119863-65)
Table 2 Result of resampling
Original image Normalized image
43 Searching Alignment Pattern Low resolution image orinappropriate binarization method will result in the defor-mation of alignment pattern Therefore we propose a newsearching alignment method to overcome the problem Firstwe roughly locate the alignment pattern using three finderpatterns Moreover we extract subimage with a specifiedradius in Figure 5 We calculate the connected componentin the subimage both black pixels and white pixels Aftercalculating the connected component we get two images inFigures 6(b) and 6(c)
For each connected component of black pixel 119862119894in
Figure 6(b) we check its border pixels If all border pixels are
Table 3 Test images
Set 1
Set 2
Set 3
Set 4
Set 5
Set 6
adjacent to the same connected component of white pixel 1198621015840119895
in Figure 6(c) then we check all border pixels in 1198621015840119895 Once
all border pixels in 1198621015840119895are adjacent to the same black pixel
connected component 119862119896in Figure 6(b) these components
possibly contain alignment pattern Finally we calculate thecentroid of 119862
119894as the centroid of alignment pattern
6 Mathematical Problems in Engineering
Table 4 Comparison between our method and Zxing-21
Our method Zxing-21Set 1 2020 1720
Set 2 3234 3034
Set 3 3842 3842
Set 4 3648 3648
Set 5 1919 1919
Set 6 1515 1515
Total 160178 155178
Table 5 Images we successfully recognize and Zxing-21 fails
44 Perspective Transformation After estimating the ver-sion and locating the centroid of three finder patterns andalignment pattern we resample QR code image throughperspective transformation The eight coordinates can bepresented as shown in Table 1
To avoid the appearance of cracks and holes we useinverse warping in perspective transformation First wecalculate a transformation 119879 from normalized coordinate tooriginal coordinate For each pixel in normalize image wecalculate its corresponding location in original image usingthe transformation 119879 Finally we copy the pixel value oforiginal image to the normalized image Table 2 shows ourresampling results
Figure 5 We extract blue rectangle to find the alignment pattern(radius = 30 pixels)
5 Experiment Result
Experimental environment
(1) CPU Intel core i5-3210M CPU 250GHz(2) memory 4GB(3) OS Windows 7(4) programming language Java
In this section we conduct several experiments to evalu-ate the performance First we compare the accuracy betweenour QR code decoding algorithm and 2D barcode imageprocessing library (Zxing) [17] The experiment result showsthat our decoding algorithm has better accuracy than ZxingAnd then we use different sizes of images to evaluate thedecoding time The experiment results show our methoddecoding images in real time Moreover we implement a QRcode scanner on Android phoneWe test the decoding abilityof somedefaced imagesThe experiment result shows that ourQR code scanner successfully decodes these images
51 Image Source Our test images in Table 3 are fromGoogleopen-source 1D2D barcode image processing library Zxing-21 [17] The images are classified into six data sets a totalof 178 images The first data set contains low resolution QRcode images The second data set contains trademark QRcode image The skew QR code images are included in thethird data setThe fourth data set contains distorted QR codeimages Uneven light QR code images are included in the fifthdata setsThe sixth data set contains rotated QR code images
52 Accuracy Analysis We compare the accuracy betweenour decoding algorithm and Google open-source 1D2Dbarcode image processing library Zxing-21 [17] Table 4shows the results
In 178 test images there are 8 images in Table 5 that wesuccessfully recognize andZxing-21 failsMoreover there are3 images in Table 6 that Zxing-21 successfully recognizes andour method fails
The accuracy of our method is about 90 and that ofZxing-21 is only 87Ourmethod has better recognition rate
Mathematical Problems in Engineering 7
Table 6 Images Zxing-21 successfully recognizes and our method fails
(a) (b) (c)
Figure 6 (a) Extracted image in Figure 5 (b) found connected components of black pixels (c) found connected components of white pixels
Table 7 The execution time between our method and Zxing fordecoding different-size images
Our method Zxing320 lowast 240 214ms 139ms640 lowast 480 312ms 190ms800 lowast 600 375ms 237ms1024 lowast 768 448ms 264ms
in Sets 1 and 2 Zxing-21 cannot accurately locate the align-ment pattern because of the low resolution or inappropriatebinarization Our method improves the problem so that wehave better result
53 Efficiency Analysis In this section we show the exe-cution time between our method and Zxing for decodingdifferent sizes of QR code images We use four different sizesof QR code images to calculate the execution time Each sizecontains five images Table 7 shows the results
Our method needs more decoding time than Zxing butour method still can decode QR code images in real timeWeonly need 448 milliseconds for decoding resolution 1024 lowast
768 pixel images
54 Comparison of Different Barcode Applications We imple-ment a QR code scanner on Android phone Moreover wecollect four popular barcode scanners from Google Playand iOS market We compare the decoding ability of some
defaced images Table 8 shows the result Our application cansuccessfully decode all test images Our application has thebest result of these applications in these images The reasonfor our better results is that two steps of the binarizationstage in our method will get a more appropriate thresholdto split each block into bright area and dark area Moreovercomparedwith current applications our new searching align-ment method could handle a large deformation of alignmentpattern as the result of inappropriate binarization and lowresolution which can be observed in sample images
6 Conclusion
In this paper our carefully designed preprocessing methodsimprove the accuracy of the traditional decoding procedureAlthough refined steps improve accuracy at the expense ofincreased decoding time [21] the QR code still can meetthe real-time requirement The decoding steps consist ofimage binarization QR code extraction perspective trans-formation and error correction We efficiently resolve thenon-uniform background and uneven light problems byusing a modified local threshold algorithm In QR codeextraction we use the position detection patterns of QR codeefficiently and accurately to locate theQR code position Afterlocating the QR code position we restore a distorted imagethrough perspective transformation and resampling Finallywe get the corrected data by Reed-Solomon error correctionalgorithm
In the experiment we compare the accuracy betweenour method and Zxing The experiment result shows our
8 Mathematical Problems in Engineering
Table 8 Comparison of different barcode scanner applications
Our Zxing [17] Quickmark [18] Bakodo [19] BarCodeScan [20]
O O X X X
O X X X X
O X O O O
O X O O O
O O O O X
O O O O X
Mathematical Problems in Engineering 9
Table 8 Continued
Our Zxing [17] Quickmark [18] Bakodo [19] BarCodeScan [20]
O X O O O
O X O O O
O X X X X
O X X X X
Total 1010 310 610 610 410
method to have better accuracy than Zxing Moreover weuse different-size images to calculate the execution time Theexperiment shows that our method can efficiently decodeimages All images can be decoded in less than one second
References
[1] L F F Belussi and N S T Hirata ldquoFast component-basedQR code detection in arbitrarily acquired imagesrdquo Journal ofMathematical Imaging and Vision vol 45 no 3 pp 277ndash2922013
[2] L F F Belussi and N S T Hirata ldquoFast QR code detection inarbitrarily acquired imagesrdquo in Proceedings of the Conferenceon Graphics Patterns and Images (SIBGRAPI rsquo11) pp 281ndash288Maceio Brazil August 2011
[3] E Ohbuchi H Hanaizumi and L A Hock ldquoBarcode readersusing the camera device inmobile phonesrdquo in Proceedings of theInternational Conference onCyberworlds (CW rsquo04) pp 260ndash265Tokyo Japan November 2004
[4] Y Liu J Yang and M Liu ldquoRecognition of QR Code withmobile phonesrdquo in Proceedings of the Chinese Control andDecision Conference (CCDC rsquo08) pp 203ndash206 Yantai ChinaJuly 2008
[5] C C Lin and M S Chen A general scheme for QR-code imagedenoising on the camera phone [MS thesis] Department ofElectrical Engineering National Taiwan University 2009
[6] C-H Chu D-N Yang andM-S Chen ldquoImage stablization for2Dbarcode in handheld devicesrdquo inProceedings of the 15thACMInternational Conference onMultimedia (MM rsquo07) pp 697ndash706September 2007
[7] Y Kato D Deguchi T Takahashi I Ide and H Murase ldquoLowresolution QR-code recognition by applying super-resolutionusing the property of QR-codesrdquo in Proceedings of the 11thInternational Conference on Document Analysis and Recognition(ICDAR rsquo11) pp 992ndash996 September 2011
[8] J J Zhou Y F Liu and P Li ldquoResearch on binarization ofQR code imagerdquo in Proceedings of the International Conferenceon Multimedia Technology (ICMT rsquo10) pp 1ndash4 Ningbo ChinaOctober 2010
[9] Z Xiong H Cuiqun L Guodong and L Zhijun ldquoA binariza-tion method of quick response code imagerdquo in Proceedings ofthe 2nd International Conference on Signal Processing Systems(ICSPS rsquo10) vol 3 pp 317ndash320 Dalian China July 2010
[10] Y H Chang C H Chu and M S Chen A general scheme forextracting QR code from a non-uniform background in camera
10 Mathematical Problems in Engineering
phones and applications [MS thesis] Department of ElectricalEngineering National Taiwan University 2007
[11] C Y Lai and M S Chen Extracting QR Code from a non-uniform background image in embedded mobile phones [MSthesis] Department of Electrical Engineering National TaiwanUniversity 2007
[12] Y L Pan and M S Chen 2D barcodes from images with spatialdistortion [MS thesis] Department of Electrical EngineeringNational Taiwan University 2008
[13] D Munoz-Mejias I Gonzalez-Diaz and F Diaz-De-Maria ldquoAlow-complexity pre-processing system for restoring low-qualityQR code imagesrdquo IEEE Transactions on Consumer Electronicsvol 57 no 3 pp 1320ndash1328 2011
[14] P S Heckbert Fundamentals of texture mapping and imagewarping [MS thesis] Department of Electrical EngineeringUniversity of California Berkeley Calif USA 1989
[15] Wikipedia ldquoReed-Solomon Error Correctionrdquo 2013httpenwikipediaorgwikiReed-Solomon error correction
[16] T K Moon Error Correction Coding Mathematical Methodsand Algorithms Wiley New York NY USA 2005
[17] S Owen ldquoZxing (ldquoZebra Crossingrdquo)rdquo 2013 httpscodegooglecompzxing
[18] SimpleAct ldquoQuickMarkrdquo 2013 httpwwwquickmarkcomtw
[19] A Dougla ldquoBakodordquo 2013 httpbakodo[20] PGiudicelli ldquoBarcode-Scannerrdquo 2013 httpsitunesapplecom
twappbarcode-scannerid478602171mt=8[21] T Falas and H Kashani ldquoTwo-dimensional bar-code decoding
with camera-equippedmobile phonesrdquo in Proceedings of the 5thAnnual IEEE International Conference on Pervasive Computingand Communications Workshops (PerCom Workshops rsquo07) pp597ndash600 New York NY USA March 2007
Impact Factor 173028 Days Fast Track Peer ReviewAll Subject Areas of ScienceSubmit at httpwwwtswjcom
Hindawi Publishing Corporation httpwwwhindawicom Volume 2013Hindawi Publishing Corporation httpwwwhindawicom Volume 2013
The Scientific World Journal
Mathematical Problems in Engineering 3
Image BinarizationFinder
patterns
Alignment pattern
Estimate version
Perspectivetransformation
QR code extraction
Reed-Solomonerror correction
Decodedtext
Figure 1 QR code decoding procedure
where 2119905 is equal to the number of codewords available forerror correction and 120572 is the primitive element on the Galoisfield Syndrome polynomial is defined as
119878 (119909) =
2119905minus1
sum119894=0
119878119894119909119894 (7)
After computing syndrome polynomial we use Euclideanalgorithm to construct the error locator polynomial and errorevaluator polynomial Error locator polynomial can be usedto find the error positions Error evaluator polynomial is usedto find the error values The Euclidean algorithm is based onthe key equation in
Ω (119909) = 119878 (119909) Λ (119909) (mod1199092119905) (8)
Given only 119878(119909) and 119905 we want to obtain the error locatorpolynomial Λ(119909) and the error evaluator polynomial Ω(119909)Equation (8) means that
120579(119909)1199092119905+ 119878 (119909) Λ (119909) = Ω (119909) (9)
for some polynomial 120579(119909) Finally we can use Euclideanalgorithm to generate the error locator polynomial and errorevaluator polynomial
For solving the error values Forneyrsquos algorithm isselected The error values for a Reed-Solomon code arecomputed by
119890119894119896= minus
Ω(119883minus1119896)
Λ1015840 (119883minus1119896) (10)
where 119890119894119896is the corrected value at position 119894
119896 119883minus1119896
is theroot of Λ(119909) at position 119896 and Λ1015840(119909) is the formal derivativeof Λ(119909) By (10) we obtain the corrected data of QR codeimages
4 The Proposed Method
Wedesign aQR code recognition procedure for decodingQRcode accurately and rapidly First we propose a new local
binarization method to overcome images with uneven lightand nonuniform background problems And then we usethree finder patterns and an alignment pattern of QR codeefficiently to locate the QR code position After locating QRcode position we resample QR code image by perspectivetransformation Finally we get the corrected data by Reed-Solomon error correction algorithm Figure 1 illustrates theprocedure
41 Binarization Binarization is an important process foraccurately recognizing black-and-white module in QR codeimages Therefore we propose a new binarization method toimprove the recognition of images with nonuniform back-ground and uneven light Our method is a local thresholdalgorithm based on Sauvolarsquos method [8] We decomposeeach image into a series of blocks and then calculate athreshold 119879
1for each block using
1198791(119909 119910) = mean (119909 119910)
times [1 + (standard deviation (119909 119910)
119877)]
(11)
The default 119877 is 1250 For each block we convolve withthe kernel in (12) to calculate a threshold 119879
2 By using the
threshold 1198792 we split each block into bright area and dark
area Figures 2 and 3 shows that our method can achieve thesame performance with less computing cost compared withmodified Sauvolarsquos method [8]
119862 =1
10[
[
1 1 1
1 2 1
1 1 1
]
]
(12)
119891 (119860 119861 119862) = (119861 sdot 119909 minus 119860 sdot 119909) (119862 sdot 119910 minus 119860 sdot 119910)
minus (119861 sdot 119910 minus 119860 sdot 119910) (119862 sdot 119909 minus 119860 sdot 119909) (13)
42 Estimating Version QR code extraction is responsiblefor searching QR code area in images QR code extractionconsists of searching finder patterns estimating version and
4 Mathematical Problems in Engineering
Figure 2 An uneven light image [17]
Figure 3 Binary image using our method
searching alignment pattern We use the proportion of finderpatterns to locate the QR code position After searching threefinder patterns we use the distance between these patterns toestimate version Finally we develop a connected-componentmethod to search alignment pattern accurately
421 Searching Finder Patterns In searching finder patternswe need to determine the upper left lower left and upperright finder patterns in the QR code First we scan the binaryimage horizontally to find all points matching the ratios1 1 3 1 1 For each point matching the ratios we checkits vertical direction Finally we have collected all points inimages matching the ratios 1 1 3 1 1 both horizontally andvertically
After collecting points we merge points in the samefinder pattern If the number of finder patterns is morethan three we filter out some inappropriate points First wecalculate the angle between three points If the maximumangle is greater than a threshold 119879
1or the minimum angle is
less than a threshold 1198792 the points will be filtered And then
we identify the direction of finder patterns The maximumangle corresponding to the finder pattern is the upper left
Figure 4 Red line is the width of finder pattern and blue line is theestimated width
finder pattern Finally we use cross product in (13) todetermine the lower left and upper right finder patternswhere119860 is the upper left finder pattern 119861 and119862 are the otherfinder patterns and 119860 sdot 119909 and 119860 sdot 119910 represent the 119909 and 119910
coordinate of119860 If119891(119860 119861 119862) lt 0 then119861 is upper right finderpattern and 119862 is lower left finder pattern
422 Estimating Version After searching three finder pat-terns we can estimate version using module size and thedistance between two finder patterns Module size can becalculated by
Module size = Width of finder pattern7
(14)
We calculate version by
Version
=((Euclidean distance (119891
1 1198912) Module size) minus 10)
4
(15)
where 1198911is upper left finder pattern and 119891
2is upper right
finder pattern We can get rough version by (15) but (15)misjudges the version when QR code image is rotated Weoverestimate the width of finder pattern in rotated image inFigure 4
As a result we underestimate the version of QR codeimage Therefore we revise (15) to be
Version
=(Euclidean distance (119891
1 1198912) Module size lowast cos 120579 minus 10)
4
(16)
where 120579 is the angle between blue line and red line in Figure 4We estimate version more accurately by (16) and thus beforeperspective transformation
Mathematical Problems in Engineering 5
Table 1 Eight coordinates used for perspective transformation (119863 =
17 + 4lowastversion)
Function patternof QR code
Originalcoordinate
Normalizedcoordinate
Upper left finder pattern (1199090 1199100) (35 35)
Upper right finder pattern (1199091 1199101) (119863-35 35)
Lower left finder pattern (1199092 1199102) (35119863-35)
Lower right alignment pattern (1199093 1199103) (119863-65119863-65)
Table 2 Result of resampling
Original image Normalized image
43 Searching Alignment Pattern Low resolution image orinappropriate binarization method will result in the defor-mation of alignment pattern Therefore we propose a newsearching alignment method to overcome the problem Firstwe roughly locate the alignment pattern using three finderpatterns Moreover we extract subimage with a specifiedradius in Figure 5 We calculate the connected componentin the subimage both black pixels and white pixels Aftercalculating the connected component we get two images inFigures 6(b) and 6(c)
For each connected component of black pixel 119862119894in
Figure 6(b) we check its border pixels If all border pixels are
Table 3 Test images
Set 1
Set 2
Set 3
Set 4
Set 5
Set 6
adjacent to the same connected component of white pixel 1198621015840119895
in Figure 6(c) then we check all border pixels in 1198621015840119895 Once
all border pixels in 1198621015840119895are adjacent to the same black pixel
connected component 119862119896in Figure 6(b) these components
possibly contain alignment pattern Finally we calculate thecentroid of 119862
119894as the centroid of alignment pattern
6 Mathematical Problems in Engineering
Table 4 Comparison between our method and Zxing-21
Our method Zxing-21Set 1 2020 1720
Set 2 3234 3034
Set 3 3842 3842
Set 4 3648 3648
Set 5 1919 1919
Set 6 1515 1515
Total 160178 155178
Table 5 Images we successfully recognize and Zxing-21 fails
44 Perspective Transformation After estimating the ver-sion and locating the centroid of three finder patterns andalignment pattern we resample QR code image throughperspective transformation The eight coordinates can bepresented as shown in Table 1
To avoid the appearance of cracks and holes we useinverse warping in perspective transformation First wecalculate a transformation 119879 from normalized coordinate tooriginal coordinate For each pixel in normalize image wecalculate its corresponding location in original image usingthe transformation 119879 Finally we copy the pixel value oforiginal image to the normalized image Table 2 shows ourresampling results
Figure 5 We extract blue rectangle to find the alignment pattern(radius = 30 pixels)
5 Experiment Result
Experimental environment
(1) CPU Intel core i5-3210M CPU 250GHz(2) memory 4GB(3) OS Windows 7(4) programming language Java
In this section we conduct several experiments to evalu-ate the performance First we compare the accuracy betweenour QR code decoding algorithm and 2D barcode imageprocessing library (Zxing) [17] The experiment result showsthat our decoding algorithm has better accuracy than ZxingAnd then we use different sizes of images to evaluate thedecoding time The experiment results show our methoddecoding images in real time Moreover we implement a QRcode scanner on Android phoneWe test the decoding abilityof somedefaced imagesThe experiment result shows that ourQR code scanner successfully decodes these images
51 Image Source Our test images in Table 3 are fromGoogleopen-source 1D2D barcode image processing library Zxing-21 [17] The images are classified into six data sets a totalof 178 images The first data set contains low resolution QRcode images The second data set contains trademark QRcode image The skew QR code images are included in thethird data setThe fourth data set contains distorted QR codeimages Uneven light QR code images are included in the fifthdata setsThe sixth data set contains rotated QR code images
52 Accuracy Analysis We compare the accuracy betweenour decoding algorithm and Google open-source 1D2Dbarcode image processing library Zxing-21 [17] Table 4shows the results
In 178 test images there are 8 images in Table 5 that wesuccessfully recognize andZxing-21 failsMoreover there are3 images in Table 6 that Zxing-21 successfully recognizes andour method fails
The accuracy of our method is about 90 and that ofZxing-21 is only 87Ourmethod has better recognition rate
Mathematical Problems in Engineering 7
Table 6 Images Zxing-21 successfully recognizes and our method fails
(a) (b) (c)
Figure 6 (a) Extracted image in Figure 5 (b) found connected components of black pixels (c) found connected components of white pixels
Table 7 The execution time between our method and Zxing fordecoding different-size images
Our method Zxing320 lowast 240 214ms 139ms640 lowast 480 312ms 190ms800 lowast 600 375ms 237ms1024 lowast 768 448ms 264ms
in Sets 1 and 2 Zxing-21 cannot accurately locate the align-ment pattern because of the low resolution or inappropriatebinarization Our method improves the problem so that wehave better result
53 Efficiency Analysis In this section we show the exe-cution time between our method and Zxing for decodingdifferent sizes of QR code images We use four different sizesof QR code images to calculate the execution time Each sizecontains five images Table 7 shows the results
Our method needs more decoding time than Zxing butour method still can decode QR code images in real timeWeonly need 448 milliseconds for decoding resolution 1024 lowast
768 pixel images
54 Comparison of Different Barcode Applications We imple-ment a QR code scanner on Android phone Moreover wecollect four popular barcode scanners from Google Playand iOS market We compare the decoding ability of some
defaced images Table 8 shows the result Our application cansuccessfully decode all test images Our application has thebest result of these applications in these images The reasonfor our better results is that two steps of the binarizationstage in our method will get a more appropriate thresholdto split each block into bright area and dark area Moreovercomparedwith current applications our new searching align-ment method could handle a large deformation of alignmentpattern as the result of inappropriate binarization and lowresolution which can be observed in sample images
6 Conclusion
In this paper our carefully designed preprocessing methodsimprove the accuracy of the traditional decoding procedureAlthough refined steps improve accuracy at the expense ofincreased decoding time [21] the QR code still can meetthe real-time requirement The decoding steps consist ofimage binarization QR code extraction perspective trans-formation and error correction We efficiently resolve thenon-uniform background and uneven light problems byusing a modified local threshold algorithm In QR codeextraction we use the position detection patterns of QR codeefficiently and accurately to locate theQR code position Afterlocating the QR code position we restore a distorted imagethrough perspective transformation and resampling Finallywe get the corrected data by Reed-Solomon error correctionalgorithm
In the experiment we compare the accuracy betweenour method and Zxing The experiment result shows our
8 Mathematical Problems in Engineering
Table 8 Comparison of different barcode scanner applications
Our Zxing [17] Quickmark [18] Bakodo [19] BarCodeScan [20]
O O X X X
O X X X X
O X O O O
O X O O O
O O O O X
O O O O X
Mathematical Problems in Engineering 9
Table 8 Continued
Our Zxing [17] Quickmark [18] Bakodo [19] BarCodeScan [20]
O X O O O
O X O O O
O X X X X
O X X X X
Total 1010 310 610 610 410
method to have better accuracy than Zxing Moreover weuse different-size images to calculate the execution time Theexperiment shows that our method can efficiently decodeimages All images can be decoded in less than one second
References
[1] L F F Belussi and N S T Hirata ldquoFast component-basedQR code detection in arbitrarily acquired imagesrdquo Journal ofMathematical Imaging and Vision vol 45 no 3 pp 277ndash2922013
[2] L F F Belussi and N S T Hirata ldquoFast QR code detection inarbitrarily acquired imagesrdquo in Proceedings of the Conferenceon Graphics Patterns and Images (SIBGRAPI rsquo11) pp 281ndash288Maceio Brazil August 2011
[3] E Ohbuchi H Hanaizumi and L A Hock ldquoBarcode readersusing the camera device inmobile phonesrdquo in Proceedings of theInternational Conference onCyberworlds (CW rsquo04) pp 260ndash265Tokyo Japan November 2004
[4] Y Liu J Yang and M Liu ldquoRecognition of QR Code withmobile phonesrdquo in Proceedings of the Chinese Control andDecision Conference (CCDC rsquo08) pp 203ndash206 Yantai ChinaJuly 2008
[5] C C Lin and M S Chen A general scheme for QR-code imagedenoising on the camera phone [MS thesis] Department ofElectrical Engineering National Taiwan University 2009
[6] C-H Chu D-N Yang andM-S Chen ldquoImage stablization for2Dbarcode in handheld devicesrdquo inProceedings of the 15thACMInternational Conference onMultimedia (MM rsquo07) pp 697ndash706September 2007
[7] Y Kato D Deguchi T Takahashi I Ide and H Murase ldquoLowresolution QR-code recognition by applying super-resolutionusing the property of QR-codesrdquo in Proceedings of the 11thInternational Conference on Document Analysis and Recognition(ICDAR rsquo11) pp 992ndash996 September 2011
[8] J J Zhou Y F Liu and P Li ldquoResearch on binarization ofQR code imagerdquo in Proceedings of the International Conferenceon Multimedia Technology (ICMT rsquo10) pp 1ndash4 Ningbo ChinaOctober 2010
[9] Z Xiong H Cuiqun L Guodong and L Zhijun ldquoA binariza-tion method of quick response code imagerdquo in Proceedings ofthe 2nd International Conference on Signal Processing Systems(ICSPS rsquo10) vol 3 pp 317ndash320 Dalian China July 2010
[10] Y H Chang C H Chu and M S Chen A general scheme forextracting QR code from a non-uniform background in camera
10 Mathematical Problems in Engineering
phones and applications [MS thesis] Department of ElectricalEngineering National Taiwan University 2007
[11] C Y Lai and M S Chen Extracting QR Code from a non-uniform background image in embedded mobile phones [MSthesis] Department of Electrical Engineering National TaiwanUniversity 2007
[12] Y L Pan and M S Chen 2D barcodes from images with spatialdistortion [MS thesis] Department of Electrical EngineeringNational Taiwan University 2008
[13] D Munoz-Mejias I Gonzalez-Diaz and F Diaz-De-Maria ldquoAlow-complexity pre-processing system for restoring low-qualityQR code imagesrdquo IEEE Transactions on Consumer Electronicsvol 57 no 3 pp 1320ndash1328 2011
[14] P S Heckbert Fundamentals of texture mapping and imagewarping [MS thesis] Department of Electrical EngineeringUniversity of California Berkeley Calif USA 1989
[15] Wikipedia ldquoReed-Solomon Error Correctionrdquo 2013httpenwikipediaorgwikiReed-Solomon error correction
[16] T K Moon Error Correction Coding Mathematical Methodsand Algorithms Wiley New York NY USA 2005
[17] S Owen ldquoZxing (ldquoZebra Crossingrdquo)rdquo 2013 httpscodegooglecompzxing
[18] SimpleAct ldquoQuickMarkrdquo 2013 httpwwwquickmarkcomtw
[19] A Dougla ldquoBakodordquo 2013 httpbakodo[20] PGiudicelli ldquoBarcode-Scannerrdquo 2013 httpsitunesapplecom
twappbarcode-scannerid478602171mt=8[21] T Falas and H Kashani ldquoTwo-dimensional bar-code decoding
with camera-equippedmobile phonesrdquo in Proceedings of the 5thAnnual IEEE International Conference on Pervasive Computingand Communications Workshops (PerCom Workshops rsquo07) pp597ndash600 New York NY USA March 2007
Impact Factor 173028 Days Fast Track Peer ReviewAll Subject Areas of ScienceSubmit at httpwwwtswjcom
Hindawi Publishing Corporation httpwwwhindawicom Volume 2013Hindawi Publishing Corporation httpwwwhindawicom Volume 2013
The Scientific World Journal
4 Mathematical Problems in Engineering
Figure 2 An uneven light image [17]
Figure 3 Binary image using our method
searching alignment pattern We use the proportion of finderpatterns to locate the QR code position After searching threefinder patterns we use the distance between these patterns toestimate version Finally we develop a connected-componentmethod to search alignment pattern accurately
421 Searching Finder Patterns In searching finder patternswe need to determine the upper left lower left and upperright finder patterns in the QR code First we scan the binaryimage horizontally to find all points matching the ratios1 1 3 1 1 For each point matching the ratios we checkits vertical direction Finally we have collected all points inimages matching the ratios 1 1 3 1 1 both horizontally andvertically
After collecting points we merge points in the samefinder pattern If the number of finder patterns is morethan three we filter out some inappropriate points First wecalculate the angle between three points If the maximumangle is greater than a threshold 119879
1or the minimum angle is
less than a threshold 1198792 the points will be filtered And then
we identify the direction of finder patterns The maximumangle corresponding to the finder pattern is the upper left
Figure 4 Red line is the width of finder pattern and blue line is theestimated width
finder pattern Finally we use cross product in (13) todetermine the lower left and upper right finder patternswhere119860 is the upper left finder pattern 119861 and119862 are the otherfinder patterns and 119860 sdot 119909 and 119860 sdot 119910 represent the 119909 and 119910
coordinate of119860 If119891(119860 119861 119862) lt 0 then119861 is upper right finderpattern and 119862 is lower left finder pattern
422 Estimating Version After searching three finder pat-terns we can estimate version using module size and thedistance between two finder patterns Module size can becalculated by
Module size = Width of finder pattern7
(14)
We calculate version by
Version
=((Euclidean distance (119891
1 1198912) Module size) minus 10)
4
(15)
where 1198911is upper left finder pattern and 119891
2is upper right
finder pattern We can get rough version by (15) but (15)misjudges the version when QR code image is rotated Weoverestimate the width of finder pattern in rotated image inFigure 4
As a result we underestimate the version of QR codeimage Therefore we revise (15) to be
Version
=(Euclidean distance (119891
1 1198912) Module size lowast cos 120579 minus 10)
4
(16)
where 120579 is the angle between blue line and red line in Figure 4We estimate version more accurately by (16) and thus beforeperspective transformation
Mathematical Problems in Engineering 5
Table 1 Eight coordinates used for perspective transformation (119863 =
17 + 4lowastversion)
Function patternof QR code
Originalcoordinate
Normalizedcoordinate
Upper left finder pattern (1199090 1199100) (35 35)
Upper right finder pattern (1199091 1199101) (119863-35 35)
Lower left finder pattern (1199092 1199102) (35119863-35)
Lower right alignment pattern (1199093 1199103) (119863-65119863-65)
Table 2 Result of resampling
Original image Normalized image
43 Searching Alignment Pattern Low resolution image orinappropriate binarization method will result in the defor-mation of alignment pattern Therefore we propose a newsearching alignment method to overcome the problem Firstwe roughly locate the alignment pattern using three finderpatterns Moreover we extract subimage with a specifiedradius in Figure 5 We calculate the connected componentin the subimage both black pixels and white pixels Aftercalculating the connected component we get two images inFigures 6(b) and 6(c)
For each connected component of black pixel 119862119894in
Figure 6(b) we check its border pixels If all border pixels are
Table 3 Test images
Set 1
Set 2
Set 3
Set 4
Set 5
Set 6
adjacent to the same connected component of white pixel 1198621015840119895
in Figure 6(c) then we check all border pixels in 1198621015840119895 Once
all border pixels in 1198621015840119895are adjacent to the same black pixel
connected component 119862119896in Figure 6(b) these components
possibly contain alignment pattern Finally we calculate thecentroid of 119862
119894as the centroid of alignment pattern
6 Mathematical Problems in Engineering
Table 4 Comparison between our method and Zxing-21
Our method Zxing-21Set 1 2020 1720
Set 2 3234 3034
Set 3 3842 3842
Set 4 3648 3648
Set 5 1919 1919
Set 6 1515 1515
Total 160178 155178
Table 5 Images we successfully recognize and Zxing-21 fails
44 Perspective Transformation After estimating the ver-sion and locating the centroid of three finder patterns andalignment pattern we resample QR code image throughperspective transformation The eight coordinates can bepresented as shown in Table 1
To avoid the appearance of cracks and holes we useinverse warping in perspective transformation First wecalculate a transformation 119879 from normalized coordinate tooriginal coordinate For each pixel in normalize image wecalculate its corresponding location in original image usingthe transformation 119879 Finally we copy the pixel value oforiginal image to the normalized image Table 2 shows ourresampling results
Figure 5 We extract blue rectangle to find the alignment pattern(radius = 30 pixels)
5 Experiment Result
Experimental environment
(1) CPU Intel core i5-3210M CPU 250GHz(2) memory 4GB(3) OS Windows 7(4) programming language Java
In this section we conduct several experiments to evalu-ate the performance First we compare the accuracy betweenour QR code decoding algorithm and 2D barcode imageprocessing library (Zxing) [17] The experiment result showsthat our decoding algorithm has better accuracy than ZxingAnd then we use different sizes of images to evaluate thedecoding time The experiment results show our methoddecoding images in real time Moreover we implement a QRcode scanner on Android phoneWe test the decoding abilityof somedefaced imagesThe experiment result shows that ourQR code scanner successfully decodes these images
51 Image Source Our test images in Table 3 are fromGoogleopen-source 1D2D barcode image processing library Zxing-21 [17] The images are classified into six data sets a totalof 178 images The first data set contains low resolution QRcode images The second data set contains trademark QRcode image The skew QR code images are included in thethird data setThe fourth data set contains distorted QR codeimages Uneven light QR code images are included in the fifthdata setsThe sixth data set contains rotated QR code images
52 Accuracy Analysis We compare the accuracy betweenour decoding algorithm and Google open-source 1D2Dbarcode image processing library Zxing-21 [17] Table 4shows the results
In 178 test images there are 8 images in Table 5 that wesuccessfully recognize andZxing-21 failsMoreover there are3 images in Table 6 that Zxing-21 successfully recognizes andour method fails
The accuracy of our method is about 90 and that ofZxing-21 is only 87Ourmethod has better recognition rate
Mathematical Problems in Engineering 7
Table 6 Images Zxing-21 successfully recognizes and our method fails
(a) (b) (c)
Figure 6 (a) Extracted image in Figure 5 (b) found connected components of black pixels (c) found connected components of white pixels
Table 7 The execution time between our method and Zxing fordecoding different-size images
Our method Zxing320 lowast 240 214ms 139ms640 lowast 480 312ms 190ms800 lowast 600 375ms 237ms1024 lowast 768 448ms 264ms
in Sets 1 and 2 Zxing-21 cannot accurately locate the align-ment pattern because of the low resolution or inappropriatebinarization Our method improves the problem so that wehave better result
53 Efficiency Analysis In this section we show the exe-cution time between our method and Zxing for decodingdifferent sizes of QR code images We use four different sizesof QR code images to calculate the execution time Each sizecontains five images Table 7 shows the results
Our method needs more decoding time than Zxing butour method still can decode QR code images in real timeWeonly need 448 milliseconds for decoding resolution 1024 lowast
768 pixel images
54 Comparison of Different Barcode Applications We imple-ment a QR code scanner on Android phone Moreover wecollect four popular barcode scanners from Google Playand iOS market We compare the decoding ability of some
defaced images Table 8 shows the result Our application cansuccessfully decode all test images Our application has thebest result of these applications in these images The reasonfor our better results is that two steps of the binarizationstage in our method will get a more appropriate thresholdto split each block into bright area and dark area Moreovercomparedwith current applications our new searching align-ment method could handle a large deformation of alignmentpattern as the result of inappropriate binarization and lowresolution which can be observed in sample images
6 Conclusion
In this paper our carefully designed preprocessing methodsimprove the accuracy of the traditional decoding procedureAlthough refined steps improve accuracy at the expense ofincreased decoding time [21] the QR code still can meetthe real-time requirement The decoding steps consist ofimage binarization QR code extraction perspective trans-formation and error correction We efficiently resolve thenon-uniform background and uneven light problems byusing a modified local threshold algorithm In QR codeextraction we use the position detection patterns of QR codeefficiently and accurately to locate theQR code position Afterlocating the QR code position we restore a distorted imagethrough perspective transformation and resampling Finallywe get the corrected data by Reed-Solomon error correctionalgorithm
In the experiment we compare the accuracy betweenour method and Zxing The experiment result shows our
8 Mathematical Problems in Engineering
Table 8 Comparison of different barcode scanner applications
Our Zxing [17] Quickmark [18] Bakodo [19] BarCodeScan [20]
O O X X X
O X X X X
O X O O O
O X O O O
O O O O X
O O O O X
Mathematical Problems in Engineering 9
Table 8 Continued
Our Zxing [17] Quickmark [18] Bakodo [19] BarCodeScan [20]
O X O O O
O X O O O
O X X X X
O X X X X
Total 1010 310 610 610 410
method to have better accuracy than Zxing Moreover weuse different-size images to calculate the execution time Theexperiment shows that our method can efficiently decodeimages All images can be decoded in less than one second
References
[1] L F F Belussi and N S T Hirata ldquoFast component-basedQR code detection in arbitrarily acquired imagesrdquo Journal ofMathematical Imaging and Vision vol 45 no 3 pp 277ndash2922013
[2] L F F Belussi and N S T Hirata ldquoFast QR code detection inarbitrarily acquired imagesrdquo in Proceedings of the Conferenceon Graphics Patterns and Images (SIBGRAPI rsquo11) pp 281ndash288Maceio Brazil August 2011
[3] E Ohbuchi H Hanaizumi and L A Hock ldquoBarcode readersusing the camera device inmobile phonesrdquo in Proceedings of theInternational Conference onCyberworlds (CW rsquo04) pp 260ndash265Tokyo Japan November 2004
[4] Y Liu J Yang and M Liu ldquoRecognition of QR Code withmobile phonesrdquo in Proceedings of the Chinese Control andDecision Conference (CCDC rsquo08) pp 203ndash206 Yantai ChinaJuly 2008
[5] C C Lin and M S Chen A general scheme for QR-code imagedenoising on the camera phone [MS thesis] Department ofElectrical Engineering National Taiwan University 2009
[6] C-H Chu D-N Yang andM-S Chen ldquoImage stablization for2Dbarcode in handheld devicesrdquo inProceedings of the 15thACMInternational Conference onMultimedia (MM rsquo07) pp 697ndash706September 2007
[7] Y Kato D Deguchi T Takahashi I Ide and H Murase ldquoLowresolution QR-code recognition by applying super-resolutionusing the property of QR-codesrdquo in Proceedings of the 11thInternational Conference on Document Analysis and Recognition(ICDAR rsquo11) pp 992ndash996 September 2011
[8] J J Zhou Y F Liu and P Li ldquoResearch on binarization ofQR code imagerdquo in Proceedings of the International Conferenceon Multimedia Technology (ICMT rsquo10) pp 1ndash4 Ningbo ChinaOctober 2010
[9] Z Xiong H Cuiqun L Guodong and L Zhijun ldquoA binariza-tion method of quick response code imagerdquo in Proceedings ofthe 2nd International Conference on Signal Processing Systems(ICSPS rsquo10) vol 3 pp 317ndash320 Dalian China July 2010
[10] Y H Chang C H Chu and M S Chen A general scheme forextracting QR code from a non-uniform background in camera
10 Mathematical Problems in Engineering
phones and applications [MS thesis] Department of ElectricalEngineering National Taiwan University 2007
[11] C Y Lai and M S Chen Extracting QR Code from a non-uniform background image in embedded mobile phones [MSthesis] Department of Electrical Engineering National TaiwanUniversity 2007
[12] Y L Pan and M S Chen 2D barcodes from images with spatialdistortion [MS thesis] Department of Electrical EngineeringNational Taiwan University 2008
[13] D Munoz-Mejias I Gonzalez-Diaz and F Diaz-De-Maria ldquoAlow-complexity pre-processing system for restoring low-qualityQR code imagesrdquo IEEE Transactions on Consumer Electronicsvol 57 no 3 pp 1320ndash1328 2011
[14] P S Heckbert Fundamentals of texture mapping and imagewarping [MS thesis] Department of Electrical EngineeringUniversity of California Berkeley Calif USA 1989
[15] Wikipedia ldquoReed-Solomon Error Correctionrdquo 2013httpenwikipediaorgwikiReed-Solomon error correction
[16] T K Moon Error Correction Coding Mathematical Methodsand Algorithms Wiley New York NY USA 2005
[17] S Owen ldquoZxing (ldquoZebra Crossingrdquo)rdquo 2013 httpscodegooglecompzxing
[18] SimpleAct ldquoQuickMarkrdquo 2013 httpwwwquickmarkcomtw
[19] A Dougla ldquoBakodordquo 2013 httpbakodo[20] PGiudicelli ldquoBarcode-Scannerrdquo 2013 httpsitunesapplecom
twappbarcode-scannerid478602171mt=8[21] T Falas and H Kashani ldquoTwo-dimensional bar-code decoding
with camera-equippedmobile phonesrdquo in Proceedings of the 5thAnnual IEEE International Conference on Pervasive Computingand Communications Workshops (PerCom Workshops rsquo07) pp597ndash600 New York NY USA March 2007
Impact Factor 173028 Days Fast Track Peer ReviewAll Subject Areas of ScienceSubmit at httpwwwtswjcom
Hindawi Publishing Corporation httpwwwhindawicom Volume 2013Hindawi Publishing Corporation httpwwwhindawicom Volume 2013
The Scientific World Journal
Mathematical Problems in Engineering 5
Table 1 Eight coordinates used for perspective transformation (119863 =
17 + 4lowastversion)
Function patternof QR code
Originalcoordinate
Normalizedcoordinate
Upper left finder pattern (1199090 1199100) (35 35)
Upper right finder pattern (1199091 1199101) (119863-35 35)
Lower left finder pattern (1199092 1199102) (35119863-35)
Lower right alignment pattern (1199093 1199103) (119863-65119863-65)
Table 2 Result of resampling
Original image Normalized image
43 Searching Alignment Pattern Low resolution image orinappropriate binarization method will result in the defor-mation of alignment pattern Therefore we propose a newsearching alignment method to overcome the problem Firstwe roughly locate the alignment pattern using three finderpatterns Moreover we extract subimage with a specifiedradius in Figure 5 We calculate the connected componentin the subimage both black pixels and white pixels Aftercalculating the connected component we get two images inFigures 6(b) and 6(c)
For each connected component of black pixel 119862119894in
Figure 6(b) we check its border pixels If all border pixels are
Table 3 Test images
Set 1
Set 2
Set 3
Set 4
Set 5
Set 6
adjacent to the same connected component of white pixel 1198621015840119895
in Figure 6(c) then we check all border pixels in 1198621015840119895 Once
all border pixels in 1198621015840119895are adjacent to the same black pixel
connected component 119862119896in Figure 6(b) these components
possibly contain alignment pattern Finally we calculate thecentroid of 119862
119894as the centroid of alignment pattern
6 Mathematical Problems in Engineering
Table 4 Comparison between our method and Zxing-21
Our method Zxing-21Set 1 2020 1720
Set 2 3234 3034
Set 3 3842 3842
Set 4 3648 3648
Set 5 1919 1919
Set 6 1515 1515
Total 160178 155178
Table 5 Images we successfully recognize and Zxing-21 fails
44 Perspective Transformation After estimating the ver-sion and locating the centroid of three finder patterns andalignment pattern we resample QR code image throughperspective transformation The eight coordinates can bepresented as shown in Table 1
To avoid the appearance of cracks and holes we useinverse warping in perspective transformation First wecalculate a transformation 119879 from normalized coordinate tooriginal coordinate For each pixel in normalize image wecalculate its corresponding location in original image usingthe transformation 119879 Finally we copy the pixel value oforiginal image to the normalized image Table 2 shows ourresampling results
Figure 5 We extract blue rectangle to find the alignment pattern(radius = 30 pixels)
5 Experiment Result
Experimental environment
(1) CPU Intel core i5-3210M CPU 250GHz(2) memory 4GB(3) OS Windows 7(4) programming language Java
In this section we conduct several experiments to evalu-ate the performance First we compare the accuracy betweenour QR code decoding algorithm and 2D barcode imageprocessing library (Zxing) [17] The experiment result showsthat our decoding algorithm has better accuracy than ZxingAnd then we use different sizes of images to evaluate thedecoding time The experiment results show our methoddecoding images in real time Moreover we implement a QRcode scanner on Android phoneWe test the decoding abilityof somedefaced imagesThe experiment result shows that ourQR code scanner successfully decodes these images
51 Image Source Our test images in Table 3 are fromGoogleopen-source 1D2D barcode image processing library Zxing-21 [17] The images are classified into six data sets a totalof 178 images The first data set contains low resolution QRcode images The second data set contains trademark QRcode image The skew QR code images are included in thethird data setThe fourth data set contains distorted QR codeimages Uneven light QR code images are included in the fifthdata setsThe sixth data set contains rotated QR code images
52 Accuracy Analysis We compare the accuracy betweenour decoding algorithm and Google open-source 1D2Dbarcode image processing library Zxing-21 [17] Table 4shows the results
In 178 test images there are 8 images in Table 5 that wesuccessfully recognize andZxing-21 failsMoreover there are3 images in Table 6 that Zxing-21 successfully recognizes andour method fails
The accuracy of our method is about 90 and that ofZxing-21 is only 87Ourmethod has better recognition rate
Mathematical Problems in Engineering 7
Table 6 Images Zxing-21 successfully recognizes and our method fails
(a) (b) (c)
Figure 6 (a) Extracted image in Figure 5 (b) found connected components of black pixels (c) found connected components of white pixels
Table 7 The execution time between our method and Zxing fordecoding different-size images
Our method Zxing320 lowast 240 214ms 139ms640 lowast 480 312ms 190ms800 lowast 600 375ms 237ms1024 lowast 768 448ms 264ms
in Sets 1 and 2 Zxing-21 cannot accurately locate the align-ment pattern because of the low resolution or inappropriatebinarization Our method improves the problem so that wehave better result
53 Efficiency Analysis In this section we show the exe-cution time between our method and Zxing for decodingdifferent sizes of QR code images We use four different sizesof QR code images to calculate the execution time Each sizecontains five images Table 7 shows the results
Our method needs more decoding time than Zxing butour method still can decode QR code images in real timeWeonly need 448 milliseconds for decoding resolution 1024 lowast
768 pixel images
54 Comparison of Different Barcode Applications We imple-ment a QR code scanner on Android phone Moreover wecollect four popular barcode scanners from Google Playand iOS market We compare the decoding ability of some
defaced images Table 8 shows the result Our application cansuccessfully decode all test images Our application has thebest result of these applications in these images The reasonfor our better results is that two steps of the binarizationstage in our method will get a more appropriate thresholdto split each block into bright area and dark area Moreovercomparedwith current applications our new searching align-ment method could handle a large deformation of alignmentpattern as the result of inappropriate binarization and lowresolution which can be observed in sample images
6 Conclusion
In this paper our carefully designed preprocessing methodsimprove the accuracy of the traditional decoding procedureAlthough refined steps improve accuracy at the expense ofincreased decoding time [21] the QR code still can meetthe real-time requirement The decoding steps consist ofimage binarization QR code extraction perspective trans-formation and error correction We efficiently resolve thenon-uniform background and uneven light problems byusing a modified local threshold algorithm In QR codeextraction we use the position detection patterns of QR codeefficiently and accurately to locate theQR code position Afterlocating the QR code position we restore a distorted imagethrough perspective transformation and resampling Finallywe get the corrected data by Reed-Solomon error correctionalgorithm
In the experiment we compare the accuracy betweenour method and Zxing The experiment result shows our
8 Mathematical Problems in Engineering
Table 8 Comparison of different barcode scanner applications
Our Zxing [17] Quickmark [18] Bakodo [19] BarCodeScan [20]
O O X X X
O X X X X
O X O O O
O X O O O
O O O O X
O O O O X
Mathematical Problems in Engineering 9
Table 8 Continued
Our Zxing [17] Quickmark [18] Bakodo [19] BarCodeScan [20]
O X O O O
O X O O O
O X X X X
O X X X X
Total 1010 310 610 610 410
method to have better accuracy than Zxing Moreover weuse different-size images to calculate the execution time Theexperiment shows that our method can efficiently decodeimages All images can be decoded in less than one second
References
[1] L F F Belussi and N S T Hirata ldquoFast component-basedQR code detection in arbitrarily acquired imagesrdquo Journal ofMathematical Imaging and Vision vol 45 no 3 pp 277ndash2922013
[2] L F F Belussi and N S T Hirata ldquoFast QR code detection inarbitrarily acquired imagesrdquo in Proceedings of the Conferenceon Graphics Patterns and Images (SIBGRAPI rsquo11) pp 281ndash288Maceio Brazil August 2011
[3] E Ohbuchi H Hanaizumi and L A Hock ldquoBarcode readersusing the camera device inmobile phonesrdquo in Proceedings of theInternational Conference onCyberworlds (CW rsquo04) pp 260ndash265Tokyo Japan November 2004
[4] Y Liu J Yang and M Liu ldquoRecognition of QR Code withmobile phonesrdquo in Proceedings of the Chinese Control andDecision Conference (CCDC rsquo08) pp 203ndash206 Yantai ChinaJuly 2008
[5] C C Lin and M S Chen A general scheme for QR-code imagedenoising on the camera phone [MS thesis] Department ofElectrical Engineering National Taiwan University 2009
[6] C-H Chu D-N Yang andM-S Chen ldquoImage stablization for2Dbarcode in handheld devicesrdquo inProceedings of the 15thACMInternational Conference onMultimedia (MM rsquo07) pp 697ndash706September 2007
[7] Y Kato D Deguchi T Takahashi I Ide and H Murase ldquoLowresolution QR-code recognition by applying super-resolutionusing the property of QR-codesrdquo in Proceedings of the 11thInternational Conference on Document Analysis and Recognition(ICDAR rsquo11) pp 992ndash996 September 2011
[8] J J Zhou Y F Liu and P Li ldquoResearch on binarization ofQR code imagerdquo in Proceedings of the International Conferenceon Multimedia Technology (ICMT rsquo10) pp 1ndash4 Ningbo ChinaOctober 2010
[9] Z Xiong H Cuiqun L Guodong and L Zhijun ldquoA binariza-tion method of quick response code imagerdquo in Proceedings ofthe 2nd International Conference on Signal Processing Systems(ICSPS rsquo10) vol 3 pp 317ndash320 Dalian China July 2010
[10] Y H Chang C H Chu and M S Chen A general scheme forextracting QR code from a non-uniform background in camera
10 Mathematical Problems in Engineering
phones and applications [MS thesis] Department of ElectricalEngineering National Taiwan University 2007
[11] C Y Lai and M S Chen Extracting QR Code from a non-uniform background image in embedded mobile phones [MSthesis] Department of Electrical Engineering National TaiwanUniversity 2007
[12] Y L Pan and M S Chen 2D barcodes from images with spatialdistortion [MS thesis] Department of Electrical EngineeringNational Taiwan University 2008
[13] D Munoz-Mejias I Gonzalez-Diaz and F Diaz-De-Maria ldquoAlow-complexity pre-processing system for restoring low-qualityQR code imagesrdquo IEEE Transactions on Consumer Electronicsvol 57 no 3 pp 1320ndash1328 2011
[14] P S Heckbert Fundamentals of texture mapping and imagewarping [MS thesis] Department of Electrical EngineeringUniversity of California Berkeley Calif USA 1989
[15] Wikipedia ldquoReed-Solomon Error Correctionrdquo 2013httpenwikipediaorgwikiReed-Solomon error correction
[16] T K Moon Error Correction Coding Mathematical Methodsand Algorithms Wiley New York NY USA 2005
[17] S Owen ldquoZxing (ldquoZebra Crossingrdquo)rdquo 2013 httpscodegooglecompzxing
[18] SimpleAct ldquoQuickMarkrdquo 2013 httpwwwquickmarkcomtw
[19] A Dougla ldquoBakodordquo 2013 httpbakodo[20] PGiudicelli ldquoBarcode-Scannerrdquo 2013 httpsitunesapplecom
twappbarcode-scannerid478602171mt=8[21] T Falas and H Kashani ldquoTwo-dimensional bar-code decoding
with camera-equippedmobile phonesrdquo in Proceedings of the 5thAnnual IEEE International Conference on Pervasive Computingand Communications Workshops (PerCom Workshops rsquo07) pp597ndash600 New York NY USA March 2007
Impact Factor 173028 Days Fast Track Peer ReviewAll Subject Areas of ScienceSubmit at httpwwwtswjcom
Hindawi Publishing Corporation httpwwwhindawicom Volume 2013Hindawi Publishing Corporation httpwwwhindawicom Volume 2013
The Scientific World Journal
6 Mathematical Problems in Engineering
Table 4 Comparison between our method and Zxing-21
Our method Zxing-21Set 1 2020 1720
Set 2 3234 3034
Set 3 3842 3842
Set 4 3648 3648
Set 5 1919 1919
Set 6 1515 1515
Total 160178 155178
Table 5 Images we successfully recognize and Zxing-21 fails
44 Perspective Transformation After estimating the ver-sion and locating the centroid of three finder patterns andalignment pattern we resample QR code image throughperspective transformation The eight coordinates can bepresented as shown in Table 1
To avoid the appearance of cracks and holes we useinverse warping in perspective transformation First wecalculate a transformation 119879 from normalized coordinate tooriginal coordinate For each pixel in normalize image wecalculate its corresponding location in original image usingthe transformation 119879 Finally we copy the pixel value oforiginal image to the normalized image Table 2 shows ourresampling results
Figure 5 We extract blue rectangle to find the alignment pattern(radius = 30 pixels)
5 Experiment Result
Experimental environment
(1) CPU Intel core i5-3210M CPU 250GHz(2) memory 4GB(3) OS Windows 7(4) programming language Java
In this section we conduct several experiments to evalu-ate the performance First we compare the accuracy betweenour QR code decoding algorithm and 2D barcode imageprocessing library (Zxing) [17] The experiment result showsthat our decoding algorithm has better accuracy than ZxingAnd then we use different sizes of images to evaluate thedecoding time The experiment results show our methoddecoding images in real time Moreover we implement a QRcode scanner on Android phoneWe test the decoding abilityof somedefaced imagesThe experiment result shows that ourQR code scanner successfully decodes these images
51 Image Source Our test images in Table 3 are fromGoogleopen-source 1D2D barcode image processing library Zxing-21 [17] The images are classified into six data sets a totalof 178 images The first data set contains low resolution QRcode images The second data set contains trademark QRcode image The skew QR code images are included in thethird data setThe fourth data set contains distorted QR codeimages Uneven light QR code images are included in the fifthdata setsThe sixth data set contains rotated QR code images
52 Accuracy Analysis We compare the accuracy betweenour decoding algorithm and Google open-source 1D2Dbarcode image processing library Zxing-21 [17] Table 4shows the results
In 178 test images there are 8 images in Table 5 that wesuccessfully recognize andZxing-21 failsMoreover there are3 images in Table 6 that Zxing-21 successfully recognizes andour method fails
The accuracy of our method is about 90 and that ofZxing-21 is only 87Ourmethod has better recognition rate
Mathematical Problems in Engineering 7
Table 6 Images Zxing-21 successfully recognizes and our method fails
(a) (b) (c)
Figure 6 (a) Extracted image in Figure 5 (b) found connected components of black pixels (c) found connected components of white pixels
Table 7 The execution time between our method and Zxing fordecoding different-size images
Our method Zxing320 lowast 240 214ms 139ms640 lowast 480 312ms 190ms800 lowast 600 375ms 237ms1024 lowast 768 448ms 264ms
in Sets 1 and 2 Zxing-21 cannot accurately locate the align-ment pattern because of the low resolution or inappropriatebinarization Our method improves the problem so that wehave better result
53 Efficiency Analysis In this section we show the exe-cution time between our method and Zxing for decodingdifferent sizes of QR code images We use four different sizesof QR code images to calculate the execution time Each sizecontains five images Table 7 shows the results
Our method needs more decoding time than Zxing butour method still can decode QR code images in real timeWeonly need 448 milliseconds for decoding resolution 1024 lowast
768 pixel images
54 Comparison of Different Barcode Applications We imple-ment a QR code scanner on Android phone Moreover wecollect four popular barcode scanners from Google Playand iOS market We compare the decoding ability of some
defaced images Table 8 shows the result Our application cansuccessfully decode all test images Our application has thebest result of these applications in these images The reasonfor our better results is that two steps of the binarizationstage in our method will get a more appropriate thresholdto split each block into bright area and dark area Moreovercomparedwith current applications our new searching align-ment method could handle a large deformation of alignmentpattern as the result of inappropriate binarization and lowresolution which can be observed in sample images
6 Conclusion
In this paper our carefully designed preprocessing methodsimprove the accuracy of the traditional decoding procedureAlthough refined steps improve accuracy at the expense ofincreased decoding time [21] the QR code still can meetthe real-time requirement The decoding steps consist ofimage binarization QR code extraction perspective trans-formation and error correction We efficiently resolve thenon-uniform background and uneven light problems byusing a modified local threshold algorithm In QR codeextraction we use the position detection patterns of QR codeefficiently and accurately to locate theQR code position Afterlocating the QR code position we restore a distorted imagethrough perspective transformation and resampling Finallywe get the corrected data by Reed-Solomon error correctionalgorithm
In the experiment we compare the accuracy betweenour method and Zxing The experiment result shows our
8 Mathematical Problems in Engineering
Table 8 Comparison of different barcode scanner applications
Our Zxing [17] Quickmark [18] Bakodo [19] BarCodeScan [20]
O O X X X
O X X X X
O X O O O
O X O O O
O O O O X
O O O O X
Mathematical Problems in Engineering 9
Table 8 Continued
Our Zxing [17] Quickmark [18] Bakodo [19] BarCodeScan [20]
O X O O O
O X O O O
O X X X X
O X X X X
Total 1010 310 610 610 410
method to have better accuracy than Zxing Moreover weuse different-size images to calculate the execution time Theexperiment shows that our method can efficiently decodeimages All images can be decoded in less than one second
References
[1] L F F Belussi and N S T Hirata ldquoFast component-basedQR code detection in arbitrarily acquired imagesrdquo Journal ofMathematical Imaging and Vision vol 45 no 3 pp 277ndash2922013
[2] L F F Belussi and N S T Hirata ldquoFast QR code detection inarbitrarily acquired imagesrdquo in Proceedings of the Conferenceon Graphics Patterns and Images (SIBGRAPI rsquo11) pp 281ndash288Maceio Brazil August 2011
[3] E Ohbuchi H Hanaizumi and L A Hock ldquoBarcode readersusing the camera device inmobile phonesrdquo in Proceedings of theInternational Conference onCyberworlds (CW rsquo04) pp 260ndash265Tokyo Japan November 2004
[4] Y Liu J Yang and M Liu ldquoRecognition of QR Code withmobile phonesrdquo in Proceedings of the Chinese Control andDecision Conference (CCDC rsquo08) pp 203ndash206 Yantai ChinaJuly 2008
[5] C C Lin and M S Chen A general scheme for QR-code imagedenoising on the camera phone [MS thesis] Department ofElectrical Engineering National Taiwan University 2009
[6] C-H Chu D-N Yang andM-S Chen ldquoImage stablization for2Dbarcode in handheld devicesrdquo inProceedings of the 15thACMInternational Conference onMultimedia (MM rsquo07) pp 697ndash706September 2007
[7] Y Kato D Deguchi T Takahashi I Ide and H Murase ldquoLowresolution QR-code recognition by applying super-resolutionusing the property of QR-codesrdquo in Proceedings of the 11thInternational Conference on Document Analysis and Recognition(ICDAR rsquo11) pp 992ndash996 September 2011
[8] J J Zhou Y F Liu and P Li ldquoResearch on binarization ofQR code imagerdquo in Proceedings of the International Conferenceon Multimedia Technology (ICMT rsquo10) pp 1ndash4 Ningbo ChinaOctober 2010
[9] Z Xiong H Cuiqun L Guodong and L Zhijun ldquoA binariza-tion method of quick response code imagerdquo in Proceedings ofthe 2nd International Conference on Signal Processing Systems(ICSPS rsquo10) vol 3 pp 317ndash320 Dalian China July 2010
[10] Y H Chang C H Chu and M S Chen A general scheme forextracting QR code from a non-uniform background in camera
10 Mathematical Problems in Engineering
phones and applications [MS thesis] Department of ElectricalEngineering National Taiwan University 2007
[11] C Y Lai and M S Chen Extracting QR Code from a non-uniform background image in embedded mobile phones [MSthesis] Department of Electrical Engineering National TaiwanUniversity 2007
[12] Y L Pan and M S Chen 2D barcodes from images with spatialdistortion [MS thesis] Department of Electrical EngineeringNational Taiwan University 2008
[13] D Munoz-Mejias I Gonzalez-Diaz and F Diaz-De-Maria ldquoAlow-complexity pre-processing system for restoring low-qualityQR code imagesrdquo IEEE Transactions on Consumer Electronicsvol 57 no 3 pp 1320ndash1328 2011
[14] P S Heckbert Fundamentals of texture mapping and imagewarping [MS thesis] Department of Electrical EngineeringUniversity of California Berkeley Calif USA 1989
[15] Wikipedia ldquoReed-Solomon Error Correctionrdquo 2013httpenwikipediaorgwikiReed-Solomon error correction
[16] T K Moon Error Correction Coding Mathematical Methodsand Algorithms Wiley New York NY USA 2005
[17] S Owen ldquoZxing (ldquoZebra Crossingrdquo)rdquo 2013 httpscodegooglecompzxing
[18] SimpleAct ldquoQuickMarkrdquo 2013 httpwwwquickmarkcomtw
[19] A Dougla ldquoBakodordquo 2013 httpbakodo[20] PGiudicelli ldquoBarcode-Scannerrdquo 2013 httpsitunesapplecom
twappbarcode-scannerid478602171mt=8[21] T Falas and H Kashani ldquoTwo-dimensional bar-code decoding
with camera-equippedmobile phonesrdquo in Proceedings of the 5thAnnual IEEE International Conference on Pervasive Computingand Communications Workshops (PerCom Workshops rsquo07) pp597ndash600 New York NY USA March 2007
Impact Factor 173028 Days Fast Track Peer ReviewAll Subject Areas of ScienceSubmit at httpwwwtswjcom
Hindawi Publishing Corporation httpwwwhindawicom Volume 2013Hindawi Publishing Corporation httpwwwhindawicom Volume 2013
The Scientific World Journal
Mathematical Problems in Engineering 7
Table 6 Images Zxing-21 successfully recognizes and our method fails
(a) (b) (c)
Figure 6 (a) Extracted image in Figure 5 (b) found connected components of black pixels (c) found connected components of white pixels
Table 7 The execution time between our method and Zxing fordecoding different-size images
Our method Zxing320 lowast 240 214ms 139ms640 lowast 480 312ms 190ms800 lowast 600 375ms 237ms1024 lowast 768 448ms 264ms
in Sets 1 and 2 Zxing-21 cannot accurately locate the align-ment pattern because of the low resolution or inappropriatebinarization Our method improves the problem so that wehave better result
53 Efficiency Analysis In this section we show the exe-cution time between our method and Zxing for decodingdifferent sizes of QR code images We use four different sizesof QR code images to calculate the execution time Each sizecontains five images Table 7 shows the results
Our method needs more decoding time than Zxing butour method still can decode QR code images in real timeWeonly need 448 milliseconds for decoding resolution 1024 lowast
768 pixel images
54 Comparison of Different Barcode Applications We imple-ment a QR code scanner on Android phone Moreover wecollect four popular barcode scanners from Google Playand iOS market We compare the decoding ability of some
defaced images Table 8 shows the result Our application cansuccessfully decode all test images Our application has thebest result of these applications in these images The reasonfor our better results is that two steps of the binarizationstage in our method will get a more appropriate thresholdto split each block into bright area and dark area Moreovercomparedwith current applications our new searching align-ment method could handle a large deformation of alignmentpattern as the result of inappropriate binarization and lowresolution which can be observed in sample images
6 Conclusion
In this paper our carefully designed preprocessing methodsimprove the accuracy of the traditional decoding procedureAlthough refined steps improve accuracy at the expense ofincreased decoding time [21] the QR code still can meetthe real-time requirement The decoding steps consist ofimage binarization QR code extraction perspective trans-formation and error correction We efficiently resolve thenon-uniform background and uneven light problems byusing a modified local threshold algorithm In QR codeextraction we use the position detection patterns of QR codeefficiently and accurately to locate theQR code position Afterlocating the QR code position we restore a distorted imagethrough perspective transformation and resampling Finallywe get the corrected data by Reed-Solomon error correctionalgorithm
In the experiment we compare the accuracy betweenour method and Zxing The experiment result shows our
8 Mathematical Problems in Engineering
Table 8 Comparison of different barcode scanner applications
Our Zxing [17] Quickmark [18] Bakodo [19] BarCodeScan [20]
O O X X X
O X X X X
O X O O O
O X O O O
O O O O X
O O O O X
Mathematical Problems in Engineering 9
Table 8 Continued
Our Zxing [17] Quickmark [18] Bakodo [19] BarCodeScan [20]
O X O O O
O X O O O
O X X X X
O X X X X
Total 1010 310 610 610 410
method to have better accuracy than Zxing Moreover weuse different-size images to calculate the execution time Theexperiment shows that our method can efficiently decodeimages All images can be decoded in less than one second
References
[1] L F F Belussi and N S T Hirata ldquoFast component-basedQR code detection in arbitrarily acquired imagesrdquo Journal ofMathematical Imaging and Vision vol 45 no 3 pp 277ndash2922013
[2] L F F Belussi and N S T Hirata ldquoFast QR code detection inarbitrarily acquired imagesrdquo in Proceedings of the Conferenceon Graphics Patterns and Images (SIBGRAPI rsquo11) pp 281ndash288Maceio Brazil August 2011
[3] E Ohbuchi H Hanaizumi and L A Hock ldquoBarcode readersusing the camera device inmobile phonesrdquo in Proceedings of theInternational Conference onCyberworlds (CW rsquo04) pp 260ndash265Tokyo Japan November 2004
[4] Y Liu J Yang and M Liu ldquoRecognition of QR Code withmobile phonesrdquo in Proceedings of the Chinese Control andDecision Conference (CCDC rsquo08) pp 203ndash206 Yantai ChinaJuly 2008
[5] C C Lin and M S Chen A general scheme for QR-code imagedenoising on the camera phone [MS thesis] Department ofElectrical Engineering National Taiwan University 2009
[6] C-H Chu D-N Yang andM-S Chen ldquoImage stablization for2Dbarcode in handheld devicesrdquo inProceedings of the 15thACMInternational Conference onMultimedia (MM rsquo07) pp 697ndash706September 2007
[7] Y Kato D Deguchi T Takahashi I Ide and H Murase ldquoLowresolution QR-code recognition by applying super-resolutionusing the property of QR-codesrdquo in Proceedings of the 11thInternational Conference on Document Analysis and Recognition(ICDAR rsquo11) pp 992ndash996 September 2011
[8] J J Zhou Y F Liu and P Li ldquoResearch on binarization ofQR code imagerdquo in Proceedings of the International Conferenceon Multimedia Technology (ICMT rsquo10) pp 1ndash4 Ningbo ChinaOctober 2010
[9] Z Xiong H Cuiqun L Guodong and L Zhijun ldquoA binariza-tion method of quick response code imagerdquo in Proceedings ofthe 2nd International Conference on Signal Processing Systems(ICSPS rsquo10) vol 3 pp 317ndash320 Dalian China July 2010
[10] Y H Chang C H Chu and M S Chen A general scheme forextracting QR code from a non-uniform background in camera
10 Mathematical Problems in Engineering
phones and applications [MS thesis] Department of ElectricalEngineering National Taiwan University 2007
[11] C Y Lai and M S Chen Extracting QR Code from a non-uniform background image in embedded mobile phones [MSthesis] Department of Electrical Engineering National TaiwanUniversity 2007
[12] Y L Pan and M S Chen 2D barcodes from images with spatialdistortion [MS thesis] Department of Electrical EngineeringNational Taiwan University 2008
[13] D Munoz-Mejias I Gonzalez-Diaz and F Diaz-De-Maria ldquoAlow-complexity pre-processing system for restoring low-qualityQR code imagesrdquo IEEE Transactions on Consumer Electronicsvol 57 no 3 pp 1320ndash1328 2011
[14] P S Heckbert Fundamentals of texture mapping and imagewarping [MS thesis] Department of Electrical EngineeringUniversity of California Berkeley Calif USA 1989
[15] Wikipedia ldquoReed-Solomon Error Correctionrdquo 2013httpenwikipediaorgwikiReed-Solomon error correction
[16] T K Moon Error Correction Coding Mathematical Methodsand Algorithms Wiley New York NY USA 2005
[17] S Owen ldquoZxing (ldquoZebra Crossingrdquo)rdquo 2013 httpscodegooglecompzxing
[18] SimpleAct ldquoQuickMarkrdquo 2013 httpwwwquickmarkcomtw
[19] A Dougla ldquoBakodordquo 2013 httpbakodo[20] PGiudicelli ldquoBarcode-Scannerrdquo 2013 httpsitunesapplecom
twappbarcode-scannerid478602171mt=8[21] T Falas and H Kashani ldquoTwo-dimensional bar-code decoding
with camera-equippedmobile phonesrdquo in Proceedings of the 5thAnnual IEEE International Conference on Pervasive Computingand Communications Workshops (PerCom Workshops rsquo07) pp597ndash600 New York NY USA March 2007
Impact Factor 173028 Days Fast Track Peer ReviewAll Subject Areas of ScienceSubmit at httpwwwtswjcom
Hindawi Publishing Corporation httpwwwhindawicom Volume 2013Hindawi Publishing Corporation httpwwwhindawicom Volume 2013
The Scientific World Journal
8 Mathematical Problems in Engineering
Table 8 Comparison of different barcode scanner applications
Our Zxing [17] Quickmark [18] Bakodo [19] BarCodeScan [20]
O O X X X
O X X X X
O X O O O
O X O O O
O O O O X
O O O O X
Mathematical Problems in Engineering 9
Table 8 Continued
Our Zxing [17] Quickmark [18] Bakodo [19] BarCodeScan [20]
O X O O O
O X O O O
O X X X X
O X X X X
Total 1010 310 610 610 410
method to have better accuracy than Zxing Moreover weuse different-size images to calculate the execution time Theexperiment shows that our method can efficiently decodeimages All images can be decoded in less than one second
References
[1] L F F Belussi and N S T Hirata ldquoFast component-basedQR code detection in arbitrarily acquired imagesrdquo Journal ofMathematical Imaging and Vision vol 45 no 3 pp 277ndash2922013
[2] L F F Belussi and N S T Hirata ldquoFast QR code detection inarbitrarily acquired imagesrdquo in Proceedings of the Conferenceon Graphics Patterns and Images (SIBGRAPI rsquo11) pp 281ndash288Maceio Brazil August 2011
[3] E Ohbuchi H Hanaizumi and L A Hock ldquoBarcode readersusing the camera device inmobile phonesrdquo in Proceedings of theInternational Conference onCyberworlds (CW rsquo04) pp 260ndash265Tokyo Japan November 2004
[4] Y Liu J Yang and M Liu ldquoRecognition of QR Code withmobile phonesrdquo in Proceedings of the Chinese Control andDecision Conference (CCDC rsquo08) pp 203ndash206 Yantai ChinaJuly 2008
[5] C C Lin and M S Chen A general scheme for QR-code imagedenoising on the camera phone [MS thesis] Department ofElectrical Engineering National Taiwan University 2009
[6] C-H Chu D-N Yang andM-S Chen ldquoImage stablization for2Dbarcode in handheld devicesrdquo inProceedings of the 15thACMInternational Conference onMultimedia (MM rsquo07) pp 697ndash706September 2007
[7] Y Kato D Deguchi T Takahashi I Ide and H Murase ldquoLowresolution QR-code recognition by applying super-resolutionusing the property of QR-codesrdquo in Proceedings of the 11thInternational Conference on Document Analysis and Recognition(ICDAR rsquo11) pp 992ndash996 September 2011
[8] J J Zhou Y F Liu and P Li ldquoResearch on binarization ofQR code imagerdquo in Proceedings of the International Conferenceon Multimedia Technology (ICMT rsquo10) pp 1ndash4 Ningbo ChinaOctober 2010
[9] Z Xiong H Cuiqun L Guodong and L Zhijun ldquoA binariza-tion method of quick response code imagerdquo in Proceedings ofthe 2nd International Conference on Signal Processing Systems(ICSPS rsquo10) vol 3 pp 317ndash320 Dalian China July 2010
[10] Y H Chang C H Chu and M S Chen A general scheme forextracting QR code from a non-uniform background in camera
10 Mathematical Problems in Engineering
phones and applications [MS thesis] Department of ElectricalEngineering National Taiwan University 2007
[11] C Y Lai and M S Chen Extracting QR Code from a non-uniform background image in embedded mobile phones [MSthesis] Department of Electrical Engineering National TaiwanUniversity 2007
[12] Y L Pan and M S Chen 2D barcodes from images with spatialdistortion [MS thesis] Department of Electrical EngineeringNational Taiwan University 2008
[13] D Munoz-Mejias I Gonzalez-Diaz and F Diaz-De-Maria ldquoAlow-complexity pre-processing system for restoring low-qualityQR code imagesrdquo IEEE Transactions on Consumer Electronicsvol 57 no 3 pp 1320ndash1328 2011
[14] P S Heckbert Fundamentals of texture mapping and imagewarping [MS thesis] Department of Electrical EngineeringUniversity of California Berkeley Calif USA 1989
[15] Wikipedia ldquoReed-Solomon Error Correctionrdquo 2013httpenwikipediaorgwikiReed-Solomon error correction
[16] T K Moon Error Correction Coding Mathematical Methodsand Algorithms Wiley New York NY USA 2005
[17] S Owen ldquoZxing (ldquoZebra Crossingrdquo)rdquo 2013 httpscodegooglecompzxing
[18] SimpleAct ldquoQuickMarkrdquo 2013 httpwwwquickmarkcomtw
[19] A Dougla ldquoBakodordquo 2013 httpbakodo[20] PGiudicelli ldquoBarcode-Scannerrdquo 2013 httpsitunesapplecom
twappbarcode-scannerid478602171mt=8[21] T Falas and H Kashani ldquoTwo-dimensional bar-code decoding
with camera-equippedmobile phonesrdquo in Proceedings of the 5thAnnual IEEE International Conference on Pervasive Computingand Communications Workshops (PerCom Workshops rsquo07) pp597ndash600 New York NY USA March 2007
Impact Factor 173028 Days Fast Track Peer ReviewAll Subject Areas of ScienceSubmit at httpwwwtswjcom
Hindawi Publishing Corporation httpwwwhindawicom Volume 2013Hindawi Publishing Corporation httpwwwhindawicom Volume 2013
The Scientific World Journal
Mathematical Problems in Engineering 9
Table 8 Continued
Our Zxing [17] Quickmark [18] Bakodo [19] BarCodeScan [20]
O X O O O
O X O O O
O X X X X
O X X X X
Total 1010 310 610 610 410
method to have better accuracy than Zxing Moreover weuse different-size images to calculate the execution time Theexperiment shows that our method can efficiently decodeimages All images can be decoded in less than one second
References
[1] L F F Belussi and N S T Hirata ldquoFast component-basedQR code detection in arbitrarily acquired imagesrdquo Journal ofMathematical Imaging and Vision vol 45 no 3 pp 277ndash2922013
[2] L F F Belussi and N S T Hirata ldquoFast QR code detection inarbitrarily acquired imagesrdquo in Proceedings of the Conferenceon Graphics Patterns and Images (SIBGRAPI rsquo11) pp 281ndash288Maceio Brazil August 2011
[3] E Ohbuchi H Hanaizumi and L A Hock ldquoBarcode readersusing the camera device inmobile phonesrdquo in Proceedings of theInternational Conference onCyberworlds (CW rsquo04) pp 260ndash265Tokyo Japan November 2004
[4] Y Liu J Yang and M Liu ldquoRecognition of QR Code withmobile phonesrdquo in Proceedings of the Chinese Control andDecision Conference (CCDC rsquo08) pp 203ndash206 Yantai ChinaJuly 2008
[5] C C Lin and M S Chen A general scheme for QR-code imagedenoising on the camera phone [MS thesis] Department ofElectrical Engineering National Taiwan University 2009
[6] C-H Chu D-N Yang andM-S Chen ldquoImage stablization for2Dbarcode in handheld devicesrdquo inProceedings of the 15thACMInternational Conference onMultimedia (MM rsquo07) pp 697ndash706September 2007
[7] Y Kato D Deguchi T Takahashi I Ide and H Murase ldquoLowresolution QR-code recognition by applying super-resolutionusing the property of QR-codesrdquo in Proceedings of the 11thInternational Conference on Document Analysis and Recognition(ICDAR rsquo11) pp 992ndash996 September 2011
[8] J J Zhou Y F Liu and P Li ldquoResearch on binarization ofQR code imagerdquo in Proceedings of the International Conferenceon Multimedia Technology (ICMT rsquo10) pp 1ndash4 Ningbo ChinaOctober 2010
[9] Z Xiong H Cuiqun L Guodong and L Zhijun ldquoA binariza-tion method of quick response code imagerdquo in Proceedings ofthe 2nd International Conference on Signal Processing Systems(ICSPS rsquo10) vol 3 pp 317ndash320 Dalian China July 2010
[10] Y H Chang C H Chu and M S Chen A general scheme forextracting QR code from a non-uniform background in camera
10 Mathematical Problems in Engineering
phones and applications [MS thesis] Department of ElectricalEngineering National Taiwan University 2007
[11] C Y Lai and M S Chen Extracting QR Code from a non-uniform background image in embedded mobile phones [MSthesis] Department of Electrical Engineering National TaiwanUniversity 2007
[12] Y L Pan and M S Chen 2D barcodes from images with spatialdistortion [MS thesis] Department of Electrical EngineeringNational Taiwan University 2008
[13] D Munoz-Mejias I Gonzalez-Diaz and F Diaz-De-Maria ldquoAlow-complexity pre-processing system for restoring low-qualityQR code imagesrdquo IEEE Transactions on Consumer Electronicsvol 57 no 3 pp 1320ndash1328 2011
[14] P S Heckbert Fundamentals of texture mapping and imagewarping [MS thesis] Department of Electrical EngineeringUniversity of California Berkeley Calif USA 1989
[15] Wikipedia ldquoReed-Solomon Error Correctionrdquo 2013httpenwikipediaorgwikiReed-Solomon error correction
[16] T K Moon Error Correction Coding Mathematical Methodsand Algorithms Wiley New York NY USA 2005
[17] S Owen ldquoZxing (ldquoZebra Crossingrdquo)rdquo 2013 httpscodegooglecompzxing
[18] SimpleAct ldquoQuickMarkrdquo 2013 httpwwwquickmarkcomtw
[19] A Dougla ldquoBakodordquo 2013 httpbakodo[20] PGiudicelli ldquoBarcode-Scannerrdquo 2013 httpsitunesapplecom
twappbarcode-scannerid478602171mt=8[21] T Falas and H Kashani ldquoTwo-dimensional bar-code decoding
with camera-equippedmobile phonesrdquo in Proceedings of the 5thAnnual IEEE International Conference on Pervasive Computingand Communications Workshops (PerCom Workshops rsquo07) pp597ndash600 New York NY USA March 2007
Impact Factor 173028 Days Fast Track Peer ReviewAll Subject Areas of ScienceSubmit at httpwwwtswjcom
Hindawi Publishing Corporation httpwwwhindawicom Volume 2013Hindawi Publishing Corporation httpwwwhindawicom Volume 2013
The Scientific World Journal
10 Mathematical Problems in Engineering
phones and applications [MS thesis] Department of ElectricalEngineering National Taiwan University 2007
[11] C Y Lai and M S Chen Extracting QR Code from a non-uniform background image in embedded mobile phones [MSthesis] Department of Electrical Engineering National TaiwanUniversity 2007
[12] Y L Pan and M S Chen 2D barcodes from images with spatialdistortion [MS thesis] Department of Electrical EngineeringNational Taiwan University 2008
[13] D Munoz-Mejias I Gonzalez-Diaz and F Diaz-De-Maria ldquoAlow-complexity pre-processing system for restoring low-qualityQR code imagesrdquo IEEE Transactions on Consumer Electronicsvol 57 no 3 pp 1320ndash1328 2011
[14] P S Heckbert Fundamentals of texture mapping and imagewarping [MS thesis] Department of Electrical EngineeringUniversity of California Berkeley Calif USA 1989
[15] Wikipedia ldquoReed-Solomon Error Correctionrdquo 2013httpenwikipediaorgwikiReed-Solomon error correction
[16] T K Moon Error Correction Coding Mathematical Methodsand Algorithms Wiley New York NY USA 2005
[17] S Owen ldquoZxing (ldquoZebra Crossingrdquo)rdquo 2013 httpscodegooglecompzxing
[18] SimpleAct ldquoQuickMarkrdquo 2013 httpwwwquickmarkcomtw
[19] A Dougla ldquoBakodordquo 2013 httpbakodo[20] PGiudicelli ldquoBarcode-Scannerrdquo 2013 httpsitunesapplecom
twappbarcode-scannerid478602171mt=8[21] T Falas and H Kashani ldquoTwo-dimensional bar-code decoding
with camera-equippedmobile phonesrdquo in Proceedings of the 5thAnnual IEEE International Conference on Pervasive Computingand Communications Workshops (PerCom Workshops rsquo07) pp597ndash600 New York NY USA March 2007
Impact Factor 173028 Days Fast Track Peer ReviewAll Subject Areas of ScienceSubmit at httpwwwtswjcom
Hindawi Publishing Corporation httpwwwhindawicom Volume 2013Hindawi Publishing Corporation httpwwwhindawicom Volume 2013
The Scientific World Journal
Impact Factor 173028 Days Fast Track Peer ReviewAll Subject Areas of ScienceSubmit at httpwwwtswjcom
Hindawi Publishing Corporation httpwwwhindawicom Volume 2013Hindawi Publishing Corporation httpwwwhindawicom Volume 2013
The Scientific World Journal
Top Related