Introduction to the Fourier transform Computer Vision & Digital Image Processing Fourier Transform Let f(x) be a continuous function of a real variable x The Fourier transform of f(x), denoted by I {f(x)} is given by: + I{ f ( x)} f ( x) exp[ jπux dx where j Given, f(x) can be obtained by using the inverse Fourier transform: I { } f ( x) exp[ jπux du. + Dr. D. J. Jackson Lecture 8- Dr. D. J. Jackson Lecture 8- The Fourier transform (continued) These two equations, called the Fourier transform pair, exist if f(x) is continuous and integrable and is integrable. These conditions are almost always satisfied in practice. We are concerned with functions f(x) which are real, however the Fourier transform of a real function is, generally, complex. So, F ( R( + ji ( where R( and I( denote the real and imaginary components of respectively. The Fourier transform (continued) Expressed in exponential form, is: where and ϕ( tan e F ( R ( + I ( I( R( jϕ ( The magnitude function is called the Fourier spectrum of f(x) and ϕ( is the phase angle. Dr. D. J. Jackson Lecture 8-3 Dr. D. J. Jackson Lecture 8-
The Fourier transform (continued) The square of the spectrum, P( R ( + I ( is commonly called the power spectrum (or the spectral densit of f(x). The variable u is often called the frequency variable. This name arises from the expression of the exponential term exp[-jπux in terms of sines and cosines (from Euler s formula): The Fourier transform (continued) Interpreting the integral in the Fourier transform equation as a limit summation of discrete terms make it obvious that: is composed of an infinite sum of sine and cosine terms. Each value of u determines the frequency of its corresponding sine-cosine pair. exp[ jπux cos(πux) j sin(πux) Dr. D. J. Jackson Lecture 8-5 Dr. D. J. Jackson Lecture 8-6 Fourier transform example Consider the following simple function. The Fourier transform is: f(x) X x + X f ( x)exp[ jπux dx exp[ jπux dx [ e jπu [ e jπu jπux X jπux e sin( πux ) e πu [ e jπu jπux jπux e jπux j πux Fourier transform example (continued) This is a complex function. The Fourier spectrum is: sin( πux) e πu sin( πux) X ( πux) jπux plot of looks like the following: Dr. D. J. Jackson Lecture 8-7 Dr. D. J. Jackson Lecture 8-8
The -D Fourier transform The Fourier transform can be extended to dimensions: + I{ } and the inverse transform I { } jπ ( ux + v dxdy. + exp[ jπ ( ux + v dudv. The -D Fourier transform (continued) The -D Fourier spectrum is: F ( R ( + I ( The phase angle is: ϕ( tan The power spectrum is: I( R( P( R ( + I ( Dr. D. J. Jackson Lecture 8-9 Dr. D. J. Jackson Lecture 8- Sample -D function and its Fourier spectrum Example -D Fourier transform + X jπ ( ux + v dxdy exp[ jπux dx exp[ jπvy dy j πux jπvy e X e Y [ [ jπu jπv [ e jπu jπux sin( πux ) e XY[ ( πux ) Y [ e jπy jπux jπvy sin( πvy ) e [ ( πvy) sin( πux ) sin( πvy) The spectrum is XY[ [ ( πux ) ( πvy) jπvy Dr. D. J. Jackson Lecture 8- Dr. D. J. Jackson Lecture 8-
Example -D functions and their spectra The discrete Fourier transform Suppose a continuous function, f(x), is discretized into a sequence {f(x ), f(x +Δx), f(x +Δx),.., f(x +[-Δx)} by taking samples Δx units apart Let x refer to either a continuous or discrete value by saying f ( x) f ( x + xδx) where x assumes the discrete values,,, - and {f(),f(),,f(-)} denotes any uniformly spaced samples from a corresponding continuous function Dr. D. J. Jackson Lecture 8-3 Dr. D. J. Jackson Lecture 8- Sampling a continuous function The discrete Fourier transform pair The discrete Fourier transform is given by: f ( x)exp[ jπux / x for u,,,- The discrete inverse Fourier transform is given by: f ( x) exp[ jπux / u for x,,,- The values of u,,,-in the discrete case correspond to samples of the continuous transform at, Δ Δ, (- )Δu Δu and Δx are related by Δu/( Δx) Dr. D. J. Jackson Lecture 8-5 Dr. D. J. Jackson Lecture 8-6
The -D discrete Fourier transform In the -D case: M M x y for u M- and v - M u v jπ ( ux / M + vy / ) exp[ jπ ( ux / M + vy / ) for x M- and y - The discrete function f(x, represents samples of the continuous function at f(x +xδx, y +yδ Δu/(MΔx) and Δv/(Δ The -D discrete Fourier transform (continued) For the case when M (such as in a square image) and x y u v jπ ( ux + v / exp[ jπ ( ux + v / ote each expression in this case has a / term. The grouping of these constant multiplier terms in the Fourier transform pair is arbitrary. Dr. D. J. Jackson Lecture 8-7 Dr. D. J. Jackson Lecture 8-8 Discrete Fourier transform example Discrete Fourier transform example (continued) The four corresponding Fourier transform terms are 3 ) f ( x)exp[ x [ f () + f () + f () + f (3) [ + 3+ + 3.5 3 ) f ( x)exp[ jπ / x jπ / jπ [e + 3e + e + e [ + j j3π / Consider sampling at x.5, x.75, x., and x 3.5 Here Δx.5 and x ranges from 3 F ( ) [ + j F ( 3) [ + j Dr. D. J. Jackson Lecture 8-9 Dr. D. J. Jackson Lecture 8-
Discrete Fourier transform example (continued) The Fourier spectrum is then ) [( / ) ) [(/ ) 3) [( / ) ) 3.5 + (/ ) + ( / ) + (/ ) / / / 5 5 Properties of the -D Fourier transform The dynamic range of the Fourier spectra is generally higher than can be displayed common technique is to display the function [ ) D ( c log + v where c is a scaling factor and the logarithm function performs a compression of the data c is usually chosen to scale the data into the range of the display device, [-55 typically ([-56 for 56 gray-level MTLB image) Dr. D. J. Jackson Lecture 8- Dr. D. J. Jackson Lecture 8- Separability Separability (continued) The discrete transform pair can be written in separable forms x for v,,,- exp[ jπux / u for x,y,,,- So, or f(x, can be obtained in steps by successive applications of the -D Fourier transform or its inverse. exp[ jπux / y v jπvy / exp[ jπvy / The -D transform can be expressed as where x x, y x, exp[ jπux / jπvy / Graphically, the process is as follows f(x,,,-,,-,,- Row transforms Multiply by x, Column transforms -, -, -, Dr. D. J. Jackson Lecture 8-3 Dr. D. J. Jackson Lecture 8-
Translation The translation properties of the Fourier transform pair are and jπ ( ux + v / u v f ( x x, y exp[ jπ ( ux + v / where the double arrow indicates a correspondence between a function and its Fourier transform (or vice versa) Multiplying f(x, by the exponential and taking the transform results in a shift of the origin of the frequency plane to the point (u,v ). Translation (continued) For our purposes, u v /. Therefore, and exp[ jπ ( u x + v / e jπ ( x+ ( ) x+ y x+ y ( ) u /, v / ) So, the origin of the Fourier transform of f(x, can be moved to the center of the corresponding x simply by multiplying f(x, by (-) x+y before taking the transform ote: This does not affect the magnitude of the Fourier transform Dr. D. J. Jackson Lecture 8-5 Dr. D. J. Jackson Lecture 8-6 Matlab example Matlab example (continued) %Create data for the test fzeros(8); for x:6 for y:6 f(x,8; end end % Perform a translation shift on f(x, for x:8 for y:8 f(x,f(x,*((-)^(x+); end end % Compute the -D discrete Fourier transform Ffft(f); % Compute the Fourier spectrum Fspectsqrt(real(F).^+imag(F).^); % Construct a scaling factor based on % the dynamic range of the spectrum FspectMXmax(max(Fspect)); % Compute D, the scaled data D(56/(log(+FspectMX)))*log(+Fspect); figure(); % Plot, as an image, a subset of D image(d(56:7,56:7));colormap(gray(56)); Dr. D. J. Jackson Lecture 8-7 Dr. D. J. Jackson Lecture 8-8
Example image and complete, scaled Fourier spectrum plot Example image and partial, scaled Fourier spectrum plot (with shifted f(x,) Dr. D. J. Jackson Lecture 8-9 Dr. D. J. Jackson Lecture 8-3