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

Authors: Saša Krešić-Jurić
Journal: Journal of Applied Mathematics
 (2012)

---

## Abstract

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.


---

## Body

## 1. 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𝒮=(p1,p2,…,pn), 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 pattern101,(2)
six digits on the left side: one digit denoting industry type and five digits with manufacturer’s code,(3)
a center guard pattern01010,(4)
six digits on the right side: five digits with item code and one check digit,(5)
a right guard pattern101.Table 1
UPCA encodation patterns.
Number
Pattern
0
(
3,2
,
1,1
)
1
(
2,2
,
2,1
)
2
(
2,1
,
2,2
)
3
(
1,4
,
1,1
)
4
(
1,1
,
3,2
)
5
(
1,2
,
3,1
)
6
(
1,1
,
1,4
)
7
(
1,3
,
1,2
)
8
(
1,2
,
1,3
)
9
(
3,1
,
1,2
)Figure 1
UPCA bar code encoding the digits “012345678905.”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 Figure2. Here, f(t) is an observed signal (photodetector current in a laser scanner), and 𝒫 represents a signal processor. The processor 𝒫 depends on signal modeling and representation. If the signal derivative f′(t) is modeled as a hidden Markov chain, then 𝒫 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].Figure 2
Bar code signal processing diagram. Signal processor𝒫 produces digital bar pattern 𝒮.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 C2 function. Here, the signal processor 𝒫 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
(1.1)Pthermal=4kBTΔf,
where kB is the Boltzmann’s constant, T is the temperature in Kelvins, and Δf is the frequency band. Similarly, the power of shot noise is
(1.2)Pshot=2eIRΔf,
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 Section2, 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.


## 2. Statistical Properties of Speckle Noise

### 2.1. 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 Figure3. 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].Figure 3
Free-space propagation model of scattered light.U(ξ,η) is the incident optical field in the scattering plane, and T(eiϕU)(x,y) is the optical field of the interference pattern in the observation plane.(a) Gaussian beam with optical fieldU(ξ,η)=U0exp[-(ξ/ω)2-(η/ω)2] and beam radius ω. (b) Speckle pattern in the photodetector plane generated by a Gaussian beam.
(a)
(b)In our analysis, we assume the same conventional model of the scattering surface as in [28]. Let U∈L2(ℝ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
(2.1)U(ξ,η)↦eiϕ(ξ,η)U(ξ,η),
where ϕ(ξ,η) is a random phase acquired at the point (ξ,η) in the scattering plane. We make the following assumptions about the random function ϕ(ξ,η):(i)
the phaseϕ(ξ,η) is uniformly distributed in [-π,π] at each point (ξ,η)∈ℝ2,(ii)
ϕ(ξ1,η1) is uncorrelated with ϕ(ξ2,η2) for all (ξ1,η1)≠(ξ2,η2).The EM field in the observation plane is given by the Fresnel integral transformation [31](2.2)T(eiϕU)(x,y)=∫ℝ2eiϕ(ξ,η)U(ξ,η)K(x-ξ,y-η)dξdη,
where K is the convolution kernel
(2.3)K(x,y)=eikziλzexp[i(k2z(x2+y2))],k=2π/λ, λ is the optical wavelength, and z is the distance between the scattering and observation planes. The transformation T:L2(ℝ2)→L2(ℝ2) is a bounded operator with unit norm ∥T∥=sup{∥T(u)∥∣u∈L2(ℝ2),∥u∥=1} where ∥·∥ denotes the L2-norm on ℝ2, ∥u∥=(∫ℝ2‍|u(x,y)|2dxdy)1/2. The intensity of a speckle pattern in the observation plane is given by
(2.4)Is(x,y)=|T(eiϕU)(x,y)|2.Assumptions (i) and (ii) imply thatIs={Is(x,y)∣(x,y)∈ℝ2} is a weakly stationary random process. Hence, the expected value E[Is(x,y)] is independent of the observation point. It is related to the physical characteristics of the system by
(2.5)E[Is(x,y)]=ρPcos(θ)πz2,
where P=∥U∥2 is the power of the optical field, ρ∈(0,1] is the reflectance of the scattering surface, and θ is the angle between the direction of specular reflection and direction of observation [32]. Let us denote E[Is(x,y)]=〈Is〉. The probability density function of Is(x,y) follows the negative exponential law [28]
(2.6)p(Is)=1〈Is〉exp(-Is〈Is〉),
and the variance is given by
(2.7)σs2=E[(Is(x,y)-〈Is〉)2]=〈Is〉2.Thus, the contrastσs/〈Is〉 of a speckle pattern is always unity.Since the processIs is weakly stationary, the autocorrelation function Rs(x1,y1;x2,y2)=E[Is(x1,y1)Is(x2,y2)] depends only on separation between the observation points (x1,y1) and (x2,y2). It can be shown that Rs is given by [28]
(2.8)Rs(x1,y1;x2,y2)=〈Is〉2(1+|μ(x2-x1,y2-y1)|2),
where μ is the complex coherence function of the optical field U defined by
(2.9)μ(x,y)=1∥U∥2∫ℝ2|U(ξ,η)|2exp(i2πλz(xξ+yη))dξdη.The functionμ is related to the average speckle size in the following way. Intuitively, if the correlation between intensity levels Is(x1,y1) and Is(x2,y2) is high, then the points (x1,y1) and (x2,y2) belong to the same speckle cell. For a fixed point (x1,y2), it is reasonable to define the speckle correlation area (average speckle size) as
(2.10)Sc=∫ℝ2ρ(Is(x1,y1),Is(x1+x,y1+y))dxdy,
where ρ is the correlation coefficient
(2.11)ρ(Is(x1,y1),Is(x2,y1))=cov(Is(x1,y1),Is(x2,y2))σs2.Here,cov(X1,X2)=E[X1X2]-E[X1]E[X2] is the covariance of the random variables X1 and X2. Using (2.7) and (2.8), we find
(2.12)ρ(Is(x1,y1),Is(x2,y2))=|μ(x2-x2,y2-y1)|2.
Hence, the speckle correlation area is given by
(2.13)Sc=∫ℝ2|μ(x,y)|2dxdy.Since the complex coherence function is proportional to the Fourier transform of the beam intensityI(ξ,η)=|U(ξ,η)|2, one can use the Parseval’s identity to obtain
(2.14)Sc=(λz)2∫ℝ2I2(ξ,η)dξdη(∫ℝ2I(ξ,η)dξdη)2.


### 2.2. 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 Figure3. 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 f={f(t)∣t∈ℝ} where
(2.15)f(t)=ℛ∫ℝ2A(x,y)Is(x,y,t)dxdy.Here,Is(x,y,t) is the speckle intensity at instant t, ℛ 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 Is(x,y,t) is independent of both space and time coordinates, that is, E[Is(x,y,t)]=〈Is〉 where 〈Is〉 is given by (2.5). It follows from (2.15) that the expected value of f(t) is given by
(2.16)E[f(t)]=ℛAd〈Is〉,
where Ad=∫ℝ2A(x,y)dxdy. Let us denote 〈f〉=ℛAd〈Is〉. In view of (2.5), 〈f〉 can be expressed as
(2.17)〈f〉=ρPℛΩd,
where Ωd=Adcos(θ)/(πz2) represents the fraction of the scattered power of the beam captured by the detector aperture.Important statistical properties off can be derived from the autocorrelation function Rf(t1,t2)=E[f(t1)f(t2)]. In view of (2.15), we find
(2.18)Rf(t1,t2)=ℛ2∫ℝ4A(x1,y1)A(x2,y2)Rds(x1,y1,x2,y2,t1,t2)dx1dy1dx2dy2,
where Rds(x1,y1,x2,y2,t1,t2)=E[Is(x1,y1,t1)Is(x2,y2,t2)] is the autocorrelation of dynamic speckle. Without loss of generality, we assume that the optical field U moves in the ξ-direction. The function Rds can be found by considering Rds to be the cross-correlation function of two static speckle patterns at instants t=t1 and t=t2. Using this argument, one can express Rds in terms of the complex coherence function μd of the moving optical field as
(2.19)Rds(x1,y1,x2,y2,t1,t2)=〈Is〉2(1+|μd(x2-x1,y2-y1,t2-t1)|2),
where
(2.20)μd(x,y,τ)=1∥U∥2∫ℝ2U(ξ,η)U*(ξ-Vτ,η)exp(i2πλz(ξx+ηy))dξdη,
and U* denotes the complex conjugate of U. We note that for τ=0 we have μd(x,y,0)=μ(x,y). Thus, Rds=Rs 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)Rf(t1,t2)=ℛ2〈Is〉2∫ℝ4A(x1,y1)A(x2,y2)(1+|μd(x2-x1,y2-y1,t2-t1)|2)dx1dy1dx2dy2.Introducing the variablesx=x2-x1, y=y2-y1, and τ=t2-t1, the above integral takes the form
(2.22)Rf(τ)=〈f〉2(1+1Ad2∫ℝ2RA(x,y)|μd(x,y,τ)|2)dxdy,
where
(2.23)RA(x,y)=∫ℝ2A(x1,y1)A(x1+x,y1+y)dx1dy1,
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,
(2.24)maxτ∈ℝ|μd(x,y,τ)|2≪1∀|x|,|y|>δ,
where δ>0 is small compared to the size of a detector aperture. Then, the integral in (2.22) can be approximated by
(2.25)∫ℝ2RA(x,y)|μd(x,y,τ)|2dxdy≈RA(0,0)∫ℝ2|μd(x,y,τ)|2dxdy,
which largely simplifies the calculation of Rf(τ). Validity of this approximation is justified by the example in Section 2.4. Using the approximation (2.25), we obtain
(2.26)Rf(τ)=〈f〉2(1+1Ae∫ℝ2|μd(x,y,τ)|2dxdy),
where
(2.27)Ae=AdRA(0,0)=(∫ℝ2A(x,y)dxdy)2∫ℝ2A2(x,y)dxdy,
is the effective aperture area. We note that if A(x,y) is the characteristic function of the aperture, then Ae=Ad, the physical area of the aperture.The autocorrelationRf(τ) 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
(2.28)∫ℝ2|μd(x,y,τ)|2dxdy=(λz)2∥U∥4∫ℝ2|U(ξ,η)|2|U(ξ-Vτ,η)|2dξdη.Hence, (2.26) becomes
(2.29)Rf(τ)=〈f〉2(1+(λz)2Ae∫ℝ2I(ξ,η)I(ξ-Vτ,η)dξdη(∫ℝ2I(ξ,η)dξ,dη)2).Therefore, the autocorrelation function of the signalf(t) is completely determined by the intensity distribution of the scanning beam. A more intuitive expression for Rf(τ) is provided by substituting the speckle correlation area (2.14) into (2.29),
(2.30)Rf(τ)=〈f〉2(1+ScAe1∥I∥2∫ℝ2I(ξ,η)I(ξ-Vτ,η)dξdη).Note that the ratioAe/Sc 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 ofN statistically independent patterns, I(x,y,t)=∑k=1N‍Ik(x,y,t), with expected value E[Ik(x,y,t)]=〈Is〉/N, then Rf(τ) is modified according to
(2.31)Rf(τ)=〈f〉2(1+ScNAe1∥I∥2∫ℝ2I(ξ,η)I(ξ-Vτ,η)dξdη).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 ofN=2 independent patterns.SinceE[f(t)] and Rf(t1,t2) 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 Rf(τ),
(2.32)Sf(ν)=∫ℝRf(τ)exp(i2πντ)dτ,
provided Rf(τ) is continuous at τ=0. The PSD describes the distribution of the signal power in the frequency domain. The total power is given by
(2.33)Pf=∫ℝSf(ν)dν=Rf(0).
Hence, (2.31) yields
(2.34)Pf=〈f〉2(1+ScNAe).Speckle noise represents random fluctuations about the average signal value〈f〉. Thus, the speckle noise power is the variance σf2 of the process f. For weakly stationary processes, we have Pf=〈f〉2+σf2, which in view of (2.34) yields
(2.35)σf2=〈f〉2ScNAe.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 Sc. 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
(2.36)Sf(ν)=〈f〉2[δ(ν)+ScNAe1∥I∥2∫ℝ3I(ξ,η)I(ξ-Vτ,η)exp(i2πντ)dξdηdτ],
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
(2.37)Sf(ν)=〈f〉2[δ(ν)+ScVNAe1∥I∥2∫ℝ(∫ℝI(ξ,η)exp(i2πνVξ)dξ)2dη].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.


