Digital Signal Processing. The Scientist and Engineers Guide. Steven W. Smith
.pdf
368 |
The Scientist and Engineer's Guide to Digital Signal Processing |
perceive and understand speech. Words are recognized by their sounds, but also by the context of the sentence, and the expectations of the listener. For example, imagine hearing the two sentences:
The child wore a spider ring on Halloween.
He was an American spy during the war.
Even if exactly the same sounds were produced to convey the underlined words, listeners hear the correct words for the context. From your accumulated knowledge about the world, you know that children don't wear secret agents, and people don't become spooky jewelry during wartime. This usually isn't a conscious act, but an inherent part of human hearing.
Most speech recognition algorithms rely only on the sound of the individual words, and not on their context. They attempt to recognize words, but not to understand speech. This places them at a tremendous disadvantage compared to human listeners. Three annoyances are common in speech recognition systems: (1) The recognized speech must have distinct pauses between the words. This eliminates the need for the algorithm to deal with phrases that sound alike, but are composed of different words (i.e., spider ring and spy during). This is slow and awkward for people accustomed to speaking in an overlapping flow. (2) The vocabulary is often limited to only a few hundred words. This means that the algorithm only has to search a limited set to find the best match. As the vocabulary is made larger, the recognition time and error rate both increase. (3) The algorithm must be trained on each speaker. This requires each person using the system to speak each word to be recognized, often needing to be repeated five to ten times. This personalized database greatly increases the accuracy of the word recognition, but it is inconvenient and time consuming.
The prize for developing a successful speech recognition technology is enormous. Speech is the quickest and most efficient way for humans to communicate. Speech recognition has the potential of replacing writing, typing, keyboard entry, and the electronic control provided by switches and knobs. It just needs to work a little better to become accepted by the commercial marketplace. Progress in speech recognition will likely come from the areas of artificial intelligence and neural networks as much as through DSP itself. Don't think of this as a technical difficulty; think of it as a technical opportunity.
Nonlinear Audio Processing
Digital filtering can improve audio signals in many ways. For instance, Wiener filtering can be used to separate frequencies that are mainly signal, from frequencies that are mainly noise (see Chapter 17). Likewise, deconvolution can compensate for an undesired convolution, such as in the restoration of old
370 |
The Scientist and Engineer's Guide to Digital Signal Processing |
requires a knowledge of the signal and noise spectra beforehand, so that the filter's frequency response can be determined. This nonlinear technique uses the same idea, except that the Wiener filter's frequency response is recalculated for each segment, based on the spectrum of that segment. In other words, the filter's frequency response changes from segment-to-segment, as determined by the characteristics of the signal itself.
One of the difficulties in implementing this (and other) nonlinear techniques is that the overlap-add method for filtering long signals is not valid. Since the frequency response changes, the time domain waveform of each segment will no longer align with the neighboring segments. This can be overcome by remembering that audio information is encoded in frequency patterns that change over time, and not in the shape of the time domain waveform. A typical approach is to divide the original time domain signal into overlapping segments. After processing, a smooth window is applied to each of the overlapping segments before they are recombined. This provides a smooth transition of the frequency spectrum from one segment to the next.
The second nonlinear technique is called homomorphic signal processing. This term literally means: the same structure. Addition is not the only way that noise and interference can be combined with a signal of interest; multiplication and convolution are also common means of mixing signals together. If signals are combined in a nonlinear way (i.e., anything other than addition), they cannot be separated by linear filtering. Homomorphic techniques attempt to separate signals combined in a nonlinear way by making the problem become linear. That is, the problem is converted to the same structure as a linear system.
For example, consider an audio signal transmitted via an AM radio wave. As atmospheric conditions change, the received amplitude of the signal increases and decreases, resulting in the loudness of the received audio signal slowly changing over time. This can be modeled as the audio signal, represented by a[ ], being multiplied by a slowly varying signal, g[ ], that represents the changing gain. This problem is usually handled in an electronic circuit called an automatic gain control (AGC), but it can also be corrected with nonlinear DSP.
As shown in Fig. 22-11, the input signal, a [ ] × g [ ] , is passed through the logarithm function. From the identity, log (x y) ' log x % log y, this results in two signals that are combined by addition, i.e., log a [ ] % log g [ ] . In other words, the logarithm is the homomorphic transform that turns the nonlinear problem of multiplication into the linear problem of addition.
Next, the added signals are separated by a conventional linear filter, that is, some frequencies are passed, while others are rejected. For the AGC, the gain signal, g[ ], will be composed of very low frequencies, far below the 200 hertz to 3.2 kHz band of the voice signal. The logarithm of these signals will have more complicated spectra, but the idea is the same: a high-pass filter is used to eliminate the varying gain component from the signal.
|
|
Chapter 22Audio Processing |
|
371 |
|||||
a [ ] × g [ ] |
Linear |
|
Anti- |
|
a [ ] |
||||
|
|
Logarithm |
|
|
|
|
|||
|
|
|
|
Filter |
Logarithm |
|
|
||
|
|
|
|
|
|
|
|||
|
|
log a [ ] % log g [ ] |
|
log a [ ] |
|
|
|
||
FIGURE 22-11
Homomorphic separation of multiplied signals. Taking the logarithm of the input signal transforms components that are multiplied into components that are added. These components can then be separated by linear filtering, and the effect of the logarithm undone.
In effect, log a [ ] % log g [ ] is converted into log a [ ] . In the last step, the logarithm is undone by using the exponential function (the anti-logarithm, or e x ), producing the desired output signal, a [ ].
Figure 22-12 shows a homomorphic system for separating signals that have been convolved. An application where this has proven useful is in removing echoes from audio signals. That is, the audio signal is convolved with an impulse response consisting of a delta function plus a shifted and scaled delta function. The homomorphic transform for convolution is composed of two stages, the Fourier transform, changing the convolution into a multiplication, followed by the logarithm, turning the multiplication into an addition. As before, the signals are then separated by linear filtering, and the homomorphic transform undone.
An interesting twist in Fig. 22-12 is that the linear filtering is dealing with frequency domain signals in the same way that time domain signals are usually processed. In other words, the time and frequency domains have been swapped from their normal use. For example, if FFT convolution were used to carry out the linear filtering stage, the "spectra" being multiplied would be in the time domain. This role reversal has given birth to a strange jargon. For instance, cepstrum (a rearrangment of spectrum) is the Fourier transform of the logarithm of the Fourier transform. Likewise, there are long-pass and shortpass filters, rather than low-pass and high-pass filters. Some authors even use the terms Quefrency Alanysis and liftering.
|
|
Homomorphic Transform |
|
|
|
Inverse Homomorphic Transform |
|
|
||||||||
x [ ] t y [ ] |
|
|
|
|
|
|
|
|
Inverse |
x [ ] |
||||||
|
|
Fourier |
|
|
|
|
Linear |
|
|
Anti- |
|
|
|
|
||
|
|
Logarithm |
|
|
|
|
|
Fourier |
|
|
|
|||||
|
|
Transform |
|
Filter |
|
|
Logarithm |
|
|
|
|
|
||||
|
|
|
|
|
|
|
|
Transform |
|
|
||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||
|
|
X [ ] × Y [ ] |
|
|
|
log X [ ] |
|
|
|
|
|
|
||||
|
|
|
|
|
log X [ ] % log Y [ ] |
|
|
|
X [ ] |
|
|
|||||
FIGURE 22-12
Homomorphic separation of convolved signals. Components that have been convolved are converted into components that are added by taking the Fourier transform followed by the logarithm. After linear filtering to separate the added components, the original steps are undone.
372 |
The Scientist and Engineer's Guide to Digital Signal Processing |
Keep in mind that these are simplified descriptions of sophisticated DSP algorithms; homomorphic processing is filled with subtle details. For example, the logarithm must be able to handle both negative and positive values in the input signal, since this is a characteristic of audio signals. This requires the use of the complex logarithm, a more advanced concept than the logarithm used in everyday science and engineering. When the linear filtering is restricted to be a zero phase filter, the complex log is found by taking the simple logarithm of the absolute value of the signal. After passing through the zero phase filter, the sign of the original signal is reapplied to the filtered signal.
Another problem is aliasing that occurs when the logarithm is taken. For example, imagine digitizing a continuous sine wave. In accordance with the sampling theorem, two or more samples per cycle is sufficient. Now consider digitizing the logarithm of this continuous sine wave. The sharp corners require many more samples per cycle to capture the waveform, i.e., to prevent aliasing. The required sampling rate can easily be 100 times as great after the log, as before. Further, it doesn't matter if the logarithm is applied to the continuous signal, or to its digital representation; the result is the same. Aliasing will result unless the sampling rate is high enough to capture the sharp corners produced by the nonlinearity. The result is that audio signals may need to be sampled at 100 kHz or more, instead of only the standard 8 kHz.
Even if these details are handled, there is no guarantee that the linearized signals can be separated by the linear filter. This is because the spectra of the linearized signals can overlap, even if the spectra of the original signals do not. For instance, imagine adding two sine waves, one at 1 kHz, and one at 2 kHz. Since these signals do not overlap in the frequency domain, they can be completely separated by linear filtering. Now imagine that these two sine waves are multiplied. Using homomorphic processing, the log is taken of the combined signal, resulting in the log of one sine wave plus the log of the other sine wave. The problem is, the logarithm of a sine wave contains many harmonics. Since the harmonics from the two signals overlap, their complete separation is not possible.
In spite of these obstacles, homomorphic processing teaches an important lesson: signals should be processed in a manner consistent with how they are formed. Put another way, the first step in any DSP task is to understand how information is represented in the signals being processed.
374 |
The Scientist and Engineer's Guide to Digital Signal Processing |
rather than by the formal constraints of the sampling theorem. Aliasing can occur in images, but it is generally thought of as a nuisance rather than a major problem. For instance, pinstriped suits look terrible on television because the repetitive pattern is greater than the Nyquist frequency. The aliased frequencies appear as light and dark bands that move across the clothing as the person changes position.
A "typical" digital image is composed of about 500 rows by 500 columns. This is the image quality encountered in television, personal computer applications, and general scientific research. Images with fewer pixels, say 250 by 250, are regarded as having unusually poor resolution. This is frequently the case with new imaging modalities; as the technology matures, more pixels are added. These low resolution images look noticeably unnatural, and the individual pixels can often be seen. On the other end, images with more than 1000 by 1000 pixels are considered exceptionally good. This is the quality of the best computer graphics, high-definition television, and 35 mm motion pictures. There are also applications needing even higher resolution, requiring several thousand pixels per side: digitized x-ray images, space photographs, and glossy advertisements in magazines.
The strongest motivation for using lower resolution images is that there are fewer pixels to handle. This is not trivial; one of the most difficult problems in image processing is managing massive amounts of data. For example, one second of digital audio requires about eight kilobytes. In comparison, one second of television requires about eight Megabytes. Transmitting a 500 by 500 pixel image over a 33.6 kbps modem requires nearly a minute! Jumping to an image size of 1000 by 1000 quadruples these problems.
It is common for 256 gray levels (quantization levels) to be used in image processing, corresponding to a single byte per pixel. There are several reasons for this. First, a single byte is convenient for data management, since this is how computers usually store data. Second, the large number of pixels in an image compensate to a certain degree for a limited number of quantization steps. For example, imagine a group of adjacent pixels alternating in value between digital numbers (DN) 145 and 146. The human eye perceives the region as a brightness of 145.5. In other words, images are very dithered. Third, and most important, a brightness step size of 1/256 (0.39%) is smaller than the eye can perceive. An image presented to a human observer will not be improved by using more than 256 levels.
However, some images need to be stored with more than 8 bits per pixel. Remember, most of the images encountered in DSP represent nonvisual parameters. The acquired image may be able to take advantage of more quantization levels to properly capture the subtle details of the signal. The point of this is, don't expect to human eye to see all the information contained in these finely spaced levels. We will consider ways around this problem during a later discussion of brightness and contrast.
The value of each pixel in the digital image represents a small region in the continuous image being digitized. For example, imagine that the Venus
376 |
The Scientist and Engineer's Guide to Digital Signal Processing |
a highly focused burst of microwave energy, striking the surface in, for example, a circular area 15 meters in diameter. Each pixel therefore contains information about this circular area, regardless of the size of the sampling grid.
This region of the continuous image that contributes to the pixel value is called the sampling aperture. The size of the sampling aperture is often related to the inherent capabilities of the particular imaging system being used. For example, microscopes are limited by the quality of the optics and the wavelength of light, electronic cameras are limited by random electron diffusion in the image sensor, and so on. In most cases, the sampling grid is made approximately the same as the sampling aperture of the system. Resolution in the final digital image will be limited primary by the larger of the two, the sampling grid or the sampling aperture. We will return to this topic in Chapter 25 when discussing the spatial resolution of digital images.
Color is added to digital images by using three numbers for each pixel, representing the intensity of the three primary colors: red, green and blue. Mixing these three colors generates all possible colors that the human eye can perceive. A single byte is frequently used to store each of the color intensities, allowing the image to capture a total of 256×256×256 = 16.8 million different colors.
Color is very important when the goal is to present the viewer with a true picture of the world, such as in television and still photography. However, this is usually not how images are used in science and engineering. The purpose here is to analyze a two-dimensional signal by using the human visual system as a tool. Black and white images are sufficient for this.
Cameras and Eyes
The structure and operation of the eye is very similar to an electronic camera, and it is natural to discuss them together. Both are based on two major components: a lens assembly, and an imaging sensor. The lens assembly captures a portion of the light emanating from an object, and focus it onto the imaging sensor. The imaging sensor then transforms the pattern of light into a video signal, either electronic or neural.
Figure 23-2 shows the operation of the lens. In this example, the image of an ice skater is focused onto a screen. The term focus means there is a one- to-one match of every point on the ice skater with a corresponding point on the screen. For example, consider a 1 mm × 1 mm region on the tip of the toe. In bright light, there are roughly 100 trillion photons of light striking this one square millimeter area each second . Depending on the characteristics of the surface, between 1 and 99 percent of these incident light photons will be reflected in random directions. Only a small portion of these reflected photons will pass through the lens. For example, only about one-millionth of the reflected light will pass through a one centimeter diameter lens located 3 meters from the object.
