Journal of Applied Mathematics
Volume 2012, Article ID 758657, 31 pages
http://dx.doi.org/10.1155/2012/758657
Research Article

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

Faculty of Mathematical and Natural Sciences, University of Split, Teslina 12, 21000 Split, Croatia

Received 1 May 2012; Revised 29 July 2012; Accepted 31 July 2012

Academic Editor: Carlos J. S. Alves

Copyright © 2012 Saša Krešić-Jurić. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

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

#### 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 , 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 ,(2)six digits on the left side: one digit denoting industry type and five digits with manufacturer’s code,(3)a center guard pattern ,(4)six digits on the right side: five digits with item code and one check digit,(5)a right guard pattern .

Table 1: UPCA encodation patterns.
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 Figure 2. Here, 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 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 with the highest probability. The statistical properties of can be modeled from heuristic considerations or inferred using learning theory such as the Baum-Welch algorithm [3]. A bar code signal 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 [59]. Edge detection techniques based on multiresolution analysis, anisotropic diffusion filtering, and level set methods can be found in [1018].

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 where is assumed to be a 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 where is the Boltzmann’s constant, is the temperature in Kelvins, and is the frequency band. Similarly, the power of shot noise is where is the electron charge, is the current, and 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.

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

Figure 3: Free-space propagation model of scattered light. is the incident optical field in the scattering plane, and is the optical field of the interference pattern in the observation plane.
Figure 4: (a) Gaussian beam with optical field and beam radius . (b) Speckle pattern in the photodetector plane generated by a Gaussian beam.

In our analysis, we assume the same conventional model of the scattering surface as in [28]. Let 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 :(i)the phase is uniformly distributed in at each point ,(ii) is uncorrelated with for all .

The EM field in the observation plane is given by the Fresnel integral transformation [31] where is the convolution kernel , is the optical wavelength, and is the distance between the scattering and observation planes. The transformation is a bounded operator with unit norm where denotes the -norm on , . The intensity of a speckle pattern in the observation plane is given by

Assumptions (i) and (ii) imply that is a weakly stationary random process. Hence, the expected value is independent of the observation point. It is related to the physical characteristics of the system by where is the power of the optical field, 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 . The probability density function of follows the negative exponential law [28] and the variance is given by

Thus, the contrast of a speckle pattern is always unity.

Since the process is weakly stationary, the autocorrelation function depends only on separation between the observation points and . It can be shown that is given by [28] where is the complex coherence function of the optical field defined by

The function is related to the average speckle size in the following way. Intuitively, if the correlation between intensity levels and is high, then the points and belong to the same speckle cell. For a fixed point , it is reasonable to define the speckle correlation area (average speckle size) as where is the correlation coefficient

Here, is the covariance of the random variables and . Using (2.7) and (2.8), we find Hence, the speckle correlation area is given by

Since the complex coherence function is proportional to the Fourier transform of the beam intensity , one can use the Parseval’s identity to obtain

##### 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 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 by a photodetector. Temporal changes in the speckle pattern intensity induce random fluctuations, called speckle noise, about the average value of . The signal is a continuous time random process where

Here, is the speckle intensity at instant , is optical-to-electrical signal conversion factor, and the function characterizes the photodetector response. A description of statistical properties of dynamic speckle can be found in [30]. We assume that has compact support bounded by the photodetector aperture. Since the surface reflectance is constant, the expected value of is independent of both space and time coordinates, that is, where is given by (2.5). It follows from (2.15) that the expected value of is given by where . Let us denote . In view of (2.5), can be expressed as where represents the fraction of the scattered power of the beam captured by the detector aperture.

Important statistical properties of 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 moves in the -direction. The function can be found by considering to be the cross-correlation function of two static speckle patterns at instants and . Using this argument, one can express in terms of the complex coherence function of the moving optical field as where and denotes the complex conjugate of . We note that for we have . Thus, when the two speckle patterns overlap. The behaviour of the complex coherence function for different optical fields is described in [32]. Substituting (2.19) into (2.18), we obtain

