Analysis of Edge Detection in Bar Code Symbols : An Overview and Open Problems

Accurate edge localization is essential in bar code decoding. Since speckle noise is the most dominant form of noise in laser bar code scanners, it is important to fully understand its effects on edge detection. Starting with the basic statistical properties of speckle patterns, we present stochastic analysis of speckle noise. We derive the autocorrelation function and power spectral density PSD of the noise in terms of intensity distribution of the scanning beam. We then study the signal-to-noise ratio for signals that result from scanning different configurations of edges. Next, we consider statistical properties of edge localization error caused by speckle noise. We show that the standard deviation of the error is determined by the PSD of the noise and relative positions of edges in a bar code symbol. Based on the analysis presented here, we propose new criteria for system design.


Introduction
Image processing, traditionally an engineering field, has recently attracted attention of the mathematical community.One of the most important image features is edges which are modeled as discontinuities in the gray level of an image.Edge detection is concerned with localization of these discontinuities.Information extracted from edges is used for image processing such as segmentation, recognition, enhancement, and compression.Edge detection also finds an important application in laser bar code scanning.Information stored in a linear bar code is encoded in a string S p 1 , p 2 , . . ., p n , called digital bar pattern, which represents a sequence of widths of black bars and white spaces.The way information is stored in a bar code symbol depends on the symbology 1 .One of the most popular symbologies is the universal product code version A UPCA which is widely used in retail stores.Figure 1 shows a UPCA symbol encoding the digits "0122345678905."UPCA symbols encode twelve digits where each digit consists of two bars and two spaces code words with a total width  of seven modules.Encodation patterns for digits between 0 and 9 are listed in Table 1 in Section 4.2.For decoding purposes, it is important to keep track of the scanning direction.Thus, each digit is assigned two code words which are mirror images of each other: those on the right side of the symbol start with a bar and those used on the left side start with a space.Each UPCA symbol contains the following groups of code words see Figure 1 : 1 a left guard pattern 101, 2 six digits on the left side: one digit denoting industry type and five digits with manufacturer's code, 3 a center guard pattern 01010, 4 six digits on the right side: five digits with item code and one check digit, 5 a right guard pattern 101.The structure of the UPCA symbols allows "scanning by halves" since each half can be scanned separately, and the symbol can be put together afterwards.This gives the advantage of scanning UPCA bar code from different directions.Since the resulting digital bar pattern is recovered from the positions of bar/space edges, accurate edge localization is critical in bar code decoding.
Bar code signal processing can be viewed as an input-output system schematically shown in Figure 2. Here, f t is an observed signal photodetector current in a laser scanner , and P represents a signal processor.The processor P depends on signal modeling and representation.If the signal derivative f t is modeled as a hidden Markov chain, then P is based on maximum likelihood estimation 2 .The digital bar pattern is chosen such that it fits the observed data f t with the highest probability.The statistical properties of f t can be modeled from heuristic considerations or inferred using learning theory such as the Baum-Welch algorithm 3 .A bar code signal f t can also be modeled as a function of bounded variation.In this case, the signal processor is based on minimization of a total variation functional over an appropriate function space 4 .The minimization algorithm performs both filtering and deblurring, and it is very robust under high noise and blur.However, it is computationally expensive for implementation in commercial scanners.For related total variation-based techniques in image processing, see 5-9 .Edge detection techniques based on multiresolution analysis, anisotropic diffusion filtering, and level set methods can be found in 10-18 .In this paper, we consider edge detection in bar code symbols based on Canny's algorithm 19, 20 .It relies on finding local extrema of f t where f t is assumed to be a C 2 function.Here, the signal processor P consists of three steps: differentiation, filtering, and edge labeling.The signal is filtered in order to regularize the derivative operator which amplifies high frequencies.Edge labelling is a process in which true edges are separated from noised or false edges.When the edges are labelled, a digital bar pattern is produced and sent to a decoder for further processing.
Laser bar code scanners are very sensitive to noise because an error in the position of a single edge may cause a failure to read the bar code or to read it incorrectly.There are several sources of noise in a bar code scanner: Johnson or thermal noise, shot noise, and speckle noise.Thermal and shot noise are noise currents that are observed in electronic circuits 21, 22 .Thermal noise 23, 24 is associated with random fluctuations of the velocities of electrons in a conductor.It is independent of any applied voltage, and hence, it is present even if no current flows in the conductor.Shot noise 25 is generated by fluctuations of the number of electrons, and it manifests itself only when a current flows in a conductor.The power spectral densities of both types of noise are nearly constant throughout the frequency spectrum.The power of thermal noise is given by the Nyquist formula where k B is the Boltzmann's constant, T is the temperature in Kelvins, and Δf is the frequency band.Similarly, the power of shot noise is where e is the electron charge, I is the current, and R is the resistance of the conductor.The power of thermal noise in a scanner is normally several times greater than the power of shot noise.A more recent review of the properties of thermal and shot noise can be found in 26, 27 .
In contrast to thermal and shot noise, speckle noise is an optical phenomenon which results when spatially coherent electromagnetic EM field is scattered from a diffuse surface, such as paper on which a bar code is printed.The scattered light forms a random interference pattern in the photodetector aperture.As the laser beam moves across the surface, temporal changes in the intensity of the pattern induce fluctuations in the photodetector current.It turns out that under normal operating conditions the effects of thermal and shot noise are negligible compared to speckle noise, which is the main factor limiting the performance of a bar code scanner.Only in long-range applications, when the photodetector signal is weak, the performance is limited by a mixture of electronic and speckle noise.Therefore, in this work, we limit our attention to speckle noise and investigate its effects on edge detection.We present stochastic properties of speckle noise and study the signal-to-noise ratio and edge localization error caused by the noise.We remark that speckle noise is difficult to filter because its spectrum often overlaps with the spectrum of a noise-free signal.However, investigation of the effects of speckle noise on edge detection may lead to more efficient filtering techniques.
The paper is organized as follows.In Section 2, we give an overview of statistical properties of static speckle patterns.We then study dynamic speckle which induces noise in the photodetector signal.We show that speckle noise is a weakly stationary random process and calculate the autocorrelation function and power spectral density of the noise.Since differentiation is used in edge detection, we also study stochastic properties of differentiated speckle noise.Section 3 is devoted to estimating the signal-to-noise ratio for bar code signals corrupted by speckle noise.As a toy model, we study signals obtained by scanning a single edge and an infinite sequence of edges.In Section 4, we address the problem of finding the edge localization error.We derive a first-order approximation of the error in terms of the power spectral density of speckle noise.We show that the standard deviation of the error depends on spectral characteristics of the noise and on relative locations of edges in a bar code symbol.This result is used to study susceptibility of different bar code symbols to edge localization error.Finally, we discuss how the theoretical analysis presented here can be used in system design.In particular, we propose a new criterion for estimating the working range of a scanner based on the combined effect of convolution distortion and edge localization error.