### 2.3. Statistical Properties of Differentiated Speckle Noise

In the conventional approach to edge detection using Canny’s algorithm, the signalf(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∈ℝ} 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]
(2.38)Sf′(ν)=4π2ν2Sf(ν).Using (2.36), we find
(2.39)Sf′(ν)=4π2〈f〉2ScNAe1∥I∥2∫ℝ3I(ξ,η)I(ξ-Vτ,η)ν2exp(i2πντ)dξdηdτ.The total power of the processf′ is now given by
(2.40)Pf′=∫ℝSf′(ν)dν=4π2〈f〉2ScNAe1∥I∥2∫ℝ4I(ξ,η)I(ξ-Vτ,η)ν2exp(i2πντ)dξdηdτdν.The above expression can be simplified to a double integral provided the intensity distribution satisfies(2.41)lim|ξ|,|η|→∞I(ξ,η)=0,sup(ξ,η)∈ℝ2|∂I∂ξ|<∞.These conditions are met in all applications sinceI(ξ,η) 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 Hξ,η(τ)=I(ξ-Vτ,η). Then
(2.42)∫ℝ2I(ξ-Vτ,η)ν2ei2πντdτdν=∫ℝν2H^ξη(ν)dν,
where H^ξη(ν)=∫ℝHξ,η(τ)exp(i2πντ)dτ is the Fourier transform of Hξ,η(τ). Substituting the identity
(2.43)d2Hξ,ηdτ2=-4π2∫ℝν2H^ξη(ν)exp(-i2πντ)dν,
into (2.42), we find
(2.44)∫ℝ2I(ξ-Vτ,η)ν2exp(i2πντ)dτdν=-14π2d2Hξ,ηdτ2|τ=0=-V24π2∂2I∂ξ2.Then the integral in (2.40) becomes
(2.45)∫ℝ4I(ξ,η)I(ξ-Vτ,η)ν2exp(i2πντ)dξdηdτdν=-V24π2∫ℝ2I(ξ,η)∂2I∂ξ2dξdη.Using conditions (2.41), a partial integration yields
(2.46)∫ℝI(ξ,η)∂2I∂ξ2dξ=-∫ℝ(∂I∂ξ)2dξ.Finally, combining (2.40), (2.45), and (2.46), we obtain
(2.47)Pf′=〈f〉2V2ScNAe1∥I∥2∥∂I∂ξ∥2.We refer to (2.47) as the total power of differentiated speckle noise. Since E[f′(t)]=0, the power Pf′ equals the variance σf′2 of the process f′.


