of 10
8/3/2019 00655421
1/10
354 IEEE TRANSACTIONS ON SIGNAL PROCESSING, VOL. 46, NO. 2, FEBRUARY 1998
Bar Code Recovery via the EM AlgorithmWilliam Turin, Senior Member, IEEE, and Robert A. Boie
Abstract The ubiquitous supermarket checkout scanner is
indeed a well engineered and effective device. There is, nev-ertheless, demand for better devices. Existing scanners rely onsimple and indeed low-cost signal processing to interpret bar codesignals. These methods, nevertheless, fundamentally limit labelreading and cannot be extended. A new method based on thedeterministic EM algorithm is described here. First results showa substantial improvement in label reading depth of field, whichis an important performance parameter for bar code readers.
Index Terms Bar-code decoding, deconvolution, EM algo-rithm, inverse problems.
I. INTRODUCTION
THE MACHINE-readable labeling system of choice in
many applications employs bar code labels and flyingspot readers (laser scanner). The label data is encoded in therelative widths of alternating light-absorbing, usually black,
printed bars and light scattering (diffusely reflecting) white
spaces arranged like a picket fence. Relative width encoding
permits the label reading to be relatively insensitive to geo-
metric effects such as label size, reading distance and, to some
degree, label orientation. Spot velocity, in principle, need only
be uniform over any label scan.
A laser scanner reads a bar code by projecting a bright
spot of light that moves across the label while a coaxial
photodetector converts the time-varying intensity of light
backscattered from the label into a corresponding time-varying
electrical signal current. Our ability to read a label depends
directly on both the intensity since substantial noise sources
are present as are dimensions of the projected spot relative to
the bars. Laser power is limited to about 1 mW by eye safety
considerations and, hence, provides an upper limit on label
illumination and, therefore, the signal intensity. Efforts to im-
prove bar code readers are directed at reducing the constraints
on label presentation. Check-out procedures then benefit by the
resulting reduction in labor and faster processing. Any increase
in the depth of field within which labels are successfully read is
advantageous in this regard. Depth of field is primarily limited
by blurring effects.
If the beam is in focus along a surface that bisects thereading volume, then labels are minimally blurred since the
projected light spot is the smallest. Labels further from the
focus are increasingly blurred by the increased spot size.
Reading volume then depends on the ability of the signal
Manuscript received September 17, 1996; revised August 12, 1997. Theassociate editor coordinating the review of this paper and approving it forpublication was Dr. Xiang-Gen Xia.
The authors are with AT&T Laboratories-Research, Florham Park, NJ07932-0971 USA (e-mail: [email protected]).
Publisher Item Identifier S 1053-587X(98)01387-6.
processing to recover signals from blurring. The degradation
in bar code signals due to blurring is accurately modeled bythe convolution with a Gaussian kernel with variable blurring
factor , depending on the labels distance from the focal
surface.
The problem of bar code decoding is closely related to
the problem of edge detection. Conventional methods of edge
detection are based on the signal filtering and feature (e.g.,
zero crossings, peaks, etc.) extraction [1][13]. Alternatively,
edges can be found by solving iteratively a system of nonlinear
equations [14].
Edge detection can be achieved as a byproduct of reversing
the blur (image deblurring). In general, the process of reversing
Gaussian blur cannot be represented as a linear filter [15].However, if we restrict the space of allowable input functions
to polynomials of fixed degree, then the convolution inverse
exists [15], [16].
All these algorithms work well if the blurring is small
relative to the bars. Performance is then limited primarily by
signal-to-noise ratio (SNR). Nevertheless, as relative blurring
increases, reading errors occur in conventional readers that are
independent of SNR. Increased signal does not, in these cases,
reduce errors. Conventional methods are primarily limited by
intersymbol interference (ISI) to a range of spot sizes that
produce relatively small blurring. To improve the algorithms
performance, the blur factor is estimated from the blurred
signal [8], [14], [16].Recently, Vardi and Lee [17] generalized the statistical
expectation-maximization (EM) algorithm [18] for solving de-
terministic linear inverse problems. They successfully applied
this deterministic EM algorithm to image deblurring. This
algorithm gives good results if the blur factor is known (see
Section III-C). However, in practice, it is usually not known
and must be estimated from the bar code signal.
Bar code decoding is simpler than edge detection because
of the bar code special structure. Bars are parallel, and their
widths and gaps between them are multiple of a unit bar
width (representing one bit of information). In addition, only a
subset of all possible bar sequences represent legal bar codes.
This additional information can be incorporated into the edge
detection algorithms [7], [8].
The problem of bar code decoding can be formulated
in terms of information transmission over communication
channel. The original sequence of bars can be viewed as
a transmitted signal, and the scanner output signal can be
viewed as a received signal. The convolution distortion of
the transmitted signal is called ISI. The signal deblurring
is performed by the channel equalization. There are many
algorithms for communication channel equalization that are
1053587X/98$10.00 1998 IEEE
8/3/2019 00655421
2/10
TURIN AND BOIE: BAR CODE RECOVERY VIA THE EM ALGORITHM 355
presented in textbooks [19], [20] and numerous papers. The
main problem of applying these methods to bar code decoding
is that communication systems are usually synchronized, which
is equivalent to estimating with high accuracy the position of
the initial bar and the pulse duration (relative bar width).
In practice, however, it is difficult to estimate directly
the blur factor or the pulse width . We propose to
estimate the signal parameters indirectly by fitting the distorted
signal to its model. By using the KullbackLeibler divergence
(KLD) between the signals [21], we develop a deterministic
EM algorithm for solving nonlinear inverse problems and
apply this algorithm to estimating the signal parameters. The
algorithm is iterative, and it monotonically decreases the KLD.
As a byproduct of this algorithm, we estimate both and .
The paper is organized into five sections. In Section II, we
present the bar code signal model and Gaussian blur. In Section
III, we consider different algorithms for bar code recovery:
deconvolution, the EM-based deblurring, and the EM-based
decoding. We conclude in Section IV. Major equation deriva-
tions are given in the Appendix.
II. SIGNAL MODEL
A scanner system consists of a light source, optics, photode-
tector, and signal processing hardware. We assume that that
the scanned image has two colors: black and white. While the
beam is stationary, the photodetector current has the form
(1)
where includes the white parts of the illuminated region,
and is an elemental contribution of the
reflected light from the point if the beam spot is centered
at . The point spread function isassumed to be symmetrical and can be modeled by Gaussian
distribution densities
where is proportional to the beam width, and are
the coordinates of the beam center. A label illuminated bya beam is illustrated in Fig. 1. Neither the source nor the
photodetector are shown in the figure. The beam focal region
is at distance above the label.
If the beam center moves, and are functions of time.
We assume that the beam moves with constant velocity
so that
If we further assume that bars have infinite length, (1) can
be simplified
where is the velocity component in the direction perpen-
dicular to bars, at bars, and at white
space (see Fig. 1). By changing the time scale, we can always
have . We also assume that so that is
constant. This assumption is valid for the following reasons:
Fig. 1. Bar code scanner model.
The label reading time is just a few microseconds, and thevariation of due orientation is small enough to be ignored.
Our experimental data confirm that the assumption is valid.It is convenient to use a complementary function
. After the substitution, we obtain
const
where
If is a binary representation of a bar code, then
(2)
where is a rectangular pulse of width corresponding
to a bar
ifotherwise
Our goal is to recover from the scanner
signal or
(3)
where is a parameter vector that
we need to recover from the scanner signal. This equationshows that a scanner can be modeled as a linear filter with
Gaussian impulse response . After substitution of ,
this equation can be written as
After integrating the sum, we obtain
(4)
8/3/2019 00655421
3/10
356 IEEE TRANSACTIONS ON SIGNAL PROCESSING, VOL. 46, NO. 2, FEBRUARY 1998
Fig. 2. Original signal (solid line) and deblurred signal with optimal (dotted line).
where
erf erf (5)
and
erf
is the error function.
III. BAR CODE RECOVERY
A. Deconvolution
In the absence of noise and interference, we can recover
bar code signal by solving (3). Applying the Fourier
transform on both sides of (3), we obtain
where and are Fourier transforms of and
, respectively. Therefore
and is obtained using the inverse Fourier transform of
This equation shows that the solution cannot be found
by filtering because the inverse Fourier transform of
does not exist. We also need to know to solve the
equation that is not the case in bar code recovery because
otherwise, the solution is indeterminate. Indeed, it follows
from the identity
that if is a solution, then with
is also a solution of (3). A trivial solution is and. However, if we limit the set of solutions
to the rectangular pulse trains presented by (2), the solution
is unique.
The existing methods of bar code recovery assume that
the blur factor is small; they treat as if it were
slightly distorted . If is small, then
, and the bar code can be recovered by
sampling it at the moments , by using the intersections of
with its mean value, or by using zero crossings
of its second derivative. However, if the beam covers several
bars, then we cannot neglect the contribution of the adjacent
elements and
to the sum, and the problem of decodingbecomes more difficult. This distortion of the sample is called
ISI or convolution interference. The problem becomes even
more complex if the signal is distorted by other sources of
interference (such as overhead lights and paper roughness)
and noise. In this case, we need to recover the code from the
received signal , which is usually a nonlinear function of
, interference signals, and noise.
To solve the problem of bar code decoding, we formulate
it as a problem of finding the coefficients by
fitting the scanner signal model presented by (3) to the
measured signal .
8/3/2019 00655421
4/10
TURIN AND BOIE: BAR CODE RECOVERY VIA THE EM ALGORITHM 357
Fig. 3. Original signal (solid line) and deblurred signal with modified (dotted line).
B. The EM Algorithm
In order to fit to the measured bar code signal ,
we need to select an optimization criterion. By proper scaling
and translation, we can make and proba-
bility density functions. This allows us to interpret the problem
of decoding as a problem of fitting a mixture of probability
distributions to the measured signal. It is convenient to fit the
mixture by minimizing the KLD [21], [22]
This equation can be written as
It is easy to see that and if and
only if almost everywhere [21]. We would
like to point out, however, that even if we find a perfect fit
[ ], this does not mean that we can find a unique
parameter . If the problem is ill conditioned, it can have
many different solutions.Since does not depend on , the minimization of
is equivalent to maximization of log-likelihood func-
tion
(6)
The maximum likelihood (ML) model parameter estimatesare obtained by maximizing the function
(7)
Note, that solutions of this equation do not change if we
multiply by a positive number. Usually, it is difficult
to solve (7) directly. To develop the iterative EM algorithm,
we introduce an auxiliary variable with the probability
density function . The augmented variable
represents the complete data, whereas represents
the incomplete data.
Denote
Taking logarithm on both sides of this equation, we obtain
Since does not depend on , we have
where is some fixed value of the parameter vector. Mul-
tiplying both sides of this equation by and integrating,
we obtain
where
(8)
8/3/2019 00655421
5/10
8/3/2019 00655421
6/10
TURIN AND BOIE: BAR CODE RECOVERY VIA THE EM ALGORITHM 359
Fig. 4. Measured signal (solid line) and the original fit from zero crossings (dotted line).
Alternatively, we can develop the EM algorithm on the basis
of representation (4) by defining
and
so that
where .
Maximizing this function, we obtain
but the rest of the equations
for the M-step are complex and are difficult to solve. In
most practically important cases, we can perform the signal
approximation to simplify the solution.
D. Signal Approximation
As we pointed out before, if is small, bar codes can be
decoded reliably using simple algorithms because ISI is small.
Signal deblurring is necessary if is large. In this case, we
can use the approximation
The ML approximation gives the relationship between param-
eters as
For , the difference between and
does not exceed 2%.
With this approximation, the scanner signal has the form
Let us consider first a more general model
where and are independent variables. In the absence
of interference and noise, fitting this model to the measured
signal is equivalent to fitting the constrained model. The EM
8/3/2019 00655421
7/10
360 IEEE TRANSACTIONS ON SIGNAL PROCESSING, VOL. 46, NO. 2, FEBRUARY 1998
Fig. 5. Fitting bar code signal after 40 iterations.
algorithm for re-estimating and has the form
(14)
(15)
This algorithm gives good results in the absence of the
signal distortion, but for distorted signals, we should use a
constrained approximation. It is easy to see that if we assume
that
and for
the EM algorithm takes the form (see Appendix)
(16)
(17)
(18)
(19)
where
Note the following property of the EM algorithm: If ,
then it follows from (16) that for all . We
can use this property by setting for corresponding
to gaps between the guard bars. We can also apply it to the
guard bars in the complementary signal .
E. Zero Crossing Fit
Bar codes can be uniquely identified by the sequenceof zero crossings of , where
is the common value of all . Using the zero crossings,
we can express as
where , , and .The scanner signal (4) takes the form
where is given by (5).If is small, and approximate the zero
crossings of the second derivative of . There-
fore, if the blur factor is small, zero crossings of are
approximately the same as the zero crossings of .
This method of decoding bar codes by finding the zero
crossings of the bar code signal second derivative is very
popular in applications. It can be used to estimate the original
values of the bar code parameters for the EM algorithm.
Our procedure of decoding bar codes consists of two parts:
A bar code is decoded using zero crossings of ; if
the recovered code is a legal bar code, the procedure outputs
8/3/2019 00655421
8/10
TURIN AND BOIE: BAR CODE RECOVERY VIA THE EM ALGORITHM 361
Fig. 6. Fitted signal when the correct bar code was determined.
it. Otherwise, the estimates of the zero crossings are used to
calculate initial values ,
and they are reestimated by (16)(19). The bar code is decoded
by comparing with a threshold.
Fig. 4 compares the measured bar code signal and
with estimated by the zero crossings of
when the zero crossing part of the algorithm failed to decode
a legal bar code. Fig. 5 illustrates the fit after 40 iterations.However, the correct bar code has been decoded after 11
iterations when the fit was not so good (see Fig. 6).
F. Discrete Approximation
Usually, the received signal is given by its samples
. In this case, integrals in the previous equa-
tions are replaced with sums by one of the well-known
numerical methods [23]. Alternatively, we can formulate the
problem of fitting in terms of discrete samples. The log-
likelihood function has the form
where we assume that and are the normalized
sequences so that they can be treated as discrete probability
distributions. In this formulation, we are trying to fit samples
of the model to the corresponding samples of the
scanner signal. If sampling rate is high, (4) can be written as
where is a discrete convolution of a rectangular
pulse of duration centered at with
Repeating the derivations of Section III-A, we obtain equations
similar to (9)
where . Similarly, we obtain a discrete
analog of (16)(19)
8/3/2019 00655421
9/10
362 IEEE TRANSACTIONS ON SIGNAL PROCESSING, VOL. 46, NO. 2, FEBRUARY 1998
where
Here, we used the rectangular approximation of the integration
area, where bar denotes the normalized sequence. We can also
use other rules (such as trapezoidal rule, Simpson formula,
splines, Gaussian quadratures, etc.) to improve the integration
accuracy or achieve the same accuracy with smaller number
of samples.
IV. CONCLUSION
The EM algorithm shows promise for extending the per-
formance of bar code readers. In one experiment, a UPC
code label was positioned near focus where the present signal
processing method read it well. As the label was movedaway from focus, a distance from focus was reached where
conventional bar code readers failed, but the EM algorithm
decoded the bar code correctly. The EM algorithm successfully
doubles the scanner depth of field. Preliminary experiments
with common label printing distortions (such as overprinting
and underprinting) also show promise.
APPENDIX
In this Appendix, we derive (8)(10) for reestimating the
constrained model parameters. We need to find a maximum of
(A1)
where . Takingthe logarithm in (A1), we obtain
(A2)
where
It follows from (A2) that maximum of is attained at
where , , and can be found from the system
which has the form
(A3)
where
, and are defined by (14) and (15).
Solving the system, we obtain the th iteration of theEM algorithm
ACKNOWLEDGMENT
The authors would like to acknowledge J. Snitow for his
help in collecting bar code data and developing software for
this project. Helpful suggestions and remarks of the anony-
mous reviewers are gratefully acknowledged.
8/3/2019 00655421
10/10
TURIN AND BOIE: BAR CODE RECOVERY VIA THE EM ALGORITHM 363
REFERENCES
[1] L. S. Davis, Survey of edge detection techniques, Comput. Graph.Image Process, vol. 16, no. 1, pp. 248270, Apr. 1975.
[2] H. Hildreth, The detection of intensity changes by computer andbiological vision systems, Comput. Vision Graph. Image Process., vol.22, pp. 127, Apr. 1983.
[3] D. Marr and H. Hildreth, Theory of edge detection, Proc. R. Soc. Lond. B, vol. 207, pp. 187217, 1980.
[4] R. A. Boie, I. J. Cox, and P. Rehak, On optimum edge detection, IEEE
Trans. Pattern Anal. Machine Intell., vol. PAMI-8, pp. 100108, 1986.[5] R. A. Boie and I. J. Cox, Two dimensional optimum edge recognitionusing matched and Wiener filters for machine vision, in Proc. IEEEFirst Int. Conf. Comput. Vison, June 1987, pp. 450456.
[6] K. S. Shanmugan, F. M. Dickey, and J. Green, An optimal frequencydomain filter for edge detection, IEEE Trans. Pattern Anal. Machine
Intell., vol. PAMI-2, pp. 3749, 1979.[7] T. Pavlidis, J. Swartz, and Y. Wang, Fundamentals of bar code
information theory, Inst. Elec. Eng. Comput., pp. 7486, Apr. 1990.[8] E. Joseph and T. Pavlidis, Bar code waveform recognition using peak
locations, IEEE Trans. Pattern Anal. Machine Intell., vol. 18, pp.630639, June 1994.
[9] J. Dybowski, Between the lines, Comput. Applications J., vol. 53, pp.78114, 1994.
[10] R. J. Tom, W. I. Hilles, B. M. Mergenthaler, and D. M. Blanford,Multiple bar code decoding system and method, U.S. Patent 5 262 625,Nov. 16, 1993.
[11] M. Concetta, M. C. Morrone, and D. C. Burr, Feature detection in
human vision: A phase-dependent energy model, in Proc. R. Soc. Lond.B, vol. 235, pp. 221245, 1988.
[12] V. Torre and T. A. Poggio, On edge detection, IEEE Trans. PatternAnal. Machine Intell., vol. PAMI-8, no. 2, pp. 147163, 1986.
[13] G. Zalman and J. Shamir, Maximum discrimination filter, J. Opt. Soc.Amer. A, vol. 8, no. 5, May 1991.
[14] J. S. Chen and G. Medioni, Detection, localization, and estimation ofedges, IEEE Trans. Pattern Anal. Machine Intell., vol. 11, Feb. 1989.
[15] R. A. Hummel, B. Kimia, and S. W. Zucker, Deblurring Gaussian blur,in Comput. Vision Graph. Image Process., vol. 38, pp. 6680, 1987.
[16] J.-B. Martens, Deblurring digital images by means of polynomialtransforms, in Comput. Vision Graph. Image Process., vol. 50, pp.157176, 1990.
[17] Y. Vardi and D. Lee, From image deblurring to optimal investments:Maximum likelihood solutions for positive linear inverse problems, J.
R. Statist. Soc., vol. 55, pp. 569612, 1993.[18] A. P. Dempster, N. M. Laird, and D. B. Rubin, Maximum likelihood
from incomplete data via the EM algorithm, J. R. Statist. Soc., vol. 76,pp. 341353, 1997.[19] J. Proakis, Digital Communications, 2nd ed. New York: McGraw-Hill,
1989.
[20] E. A. Lee and D. G. Messerschmitt, Digital Communication. Boston,MA: Kluwer, 1988.
[21] S. Kullback, Information Theory and Statistics. New York: Wiley,1959.
[22] W. Turin, Fitting probabilistic automata via the EM algorithm, Stoch.Models, vol. 12, no. 3, pp. 405424, 1996.
[23] W. H. Press, S. A. Teukolsky, W. T. Vetterling, and B. P. Flannery,Numerical Recipes in C. Cambridge, U.K.: Cambridge Univ. Press,1992.
William Turin (SM83) received the M.S. degree inmathematics from Odessa State University, Odessa,U.S.S.R., in 1958 and the Ph.D. degree in mathemat-ics from the Institute for Problems of Mechanics ofthe Academy of Sciences of the U.S.S.R., Moscow,in 1966.
From 1960 to 1979, he was associated withthe Moscow Institute of Electrical Engineering andTelecommunications, first as an Assistant and lateras an Associate Professor. From 1980 to 1981,he was a Senior Research Scientist, Department
of Psychology, New York University, New York, NY. Since 1981, he hasbeen a member of the Technical Staff at AT&T Bell Laboratories, Holmdeland Murray Hill, NJ. Currently, he is a Technology Consultant at AT&T
Laboratories-Research, Florham Park, NJ. His research interests include digitalsignal processing, handwriting and speech recognition and compression,computer simulation, error correcting codes, microwave radio, and Markovprocesses. He has published 70 papers and is the author of four books.
Robert A. Boie was born in New York, NY, onApril 24, 1939. He received the A.B. degree inphysics from the University of Connecticut, Storrs,in 1965.
He has held research positions at Bell Labora-tories, Holmdel, NJ, Brookhaven National Labo-ratories, Brookhaven, NY, and, most recently, atAT&T Laboratories, Murray Hill, NJ. He is cur-
rently a Principal Member of Technical Staff in theConsumer Electronics Research Department, AT&TLaboratories, Florham Park, NJ. He is interested in
devices, instrumentation, and analog design.