91 4 IMAGE SAMPLING AND RECONSTRUCTION In digital image processing systems, one usually deals with arrays of numbers obtained by spatially sampling points of a physical image. After processing, another array of numbers is produced, and these numbers are then used to reconstruct a con- tinuous image for viewing. Image samples nominally represent some physical mea- surements of a continuous image field, for example, measurements of the image intensity or photographic density. Measurement uncertainties exist in any physical measurement apparatus. It is important to be able to model these measurement errors in order to specify the validity of the measurements and to design processes for compensation of the measurement errors. Also, it is often not possible to mea- sure an image field directly. Instead, measurements are made of some function related to the desired image field, and this function is then inverted to obtain the desired image field. Inversion operations of this nature are discussed in the sections on image restoration. In this chapter the image sampling and reconstruction process is considered for both theoretically exact and practical systems. 4.1. IMAGE SAMPLING AND RECONSTRUCTION CONCEPTS In the design and analysis of image sampling and reconstruction systems, input images are usually regarded as deterministic fields (1–5). However, in some situations it is advantageous to consider the input to an image processing system, especially a noise input, as a sample of a two-dimensional random process (5–7). Both viewpoints are developed here for the analysis of image sampling and reconstruction methods. Digital Image Processing: PIKS Inside, Third Edition. William K. Pratt Copyright © 2001 John Wiley & Sons, Inc. ISBNs: 0-471-37407-5 (Hardback); 0-471-22132-5 (Electronic) 92 IMAGE SAMPLING AND RECONSTRUCTION 4.1.1. Sampling Deterministic Fields Let denote a continuous, infinite-extent, ideal image field representing the luminance, photographic density, or some desired parameter of a physical image. In a perfect image sampling system, spatial samples of the ideal image would, in effect, be obtained by multiplying the ideal image by a spatial sampling function (4.1-1) composed of an infinite array of Dirac delta functions arranged in a grid of spacing as shown in Figure 4.1-1. The sampled image is then represented as (4.1-2) where it is observed that may be brought inside the summation and evalu- ated only at the sample points . It is convenient, for purposes of analysis, to consider the spatial frequency domain representation of the sampled image obtained by taking the continuous two-dimensional Fourier transform of the sampled image. Thus (4.1-3) FIGURE 4.1-1. Dirac delta function sampling array. F I xy,() Sxy,() δxj∆x– yk∆y–,() k ∞ –= ∞ ∑ j ∞ –= ∞ ∑ = ∆x ∆y,() F P xy,()F I xy,()Sxy,() F I j ∆xk∆y,()δxj∆x– yk∆y–,() k ∞ –= ∞ ∑ j ∞ –= ∞ ∑ == F I xy,() j ∆xk∆y,() F P ω x ω y ,() F P ω x ω y ,() F P xy,() i ω x x ω y y+()–{}exp xdyd ∞ – ∞ ∫ ∞ – ∞ ∫ = IMAGE SAMPLING AND RECONSTRUCTION CONCEPTS 93 By the Fourier transform convolution theorem, the Fourier transform of the sampled image can be expressed as the convolution of the Fourier transforms of the ideal image and the sampling function as expressed by (4.1-4) The two-dimensional Fourier transform of the spatial sampling function is an infi- nite array of Dirac delta functions in the spatial frequency domain as given by (4, p. 22) (4.1-5) where and represent the Fourier domain sampling fre- quencies. It will be assumed that the spectrum of the ideal image is bandlimited to some bounds such that for and . Performing the convolution of Eq. 4.1-4 yields (4.1-6) Upon changing the order of summation and integration and invoking the sifting property of the delta function, the sampled image spectrum becomes (4.1-7) As can be seen from Figure 4.1-2, the spectrum of the sampled image consists of the spectrum of the ideal image infinitely repeated over the frequency plane in a grid of resolution . It should be noted that if and are chosen too large with respect to the spatial frequency limits of , the individual spectra will overlap. A continuous image field may be obtained from the image samples of by linear spatial interpolation or by linear spatial filtering of the sampled image. Let denote the continuous domain impulse response of an interpolation filter and represent its transfer function. Then the reconstructed image is obtained F I ω x ω y ,() S ω x ω y ,() F P ω x ω y ,() 1 4π 2 ---------F I ω x ω y ,() ᭺ * S ω x ω y ,()= S ω x ω y ,() 4π 2 ∆x ∆y --------------- δω x j ω xs – ω y k ω ys –,() k ∞ –= ∞ ∑ j ∞ –= ∞ ∑ = ω xs 2π∆x⁄= ω ys 2π∆y⁄= F I ω x ω y ,()0= ω x ω xc > ω y ω yc > F P ω x ω y ,() 1 ∆x ∆y --------------- F I ω x α– ω y β–,() ∞ – ∞ ∫ ∞ – ∞ ∫ = δω x j ω xs – ω y k ω ys –,() k ∞ –= ∞ ∑ j ∞ –= ∞ ∑ × dα dβ F P ω x ω y ,() 1 ∆x ∆y --------------- F I ω x j ω xs – ω y k ω ys –,() k ∞ –= ∞ ∑ j ∞ –= ∞ ∑ = 2π∆x 2π∆y⁄,⁄() ∆x ∆y F I ω x ω y ,() F P xy,() Rxy,() R ω x ω y ,() 94 IMAGE SAMPLING AND RECONSTRUCTION by a convolution of the samples with the reconstruction filter impulse response. The reconstructed image then becomes (4.1-8) Upon substituting for from Eq. 4.1-2 and performing the convolution, one obtains (4.1-9) Thus it is seen that the impulse response function acts as a two-dimensional interpolation waveform for the image samples. The spatial frequency spectrum of the reconstructed image obtained from Eq. 4.1-8 is equal to the product of the recon- struction filter transform and the spectrum of the sampled image, (4.1-10) or, from Eq. 4.1-7, (4.1-11) FIGURE 4.1-2. Typical sampled image spectra. ( a ) Original image ( b ) Sampled image 2p ∆x 2p ∆y w X w X w Y w Y F R xy,()F P xy,() ᭺ * Rxy,()= F P xy,() F R xy,() F I j ∆xk∆y,()Rx j∆x– yk∆y–,() k ∞ –= ∞ ∑ j ∞ –= ∞ ∑ = Rxy,() F R ω x ω y ,()F P ω x ω y ,()R ω x ω y ,()= F R ω x ω y ,() 1 ∆x ∆y --------------- R ω x ω y ,() F I ω x j ω xs – ω y k ω ys –,() k ∞ –= ∞ ∑ j ∞ –= ∞ ∑ = IMAGE SAMPLING AND RECONSTRUCTION CONCEPTS 95 It is clear from Eq. 4.1-11 that if there is no spectrum overlap and if filters out all spectra for , the spectrum of the reconstructed image can be made equal to the spectrum of the ideal image, and therefore the images themselves can be made identical. The first condition is met for a bandlimited image if the sampling period is chosen such that the rectangular region bounded by the image cutoff frequencies lies within a rectangular region defined by one-half the sam- pling frequency. Hence (4.1-12a) or, equivalently, (4.1-12b) In physical terms, the sampling period must be equal to or smaller than one-half the period of the finest detail within the image. This sampling condition is equivalent to the one-dimensional sampling theorem constraint for time-varying signals that requires a time-varying signal to be sampled at a rate of at least twice its highest-fre- quency component. If equality holds in Eq. 4.1-12, the image is said to be sampled at its Nyquist rate; if and are smaller than required by the Nyquist criterion, the image is called oversampled; and if the opposite case holds, the image is under- sampled. If the original image is sampled at a spatial rate sufficient to prevent spectral overlap in the sampled image, exact reconstruction of the ideal image can be achieved by spatial filtering the samples with an appropriate filter. For example, as shown in Figure 4.1-3, a filter with a transfer function of the form for and (4.1-13a) otherwise (4.1-13b) where K is a scaling constant, satisfies the condition of exact reconstruction if and . The point-spread function or impulse response of this reconstruction filter is (4.1-14) R ω x ω y ,() j k, 0≠ ω xc ω yc ,() ω xc ω xs 2 --------≤ω yc ω ys 2 --------≤ ∆x π ω xc --------≤∆y π ω yc --------≤ ∆x ∆y R ω x ω y ,() K 0 = ω x ω xL ≤ ω y ω yL ≤ ω xL ω xc >ω yL ω yc > Rxy,() Kω xL ω yL π 2 ----------------------- ω xL x{}sin ω xL x -------------------------- ω yL y{}sin ω yL y --------------------------= 96 IMAGE SAMPLING AND RECONSTRUCTION With this filter, an image is reconstructed with an infinite sum of func- tions, called sinc functions. Another type of reconstruction filter that could be employed is the cylindrical filter with a transfer function for (4.1-15a) otherwise (4.1-15b) provided that . The impulse response for this filter is FIGURE 4.1-3. Sampled image reconstruction filters. θsin()θ⁄ R ω x ω y ,() K 0 = ω x 2 ω y 2 + ω 0 ≤ ω 0 2 ω xc 2 ω yc 2 +> IMAGE SAMPLING AND RECONSTRUCTION CONCEPTS 97 (4.1-16) where is a first-order Bessel function. There are a number of reconstruction filters, or equivalently, interpolation waveforms, that could be employed to provide perfect image reconstruction. In practice, however, it is often difficult to implement optimum reconstruction filters for imaging systems. 4.1.2. Sampling Random Image Fields In the previous discussion of image sampling and reconstruction, the ideal input image field has been considered to be a deterministic function. It has been shown that if the Fourier transform of the ideal image is bandlimited, then discrete image samples taken at the Nyquist rate are sufficient to reconstruct an exact replica of the ideal image with proper sample interpolation. It will now be shown that similar results hold for sampling two-dimensional random fields. Let denote a continuous two-dimensional stationary random process with known mean and autocorrelation function (4.1-17) where and . This process is spatially sampled by a Dirac sampling array yielding (4.1-18) The autocorrelation of the sampled process is then (4.1-19) The first term on the right-hand side of Eq. 4.1-19 is the autocorrelation of the stationary ideal image field. It should be observed that the product of the two Dirac sampling functions on the right-hand side of Eq. 4.1-19 is itself a Dirac sampling function of the form Rxy,()2πω 0 K J 1 ω 0 x 2 y 2 + x 2 y 2 + ----------------------------------------= J 1 · {} F I xy,() η F I R F I τ x τ y ,()EF I x 1 y 1 ,()F * I x 2 y 2 ,(){}= τ x x 1 x 2 –= τ y y 1 y 2 –= F P xy,()F I xy,()Sxy,()F I xy,() δxj∆x– yk∆y–,() k ∞ –= ∞ ∑ j ∞ –= ∞ ∑ == R F P τ x τ y ,()EF P x 1 y 1 ,()F * P x 2 y 2 ,(){}= EF I x 1 y 1 ,()F * I x 2 y 2 ,(){}Sx 1 y 1 ,()Sx 2 y 2 ,()= 98 IMAGE SAMPLING AND RECONSTRUCTION (4.1-20) Hence the sampled random field is also stationary with an autocorrelation function (4.1-21) Taking the two-dimensional Fourier transform of Eq. 4.1-21 yields the power spec- trum of the sampled random field. By the Fourier transform convolution theorem (4.1-22) where and represent the power spectral densities of the ideal image and sampled ideal image, respectively, and is the Fourier transform of the Dirac sampling array. Then, by the derivation leading to Eq. 4.1-7, it is found that the spectrum of the sampled field can be written as (4.1-23) Thus the sampled image power spectrum is composed of the power spectrum of the continuous ideal image field replicated over the spatial frequency domain at integer multiples of the sampling spatial frequency . If the power spectrum of the continuous ideal image field is bandlimited such that for and , where and are cutoff frequencies, the individual spectra of Eq. 4.1-23 will not overlap if the spatial sampling periods are chosen such that and . A continuous random field may be recon- structed from samples of the random ideal image field by the interpolation formula (4.1-24) where is the deterministic interpolation function. The reconstructed field and the ideal image field can be made equivalent in the mean-square sense (5, p. 284), that is, (4.1-25) if the Nyquist sampling criteria are met and if suitable interpolation functions, such as the sinc function or Bessel function of Eqs. 4.1-14 and 4.1-16, are utilized. Sx 1 y 1 ,()Sx 2 y 2 ,()Sx 1 x 2 – y 1 y 2 –,()S τ x τ y ,()== R F P τ x τ y ,()R F I τ x τ y ,()S τ x τ y ,()= W F P ω x ω y ,() 1 4π 2 ---------W F I ω x ω y ,() ᭺ * S ω x ω y ,()= W F I ω x ω y ,() W F P ω x ω y ,() S ω x ω y ,() W F P ω x ω y ,() 1 ∆x ∆y --------------- W F I ω x j ω xs – ω y k ω ys –,() k ∞ –= ∞ ∑ j ∞ –= ∞ ∑ = 2π∆x 2π∆y⁄,⁄() W F I ω x ω y ,()0= ω x ω xc > ω y ω yc > ω xc ω yc ∆x πω xc ⁄<∆y πω yc ⁄< F R xy,() F R xy,() F I j ∆xk∆y,()Rx j∆x– yk∆y–,() k ∞ –= ∞ ∑ j ∞ –= ∞ ∑ = Rxy,() EF I xy,()F R xy,()– 2 {}0= IMAGE SAMPLING SYSTEMS 99 The preceding results are directly applicable to the practical problem of sampling a deterministic image field plus additive noise, which is modeled as a random field. Figure 4.1-4 shows the spectrum of a sampled noisy image. This sketch indicates a significant potential problem. The spectrum of the noise may be wider than the ideal image spectrum, and if the noise process is undersampled, its tails will overlap into the passband of the image reconstruction filter, leading to additional noise artifacts. A solution to this problem is to prefilter the noisy image before sampling to reduce the noise bandwidth. 4.2. IMAGE SAMPLING SYSTEMS In a physical image sampling system, the sampling array will be of finite extent, the sampling pulses will be of finite width, and the image may be undersampled. The consequences of nonideal sampling are explored next. As a basis for the discussion, Figure 4.2-1 illustrates a common image scanning system. In operation, a narrow light beam is scanned directly across a positive photographic transparency of an ideal image. The light passing through the transparency is collected by a condenser lens and is directed toward the surface of a photodetector. The electrical output of the photodetector is integrated over the time period during which the light beam strikes a resolution cell. In the analysis it will be assumed that the sampling is noise-free. The results developed in Section 4.1 for FIGURE 4.1-4. Spectra of a sampled noisy image. 100 IMAGE SAMPLING AND RECONSTRUCTION sampling noisy images can be combined with the results developed in this section quite readily. Also, it should be noted that the analysis is easily extended to a wide class of physical image sampling systems. 4.2.1. Sampling Pulse Effects Under the assumptions stated above, the sampled image function is given by (4.2-1) where the sampling array (4.2-2) is composed of (2J + 1)(2K + 1) identical pulses arranged in a grid of spac- ing . The symmetrical limits on the summation are chosen for notational simplicity. The sampling pulses are assumed scaled such that (4.2-3) For purposes of analysis, the sampling function may be assumed to be generated by a finite array of Dirac delta functions passing through a linear filter with impulse response . Thus FIGURE 4.2-1. Image scanning system. F P xy,()F I xy,()Sxy,()= Sxy,() Px j∆x– yk∆y–,() kK –= K ∑ jJ –= J ∑ = Pxy,() ∆x ∆y, Pxy,()xdyd ∞ – ∞ ∫ 1= ∞ – ∞ ∫ D T xy,() Pxy,( )