Introducing the variables , , and , the above integral takes the form where is the autocorrelation of the weighting function . In many cases of practical interest, the magnitude of tends to zero very rapidly as and increase, that is, where 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 . 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 is the characteristic function of the aperture, then , the physical area of the aperture.

The autocorrelation can be conveniently expressed in terms of the intensity distribution of the laser beam. Using (2.20) and applying the Parseval’s identity, we find

Hence, (2.26) becomes

Therefore, the autocorrelation function of the signal is completely determined by the intensity distribution of the scanning beam. A more intuitive expression for is provided by substituting the speckle correlation area (2.14) into (2.29),

Note that the ratio 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 statistically independent patterns, , with expected value , then 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 independent patterns.

Since and are invariant under time translation, the process is weakly stationary. By the Wiener–Khinchin theorem [34, 35], the power spectral density (PSD) of is the Fourier transform of the autocorrelation function , provided is continuous at . The PSD describes the distribution of the signal power in the frequency domain. The total power is given by Hence, (2.31) yields

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

Relation (2.35) shows that the noise power is multiplicative in the sense that it is proportional to the average signal power . Consequently, speckle noise cannot be made relatively smaller by increasing the signal power. We also note that the noise power is proportional to . 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, . 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.

##### 2.3. Statistical Properties of Differentiated Speckle Noise

In the conventional approach to edge detection using Canny’s algorithm, the signal 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 denote the random process where is the derivative of . Since is also weakly stationary, the power spectral densities of and are related by [34]

Using (2.36), we find

The total power of the process is now given by

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

These conditions are met in all applications since 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 . Then where is the Fourier transform of . Substituting the identity into (2.42), we find

Then the integral in (2.40) becomes

Using conditions (2.41), a partial integration yields

Finally, combining (2.40), (2.45), and (2.46), we obtain

We refer to (2.47) as the total power of differentiated speckle noise. Since , the power equals the variance of the process .

##### 2.4. Example: Elliptical Gaussian Illumination

Many lasers emit beam whose optical field can be approximated by the elliptical Gaussian function where and are the beam radii in the and directions, and 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 and are the beam radii at the waist, then at some distance measured from the waist, the beam size is given by [36]

Let us calculate the average size of speckle generated by a Gaussian beam. Substituting the beam intensity from (2.48) into (2.14), we find that the speckle correlation cells have elliptical shape of average area

It is interesting to note that using geometrical considerations, Ennos [37] estimated the average speckle diameter to be where is the diameter of the laser beam. For a circular Gaussian beam with , the speckle correlation area corresponds to a circle with diameter

This is indeed very close to the estimated value derived in [37] with .

The complex coherence function (2.20) of the moving field is given by

The maximum value of is attained at . For a fixed value of , the “support” of can be defined as the subset such that

It is easily seen that is the elliptical region defined by where and . Thus, has the area where is the average speckle size. Since a typical detector aperture contains a large number of speckle cells, the support of is much smaller than the aperture. This justifies the approximation made in (2.25).

The autocorrelation function (2.30) is given by

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

Integrating (2.58) over the real line, we obtain the power of differentiated speckle noise where 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 . The gray level of a sequence of bars and spaces is modeled by a piecewise constant function . The photodetector signal is now given by where is the noise-free signal, and is speckle noise. The noise-free signal is the convolution where is the line spread function of the beam, and is the beam power. Note that if the reflectance is constant, , then ; hence, is the maximum value of corresponding to . In view of (2.17), we have .

Information about edges is extracted from the derivative of . 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, . Then the local extrema of above a certain threshold correspond to edges, as illustrated in Figures 6 and 7. Thus, it is appropriate to define the signal by

Figure 5: Derivative of a signal corrupted by speckle noise obtained by scanning the bar code in Figure 1.
Figure 6: Derivative of a photodetector signal (– –) generated by a Gaussian beam scanning a single edge at .
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 where 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 in which case . Combining (2.14) and (2.47), we can express as

Let us now consider specific examples.

##### 3.1. One Edge

The gray level of a single edge is given by where is the Heaviside step function: if and if . Then ; hence, (3.2) leads to

The line spread function has a global maximum at its centre, and thus, the signal yields