Statistics of Speckle Patterns
This section summarizes the basic properties of speckle relevant to applications in bar code scanning.Consider the free space propagation geometry shown in Figure 3.A focused laser beam is incident on a diffuse surface, and the scattered wave is captured by a photodetector  in the observation plane.A speckle pattern formed in the observation plane results from interference of EM waves reflected from a large number of microscopic scatterers randomly distributed in the illuminated region.The pattern is characterized by a multitude of tiny spots speckle of varying size and intensity.Figure 4 shows a Gaussian beam incident on the scattering surface and the resulting speckle pattern.A comprehensive review of speckle properties can be found in Goodman's chapter in 28 .More recent developments in the field have been discussed in 29, 30 .
In our analysis, we assume the same conventional model of the scattering surface as in 28 .Let U ∈ L 2 R 2 be a complex-valued function which describes the scalar components of the EM field of the laser beam.A description of only one component is sufficient to describe the properties of the beam.The scattered waves are randomly dephased; hence, the EM field transforms according to where φ ξ, η is a random phase acquired at the point ξ, η in the scattering plane.We make the following assumptions about the random function φ ξ, η : The EM field in the observation plane is given by the Fresnel integral transformation 31 where K is the convolution kernel , λ is the optical wavelength, and z is the distance between the scattering and observation planes.The transformation T : where μ is the complex coherence function of the optical field U defined by The function μ is related to the average speckle size in the following way.Intuitively, if the correlation between intensity levels I s x 1 , y 1 and I s x 2 , y 2 is high, then the points x 1 , y 1 and x 2 , y 2 belong to the same speckle cell.For a fixed point x 1 , y 2 , it is reasonable to define the speckle correlation area average speckle size as where ρ is the correlation coefficient

2.11
Here, cov is the covariance of the random variables X 1 and X 2 .Using 2.7 and 2.8 , we find Hence, the speckle correlation area is given by μ x, y 2 dx dy.

2.13
Since the complex coherence function is proportional to the Fourier transform of the beam intensity I ξ, η |U ξ, η | 2 , one can use the Parseval's identity to obtain 2.14

