Anda di halaman 1dari 6

A 2D Barcode Recognition System Based on Image Processing

Changnian Zhang, Ling Ma, and Dong Mao


College of Information Engineering, North China University of Technology, Beijing 100144, China ml-28wd-23@163.com

Abstract. 2D barcode identification is a hot topic in the field of image processing. This paper shows the analysis of 2D barcode structure and the development at home and abroad. A 2D barcode recognition system based on image processing was proposed. The segmentation and denoising algorithm were improved. The identification and decoding of 2D barcode was realized in VC + + programming environment. The recognition efficiency of the barcode was successfully increased. It pushes the promotion and development of 2D barcode. Keywords: QR Code; 2D barcode; Image processing.

1 Introduction
2D barcode has received a wide range of attention since the day it appeared for its advantages of large storage capacity, high secrecy, strong resistance to damage and low cost and other features [1]. It has become an important research topic in the field of image processing and pattern recognition. The overseas research on two-dimensional barcode technology began in the late 1980s and they have developed a variety of code systems such as PDF417, QR Code, DataMatrix, Code 16K and so on. The research in home began in 1993. ANCC (Article Numbering Center of China) translated and studied some commonly used 2D barcode technical specifications. On the basis of digesting some foreign relevant materials, China has made two 2D barcode national standards, GB/T 17172-1997 FPD417 and GB/T 18284-2000 Quick Response Code . QR Code (Quick Response Code) released by Japanese Denso Company, had become ISO international standard in 2000 and then recognized as the Chinese national standard GB / T 18284-2000 in 2001 [2]. In addition to the features such as large information capacity, high reliability, the ability of expressing characters and image information and strong security advantages, it also has the following main features, high-speed reading, error correction capability and effectively expressing Chinese and Japan characters. A QR Code symbol is made up with square modules which are formed into a square array. The symbol consists of coding region and function graphic which includes searching pattern, separator, positioning pattern and correcting pattern. The function graphic cant be used for data encoding. The symbol is surrounded by the white blank area. The sample and the structure are shown in Fig. 1(a) and Fig. 1(b).
M. Zhu (Ed.): Electrical Engineering and Control, LNEE 98, pp. 683688. springerlink.com Springer-Verlag Berlin Heidelberg 2011

684

C. Zhang, L. Ma, and D. Mao

(a) QR Code sample

(b) QR Code structure

Fig. 1. QR Code sample and structure

p p

Image Acquisition

Graying

Filtering

Binarization

Data Recognition

Decoding and output h h f h Fig. 2. The system chart of the recognition system

2 Barcode Recognition System Designing


According to the structure of 2D barcode, we propose the system chart. It is shown in Fig. 2.

A 2D Barcode Recognition System Based on Image Processing

685

2.1 Graying In the experiment, we get a 24-bit color image of the barcode from an ordinary USB camera. We have to convert the color image into gray-scale before we deal with the image because the color image contains a lot of color information. We can improve the speed and efficiency of software in this way. Each pixel of the color image is composed by the RGB components. We have several methods to gray the image, such as maximum method, average method and weighted average method which conversion formula are as follows:

Y = max(R, G, B ) Y = ( R + G + B) / 3 Y = 0.11R + 0.59G + 0.3B


There are no significant differences among these three methods. We can choose one of them according the experiment conditions. In our experiment, we used the third one. 2.2 Adaptive Filtering In the process of image acquisition, the picture we got from the camera contains a lot of noise because of the influence of the acquisition equipment and other factors. Then the image looks fuzzy and spotted. So we need to filter the image before the next step. In recent years, the anisotropic diffusion equation-based image processing has been attaining more and more attentions. It has been widely applied in the fields of image segmentation, denoising, image matching and feature extraction. As early as 1990s, Perona and Malik [3] had successfully applied anisotropic diffusion equation in image denoising. The P-M model proposed by Perona and Malik is as follows:

I = div ( c (| I | )) I t I ( x , y , 0) = I 0 ( x , y )

(1)

Where I is evolution image, and div is divergence operator, and I is gradient, and

c( I ) is the diffusion coefficient of the anisotropic diffusion equation. c() is


1 . 1 + (s / k ) 2 Denoising with anisotropic diffusion equation is an iterative process. The iteration number will affect the denoising result. We combined the structural similarity algorithm and anisotropic diffusion model. We use structure similarity model to assess image quality and then control the number of iteration on the basis of anisotropic diffusion equation. Adaptive filtering can be realized with this method. Literatures [4] and [5] have given an accurate discussion of structural similarity.
defined as: c( s ) = e
( s / k )2