Therefore, a lower bound for SNR is given by

##### 3.2. Infinite Sequence of Edges

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

The distributional derivative of is the generalized function which together with (3.2) yields

We show that under certain mild assumptions which are satisfied in applications, the maximum of is attained at the point . Let us expand into generalized Fourier series where . Using relation (3.14), we find that the signal derivative is given by where is the Fourier transform of . If the laser beam is symmetric in the scanning direction, then is an even function which implies . One can use the symmetry of to obtain

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, for all . Since , it follows from (3.17) that the maximum value of is attained at , which yields

Finally, using (3.6) and (3.18), we find a lower bound for SNR to be

##### 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 distance . The line spread function of the Gaussian field (2.48) is given by and the -norm of is

Substituting (3.20) and (3.21) into (3.10), we find

In order to find , we need the Fourier transform of the line spread function ,

Then, (3.19) yields

We note that depends on the spot-to-bar ratio which plays an important role in bar code signal analysis. In most cases, ; 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 on the spot-to-bar ratio . It is apparent that is maximum when which implies that narrow beams () have better SNR than wide beams ().

Figure 8: Function .
##### 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 , which we investigate next. Suppose the beam waist is at a distance from the photodetector. Since the laser is placed next to the photodetector, the scan distance can be written as where is the distance from the waist to the scattering plane. For simplicity, we assume that the beam is circular, that is, . Then in view of (2.49),

Let us define the dimensionless variables and . Substituting (3.25) into (3.22) and rearranging terms, we obtain where

For a particular scanner, the waist location is fixed (it is close to the output surface of the laser). Thus, (3.26) provides dependence of on the scan distance . The function is decreasing for and increasing for . It has a local minimum at , that is, at . The lowest value of is attained at and

Typical values of the wavelength and spot size are  m,  m, and  m. For these values of , , and , we have ; hence, the minimum occurs far beyond the working range of a scanner. Consequently, for application purposes, we may consider simply a decreasing function of , which implies that better SNR is achieved at shorter scan distances.

The same qualitative behaviour can also be deduced by analyzing . Let us define where is the spot-to-bar ratio at distance . Then (3.24) can be written as

We wish to find an approximate expression for . Define where is the spot-to-bar ratio at the waist. It is easily seen that for , we can make the approximation

Since , we have ; hence, the approximation (3.30) also holds for . Therefore, can be approximated by for all . Now, substituting (3.25) into (3.31), we find where

The behaviour of is more complex than , and it depends on the exact values of the parameters and . For typical values of , , and as given above, the function is monotonically decreasing for all . 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 .

#### 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 at , so the gray level of a bar code is represented by

As explained earlier, the observed signal is given by (3.1), and the edges are detected by finding the local extrema of . There are several difficulties related to this approach. First, a local extremum of 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 scanned by the Gaussian beam (2.48) at two different scales: and . It is evident that the distance between the local extrema of increases with , 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 may lead to false edges as in Figure 9(b). This figure shows a single bar scanned by the beam with intensity where , and 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.

Figure 9: Noise-free signal (– –) generated by different scanning beams: (a) Gaussian beam with and , (b) beam with intensity distribution given by (4.2).

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 is given by (3.1)–(3.3). In the preprocessing stage, the derivative is filtered by a linear filter with impulse response . 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 [1315, 39]. After filtering, the observed signal becomes

We denote and where is the convolution operator . Since the derivative of speckle noise is a weakly stationary process, so is the process . Now, we pose the following problem: given spectral characteristics of the process 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 . By substituting (4.1) into (3.2), we obtain where and are the edge positions in time domain. The edge locations in noise-free conditions are approximated by solutions of the nonlinear equation , that is,

The number of solutions of (4.5) is usually greater than the number of edges, depending on the exact shape of the line spread function. Furthermore, due to convolution distortion. In our analysis, we will assume that the data is given and is sufficient to perform decoding, that is, for all . This is true if the support of is comparable in size with , the smallest bar or space.