Power Spectral Density of Speckle Noise
In the preceding subsection, we discussed statistical properties of static speckle patterns.Next, we consider time-varying speckle which arises when a laser beam scans a surface of constant reflectance e.g., white paper , as shown in Figure 3. Early analysis of speckle noise in laser scanning systems and comparison of theoretical results with experiment were given in 33 .The scattered light is converted to an electrical signal f t by a photodetector.Temporal changes in the speckle pattern intensity induce random fluctuations, called speckle noise, about the average value of f t .The signal is a continuous time random process A x, y I s x, y, t dx dy.

2.15
Here, I s x, y, t is the speckle intensity at instant t, R is optical-to-electrical signal conversion factor, and the function 0 < A x, y ≤ 1 characterizes the photodetector response.A description of statistical properties of dynamic speckle can be found in 30 .We assume that A has compact support bounded by the photodetector aperture.Since the surface reflectance is constant, the expected value of I s x, y, t is independent of both space and time coordinates, that is, E I s x, y, t I s where I s is given by 2.5 .It follows from 2.15 that the expected value of f t is given by where A d R 2 A x, y dx dy.Let us denote f RA d I s .In view of 2.5 , f can be expressed as where Ω d A d cos θ / πz 2 represents the fraction of the scattered power of the beam captured by the detector aperture.
Important statistical properties of f can be derived from the autocorrelation function In view of 2.15 , we find where is the autocorrelation of dynamic speckle.Without loss of generality, we assume that the optical field U moves in the ξdirection.The function R ds can be found by considering R ds to be the cross-correlation function of two static speckle patterns at instants t t 1 and t t 2 .Using this argument, one can express R ds in terms of the complex coherence function μ d of the moving optical field as where and U * denotes the complex conjugate of U. We note that for τ 0 we have μ d x, y, 0 μ x, y .Thus, R ds R s when the two speckle patterns overlap.The behaviour of the complex coherence function μ d for different optical fields is described in 32 .Substituting 2.19 into 2.18 , we obtain

2.21
Introducing the variables x x 2 − x 1 , y y 2 − y 1 , and τ t 2 − t 1 , the above integral takes the form where is the autocorrelation of the weighting function A. In many cases of practical interest, the magnitude of |μ d x, y, τ | 2 tends to zero very rapidly as |x| and |y| increase, that is, where δ > 0 is small compared to the size of a detector aperture.Then, the integral in 2.22 can be approximated by which largely simplifies the calculation of R f τ .Validity of this approximation is justified by the example in Section 2.4.Using the approximation 2.25 , we obtain where is the effective aperture area.We note that if A x, y is the characteristic function of the aperture, then A e A d , the physical area of the aperture.
The autocorrelation R f τ can be conveniently expressed in terms of the intensity distribution I ξ, η |U ξ, η | 2 of the laser beam.Using 2.20 and applying the Parseval's identity, we find Hence, 2.26 becomes

2.29
Therefore, the autocorrelation function of the signal f t is completely determined by the intensity distribution of the scanning beam.A more intuitive expression for R f τ is provided by substituting the speckle correlation area 2.14 into 2.29 , Note that the ratio A e /S c represents the average number of speckle correlation cells in the photodetector aperture speckle density .
One can readily show that if the initial speckle pattern is a superposition of N statistically independent patterns, I x, y, t N k 1 I k x, y, t , with expected value E I k x, y, t I s /N, then R f τ is modified according to This observation is important because when a polarized laser beam is scattered from a dielectric surface, it gets depolarized.The resulting speckle pattern is then equivalent to a superposition of N 2 independent patterns.Since E f t and R f t 1 , t 2 are invariant under time translation, the process f is weakly stationary.By the Wiener-Khinchin theorem 34, 35 , the power spectral density PSD of f is the Fourier transform of the autocorrelation function R f τ , provided R f τ is continuous at τ 0. The PSD describes the distribution of the signal power in the frequency domain.The total power is given by Hence, 2.31 yields

2.34
Speckle noise represents random fluctuations about the average signal value f .Thus, the speckle noise power is the variance σ 2 f of the process f.For weakly stationary processes, we have P f f 2 σ 2 f , which in view of 2.34 yields