### 2.4. Example: Elliptical Gaussian Illumination

Many lasers emit beam whose optical field can be approximated by the elliptical Gaussian function(2.48)U(ξ,η)=2Pπωxωyexp[-(ξ2ωx2+η2ωy2)],
where ωx and ωy are the beam radii in the ξ and η directions, and P=∫ℝ2|U(ξ,η)|2dξ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]
(2.49)ωx=ω0x1+(λz′πω0x2)2,ωy=ω0y1+(λz′πω0y2)2.Let us calculate the average size of speckle generated by a Gaussian beam. Substituting the beam intensityI(ξ,η)=|U(ξ,η)|2 from (2.48) into (2.14), we find that the speckle correlation cells have elliptical shape of average area
(2.50)Sc=π(λzπωx)(λzπωy).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 Sc corresponds to a circle with diameter
(2.51)dc=2Scπ=2λzπω≈1.27λz2ω.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)|μd(x,y,τ)|2=exp[-(Vτωx)2]exp[-(πλz)2((ωxx)2+(ωyy)2)].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 Ω⊂ℝ2 such that
(2.53)sup(x,y)∈Ω|μd(x,y,τ)|2≤1e2|μd(0,0,τ)|2.It is easily seen thatΩ is the elliptical region defined by
(2.54)(xa)2+(yb)2≤1,
where a=2λz/(πωx) and b=2λz/(πωy). Thus, Ω has the area
(2.55)|Ω|=2π(λzπωx)(λzπωy)=2Sc,
where Sc=(λ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)Rf(τ)=〈f〉2(1+ScNAeexp[-(Vτωx)2]).Now, the PSD of the processesf and f′ are found to be
(2.57)Sf(ν)=∫ℝRf(τ)exp(i2πντ)dτ=〈f〉2(δ(ν)+πScNAeωxVexp[-(πωxV)2ν2]),(2.58)Sf′(ν)=4πν2Sf(ν)=4π5/2〈f〉2ScNAeωxVν2exp[-(πωxV)2ν2].Integrating (2.58) over the real line, we obtain the power of differentiated speckle noise
(2.59)Pf′=2〈f〉2(Vωx)2ScNAe,
where Sc is given by (2.50).