If the signal is corrupted by noise, we are interested in solutions of the equation which represent small random perturbations of the noise-free solutions . Let be a solution of (4.6), and let be a random error associated to . The statistical properties of the random variable depend on the process . It is shown in [40] that for small errors the expected value of is . Furthermore, the second moment of is given by where is the Fourier transform of , and is the power spectral density of . We define the edge position error to be the standard deviation

The above relation shows that depends on the spectral characteristics of the noise as well as the positions of edges in a bar code symbol. The function often decays rapidly to zero as grows, that is, when is large. Hence, only the nearest neighbours of edge contribute to the error .

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

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 . Furthermore, the PSD of speckle noise is given by ; hence, in view of (2.57),

A straightforward computation yields where . By convolving the impulse response with the line spread function (3.20), we obtain

This leads immediately to where is the Hermite polynomial of degree two. Substituting (4.11) and (4.13) into (4.8), we find where and . Recall that are true edge positions and that are solutions of (4.5) which in our case yields

This equation has exactly distinct solutions . Convolution distortion is negligible if , the smallest bar or space. In this case, to a very good approximation; otherwise, (4.15) must be solved numerically.

The factor is responsible for deviations of from the value it would have in the absence of a filter. Indeed, where is the error obtained from (4.8) if is replaced by the Dirac function .

##### 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, for all , 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 , called module. We may assume that the edges are located at

A message stored in a bar code is encoded in the digital bar pattern . As explained earlier, the possible values of in the UPCA symbology are . Each integer between and is encoded as a sequence where . Table 1 shows encodation patterns for integers . For more details on different symbologies, see [1]. For convenience, we define , , and set . Then the distance between a pair of edges is . We introduce the spot-to-bar ratio as a measure of the beam size 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 .

The relative error 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 is proportional to which depends only on the physical characteristics of the system. Hence, we introduce susceptibility which is intrinsic to the bar code symbol alone by where

The measure depends only on the relative positions of edges, that is, the message content of the bar code, and the spot-to-bar ratio . Figure 10 shows the distribution of errors 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 cluster around the values , , and . Hence, all UPCA symbols have approximately the same maximum error 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 is not valid, then the apparent edge positions must be computed numerically from (4.15).

Figure 10: Edge position errors 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. Let be the line spread function of the beam, and let be the spatial frequency of the smallest bar or space we wish to read (). For symmetric beams, the MTF is given by . Since the beam intensity changes with scan distance , so does the MTF. By plotting the MTF as a function of , 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 and , where are solutions of (4.5). The convolution distortion of a bar (space) between the edges and is defined by

A bar code can be decoded if the maximum error of a detected bar (space) width is less than some value , usually . Then, in noise-free conditions, we demand that

Now, suppose the signal is corrupted by speckle noise. Then the edge position becomes a random variable where is the error in space domain associated with speckle noise (i.e., ). The detected bar (space) width is given by . Since , the variance of the detected width is

Using the Cauchy-Schwartz inequality , we obtain where is the edge position error defined by (4.8). Therefore, the standard deviation of is bounded by . This suggests that the condition (5.2) should be replaced by

The above criteria for bar code decoding also takes into account the effect of filtering since both and depend on the filter impulse response .

As seen in Section 2, the intensity of a laser beam depends on the scan distance . The change in the scan distance affects the convolution distortion and the edge position error caused by speckle noise. Therefore, the quantity defined by is a function of . It follows that the working range of a scanner can be defined as the interval such that

Another possible use of the above inequality is beam focusing. Since depends on the beam intensity , for a desired interval , one should try to design a beam such that (5.5) holds. This condition can also be used to optimize the filter impulse response . 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.

#### List of Symbols

 : -norm on : Photodetector response function : Effective aperture area : Gray level of a bar code : Convolution distortion : Bar code module : Standard deviation of edge position error : Edge position error : Photodetector signal : Intensity distribution of incident beam : Intensity distribution of a static speckle pattern : Intensity distribution of a dynamic speckle pattern : Expected value of : Line spread function : Optical wavelength : Complex coherence function of a static optical field : Complex coherence function of a moving optical field : Beam power : Total power of photodetector signal : Optical-to-electrical signal conversion factor