35
Relation 2.35 shows that the noise power is multiplicative in the sense that it is proportional to the average signal power f 2 .Consequently, speckle noise cannot be made relatively smaller by increasing the signal power.We also note that the noise power is proportional to S c .Therefore, the noise can be reduced by reducing the average speckle size.This is intuitively clear since smaller speckle induces smaller fluctuations in the detector signal.
Let us now derive an explicit expression for the power spectral density 2.32 .Substituting 2.31 into 2.32 , we have where δ ν is the Dirac delta function.Very often laser beams are symmetric in the scanning direction, that is, I −ξ, η I ξ, η .In this case, the PSD can be simplified as Expressed in this form, the PSD can be easily computed using FFT and a numerical integration algorithm, which is important from the standpoint of applications.

Statistical Properties of Differentiated Speckle Noise
In the conventional approach to edge detection using Canny's algorithm, the signal f t is differentiated in order to enhance edges.Since differentiation amplifies high frequencies, it is important to understand the statistical properties of differentiated speckle noise.Let f denote the random process {f t | t ∈ R} where f t is the derivative of f t .Since f is also weakly stationary, the power spectral densities of f and f are related by 34 Using 2.36 , we find The total power of the process f is now given by

2.40
The above expression can be simplified to a double integral provided the intensity distribution satisfies

2.41
These conditions are met in all applications since I ξ, η has bounded partial derivatives, and it rapidly tends to zero away from the beam centre this is easily verified for Gaussian beams .Assuming conditions 2.41 , let us define the function where H ξη ν R H ξ,η τ exp i2πντ dτ is the Fourier transform of H ξ,η τ .Substituting the identity

2.44
Then the integral in 2.40 becomes

2.47
We refer to 2.47 as the total power of differentiated speckle noise.Since E f t 0, the power P f equals the variance σ 2 f of the process f .

Example: Elliptical Gaussian Illumination
Many lasers emit beam whose optical field can be approximated by the elliptical Gaussian function where ω x and ω y are the beam radii in the ξ and η directions, and P R 2 |U ξ, η | 2 dξ dη is the beam power.Diffraction causes light waves to spread transversely to the direction of propagation.For a Gaussian beam propagating in free space, the beam size is minimum at some point along the axis, called the beam waist.If ω 0x and ω 0y are the beam radii at the waist, then at some distance z measured from the waist, the beam size is given by 36 , ω y ω 0y 1 λz πω 2 0y 2 .

2.49
Let us calculate the average size of speckle generated by a Gaussian beam.Substituting the beam intensity I ξ, η |U ξ, η | 2 from 2.48 into 2.14 , we find that the speckle correlation cells have elliptical shape of average area S c π λz πω x λz πω y .

2.50
It is interesting to note that using geometrical considerations, Ennos 37 estimated the average speckle diameter to be d 1.2λz/D where D is the diameter of the laser beam.For a circular Gaussian beam with ω x ω y ω, the speckle correlation area S c corresponds to a circle with diameter

2.51
This is indeed very close to the estimated value derived in 37 with D 2ω.
The complex coherence function 2.20 of the moving field is given by

2.52
The maximum value of |μ d x, y, τ | 2 is attained at x y 0. For a fixed value of τ > 0, the "support" of |μ d x, y, τ | 2 can be defined as the subset Ω ⊂ R 2 such that sup where S c λz 2 / πω x ω y is the average speckle size.Since a typical detector aperture contains a large number of speckle cells, the support of μ d is much smaller than the aperture.This justifies the approximation made in 2.25 .
The autocorrelation function 2.30 is given by

2.56
Now, the PSD of the processes f and f are found to be

2.58
Integrating 2.58 over the real line, we obtain the power of differentiated speckle noise where S c is given by 2.50 .

Signal-to-Noise Ratio
Thus far, we considered only signals corrupted by speckle noise when a laser beam scans a surface of uniform reflectance.Next, we turn our attention to signals that result from scanning different configurations of edges.As a toy model, we consider a single edge and an infinite sequence of edges.An edge is defined as a boundary between two regions of different reflectance.The higher reflectance is normalized to one, and the lower reflectance is denoted by ρ ∈ 0, 1 .The gray level of a sequence of bars and spaces is modeled by a piecewise constant function B ξ .The photodetector signal is now given by f t s t n t , 3.1 where s t is the noise-free signal, and n t is speckle noise.The noise-free signal is the convolution where is the line spread function of the beam, and P R 2 I ξ, η dξ dη is the beam power.Note that if the reflectance is constant, B ξ ρ, then f s t f 0 ρ; hence, f 0 is the maximum value of f corresponding to ρ 1.In view of 2.17 , we have f 0 P RΩ d .
Information about edges is extracted from the derivative of f t .Figure 5 shows the derivative of a signal corrupted by speckle noise obtained by scanning the bar code in Figure 1.Suppose for the moment that the signal is noise-free, that is, f t s t .Then the local extrema of s t above a certain threshold correspond to edges, as illustrated in Figures 6 and 7. Thus, it is appropriate to define the signal S by S max t s t .

