Adaptive binarization method such as Niblack's method [6] works well for ... Specifically, an. âedge mapâ consisting of high gradient pixels is obtained us- ..... images that can be correctly decoded without errors versus the total number of ... Mobile phones. Md Dopod HTC Nokia. O2. Samsung. In. 16.7. 18.3. 33.3. 6.67. 50.0.
Proceedings of 2010 IEEE 17th International Conference on Image Processing
September 26-29, 2010, Hong Kong
DYNAMIC WINDOW CONSTRUCTION FOR THE BINARIZATION OF BARCODE IMAGES CAPTURED BY MOBILE PHONES Huijuan Yang, Alex C. Kot and Xudong Jiang Nanyang Technological University, Nanyang Avenue, Singapore 639798. Email: {PS2707312C, eackot and exdjiang}@ntu.edu.sg ABSTRACT It is difficult to directly apply existing binarization methods to the barcode images captured by mobile devices under uncontrolled lighting conditions. Employing a fix-sized window to locally binarize the image cannot handle the situation when small and large objects co-exist in an image. This paper proposes a novel scheme to dynamically determine the size of the binarization window, which changes with the presence of the high gradient pixels in a search window centering the processing pixel. The proposed method has demonstrated its capability in handling objects of different sizes and the uneven illumination problem. Further, it is not constrained to certain barcode types. Experimental results conducted on 330 images captured using five mobile phones in indoor and outdoor environments achieve about 93% recognition rate evaluated using a barcode decoder. Comparisons with some existing approaches show its superior binarization performance.
[2], which takes the minimum of the medians of nine sampled square areas near the image center as the threshold. Poor binarization results can be expected when the assumption that the barcode is located near the image center is not valid. Contrast enhancement using Niblack’s algorithm is employed in [3], followed by thresholding using Ridler and Calvard’s method. Normalizing each block to account for varying lighting, followed with the binarization using a fixed threshold is proposed in [4]. In this paper, we propose to dynamically construct the binarization window based on the minimum distance from each pixel to the edges lying in the search window. Using statistics in the dynamical binarization window in the threshold calculation effectively addresses the problem of significant gap in object sizes in the barcodes such as PDF417.
Index Terms— dynamic binarization window, barcode images, high gradient pixels, uneven illumination.
As is known, it is difficult to use a single threshold to binarize the images captured under uncontrolled lighting conditions. Adaptive binarization method such as Niblack’s method [6] works well for general natural images by properly choosing the parameters. However, a key issue in applying it for the barcode images captured by mobile device is how to choose an appropriate size of the moving window and the parameters for different images. This is especially necessary for 2D barcode images such as PDF417 [7], in which a significant gap exists in the size between the start and stop bars with that of the data codewords located in the middle. This creates difficulty in binarization using a fix-sized moving window. Our idea is to choose the window size based on the presence of the high gradient pixels in the vicinity of the current pixel such that sufficient information for both the foreground and background is available in the window. Specifically, an “edge map” consisting of high gradient pixels is obtained using “Canny” edge detector, which can detect weak edges and eliminate isolated noise. Thereafter, we define the minimum pixel-to-edge distance, denoted as D pe , as the minimum distance from the current pixel to the edges in a search window (Ws ) of the edge map, as illustrated in Fig. 1. Finally, the size of the dynamic moving window used for binarization is calculated based on D pe and centered at the nearest edge pixel.
1. INTRODUCTION Barcode image processing has drawn a lot of concerns recently, owing to the availability and wide usage of the mobile phones [1]-[4]. Typical application is “mobile tagging”, which encodes a URL in a two-dimensional barcode to be read and inputted using a camera phone. However, using the mobile phones as the barcode reader encounters a lot of problems since no guideline on how to capture a barcode image of good quality exists. The barcode images captured by mobile devices are generally non-uniformly illuminated due to the uncontrolled lighting environments in capturing the barcode images. Excessive noise and blurriness may also exist in the image owing to the small sensor size and lack of auto-focus of the mobile phones. Geometric distortions may also occur due to the capturing angle to the image plane. Hence, preprocessing steps such as localizing the four extreme corners to undo the geometric distortions and adaptive binarization to get back the original barcode images are important steps for barcode reading using mobile phone [5]. Various methods are proposed for the binarization of barcode images. A modified version of Niblack’s algorithm is employed in [1] by using the averaged gray level in a neighborhood surrounding the current pixel as the threshold. Histogram calculation is employed to calculate the threshold in This work was supported by Singapore A*Star SERC Research Grant No: 0621300056.
978-1-4244-7994-8/10/$26.00 ©2010 IEEE
3001
2. BINARIZATION USING DYNAMIC WINDOWS
2.1. Dynamic Window Size Calculation The detail steps for calculating the pixel-to-edge distance and determining the dynamic size and location of the window for each pixel are described as follows.
ICIP 2010
discussed in the following Section.
(a)
2.2. Binarization Strategies We define the binarization strategy as follows: using a dynamic window to center the found edge pixel and computing the threshold based on the statistics in the window. We differentiate foreground from background regions in the binarization. The threshold for foreground region (T f ) is given by
(b)
Fig. 1. A barcode image captured by O2 XDA Atom Life (a) and the pixel-to-edge distances shown in the enlarged edge map (b). 1. Determine the largest size of search window (W m ) based on the width of the widest start or stop bar (M e ) in PDF417 or the largest module element in the finder pattern of QR code [8]. Take PDF417 as an example, M e is obtained by scanning the barcode images along N l scan lines positioned in pre-defined distances from the center of the image, e.g., Nl =5 is chosen. To obtain the run patterns for each line profile, the mean of the pixels in the line is used as the initial threshold. The so-obtained threshold may be biased towards the background value. This is due to the facts that a barcode is assumed to be balanced in terms of black and white modules in barcode region, however, there will be more background pixels in a line by including background region. Hence, this threshold is refined by using the mean of object pixels. A small offset, e.g., 15, can be added to the threshold to retain all object pixels (a relaxation rule). A line profile is identified as “invalid” if the number of transitions (a transition is a change from a black run to a white run, or vice versa) in a line is less than a small constant, e.g., 10. This is due to the reason that the black and white runs are intersected a lot in barcode region, whereas there is no or few transitions in the background region. M e is finally taken as the mean of the maximum black runs in those “valid” profile and used as the largest size of search window W m . 2. Obtain the edge map using “Canny” edge detector. The low and high thresholds in the implementation are chosen as 0.01 and 0.3, respectively. The standard deviation of the gaussian filter is chosen to as 1.0. 3. Iterate using a dynamic search window of size (2W s +1)2 , where Ws =1, 2,...,Wm. Check if the number of edge pixels and the minimum number of edge pixels required (denoted as Ne and Tep ) in the search window satisfy N e ≥Tep , e.g., Tep =1 in current implementation. Stop and calculate the distances (Ds ) from the current pixel to the edge pixels if it is true. The minimum distance D pe =min(Ds ), where min() gives the minimum value in the set. Finally, the size of the binarization window is chosen as (2W b +1)×(2Wb+1) and centered at the found nearest edge pixel, where W b =α·Dpe and α>1 to ensure the processing pixel lies in the window, e.g., α=1.5 is chosen considering an extreme case that the pixel lies in the middle of the largest object. Otherwise, continue searching with an increased window size. 4. If the size of the search window has reached its maximum (i.e., Ws =Wm ) and Ne