and c ( s ) =

686

C. Zhang, L. Ma, and D. Mao

2.3 Image Binarization

In many binary algorithms, the Otsu [6] method can extract an ideal threshold in most situations. In some cases, maybe we cant get the best threshold value, but the quality is guaranteed. Some scholars believe that the Otsu is the best choice in adaptive binary algorithms. But in the specific test, we found that we would get some large black areas or even loose the whole image information when there are no obvious differences between the target and the background. To resolve this problem, we could enhance the Otsu through gray value stretching. The principle is to highlight the differences between the foreground and background by increasing the gray level. In order to simplified calculation, we use the linear stretch to complete the gray stretch. It is shown in Fig. 3. An input image f ( x, y ) could become output image

g ( x, y ) via mapping function T as follows:

g ( x, y ) = T [ f ( x, y )] .

(2)

Suppose the gray range of the input image is [ a, b] and output image [c, d ] . The change can be realized by the following formula.

g ( x, y ) = [( d c) /(b a )] + c .

(3)

Fig. 3. The schematic diagram of gray stretching

Otsu method is as follows: suppose N is the number of pixels. The image has L gray levels. ni is the number of the pixels at the gray level i . Thus N = probability of each gray level pi =

n
i =1

. The

ni . An image is divided into two parts according N to the threshold t : C0 and C1 . They are target and background. C0 and C1 correspond to the pixels with gray levels {1,2,L, t} and {t + 1, t + 2,L, L} .

A 2D Barcode Recognition System Based on Image Processing

687

The proportion of the target and the background pixels: values of the target and the background: image:

0 , 1 .

Average gray

0 , 1 .

Average gray value of the whole

T . Otsu can be expressed as:


2 B = 0 ( 0 T ) 2 + 1 ( 1 + T ) 2 .

(4)

Where
i =1
i i = t +1
i =1

i =t +1

Traversing t from smallest gray value to largest, when best threshold.

2 B

gets its maximum, t is the

3 Data Recognition
We need to locate the detection graphic of the barcode after preprocessing to get the version information and decode the barcode. A QR Code symbol contains three detection graphics which have same size and shape. Each of them is composed by three overlapping concentric squares. The module width proportion is 1:1:3:1:1. Since it is unlikely to appear the similar graphic in the symbol image, we can find the approximate regions which meet to the proportion to locate the detection graphic. The barcode is divided into grids on the basis of the detection graphic. Every grid is a module. White module represents 1 while black one represents 0. Now we get the data flow of the QR Code by which we can obtain the code information according the encoding rules. The window of the recognition system is shown in Fig. 4.

Fig. 4. The window of the recognition system

0 = pi

1 =

= 1 0

0 = ipi / 0

1 =

ip

/ 1

T = ip i .
i =1

688

C. Zhang, L. Ma, and D. Mao

4 Conclusion
There are plenty of image processing methods for 2D barcode. However, the process of designing algorithms is extremely complex in full accordance with the existing algorithms. This article has studied recognition process for the QR code, including graying, binarization, filter, barcode localization and decoding. The denoising and segmentation algorithm are improved for reading QR code accurately and quickly, meanwhile, the system is achieved in VC + +6.0 programming environment to meet real time requirements. It is helpful for the development of embedded system. The application of 2D barcode in mobile phone platform will be a research focus in future with the development of smart phone and the increasing processing capacity.

References
1. Parikh, D., Jancke, G.: Localization and Segmentation of A 2D High Capacity Color Barcode. Applications of Computer Vision, pp. 16 (2008) 2. Zhou, J., Liu, Y., Li, P.: Research on Binarization of QR Code Image. In: 2010 International Conference on Multimedia Technology, pp. 14 (2010) 3. Perona, P., Malik, J.: Scale Space and Edge Detection Using Anisotropic Diffusion. IEEE Transactions on Pattern Analysis and Machine Intelligence 12, 629639 (1990) 4. Wang, Z., ConradBovik, A.: A universal Image Quality Index. IEEE Signal Processing Letters 9, 8184 (2002) 5. Wang, Z., ConradBovik, A., RahimSheikh, H., et al.: Image Quality Assessment: From Error Visibility to Structural Similarity. IEEE Transactions on Image Processing 13, 600612 (2004) 6. Ostu, N.A.: Threshold Selection Method from Gray-Level Histograms. IEEE Transactions on Systems, Man and Cybernetics 9, 6266 (1979) 7. GB/T 1828-2000, Chinese National Standard-Quick Respond Code (QR Code), Standards Press of China (2001)

Anda mungkin juga menyukai