3.4
Accordingly, we define the signal-to-noise ratio SNR to be where σ 2 n denotes the power of differentiated speckle noise.We are interested in obtaining a lower bound for SNR when the speckle noise power is maximal.This happens when the beam is scattered from the region of higher reflectance ρ 1 in which case f f 0 .Combining 2.14 and 2.47 , we can express σ 2 n as

3.6
Let us now consider specific examples.

One Edge
The gray level of a single edge is given by where H ξ is the Heaviside step function: The line spread function has a global maximum at its centre, and thus, the signal S yields Therefore, a lower bound for SNR is given by L 2 0 ∂I/∂ξ 2 .3.10

Infinite Sequence of Edges
Consider an infinite sequence of black and white bars of width D where the middle of a white bar is placed at ξ 0, as shown in Figure 7.The gray level is represented by

3.11
The distributional derivative of B ξ is the generalized function 12 which together with 3.2 yields

3.13
We show that under certain mild assumptions which are satisfied in applications, the maximum of |s t | is attained at the point V t D/2.Let us expand B ξ into generalized Fourier series where i √ −1.Using relation 3.14 , we find that the signal derivative is given by where is the Fourier transform of L ξ .If the laser beam is symmetric in the scanning direction, then L ξ is an even function which implies L −ν L ν .One can use the symmetry of L ν to obtain 3.17 Most often laser beams used in scanning applications have a nearly Gaussian profile.Thus, the Fourier transform of the line spread function may be assumed to be nonnegative, L ν ≥ 0 for all ν ∈ R. Since sin π/2 2k 1 −1 k , it follows from 3.17 that the maximum value of |s t | is attained at V t D/2, which yields Finally, using 3.6 and 3.18 , we find a lower bound for SNR to be 3.19

SNR for Gaussian Optical Field
In the following, we illustrate the estimates of SNR for a beam with Gaussian intensity.We also describe qualitative dependence of SNR on the scan distance z.The line spread function of the Gaussian field 2.48 is given by

3.24
We note that SNR ∞ depends on the spot-to-bar ratio r 2ω x /D which plays an important role in bar code signal analysis.In most cases, 1 ≤ r ≤ 3; hence, the series in 3.24 converges very quickly, and it suffices to keep only the first few terms.This is intuitively clear since the edges far away from the beam do not contribute to the SNR. Figure 8 shows dependence of SNR ∞ on the spot-to-bar ratio r ∈ 1, 3 .It is apparent that SNR ∞ is maximum when r 1 which implies that narrow beams r D have better SNR than wide beams r 3D .

Dependence of SNR on Scan Distance
Recall that the beam size changes along the propagation axis according to 2.49 .Thus, the SNR is a function of the scan distance z, which we investigate next.Suppose the beam waist is at a distance z w from the photodetector.Since the laser is placed next to the photodetector, the scan distance can be written as z z w z where z is the distance from the waist to the scattering plane.For simplicity, we assume that the beam is circular, that is, ω 0x ω 0y ω 0 .Then in view of 2.49 ,

3.25
Let us define the dimensionless variables u λz /ω 2 0 and u w λz w /ω 2 0 .Substituting 3.25 into 3.22 and rearranging terms, we obtain where

3.27
For a particular scanner, the waist location z w is fixed it is close to the output surface of the laser .Thus, 3.26 provides dependence of SNR 1 on the scan distance z z w z .The function f u is decreasing for −u w < u < π 2 /u w and increasing for u > π 2 /u w .It has a local minimum at u min π 2 /u w , that is, at z min π 2 ω 4 0 / λ 2 z w .The lowest value of SNR 1 is attained at z min z min z w and

3.28
Typical values of the wavelength and spot size are λ 670 • 10 −9 m, ω 0 ≈ 10 −3 m, and z w ≈ 10 −1 m.For these values of λ, ω 0 , and z w , we have z min z w ; hence, the minimum occurs far beyond the working range of a scanner.Consequently, for application purposes, we may consider SNR 1 simply a decreasing function of z, which implies that better SNR is achieved at shorter scan distances.
The same qualitative behaviour can also be deduced by analyzing SNR ∞ .Let us define Q exp − π 2 /8 r/2 2 where r 2ω x /D is the spot-to-bar ratio at distance z.Then 3.24 can be written as

