7 Image Processing: Discrete Images In the previous chapter we explored linear, shift-invariant systems in the continuous two-dimensional domain. In practice, we deal with images that are both limited in extent and sampled at discrete points. The results developed so far have to be specialized, extended, and modified to be useful in this domain. Also, a few new aspects appear that must be treated carefully. The sampling theorem tells us under what circumstances a discrete set of samples can accurately represent a continuous image. We also learn what happens when the conditions for the application of this result are not met. This has significant implications for the design of imaging systems. Methods requiring transformation to the frequency domain have be- come popular, in part because of algorithms that permit the rapid compu- tation of the discrete Fourier transform. Care has to be taken, however, since these methods assume that the signal is periodic. We discuss how this requirement can be met and what happens when the assumption does not apply. 7.1 Finite Image Size In practice, images are always of finite size. Consider a rectangular image 7.1 Finite Image Size 145 of width W and height H. Then the integrals in the Fourier transform no longer need to be taken to infinity: H/2 W/2 F (u, v)= f(x, y)e−i(ux+vy) dx dy. −H/2 −W/2 Curiously, we do not need to know F (u, v) for all frequencies in order to reconstruct f(x, y). Knowing that f(x, y)=0for|x| >W/2 and |y| >H/2 provides a strong constraint. Put another way, there is a lot less information in a function that is nonzero only over a finite part of the image plane than in one that is not. To see this, consider the image plane tiled with copies of the image. That is, extend the image in a doubly periodic fashion into a function f(x, y), for |x|≤W/2 and |y|≤H/2; f(x, y)= f(x − kW, y − lH), for |x| >W/2or|y| >H/2, where x + W/2 y + H/2 k = and l = . W H Here x is the largest integer that is not larger than x. The Fourier transform of the repeated image is ∞ ∞ F(u, v)= f(x, y)e−i(ux+vy) dx dy −∞ −∞ ∞ ∞ H/2 W/2 = f(x, y) e−i(u(x−kW )+v(y−lH)) dx dy k=−∞ l=−∞ −H/2 −W/2 ∞ ∞ = eiukW eivlH F (u, v). k=−∞ l=−∞ It is shown in exercise 7-1, using suitable convergence factors, that ∞ ∞ eikx =2π δ(x − 2πk). k=−∞ k=−∞ 146 Image Processing: Discrete Images Thus ∞ ∞ F(u, v)=4π2 δ(uW − 2πk) δ(vH − 2πl) F (u, v) k=−∞ l=−∞ ∞ ∞ 1 2π 2π =4π2 δ u − k δ v − l F (u, v), WH k=−∞ l=−∞ W H from which we see that F(u, v) is zero except at a discrete set of frequencies, 2π 2π (u, v)= k, l . W H Thus, to find f(x, y) we only need to know F (u, v) at these frequencies. But f(x, y) can be obtained from f(x, y) by just “cutting out” the piece for which |x| <W/2 and |y| <H/2. So we only need to know 2π 2π Fkl = F k, l W H for all k and l to recover f(x, y). This is a countable set of numbers. Note that the transform of a periodic function is discrete. The inverse transform can be expressed in the form of a series, since ∞ ∞ 1 +i(ux+vy) f(x, y)= 2 F (u, v)e dx dy 4π −∞ −∞ ∞ ∞ 1 ∞ ∞ 2π 2π = δ u − k δ v − l WH k=−∞ l=−∞ −∞ −∞ W H × F (u, v)e+i(ux+vy)dxdy ∞ ∞ 1 2πi( k x+ l y) = Fkl e W H . WH k=−∞ l=−∞ Another way to look at this is to consider f(x, y) a windowed version of some f(x, y), where f(x, y)=f(x, y) within the window. That is, f(x, y)=f(x, y) w(x, y), where the window function w(x, y) is defined as 1, for |x|≤W/2 and |y|≤H/2; w(x, y)= 0, for |x| >W/2or|y| >H/2. 7.2 Discrete Image Sampling 147 The transform of f(x, y) is then just the convolution of the transform of f(x, y) with the transform of w(x, y). The latter is sin(uW/2) sin(vH/2) WH . uW/2 vH/2 The Fourier transform of f(x, y) is thus a highly smoothed version of the transform of f(x, y). We shall see later that such a filtered function can be fully specified by suitably chosen samples. The function at points other than the given sample points can easily be found by interpolation from the given samples. 7.2 Discrete Image Sampling When the image is digitized, the brightness is known only at a discrete set of locations. We can think of the result as defined by a discrete grid of impulses, ∞ ∞ f(x, y)=wh fkl δ(x − kw, y − lh), k=−∞ l=−∞ where w and h are the horizontal and vertical sampling intervals, respec- tively. The Fourier transform now becomes ∞ ∞ ∞ ∞ −i(ux+vy) F (u, v)=wh fkl δ(x − kw, y − lh)e dx dy −∞ −∞ k=−∞ l=−∞ ∞ ∞ −i(ukw+vlh) = wh fkl e . k=−∞ l=−∞ This is a periodic function. The period in u is 2π/w and that in v is 2π/h. Thus a discrete function transforms into a periodic one. This means that we can forget the part of F (u, v) for |u| >π/wand |v| >π/h. Wedonot need it to recover f(x, y). It is of interest to recover the inverse transform of a function that is equal to F (u, v) in this region and zero outside: F (u, v), for |u|≤π/w and |v|≤π/h; F(u, v)= 0, for |u| >π/wor |v| >π/h. The inverse transform is π/h π/w 1 +i(ux+vy) f(x, y)= 2 F (u, v)e dx dy. 4π −π/h −π/w 148 Image Processing: Discrete Images This function is defined for all x and y, but we are particularly interested in its values at the grid points (x, y)=(kw, lh). We can write the function as π/h π/w ∞ ∞ wh −i(ukw+vlh) +i(ux+vy) f(x, y)= 2 fkl e e du dv 4π −π/h −π/w k=−∞ l=−∞ ∞ ∞ π/h π/w wh i(u(x−kw)+v(y−lh)) = 2 fkl e du dv 4π k=−∞ l=−∞ −π/h −π/w ∞ ∞ sin π(x/w − k) sin π(y/h − l) = fkl − − . k=−∞ l=−∞ π(x/w k) π(y/h l) At (x, y)=(kw, lh) the above reduces to fkl. Between grid points, f(x, y) is interpolated using a kernel that is the product of a sin(x)/x term and a sin(y)/y term. Another way to look at this is to consider the function created by multiplying f(x, y) by the sampling grid: ∞ ∞ g(x, y)=wh δ(x − kw, y − lh). k=−∞ l=−∞ The Fourier transform of the result is 1/(4π2) times the convolution of the transform of f(x, y) with the transform of the sampling grid. The latter is ∞ ∞ 2πk 2πl 4π2 δ u − ,v− , k=−∞ l=−∞ w h so that the Fourier transform of f(x, y) times g(x, y) is a sampled version of the transform F (u, v)off(x, y), namely ∞ ∞ 2π 2π 2πk 2πl F k, l δ u − ,v− . k=−∞ l=−∞ w h w h 7.3 The Sampling Theorem From the foregoing discussion we see that a function that is bandlimited is fully specified by samples on a regular grid. This result is known as the sampling theorem.IfF (u, v)=0for|u| >π/wor |v| >π/h, then f(x, y) 7.3 The Sampling Theorem 149 can be recovered from the set f(kw, lh) for all integers k and l. In fact, we have an explicit interpolation formula, ∞ ∞ sin π(x/w − k) sin π(y/h − l) f(x, y)= fkl − − , k=−∞ l=−∞ π(x/w k) π(y/h l) that does not involve the Fourier transform. This is an important result because it justifies sampling the image. No information is lost, provided that the function sampled is “smooth” enough, that is, provided that it is bandlimited. The required sampling interval is also specified. If only frequencies less than B occur, the sampling interval can be as large as δ = π/B. Stated in a different way, the sampling interval should be less than λ/2 when λ is the wavelength of the highest frequency present. If δ is the sampling interval, the result can be expressed in terms of the Nyquist frequency, π/δ. The signal can contain frequencies only up to the Nyquist frequency if it is to be faithfully reconstructed from samples. The sampling theorem makes clear the dangers of applying this method to functions that are not limited in this way. Information is lost, and the original function cannot be recovered. What happens specifically is that higher frequencies, when sampled, look no different than frequencies within the acceptable interval. It is as if their frequencies were “folded back” at the frequency π/B. This is also called aliasing, since a wave of frequency ω>Bproduces the same samples as one of frequency 2B − ω.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages17 Page
-
File Size-