## 2.1. 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 Figure3. 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].Figure 3
Free-space propagation model of scattered light.U(ξ,η) is the incident optical field in the scattering plane, and T(eiϕU)(x,y) is the optical field of the interference pattern in the observation plane.(a) Gaussian beam with optical fieldU(ξ,η)=U0exp[-(ξ/ω)2-(η/ω)2] and beam radius ω. (b) Speckle pattern in the photodetector plane generated by a Gaussian beam.
(a)
(b)In our analysis, we assume the same conventional model of the scattering surface as in [28]. Let U∈L2(ℝ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
(2.1)U(ξ,η)↦eiϕ(ξ,η)U(ξ,η),
where ϕ(ξ,η) is a random phase acquired at the point (ξ,η) in the scattering plane. We make the following assumptions about the random function ϕ(ξ,η):(i)
the phaseϕ(ξ,η) is uniformly distributed in [-π,π] at each point (ξ,η)∈ℝ2,(ii)
ϕ(ξ1,η1) is uncorrelated with ϕ(ξ2,η2) for all (ξ1,η1)≠(ξ2,η2).The EM field in the observation plane is given by the Fresnel integral transformation [31](2.2)T(eiϕU)(x,y)=∫ℝ2eiϕ(ξ,η)U(ξ,η)K(x-ξ,y-η)dξdη,
where K is the convolution kernel
(2.3)K(x,y)=eikziλzexp[i(k2z(x2+y2))],k=2π/λ, λ is the optical wavelength, and z is the distance between the scattering and observation planes. The transformation T:L2(ℝ2)→L2(ℝ2) is a bounded operator with unit norm ∥T∥=sup{∥T(u)∥∣u∈L2(ℝ2),∥u∥=1} where ∥·∥ denotes the L2-norm on ℝ2, ∥u∥=(∫ℝ2‍|u(x,y)|2dxdy)1/2. The intensity of a speckle pattern in the observation plane is given by
(2.4)Is(x,y)=|T(eiϕU)(x,y)|2.Assumptions (i) and (ii) imply thatIs={Is(x,y)∣(x,y)∈ℝ2} is a weakly stationary random process. Hence, the expected value E[Is(x,y)] is independent of the observation point. It is related to the physical characteristics of the system by
(2.5)E[Is(x,y)]=ρPcos(θ)πz2,
where P=∥U∥2 is the power of the optical field, ρ∈(0,1] is the reflectance of the scattering surface, and θ is the angle between the direction of specular reflection and direction of observation [32]. Let us denote E[Is(x,y)]=〈Is〉. The probability density function of Is(x,y) follows the negative exponential law [28]
(2.6)p(Is)=1〈Is〉exp(-Is〈Is〉),
and the variance is given by
(2.7)σs2=E[(Is(x,y)-〈Is〉)2]=〈Is〉2.Thus, the contrastσs/〈Is〉 of a speckle pattern is always unity.Since the processIs is weakly stationary, the autocorrelation function Rs(x1,y1;x2,y2)=E[Is(x1,y1)Is(x2,y2)] depends only on separation between the observation points (x1,y1) and (x2,y2). It can be shown that Rs is given by [28]
(2.8)Rs(x1,y1;x2,y2)=〈Is〉2(1+|μ(x2-x1,y2-y1)|2),
where μ is the complex coherence function of the optical field U defined by
(2.9)μ(x,y)=1∥U∥2∫ℝ2|U(ξ,η)|2exp(i2πλz(xξ+yη))dξdη.The functionμ is related to the average speckle size in the following way. Intuitively, if the correlation between intensity levels Is(x1,y1) and Is(x2,y2) is high, then the points (x1,y1) and (x2,y2) belong to the same speckle cell. For a fixed point (x1,y2), it is reasonable to define the speckle correlation area (average speckle size) as
(2.10)Sc=∫ℝ2ρ(Is(x1,y1),Is(x1+x,y1+y))dxdy,
where ρ is the correlation coefficient
(2.11)ρ(Is(x1,y1),Is(x2,y1))=cov(Is(x1,y1),Is(x2,y2))σs2.Here,cov(X1,X2)=E[X1X2]-E[X1]E[X2] is the covariance of the random variables X1 and X2. Using (2.7) and (2.8), we find
(2.12)ρ(Is(x1,y1),Is(x2,y2))=|μ(x2-x2,y2-y1)|2.
Hence, the speckle correlation area is given by
(2.13)Sc=∫ℝ2|μ(x,y)|2dxdy.Since the complex coherence function is proportional to the Fourier transform of the beam intensityI(ξ,η)=|U(ξ,η)|2, one can use the Parseval’s identity to obtain
(2.14)Sc=(λz)2∫ℝ2I2(ξ,η)dξdη(∫ℝ2I(ξ,η)dξdη)2.


## 2.2. 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 Figure3. 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 f={f(t)∣t∈ℝ} where
(2.15)f(t)=ℛ∫ℝ2A(x,y)Is(x,y,t)dxdy.Here,Is(x,y,t) is the speckle intensity at instant t, ℛ 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 Is(x,y,t) is independent of both space and time coordinates, that is, E[Is(x,y,t)]=〈Is〉 where 〈Is〉 is given by (2.5). It follows from (2.15) that the expected value of f(t) is given by
(2.16)E[f(t)]=ℛAd〈Is〉,
where Ad=∫ℝ2A(x,y)dxdy. Let us denote 〈f〉=ℛAd〈Is〉. In view of (2.5), 〈f〉 can be expressed as
(2.17)〈f〉=ρPℛΩd,
where Ωd=Adcos(θ)/(πz2) represents the fraction of the scattered power of the beam captured by the detector aperture.Important statistical properties off can be derived from the autocorrelation function Rf(t1,t2)=E[f(t1)f(t2)]. In view of (2.15), we find
(2.18)Rf(t1,t2)=ℛ2∫ℝ4A(x1,y1)A(x2,y2)Rds(x1,y1,x2,y2,t1,t2)dx1dy1dx2dy2,
where Rds(x1,y1,x2,y2,t1,t2)=E[Is(x1,y1,t1)Is(x2,y2,t2)] is the autocorrelation of dynamic speckle. Without loss of generality, we assume that the optical field U moves in the ξ-direction. The function Rds can be found by considering Rds to be the cross-correlation function of two static speckle patterns at instants t=t1 and t=t2. Using this argument, one can express Rds in terms of the complex coherence function μd of the moving optical field as
(2.19)Rds(x1,y1,x2,y2,t1,t2)=〈Is〉2(1+|μd(x2-x1,y2-y1,t2-t1)|2),
where
(2.20)μd(x,y,τ)=1∥U∥2∫ℝ2U(ξ,η)U*(ξ-Vτ,η)exp(i2πλz(ξx+ηy))dξdη,
and U* denotes the complex conjugate of U. We note that for τ=0 we have μd(x,y,0)=μ(x,y). Thus, Rds=Rs 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)Rf(t1,t2)=ℛ2〈Is〉2∫ℝ4A(x1,y1)A(x2,y2)(1+|μd(x2-x1,y2-y1,t2-t1)|2)dx1dy1dx2dy2.Introducing the variablesx=x2-x1, y=y2-y1, and τ=t2-t1, the above integral takes the form
(2.22)Rf(τ)=〈f〉2(1+1Ad2∫ℝ2RA(x,y)|μd(x,y,τ)|2)dxdy,
where
(2.23)RA(x,y)=∫ℝ2A(x1,y1)A(x1+x,y1+y)dx1dy1,
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,
(2.24)maxτ∈ℝ|μd(x,y,τ)|2≪1∀|x|,|y|>δ,
where δ>0 is small compared to the size of a detector aperture. Then, the integral in (2.22) can be approximated by
(2.25)∫ℝ2RA(x,y)|μd(x,y,τ)|2dxdy≈RA(0,0)∫ℝ2|μd(x,y,τ)|2dxdy,
which largely simplifies the calculation of Rf(τ). Validity of this approximation is justified by the example in Section 2.4. Using the approximation (2.25), we obtain
(2.26)Rf(τ)=〈f〉2(1+1Ae∫ℝ2|μd(x,y,τ)|2dxdy),
where
(2.27)Ae=AdRA(0,0)=(∫ℝ2A(x,y)dxdy)2∫ℝ2A2(x,y)dxdy,
is the effective aperture area. We note that if A(x,y) is the characteristic function of the aperture, then Ae=Ad, the physical area of the aperture.The autocorrelationRf(τ) 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
(2.28)∫ℝ2|μd(x,y,τ)|2dxdy=(λz)2∥U∥4∫ℝ2|U(ξ,η)|2|U(ξ-Vτ,η)|2dξdη.Hence, (2.26) becomes
(2.29)Rf(τ)=〈f〉2(1+(λz)2Ae∫ℝ2I(ξ,η)I(ξ-Vτ,η)dξdη(∫ℝ2I(ξ,η)dξ,dη)2).Therefore, the autocorrelation function of the signalf(t) is completely determined by the intensity distribution of the scanning beam. A more intuitive expression for Rf(τ) is provided by substituting the speckle correlation area (2.14) into (2.29),
(2.30)Rf(τ)=〈f〉2(1+ScAe1∥I∥2∫ℝ2I(ξ,η)I(ξ-Vτ,η)dξdη).Note that the ratioAe/Sc 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 ofN statistically independent patterns, I(x,y,t)=∑k=1N‍Ik(x,y,t), with expected value E[Ik(x,y,t)]=〈Is〉/N, then Rf(τ) is modified according to
(2.31)Rf(τ)=〈f〉2(1+ScNAe1∥I∥2∫ℝ2I(ξ,η)I(ξ-Vτ,η)dξdη).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 ofN=2 independent patterns.SinceE[f(t)] and Rf(t1,t2) 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 Rf(τ),
(2.32)Sf(ν)=∫ℝRf(τ)exp(i2πντ)dτ,
provided Rf(τ) is continuous at τ=0. The PSD describes the distribution of the signal power in the frequency domain. The total power is given by
(2.33)Pf=∫ℝSf(ν)dν=Rf(0).
Hence, (2.31) yields
(2.34)Pf=〈f〉2(1+ScNAe).Speckle noise represents random fluctuations about the average signal value〈f〉. Thus, the speckle noise power is the variance σf2 of the process f. For weakly stationary processes, we have Pf=〈f〉2+σf2, which in view of (2.34) yields
(2.35)σf2=〈f〉2ScNAe.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 Sc. 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
(2.36)Sf(ν)=〈f〉2[δ(ν)+ScNAe1∥I∥2∫ℝ3I(ξ,η)I(ξ-Vτ,η)exp(i2πντ)dξdηdτ],
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
(2.37)Sf(ν)=〈f〉2[δ(ν)+ScVNAe1∥I∥2∫ℝ(∫ℝI(ξ,η)exp(i2πνVξ)dξ)2dη].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.


## 2.3. Statistical Properties of Differentiated Speckle Noise

In the conventional approach to edge detection using Canny’s algorithm, the signalf(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∈ℝ} 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]
(2.38)Sf′(ν)=4π2ν2Sf(ν).Using (2.36), we find
(2.39)Sf′(ν)=4π2〈f〉2ScNAe1∥I∥2∫ℝ3I(ξ,η)I(ξ-Vτ,η)ν2exp(i2πντ)dξdηdτ.The total power of the processf′ is now given by
(2.40)Pf′=∫ℝSf′(ν)dν=4π2〈f〉2ScNAe1∥I∥2∫ℝ4I(ξ,η)I(ξ-Vτ,η)ν2exp(i2πντ)dξdηdτdν.The above expression can be simplified to a double integral provided the intensity distribution satisfies(2.41)lim|ξ|,|η|→∞I(ξ,η)=0,sup(ξ,η)∈ℝ2|∂I∂ξ|<∞.These conditions are met in all applications sinceI(ξ,η) 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 Hξ,η(τ)=I(ξ-Vτ,η). Then
(2.42)∫ℝ2I(ξ-Vτ,η)ν2ei2πντdτdν=∫ℝν2H^ξη(ν)dν,
where H^ξη(ν)=∫ℝHξ,η(τ)exp(i2πντ)dτ is the Fourier transform of Hξ,η(τ). Substituting the identity
(2.43)d2Hξ,ηdτ2=-4π2∫ℝν2H^ξη(ν)exp(-i2πντ)dν,
into (2.42), we find
(2.44)∫ℝ2I(ξ-Vτ,η)ν2exp(i2πντ)dτdν=-14π2d2Hξ,ηdτ2|τ=0=-V24π2∂2I∂ξ2.Then the integral in (2.40) becomes
(2.45)∫ℝ4I(ξ,η)I(ξ-Vτ,η)ν2exp(i2πντ)dξdηdτdν=-V24π2∫ℝ2I(ξ,η)∂2I∂ξ2dξdη.Using conditions (2.41), a partial integration yields
(2.46)∫ℝI(ξ,η)∂2I∂ξ2dξ=-∫ℝ(∂I∂ξ)2dξ.Finally, combining (2.40), (2.45), and (2.46), we obtain
(2.47)Pf′=〈f〉2V2ScNAe1∥I∥2∥∂I∂ξ∥2.We refer to (2.47) as the total power of differentiated speckle noise. Since E[f′(t)]=0, the power Pf′ equals the variance σf′2 of the process f′.