3.29
We wish to find an approximate expression for SNR ∞ .Define Q 0 exp − π 2 /8 r 0 /2 2 where r 0 2ω 0 /D is the spot-to-bar ratio at the waist.It is easily seen that for r 0 ∈ 1, 3 , we can make the approximation Since ω 0 ≤ ω x , we have 0 < Q ≤ Q 0 < 1; hence, the approximation 3.30 also holds for Q.Therefore, SNR ∞ can be approximated by for all r 0 ∈ 1, 3 .Now, substituting 3.25 into 3.31 , we find where

3.33
The behaviour of g u is more complex than f u , and it depends on the exact values of the parameters u w λz w /ω 2 0 and r 0 2ω 0 /D.For typical values of λ, ω 0 , and z w as given above, the function g u is monotonically decreasing for all r 0 ∈ 1, 3 .This means that SNR is larger at shorter scan distances.Since a laser beam spreads as it propagates, this is in agreement with earlier finding that a better SNR is achieved for smaller spot-to-bar ratios r 2ω x /D.

Edge Localization Error
In this section, we investigate the edge localization error in bar code signals caused by speckle noise.Suppose the edges are located at X 1 < X 2 < • • • < X n , so the gray level of a bar code is represented by 4.1 As explained earlier, the observed signal is given by 3.1 , and the edges are detected by finding the local extrema of f t .There are several difficulties related to this approach.First, a local extremum of f t may represent a noised edge, which is clearly seen in Figure 5. Second, even in noise-free conditions, an edge may be erroneously detected due to convolution distortion blur , or due to a specific shape of the line spread function.Figure 9 a shows a single bar with gray level B ξ H ξ 1 − H ξ − 1 scanned by the Gaussian beam 2.48 at two different scales: ω x 1 and ω x 3. It is evident that the distance between the local extrema of s t increases with ω x , which distorts the apparent bar width.In general, the neighbouring edges interact with each other, and the convolution distortion becomes more complicated.For a modification of the standard technique for edge detection which deals with severely blurred bar codes, see 20 and 38 .If the line spread function is not Gaussian, then the local extrema of s t may lead to false edges as in Figure 9 b .This figure shows a single bar scanned by the beam with intensity where r ξ 2 η 2 , and J 0 is the zero-order Bessel function of the first kind.Due to its slow divergence, this kind of beam is used in some scanners for long-range applications.These two effects combined together make edge detection even more difficult.
In our analysis, we assume that the convolution distortion is sufficiently small, and we focus our attention on edge localization error caused by speckle noise only.Suppose that the signal f t s t n t is given by 3.1 -3.3 .In the preprocessing stage, the derivative f t is filtered by a linear filter with impulse response h t .An algorithm for selecting optimal filter scale based on the narrow element estimate is presented in 2 .Applications of multiscale algorithms in edge detection can be found in 13-15, 39 .After filtering, the observed signal becomes We denote g 0 t h * s t and g n t h * n t where * is the convolution operator x * y t R x t − τ y τ dτ.Since the derivative of speckle noise is a weakly stationary process, so is the process g n {g n t | t ∈ R}.Now, we pose the following problem: given spectral characteristics of the process n {n t | t ∈ R} estimate the error in locating the edges in 4.1 .In general, this is a fairly complicated problem, so we introduce several simplifying assumptions.Let us examine more closely the noise-free signal g 0 t h * s t .By substituting 4.1 into 3.2 , we obtain where L V t L V t and T k X k /V are the edge positions in time domain.The edge locations in noise-free conditions are approximated by solutions of the nonlinear equation The number of solutions t k of 4.5 is usually greater than the number of edges, depending on the exact shape of the line spread function.Furthermore, t k / T k due to convolution distortion.
In our analysis, we will assume that the data {t k } n k 1 is given and is sufficient to perform decoding, that is, t k 1 − t k ≈ T k 1 − T k for all k.This is true if the support of L ξ is comparable in size with min k |X k 1 − X k |, the smallest bar or space.
If the signal is corrupted by noise, we are interested in solutions of the equation g 0 t g n t 0, 4.6 which represent small random perturbations of the noise-free solutions {t k } n k 1 .Let t be a solution of 4.6 , and let e k t−t k be a random error associated to t k .The statistical properties of the random variable e k depend on the process n {n t | t ∈ R}.It is shown in 40 that for small errors the expected value of e k is E e k 0. Furthermore, the second moment of e k is given by where h ν is the Fourier transform of h t , and S n ν is the power spectral density of n.We define the edge position error to be the standard deviation

