Lost in The Supermarket: Decoding Blurry Barcodes: by Todd Wittman
Lost in The Supermarket: Decoding Blurry Barcodes: by Todd Wittman
Imaging Science
where n is the noise and Ga,w is a Gaussian of amplitude a and width scaled by a factor w:
Ga ,w x
a exp x / w
.
2
(2)
Because the parameters a and w are uncorrelated, G does not necessarily have unit area. The results of the convolution are similar in appearance to the signals actually encountered (see Figure 1). Each of the parameters in (1) describes a different noise process. The additive noise n can result from electrical noise in the scanner or from source defects, such as stray marks on the paper. The amplitude a is controlled by the intensity of the scanner and the ambient light. The blur factor w models the size of the laser spot relative to the size of the
Figure 1. Top, synthetic image of a UPC barcode encoding 0123456789. Middle, the ideal signal u. Bottom, blurred signal u0,with a = .05, w = .012, and a moderate amount of additive noise.
barcode. In particular, w increases as the scanner moves away from the barcode. In reconstructing u, we assume that the Gaussian width is at most the size of the thinnest bar. Standard commercial decoding techniques are based on classic edge detectors, such as those that determine zero crossings of the second derivative. Such techniques use only local information and would have difficulty decoding the three bars at position 550 in the image at the bottom of Figure 1. Our global approach to solving (1) is to minimize the total-variation (TV) energy
E u u0 u0 Ga,w * u dx
}
a ua dx.
}
(3)
The first term measures the fidelity or truth of the blurring function. The second term monitors the total variation of our reconstructed signal u. The parameter a balances the two terms and needs to be set experimentally. It is well documented that in two dimensions, the TV norm results in blocky or blotchy images. This is because the TV term controls the jumps, but not the smoothness, of u. This staircasing effect is aesthetically displeasing in two dimensions, but it is a desirable side effect in our onedimensional problem. In general, the blind deconvolution problem (1) is famously ill-posed. The problem is central to image processing, as evidenced by the many speakers at IS04 who focused on it, often suggesting a TV approach similar to (3). Fortunately, our knowledge of the point-spread function G and the desired u contains a mathematical ray of sunshine. Selim Esedoglu proved recently that under certain conditions, our problem is well-posed [2]. Specifically, if we assume that w 0, a lies in a compact set, and u = 0 outside the barcode region, then the infimum of (3) is attained. Using a Newtons method approach, we experimented with minimizing (3). We had great success in recovering u with any initial guess, but it was more difficult to recover the correct parameters a and w. For correct results, we found that the initializations for a and w must be very close to the actual values. It may seem strange that the minimization can accurately recover a long signal and yet struggles with two numbers. The explanation is that the energy (3) is convex in u, but not in a and w. Some techniques are available for estimating the size of the blur kernel G using peak locations [3]. Figure 2. Minimizing the total-variation energy of the For the example shown in Figure 2, the correct u is obtained in about noisy signal in Figure 1 produces the solid line. This gives 6 minutes in MATLAB with a 2.4-GHz Celeron processor. This is too the correct barcode, after thresholding at 0.5. The ideal signal is overlaid as a dotted line. slow to be practical, especially in the 10-items-or-less checkout lane. But the approach is promising and could prove useful for applications in which the signal has high levels of blur and speed is not an important factor. To decode more complex barcode schemes, such as two-dimensional barcodes or the UPS bulls-eye barcode, there is a movement in the industry to replace the optical lasers of scanners with digital cameras. Future research may involve adapting this method for one-dimensional signals to two-dimensional barcode images.
References
[1] R. Muniz, L. Junco, and A. Otero, A robust software barcode reader using the Hough transform, Proceedings of IEEE International Conference on Information, Intelligence, and Systems, 1999, 313319. [2] S. Esedoglu, Blind deconvolution of barcode signals, Inverse Prob., 20 (2004), 121135. [3] E. Joseph and T. Pavlidis, Bar code waveform recognition using peak locations, IEEE Trans. Pattern Anal. Machine Intell., 16:6 (1994), 630640. Todd Wittman ([email protected]) is a graduate student in mathematics at the University of Minnesota, where he is working under the supervision of Fadil Santosa.