## 2.4. Example: Elliptical Gaussian Illumination

Many lasers emit beam whose optical field can be approximated by the elliptical Gaussian function(2.48)U(ξ,η)=2Pπωxωyexp[-(ξ2ωx2+η2ωy2)],
where ωx and ωy are the beam radii in the ξ and η directions, and P=∫ℝ2|U(ξ,η)|2dξ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]
(2.49)ωx=ω0x1+(λz′πω0x2)2,ωy=ω0y1+(λz′πω0y2)2.Let us calculate the average size of speckle generated by a Gaussian beam. Substituting the beam intensityI(ξ,η)=|U(ξ,η)|2 from (2.48) into (2.14), we find that the speckle correlation cells have elliptical shape of average area
(2.50)Sc=π(λzπωx)(λzπωy).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 Sc corresponds to a circle with diameter
(2.51)dc=2Scπ=2λzπω≈1.27λz2ω.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)|μd(x,y,τ)|2=exp[-(Vτωx)2]exp[-(πλz)2((ωxx)2+(ωyy)2)].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 Ω⊂ℝ2 such that
(2.53)sup(x,y)∈Ω|μd(x,y,τ)|2≤1e2|μd(0,0,τ)|2.It is easily seen thatΩ is the elliptical region defined by
(2.54)(xa)2+(yb)2≤1,
where a=2λz/(πωx) and b=2λz/(πωy). Thus, Ω has the area
(2.55)|Ω|=2π(λzπωx)(λzπωy)=2Sc,
where Sc=(λ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)Rf(τ)=〈f〉2(1+ScNAeexp[-(Vτωx)2]).Now, the PSD of the processesf and f′ are found to be
(2.57)Sf(ν)=∫ℝRf(τ)exp(i2πντ)dτ=〈f〉2(δ(ν)+πScNAeωxVexp[-(πωxV)2ν2]),(2.58)Sf′(ν)=4πν2Sf(ν)=4π5/2〈f〉2ScNAeωxVν2exp[-(πωxV)2ν2].Integrating (2.58) over the real line, we obtain the power of differentiated speckle noise
(2.59)Pf′=2〈f〉2(Vωx)2ScNAe,
where Sc is given by (2.50).


## 3. 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
(3.1)f(t)=s(t)+n(t),
where s(t) is the noise-free signal, and n(t) is speckle noise. The noise-free signal is the convolution
(3.2)s(t)=f0∫ℝB(Vt-ξ)L(ξ)dξ,
where
(3.3)L(ξ)=1P∫ℝI(ξ,η)dη
is the line spread function of the beam, and P=∫ℝ2‍I(ξ,η)dξdη is the beam power. Note that if the reflectance is constant, B(ξ)=ρ, then 〈f〉=s(t)=f0ρ; hence, f0 is the maximum value of 〈f〉 corresponding to ρ=1. In view of (2.17), we have f0=PℛΩd.Information about edges is extracted from the derivative off(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
(3.4)S=maxt|s′(t)|.Figure 5
Derivative of a signal corrupted by speckle noise obtained by scanning the bar code in Figure1.Figure 6
Derivative of a photodetector signal (– –) generated by a Gaussian beam scanning a single edge atξ=0.Figure 7
Derivative of a photodetector signal (– –) generated by a Gaussian beam scanning an infinite sequence of edges.Accordingly, we define the signal-to-noise ratio (SNR) to be(3.5)SNR=(Sσn′)2,
where σn′2 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〉=f0. Combining (2.14) and (2.47), we can express σn′2 as
(3.6)σn′2=f02V2(λz)2NAe1P2∥∂I∂ξ∥2.Let us now consider specific examples.


### 3.1. One Edge

The gray level of a single edge is given by(3.7)B(ξ)=ρ+(1-ρ)H(ξ),
where H(ξ) is the Heaviside step function: H(ξ)=0 if ξ<0 and H(ξ)=1 if ξ≥0. Then B′(ξ)=(1-ρ)δ(ξ); hence, (3.2) leads to
(3.8)s′(t)=(1-ρ)f0VL(Vt).The line spread function has a global maximum at its centre, and thus, the signalS yields
(3.9)S=maxt|s′(t)|=(1-ρ)f0VL(0).Therefore, a lower bound for SNR is given by(3.10)SNR1=(Sσn′)2=(1-ρ)2P2NAe(λz)2L2(0)∥∂I/∂ξ∥2.


### 3.2. Infinite Sequence of Edges

Consider an infinite sequence of black and white bars of widthD where the middle of a white bar is placed at ξ=0, as shown in Figure 7. The gray level is represented by
(3.11)B(ξ)=ρ+(1-ρ)∑k=-∞∞‍(-1)k+1H(ξ-(2k+1)D2).The distributional derivative ofB(ξ) is the generalized function
(3.12)B′(ξ)=(1-ρ)∑k=-∞∞‍(-1)k+1δ(ξ-(2k+1)D2),
which together with (3.2) yields
(3.13)s′(t)=(1-ρ)f0V∑k=-∞∞‍(-1)k+1L(Vt-(2k+1)D2).We show that under certain mild assumptions which are satisfied in applications, the maximum of|s′(t)| is attained at the point Vt=D/2. Let us expand B′(ξ) into generalized Fourier series
(3.14)B′(ξ)=i1-ρD∑k=-∞∞‍(-1)kexp(i2π2k+12Dξ),
where i=-1. Using relation (3.14), we find that the signal derivative is given by
(3.15)s′(t)=i(1-ρ)f0VD∑k=-∞∞‍(-1)kexp(i2π2k+12DVt)L^(-2k+12D),
where
(3.16)L^(ν)=∫ℝL(ξ)exp(i2πνξ)dξ
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)s′(t)=2(1-ρ)f0VD∑k=0∞‍(-1)k+1sin(π(2k+1)VtD)L^(2k+12D).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 ν∈ℝ. Since sin((π/2)(2k+1))=(-1)k, it follows from (3.17) that the maximum value of |s′(t)| is attained at Vt=D/2, which yields
(3.18)S=maxt|s′(t)|=2(1-ρ)f0VD∑k=0∞‍L^(2k+12D).Finally, using (3.6) and (3.18), we find a lower bound for SNR to be
(3.19)SNR∞=(Sσn′)2=4(1-ρ)2P2NAe(λz)21D2[∑k=0∞‍L^((2k+1)/2D)]2∥∂I/∂ξ∥2.


