Beruflich Dokumente
Kultur Dokumente
f (x, y) exp i2
x=0 y=0
xu yv + M N
for frequencies u = 0, 1, . . . , M 1 and v = 0, 1, . . . , N 1. The letter i = 1 denotes the imaginary unit of complex numbers. The Eulerian number e = 2.71828 . . . is also denoted by exp, and satises the Eulerian formula exp(i) = ei = cos() + i sin() for any real .
Page 1 August 2006
. .
Complex numbers combine real parts and imaginary parts, and the latter ones cannot be identied in reality; they are a creation of mathematics. These new entities simplied mathematics. For example, they allowed to proof the Fundamental Theorem of Algebra, and uniform solution formulas for quadric or cubic (i.e., x3 + b x2 + c x + d = 0) equations. It is common practice to visualize complex numbers a + i b as points (a, b) in the plane, called the complex plane.
Page 2 August 2006
. .
The conjugate z of a complex number z = a + i b is the complex number a i b. We have (z ) = z and (z1 z2 ) = z1 z2 . Let z = 0. Then we have z 1 = ||z||2 z . There are many interesting links between the calculus of complex numbers and geometry in the Euclidean plane. For example, a complex number z can also be written in the form z = r ei , with r = ||z|| and (the complex argument of z) is uniquely dened modulo 2. This maps complex numbers into polar coordinates (r, ). The following theorem is of basic geometric importance: THEOREM: A rotation of a vector (m, n)T [i.e., starting at the origin (0, 0)] about an angle is the vector (a, b)T , with a + i b = ei (m + i n) In particular, the complex number z = exp[i2/M ] denes an M th root of unity; we have z M = z 2M = z 3M = . . . = 1. Assume that M is a multiple of 4. Then we have z 0 = 1 + i 0, z M/4 = 0 + i 1, z M/2 = 1 + i 0, and z 3M/4 = 0 + i (1). These properties allowed to design the algorithm of the Fast Fourier Transform (FFT).
Page 3 August 2006
. .
Assume we apply the 2D Fourier transform to a function f , dened in the spatial domain. For the resulting 2D Fourier transform, we obtain at the origin in the Fourier domain 1 F(0, 0) = MN
M 1 N 1
f (x, y)
x=0 y=0
what is the mean of f . Because f has only real values, it follows that the imaginary part of F(0, 0) equals zero. We can also calculate F(1, 0), F(0, 1), F(1, 1), and so forth. It follows that the values of the Fourier transform are in general complex valued (with non-zero imaginary parts). Values for small frequencies u or v (close to zero) represent long wavelengths of sine or cosine components; values for large frequencies u or v (away from zero) represent short wavelengths.
Left: sin . Right: sin 2, with half of the wave length of sin . Low frequencies represent long wavelengths, and thus smooth components of the input picture f . High frequencies represent short wavelength, and thus contrast or point noise in f . Visible directions in f , for example lines into direction (which is equivalent to + ), create value patterns in the F in orthogonal direction (i.e., in direction + /2 in the assumed line example).
Page 4 August 2006
. .
Representation of Matrix F
In pictures we will not have the origin at the center. Values in matrix F are periodic, with periods M and N . Having an innite number of copies of this matrix, we could tessellate the plane (in the form of a regular rectangular grid):
The shaded area is the M N area of matrix F, and it is surrounded by eight more copies of F. The origins are always at the upper left corner. Due to the periodicity, the gure shows that low frequencies are represented in the four corners of matrix F, and the highest frequencies at the center of the matrix. It is possible to shift F into a centered position within the shaded area by multiplying all values f (x, y) rst by (1)x+y , before performing the 2D DFT.
Page 5 August 2006
. .
Spectrum
The norm (or magnitude) ||z|| = r = a2 + b2 and the complex argument (or phase) = arc tan(b/a) dene complex numbers z = a + i b in polar coordinates (r, ). The norm received much attention, because it provides a convenient way of representing the complex-valued matrix F in form of the spectrum ||F||, with ||F||(u, v) = ||F(u, v)|| for all M N frequencies (u, v). For better visibility, the spectrum is normally log-transformed into log10 (1 + ||F(u, v)||):
Page 6
August 2006
. .
Left, top to bottom: Original (low-quality jpg-image), after histogram equalization (showing jpg-artifacts), and inverted color values. Right: Spectra.
Page 7 August 2006
. .
Simple geometric shapes illustrating that main orientations in a picture are (also) rotated by 90 (e.g., vertical bar also generates a horizontal stripe in its spectrum).
Page 8 August 2006
. .
The ideal wave pattern on top generates non-negative values only at v = 0. The diagonal wave pattern is inuenced by nite-array effects. For the overlaid diagonal wave pattern, compare with DFT spectrum shown two pages earlier.
Page 9 August 2006
. .
The Fourier transform F consists of two M N arrays representing the real (i.e., the as) and the imaginary part (i.e., the bs) of the obtained complex numbers a + i b. Thus, the M N real data of the input picture f are now doubled. However, we have the symmetry property that F(u, v) = F(u, v) (recall: the number on the right is the conjugate complex number). Thus, actually half of the data in both arrays of F can be obtained directly from the others. The FFT algorithm typically performs in place: the original picture is used for initializing the M N matrix of the real part, and the matrix of the imaginary part is initialized by zero at all positions. Then the 2D FFT replaces all values in both matrices by 2D DFT results. There is an inverse 2D DFT which allows to transform F back into f :
M 1 N 1
f (x, y) =
u=0 v=0
F(u, v) exp i2
xu yv + M N
Note that the powers of the root of unity are here used in opposite direction (i.e., the minus sign has been replaced by +), and the scaling factor 1/M N of the 2D DFT changed into the scaling factor 1. Important is that the product of both scaling factors equals 1/M N , and we could have split 1/M N also into two scaling factors, both equal to 1/ M N . The inverse 2D DFT will lead to a real-valued function f as long as F satises the symmetry property. Thus, any change in the frequency domain is constrained by this.
Page 10 August 2006
. .
The inverse 2D DFT can also be read as follows: the complex numbers F(u, v) are the Fourier coefcients of f , dened for different frequencies u and v. Each Fourier coefcient is multiplied with a certain combination of a sine and a cosine function, and the sum of all those combinations forms the picture f . That means, if we modify one of the Fourier coefcients (and its symmetric coefcient!) before applying the inverse 2D DFT, then we obtain a modied function f . (i) Option 1: We modify picture data by linear convolution
M 1 N 1
h (x, y) = (f g) (x, y) =
i=0 j=0
f (i, j) g (x i, y j)
in the spatial domain, where g is the lter kernel (also called convolution function). Function h is the ltered picture. (i) Option 2: We modify the 2D DFT F of f by multiplying values in F (symmetry constraint!), position by position, with corresponding complex numbers in G [i.e., F(u, v) G(u, v)]. Let us denote this by F G (not to be confused with matrix multiplication). The resulting complex array is transformed by the inverse 2D DFT into a modied picture. Interestingly, both options lead to identical results assuming that G is the 2D DFT of g, due to the convolution theorem: f g equals the inverse 2D DFT of F G Thus, either a convolution in the spatial domain, or a position-by-position multiplication in the frequency domain, allow to obtain identical ltered pictures.
Page 11 August 2006
. .
Fourier Pairs
Function f its Fourier transform F f (x, y) F(u, v) f g(x, y) F G(u, v) M N f (x, y) (1)x+y F(u + ,v + ) 2 2 a f (x, y) + b g(x, y) a F(u, v) + b G(u, v)
. .
. .
Top: a linear high-pass lter. Bottom: a linear low-pass lter (both shown by amplitudes in the frequency domain). In the example above, linear stands for the decrease of values between the upper and the lower plateau. Further options are, for example, ideal lters (with step edges), or exponential lters with exponentially decreasing (or increasing) values.
A wave pattern [here shown as being generated by F(2, 3)] is possibly apparent in transmitted picture data. It can be removed by decreasing values at a very narrow spot [in the given example, at (u, v) = (2, 3) and at (u, v) = (2, 3)].
Page 14 August 2006
. .
Upper row, left: the famous Lena image, used since 1976 in image analysis for comparing results. Upper row, right: its spectrum, here with lower frequencies at the four corners, and without log-transform, but with a general increase in brightness (otherwise it would appear as black). Lower row, left: a low pass, showing a typical smoothing effect. Lower row, right: a high pass, totally removing lower frequencies.
Page 15
August 2006
. .
Coursework
10.1. [possible lab project] For this assignment we assume that you already have programs for the 2D DFT and inverse 2D DFT (from an available image processing software system, or a free download from the internet). In this project you are expected to study the problem of evaluating information contained in amplitude and phase of the Fourier transforms: (i) select scalar images showing some type of homogeneous textures; transform these into the frequency domain and modify either (a) the amplitude or (b) the phase of the Fourier transform in a uniform way (for all frequencies), before transforming back into the spatial domain; (ii) do the same for a set of images showing faces of human beings. Discuss your ndings. How do uniform changes (of different degrees), either in amplitude or in phase, alter the information in the given image? 10.2. Who was Euler, and who was Fourier? 10.3. Assume an N N picture. Proof that a multiplication with (1)x+y in the spatial domain causes a shift by N/2 (both in row and column direction) in the frequency domain. 10.4. Sketch (as on Page 10) lter curves in the frequency domain which might be called exponential high-emphasis lter and ideal band-pass lter.
Page 16 August 2006