4.8
The above relation shows that δ k depends on the spectral characteristics of the noise n as well as the positions of edges in a bar code symbol.The function h * L V t often decays rapidly to zero as |t| grows, that is, h * L V t k − T i ≈ 0 when |t k − T i | is large.Hence, only the nearest neighbours of edge k contribute to the error δ k .

Speckle Noise and Edge Localization Error for Gaussian Optical Field
As noted earlier, the laser beam profile most often used in scanning is approximately the Gaussian function.Hence, it is instructive to study the edge localization error when the optical field is given by 2.48 .We assume that the filer impulse response is given by is the error obtained from 4.8 if h t is replaced by the Dirac function δ t .

Susceptibility of Bar Code Symbols to Edge Localization Errors
Relation 4.16 is very useful in studying the distribution of edge localization errors caused by speckle noise in different bar code symbols.When convolution distortion is small, that is, x k ≈ X k for all k, the edge localization errors in a given bar code symbol can be analyzed as follows.
The width of a bar or space in a symbol is a multiple of a unit width D, called module.We may assume that the edges are located at We introduce the spot-to-bar ratio r 2ω x /D as a measure of the beam size 2ω x relative to the smallest bar or space.Using 4.16 , the edge localization error relative to the module size can be written as where we have used x k X k .The relative error δ 0 k /D can be used to define susceptibility of a bar code symbol to edge localization errors.Here, we should take into account that a large error in the position of a single edge can make the entire bar code unreadable.This suggests that susceptibility should be defined by Note that S is proportional to 1 − ρ −1 3πS c / 8NA e which depends only on the physical characteristics of the system.Hence, we introduce susceptibility which is intrinsic to the bar code symbol alone by S 0 max k |E k S | where

4.20
The measure S 0 depends only on the relative positions of edges, that is, the message content of the bar code, and the spot-to-bar ratio r. Figure 10 shows the distribution of errors E k S when S encodes the message "012345678905."Investigation of the error distributions for a large number of UPCA symbols reveals that this is a typical result: the errors E k S cluster around the values 0.5, 0.35, and 0.27.Hence, all UPCA symbols have approximately the same maximum error S 0 0.5 which is about twice as large as the minimum error.One can similarly study the distribution of errors in other popular symbologies, such as code 39 and code 128, and for different beam profiles.We remark that if the approximation x k ≈ X k is not valid, then the apparent edge positions x k must be computed numerically from 4.15 .

Applications to System Design and Open Problems
The theoretical analysis presented here can be used as a guide in system design.Here, we discuss several possibilities that will be investigated in future work.Performance of a bar code scanner greatly depends on how the laser beam is focused.Beam focusing is guided by two key requirements imposed on the scanning device: i bar code density, that is, the smallest bar code a scanner can read, ii working range within which bar codes can be decoded.
The working range is estimated by using the modulation transfer function MTF of the scanning beam.Let L ξ be the line spread function of the beam, and let ν 0 be the spatial frequency of the smallest bar or space we wish to read ν 0 1/ 2D .For symmetric beams, the MTF is given by MTF | L ν 0 |.Since the beam intensity changes with scan distance z, so does the MTF.By plotting the MTF as a function of z, one can estimate the region of decoding as the interval in which the MTF is greater than some predefined value.This analysis, however, takes into account only degradation of the image due to finite size of the beam.
We propose an alternative approach which also takes into account the effects of speckle noise on decoding process.Bar code decoding is based on the distance between two adjacent edges.Suppose the edges are located at x k and x k 1 , where x k V t k are solutions of 4.5 .The convolution distortion of a bar space between the edges X k and X k 1 is defined by A bar code can be decoded if the maximum error of a detected bar space width is less than some value σ B , usually σ B B/2.Then, in noise-free conditions, we demand that The above criteria for bar code decoding also takes into account the effect of filtering since both C k and δ k depend on the filter impulse response h t .As seen in Section 2, the intensity of a laser beam depends on the scan distance z.The change in the scan distance affects the convolution distortion and the edge position error caused by speckle noise.Therefore, the quantity defined by J k z |C k z | δ k 1 z δ k z is a function of z.It follows that the working range of a scanner can be defined as the interval z 1 , z 2 such that max k J k z ≤ σ B ∀z ∈ z 1 , z 2 .

5.5
Another possible use of the above inequality is beam focusing.Since J k z depends on the beam intensity I ξ, η , for a desired interval z 1 , z 2 , one should try to design a beam such that 5.5 holds.This condition can also be used to optimize the filter impulse response h t .These considerations lead to certain variational problems that warrant further investigation.