### 3.3. 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 distancez. The line spread function of the Gaussian field (2.48) is given by
(3.20)L(ξ)=2π1ωxexp[-2(ξωx)2],
and the L2-norm of ∂I/∂ξ is
(3.21)∥∂I∂ξ∥2=2πP2ωx3ωy.Substituting (3.20) and (3.21) into (3.10), we find
(3.22)SNR1=(1-ρ)2NAe(λz)2ωxωy.In order to findSNR∞, we need the Fourier transform of the line spread function L(ξ),
(3.23)L^(ν)=exp(-12(πωx)2ν2).Then, (3.19) yields
(3.24)SNR∞=2π(1-ρ)2ωxωy(ωxD)2NAe(λz)2[∑k=0∞exp(-π28(ωxD)2(2k+1)2)]2.We note thatSNR∞ 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).Figure 8
Functionf(r)=(r/2)2[∑k=02‍exp(-(π2/8)(2k+1)2(r/2)2)]2.


### 3.4. 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 zw from the photodetector. Since the laser is placed next to the photodetector, the scan distance can be written as z=zw+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)ωx=ωy=ω01+(λz′πω02)2.Let us define the dimensionless variablesu=λz′/ω02 and uw=λzw/ω02. Substituting (3.25) into (3.22) and rearranging terms, we obtain
(3.26)SNR1=(1-ρ)2NAeω02f(u),
where
(3.27)f(u)=1+(u/π)2(u+uw)2,-uw<u<∞.For a particular scanner, the waist locationzw is fixed (it is close to the output surface of the laser). Thus, (3.26) provides dependence of SNR1 on the scan distance z=zw+z′. The function f(u) is decreasing for -uw<u<π2/uw and increasing for u>π2/uw. It has a local minimum at umin=π2/uw, that is, at zmin′=π2ω04/(λ2zw). The lowest value of SNR1 is attained at zmin=zmin′+zw and
(3.28)(SNR1)min=(1-ρ)2NAeω021π2+(λzw/ω02)2.Typical values of the wavelength and spot size areλ=670·10-9 m, ω0≈10-3 m, and zw≈10-1 m. For these values of λ, ω0, and zw, we have zmin≫zw; hence, the minimum occurs far beyond the working range of a scanner. Consequently, for application purposes, we may consider SNR1 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 analyzingSNR∞. 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)SNR∞=2π(1-ρ)2ωxωy(ωxD)2NAe(λz)2[∑k=0∞‍Q(2k+1)2]2.We wish to find an approximate expression forSNR∞. Define Q0=exp[-(π2/8)(r0/2)2] where r0=2ω0/D is the spot-to-bar ratio at the waist. It is easily seen that for r0∈[1,3], we can make the approximation
(3.30)[∑k=0∞‍Q0(2k+1)2]2=Q02+2Q010+higher-orderterms≈Q02.Sinceω0≤ωx, we have 0<Q≤Q0<1; hence, the approximation (3.30) also holds for Q. Therefore, SNR∞ can be approximated by
(3.31)SNR∞=2π(1-ρ)2ωxωy(ωxD)2NAe(λz)2Q2,
for all r0∈[1,3]. Now, substituting (3.25) into (3.31), we find
(3.32)SNR∞=2π(1-ρ)2NAeD2g(u),
where
(3.33)g(u)=1(u+uw)2[1+(uπ)2]2exp[-π24(r02)2(1+(uπ)2)].The behaviour ofg(u) is more complex than f(u), and it depends on the exact values of the parameters uw=λzw/ω02 and r0=2ω0/D. For typical values of λ, ω0, and zw as given above, the function g(u) is monotonically decreasing for all r0∈[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.


## 3.1. One Edge

The gray level of a single edge is given by(3.7)B(ξ)=ρ+(1-ρ)H(ξ),
where H(ξ) is the Heaviside step function: H(ξ)=0 if ξ<0 and H(ξ)=1 if ξ≥0. Then B′(ξ)=(1-ρ)δ(ξ); hence, (3.2) leads to
(3.8)s′(t)=(1-ρ)f0VL(Vt).The line spread function has a global maximum at its centre, and thus, the signalS yields
(3.9)S=maxt|s′(t)|=(1-ρ)f0VL(0).Therefore, a lower bound for SNR is given by(3.10)SNR1=(Sσn′)2=(1-ρ)2P2NAe(λz)2L2(0)∥∂I/∂ξ∥2.


## 3.2. Infinite Sequence of Edges

Consider an infinite sequence of black and white bars of widthD where the middle of a white bar is placed at ξ=0, as shown in Figure 7. The gray level is represented by
(3.11)B(ξ)=ρ+(1-ρ)∑k=-∞∞‍(-1)k+1H(ξ-(2k+1)D2).The distributional derivative ofB(ξ) is the generalized function
(3.12)B′(ξ)=(1-ρ)∑k=-∞∞‍(-1)k+1δ(ξ-(2k+1)D2),
which together with (3.2) yields
(3.13)s′(t)=(1-ρ)f0V∑k=-∞∞‍(-1)k+1L(Vt-(2k+1)D2).We show that under certain mild assumptions which are satisfied in applications, the maximum of|s′(t)| is attained at the point Vt=D/2. Let us expand B′(ξ) into generalized Fourier series
(3.14)B′(ξ)=i1-ρD∑k=-∞∞‍(-1)kexp(i2π2k+12Dξ),
where i=-1. Using relation (3.14), we find that the signal derivative is given by
(3.15)s′(t)=i(1-ρ)f0VD∑k=-∞∞‍(-1)kexp(i2π2k+12DVt)L^(-2k+12D),
where
(3.16)L^(ν)=∫ℝL(ξ)exp(i2πνξ)dξ
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)s′(t)=2(1-ρ)f0VD∑k=0∞‍(-1)k+1sin(π(2k+1)VtD)L^(2k+12D).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 ν∈ℝ. Since sin((π/2)(2k+1))=(-1)k, it follows from (3.17) that the maximum value of |s′(t)| is attained at Vt=D/2, which yields
(3.18)S=maxt|s′(t)|=2(1-ρ)f0VD∑k=0∞‍L^(2k+12D).Finally, using (3.6) and (3.18), we find a lower bound for SNR to be
(3.19)SNR∞=(Sσn′)2=4(1-ρ)2P2NAe(λz)21D2[∑k=0∞‍L^((2k+1)/2D)]2∥∂I/∂ξ∥2.


## 3.3. 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 distancez. The line spread function of the Gaussian field (2.48) is given by
(3.20)L(ξ)=2π1ωxexp[-2(ξωx)2],
and the L2-norm of ∂I/∂ξ is
(3.21)∥∂I∂ξ∥2=2πP2ωx3ωy.Substituting (3.20) and (3.21) into (3.10), we find
(3.22)SNR1=(1-ρ)2NAe(λz)2ωxωy.In order to findSNR∞, we need the Fourier transform of the line spread function L(ξ),
(3.23)L^(ν)=exp(-12(πωx)2ν2).Then, (3.19) yields
(3.24)SNR∞=2π(1-ρ)2ωxωy(ωxD)2NAe(λz)2[∑k=0∞exp(-π28(ωxD)2(2k+1)2)]2.We note thatSNR∞ 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).Figure 8
Functionf(r)=(r/2)2[∑k=02‍exp(-(π2/8)(2k+1)2(r/2)2)]2.


## 3.4. 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 zw from the photodetector. Since the laser is placed next to the photodetector, the scan distance can be written as z=zw+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)ωx=ωy=ω01+(λz′πω02)2.Let us define the dimensionless variablesu=λz′/ω02 and uw=λzw/ω02. Substituting (3.25) into (3.22) and rearranging terms, we obtain
(3.26)SNR1=(1-ρ)2NAeω02f(u),
where
(3.27)f(u)=1+(u/π)2(u+uw)2,-uw<u<∞.For a particular scanner, the waist locationzw is fixed (it is close to the output surface of the laser). Thus, (3.26) provides dependence of SNR1 on the scan distance z=zw+z′. The function f(u) is decreasing for -uw<u<π2/uw and increasing for u>π2/uw. It has a local minimum at umin=π2/uw, that is, at zmin′=π2ω04/(λ2zw). The lowest value of SNR1 is attained at zmin=zmin′+zw and
(3.28)(SNR1)min=(1-ρ)2NAeω021π2+(λzw/ω02)2.Typical values of the wavelength and spot size areλ=670·10-9 m, ω0≈10-3 m, and zw≈10-1 m. For these values of λ, ω0, and zw, we have zmin≫zw; hence, the minimum occurs far beyond the working range of a scanner. Consequently, for application purposes, we may consider SNR1 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 analyzingSNR∞. 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)SNR∞=2π(1-ρ)2ωxωy(ωxD)2NAe(λz)2[∑k=0∞‍Q(2k+1)2]2.We wish to find an approximate expression forSNR∞. Define Q0=exp[-(π2/8)(r0/2)2] where r0=2ω0/D is the spot-to-bar ratio at the waist. It is easily seen that for r0∈[1,3], we can make the approximation
(3.30)[∑k=0∞‍Q0(2k+1)2]2=Q02+2Q010+higher-orderterms≈Q02.Sinceω0≤ωx, we have 0<Q≤Q0<1; hence, the approximation (3.30) also holds for Q. Therefore, SNR∞ can be approximated by
(3.31)SNR∞=2π(1-ρ)2ωxωy(ωxD)2NAe(λz)2Q2,
for all r0∈[1,3]. Now, substituting (3.25) into (3.31), we find
(3.32)SNR∞=2π(1-ρ)2NAeD2g(u),
where
(3.33)g(u)=1(u+uw)2[1+(uπ)2]2exp[-π24(r02)2(1+(uπ)2)].The behaviour ofg(u) is more complex than f(u), and it depends on the exact values of the parameters uw=λzw/ω02 and r0=2ω0/D. For typical values of λ, ω0, and zw as given above, the function g(u) is monotonically decreasing for all r0∈[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.


## 4. 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 atX1<X2<⋯<Xn, so the gray level of a bar code is represented by
(4.1)B(ξ)=ρ+(1-ρ)∑k=1n‍(-1)k+1H(ξ-Xk).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
(4.2)I(ξ,η)=I0exp(-2r2ω2)J02(2πλθr),
where r=ξ2+η2, and J0 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.Noise-free signals′(t) (– –) generated by different scanning beams: (a) Gaussian beam with ωx=1 and ωx=3, (b) beam with intensity distribution given by (4.2).
(a)
(b)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 signalf(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
(4.3)g(t)=∫ℝh(t-τ)s′(τ)dτ+∫ℝh(t-τ)n′(τ)dτ.We denoteg0(t)=(h*s′)(t) and gn(t)=(h*n′)(t) where * is the convolution operator (x*y)(t)=∫ℝ‍x(t-τ)y(τ)dτ. Since the derivative of speckle noise is a weakly stationary process, so is the process gn={gn(t)∣t∈ℝ}. Now, we pose the following problem: given spectral characteristics of the process n={n(t)∣t∈ℝ} 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 g0(t)=(h*s′)(t). By substituting (4.1) into (3.2), we obtain
(4.4)g0(t)=f0(1-ρ)V∑k=1n‍(-1)k+1(h*LV)(t-Tk),
where LV(t)=L(Vt) and Tk=Xk/V are the edge positions in time domain. The edge locations in noise-free conditions are approximated by solutions of the nonlinear equation g0′(t)=0, that is,
(4.5)∑k=1n‍(-1)k+1(h*LV)′(t-Tk)=0.The number of solutionstk of (4.5) is usually greater than the number of edges, depending on the exact shape of the line spread function. Furthermore, tk≠Tk due to convolution distortion. In our analysis, we will assume that the data {tk}k=1n is given and is sufficient to perform decoding, that is, tk+1-tk≈Tk+1-Tk for all k. This is true if the support of L(ξ) is comparable in size with mink|Xk+1-Xk|, the smallest bar or space.If the signal is corrupted by noise, we are interested in solutions of the equation(4.6)g0′(t)+gn′(t)=0,
which represent small random perturbations of the noise-free solutions {tk}k=1n. Let t be a solution of (4.6), and let ek=t-tk be a random error associated to tk. The statistical properties of the random variable ek depend on the process n={n(t)∣t∈ℝ}. It is shown in [40] that for small errors the expected value of ek is E[ek]=0. Furthermore, the second moment of ek is given by
(4.7)E[ek2]=(4π2f0(1-ρ)V)2∫ℝν4|h^(ν)|2Sn(ν)dν[∑i=1n‍(-1)i+1(h*LV)′′(tk-Ti)]2,
where h^(ν) is the Fourier transform of h(t), and Sn(ν) is the power spectral density of n. We define the edge position error to be the standard deviation
(4.8)δk=VE[ek2]-E2[ek]=4π2f0(1-ρ)[∫ℝν4|h^(ν)|2Sn(ν)dν]1/2|∑i=1n‍(-1)i+1(h*LV)′′(tk-Ti)|.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*LV)′′(t) often decays rapidly to zero as |t| grows, that is, (h*LV)′′(tk-Ti)≈0 when |tk-Ti| is large. Hence, only the nearest neighbours of edge k contribute to the error δk.


### 4.1. 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
(4.9)h(t)=12πσexp[-12(tσ)2].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 Sn(ν)=Sf(ν)-〈f〉2δ(ν); hence, in view of (2.57),
(4.10)Sn(ν)=f02πScNAeωxVexp[-(πωxV)2ν2].A straightforward computation yields(4.11)∫ℝν2|h^(ν)|2Sn(ν)dν=34π4f02ScNAe(Vωx)41β5,
where β=1+4(Vσ/ωx)2. By convolving the impulse response h(t) with the line spread function (3.20), we obtain
(4.12)(h*LV)(t)=2π1βωxexp[-2(Vtβωx)2].This leads immediately to(4.13)(h*LV)′′(t)=8πV2(βωx)3H2(2Vtβωx)exp[-2(Vtβωx)2],
where H2(x)=4x2-2 is the Hermite polynomial of degree two. Substituting (4.11) and (4.13) into (4.8), we find
(4.14)δk=11-ρ3πSc2NAeβωx|∑i=1n‍(-1)i+1H2(2(xk-Xi/βωx))exp[-2(xk-Xi/βωx)2]|,
where xk=Vtk and Xk=VTk. Recall that {Xk}k=1n are true edge positions and that {xk}k=1n are solutions of (4.5) which in our case yields
(4.15)∑k=1n‍(-1)k+1(t-Tk)exp[-2(Vβωx)2(t-Tk)2]=0.This equation has exactlyn distinct solutions t1<t2<⋯<tn. Convolution distortion is negligible if βωx≤mink|Xk+1-Xk|, the smallest bar or space. In this case, tk≈Tk 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+δk=δk(0) where
(4.16)δk(0)=11-ρ3πSc2NAeωx|∑i=1n‍(-1)i+1H2(2(xk-Xi)/ωx)exp[-2((xk-Xi)/ωx)2]|
is the error obtained from (4.8) if h(t) is replaced by the Dirac function δ(t).


### 4.2. 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, xk≈Xk 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 widthD, called module. We may assume that the edges are located at
(4.17)X1=0,X2=p1D,X3=(p1+p2)D,…,Xn=(∑k=1n-1‍pk)D.A message stored in a bar code is encoded in the digital bar pattern𝒮=(p1,p2,…,pn-1). As explained earlier, the possible values of pk in the UPCA symbology are pk=1,2,3,4. Each integer between 0 and 9 is encoded as a sequence (p1,p2,p3,p4) where ∑k=14‍pk=7. Table 1 shows encodation patterns for integers 0,1,…,9. For more details on different symbologies, see [1]. For convenience, we define dk=∑i=1k-1‍pi, 2≤k≤n, and set d1=0. Then the distance between a pair of edges is Xk-Xi=(dk-di)D. 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
(4.18)δk(0)D=11-ρ3πSc8NAer|∑i=1n‍(-1)i+1H2(8(dk-di)/r)exp[-8((dk-di)/r)2]|,
where we have used xk=Xk.The relative errorδk(0)/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
(4.19)∥𝒮∥=maxk|δk(0)D|.Note that∥𝒮∥ is proportional to (1-ρ)-13πSc/(8NAe) which depends only on the physical characteristics of the system. Hence, we introduce susceptibility which is intrinsic to the bar code symbol alone by ∥𝒮∥0=maxk|Ek(𝒮)| where
(4.20)Ek(𝒮)=r|∑i=1n‍(-1)i+1H2(8(dk-di)/r)exp[-8((dk-di)/r))2]|.The measure∥𝒮∥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 Ek(𝒮) when 𝒮 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 Ek(𝒮) cluster around the values 0.5, 0.35, and 0.27. Hence, all UPCA symbols have approximately the same maximum error ∥𝒮∥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 xk≈Xk is not valid, then the apparent edge positions xk must be computed numerically from (4.15).Figure 10
Edge position errorsEk(𝒮) for UPCA symbol encoding the message “012345678905.”