Conclusion
In this paper, we reviewed the effects of speckle noise on bar code decoding.We have shown that when the scattering surface has uniform reflectance, speckle noise is a weakly stationary random process.We derived expressions for the autocorrelation function and power spectral density of the noise in terms of intensity distribution of the scanning beam.We have also derived estimates for a lower bound of signal-to-noise ratio when the signal is obtained by scanning a single edge and an infinite sequence of edges.In the last part of the paper, we investigated the edge localization error caused by speckle noise.We derived a first-order approximation of the error and showed that it depends on the spectral characteristics of the noise as well as relative positions of the edges in a bar code symbol.The results derived here are used to propose alternative criteria for system optimization.We have also pointed to some open problems in systems design that could be studied using the presented analysis.Throughout the paper, the theory was illustrated by analytical examples when a scanning beam has Gaussian intensity.

Figure 2 :
Figure 2: Bar code signal processing diagram.Signal processor P produces digital bar pattern S.

Figure 3 :
Figure 3: Free-space propagation model of scattered light.U ξ, η is the incident optical field in the scattering plane, and T e iφ U x, y is the optical field of the interference pattern in the observation plane.

Figure 5 :
Figure 5: Derivative of a signal corrupted by speckle noise obtained by scanning the bar code in Figure 1.

Figure 6 :
Figure 6: Derivative of a photodetector signal --generated by a Gaussian beam scanning a single edge at ξ 0.

Figure 7 :
Figure 7: Derivative of a photodetector signal --generated by a Gaussian beam scanning an infinite sequence of edges.

Figure 9 :
Figure 9: Noise-free signal s t --generated by different scanning beams: a Gaussian beam with ω x 1 and ω x 3, b beam with intensity distribution given by 4.2 .

Figure 10 :
Figure 10: Edge position errors E k S for UPCA symbol encoding the message "012345678905."

5 . 3
the signal is corrupted by speckle noise.Then the edge position x k becomes a random variable x k x k e k where e k is the error in space domain associated with speckle noise i.e., e k V e k .The detected bar space width is given by Δxk x k 1 − x k Δx k e k 1 − e k .Since E e k 0,the variance of the detected width is var Δx k E e k 1 − e k 2 .Using the Cauchy-Schwartz inequality E 2 e k 1 e k ≤ E e 2 k 1 E e 2 k , we obtain var Δx k ≤ δ k 1 δ k 2 where δ k is the edge position error defined by 4.8 .Therefore, the standard Journal of Applied Mathematics deviation of Δx k is bounded by δ k 1 δ k .This suggests that the condition 5.2 should be replaced by max k |C k | δ k 1 δ k ≤ σ B .5.4
, y 1 I s x 2 , y 2 depends only on separation between the observation points x 1 , y 1 and x 2 , y 2 .It can be shown that R s is given by 28 This type of filter acts as a low-pass filter and is commonly used in Canny's algorithm for edge detection 19 .It is known that the Gaussian filter does not create false edges as the scale σ increases 41 .The frequency response of the filter is given by h ν exp −2 πσν 2 .Furthermore, the PSD of speckle noise is given by S n ν S f ν − f 2 δ ν ; hence, in view of 2.57 , This equation has exactlyn distinct solutions t 1 < t 2 < • • • < t n .Convolution distortion is negligible if βω x ≤ min k |X k 1 − X k |,the smallest bar or space.In this case, t k ≈ T k to a very good approximation; otherwise, 4.15 must be solved numerically.The factor β is responsible for deviations of δ k from the value it would have in the absence of a filter.Indeed, lim σ → 0 17 A message stored in a bar code is encoded in the digital bar pattern S p 1 , p 2 , . . ., p n−1 .As explained earlier, the possible values of p k in the UPCA symbology are p k 1, 2, 3, 4. Each integer between 0 and 9 is encoded as a sequence p 1 , p 2 , p 3 , p 4 where 4 k 1 p k 7. Table 1 shows encodation patterns for integers 0, 1, . . ., 9. For more details on different symbologies, see 1 .For convenience, we define d k k−1 i 1 p i , 2 ≤ k ≤ n, and set d 1 0. Then the distance between a pair of edges is X k Optical-to-electrical signal conversion factor R s x 1 , y 1 ; x 2 , y 2 : Autocorrelation function of I s x, y R ds x 1 , y 1 ; x 2 , y 2 ; t 2 , t 1 : Autocorrelation function of I ds x, y; t R f t 1 , t 2 : k : Edge positions in space domain.