## 4.1. 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
(4.9)h(t)=12πσexp[-12(tσ)2].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 Sn(ν)=Sf(ν)-〈f〉2δ(ν); hence, in view of (2.57),
(4.10)Sn(ν)=f02πScNAeωxVexp[-(πωxV)2ν2].A straightforward computation yields(4.11)∫ℝν2|h^(ν)|2Sn(ν)dν=34π4f02ScNAe(Vωx)41β5,
where β=1+4(Vσ/ωx)2. By convolving the impulse response h(t) with the line spread function (3.20), we obtain
(4.12)(h*LV)(t)=2π1βωxexp[-2(Vtβωx)2].This leads immediately to(4.13)(h*LV)′′(t)=8πV2(βωx)3H2(2Vtβωx)exp[-2(Vtβωx)2],
where H2(x)=4x2-2 is the Hermite polynomial of degree two. Substituting (4.11) and (4.13) into (4.8), we find
(4.14)δk=11-ρ3πSc2NAeβωx|∑i=1n‍(-1)i+1H2(2(xk-Xi/βωx))exp[-2(xk-Xi/βωx)2]|,
where xk=Vtk and Xk=VTk. Recall that {Xk}k=1n are true edge positions and that {xk}k=1n are solutions of (4.5) which in our case yields
(4.15)∑k=1n‍(-1)k+1(t-Tk)exp[-2(Vβωx)2(t-Tk)2]=0.This equation has exactlyn distinct solutions t1<t2<⋯<tn. Convolution distortion is negligible if βωx≤mink|Xk+1-Xk|, the smallest bar or space. In this case, tk≈Tk 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+δk=δk(0) where
(4.16)δk(0)=11-ρ3πSc2NAeωx|∑i=1n‍(-1)i+1H2(2(xk-Xi)/ωx)exp[-2((xk-Xi)/ωx)2]|
is the error obtained from (4.8) if h(t) is replaced by the Dirac function δ(t).


## 4.2. 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, xk≈Xk 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 widthD, called module. We may assume that the edges are located at
(4.17)X1=0,X2=p1D,X3=(p1+p2)D,…,Xn=(∑k=1n-1‍pk)D.A message stored in a bar code is encoded in the digital bar pattern𝒮=(p1,p2,…,pn-1). As explained earlier, the possible values of pk in the UPCA symbology are pk=1,2,3,4. Each integer between 0 and 9 is encoded as a sequence (p1,p2,p3,p4) where ∑k=14‍pk=7. Table 1 shows encodation patterns for integers 0,1,…,9. For more details on different symbologies, see [1]. For convenience, we define dk=∑i=1k-1‍pi, 2≤k≤n, and set d1=0. Then the distance between a pair of edges is Xk-Xi=(dk-di)D. 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
(4.18)δk(0)D=11-ρ3πSc8NAer|∑i=1n‍(-1)i+1H2(8(dk-di)/r)exp[-8((dk-di)/r)2]|,
where we have used xk=Xk.The relative errorδk(0)/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
(4.19)∥𝒮∥=maxk|δk(0)D|.Note that∥𝒮∥ is proportional to (1-ρ)-13πSc/(8NAe) which depends only on the physical characteristics of the system. Hence, we introduce susceptibility which is intrinsic to the bar code symbol alone by ∥𝒮∥0=maxk|Ek(𝒮)| where
(4.20)Ek(𝒮)=r|∑i=1n‍(-1)i+1H2(8(dk-di)/r)exp[-8((dk-di)/r))2]|.The measure∥𝒮∥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 Ek(𝒮) when 𝒮 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 Ek(𝒮) cluster around the values 0.5, 0.35, and 0.27. Hence, all UPCA symbols have approximately the same maximum error ∥𝒮∥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 xk≈Xk is not valid, then the apparent edge positions xk must be computed numerically from (4.15).Figure 10
Edge position errorsEk(𝒮) for UPCA symbol encoding the message “012345678905.”


## 5. 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. LetL(ξ) 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 atxk and xk+1, where xk=Vtk are solutions of (4.5). The convolution distortion of a bar (space) between the edges Xk and Xk+1 is defined by
(5.1)Ck=(xk+1-xk)-(Xk+1-Xk)=Δxk-ΔXk.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
(5.2)maxk|Ck|≤σB.Now, suppose the signal is corrupted by speckle noise. Then the edge positionxk becomes a random variable x-k=xk+e-k where e-k is the error in space domain associated with speckle noise (i.e., e-k=Vek). The detected bar (space) width is given by Δx-k=x-k+1-x-k=Δxk+e-k+1-e-k. Since E[e-k]=0, the variance of the detected width is
(5.3)var(Δx-k)=E[(e-k+1-e-k)2].Using the Cauchy-Schwartz inequalityE2[e-k+1e-k]≤E[e-k+12]E[e-k2], we obtain var(Δx-k)≤(δk+1+δk)2 where δk is the edge position error defined by (4.8). Therefore, the standard deviation of Δx-k is bounded by δk+1+δk. This suggests that the condition (5.2) should be replaced by
(5.4)maxk(|Ck|+δk+1+δk)≤σB.The above criteria for bar code decoding also takes into account the effect of filtering since bothCk and δk depend on the filter impulse response h(t).As seen in Section2, 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 Jk(z)=|Ck(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 [z1,z2] such that
(5.5)maxkJk(z)≤σB∀z∈[z1,z2].Another possible use of the above inequality is beam focusing. SinceJk(z) depends on the beam intensity I(ξ,η), for a desired interval [z1,z2], 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.


## 6. 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.



---

*Source: 758657-2012-09-19.xml*