The Frequency Domain Date: 07/21/04 References: [Efford 2000] [Petrou & Bosdogianni,1999] [Gonzalez & Woods 1993] The frequency domain o the goal is to represent an image as a weighted sum of sinusoidal functions o a periodic function - a sinusoid - Eric Weisstein's World of Mathematics - periodic function (http://mathworld.wolfram.com/PeriodicFunction.html) period - length of the cycle, L frequency - 1/L if L is a distance, 1/L is the spatial frequency amplitude - height of the peak, A phase - position of the start of a cycle, phi o images of sinusoidal functions - equation 8.1 u is the spatial frequency - number of cycles that fit into the width of the image u/N is cycles per pixel o Fourier theory any periodic function can be represented as a sum of simple sinusoids basis functions - sine and cosine functions of a given frequency Fourier series - weighted sum of basis functions - equation 8.2 n is the frequency of a basis function - number of cycles that fit into one period L Fourier series representation of f(x) can be given by two 1D arrays (of infinite size) of coefficients Fourier coefficients - weighting factors for each sine and cosine function example - summation of sinusoids can generate discontinuities and homogeneous regions o 2D Fourier series use 2D sine and cosine functions - equation 8.3 Fourier series representation of f(x,y) can be given by two 2D arrays (of infinite size) of coefficients basis images - figure 8.7 coefficients determine contributions of each basis image to the representation Fourier series (http://mathworld.wolfram.com/FourierSeries.html) o Fourier transform determine the contribution made by any basis function (image) to the representation of a function (image) Fourier transform pair (http://mathworld.wolfram.com/FourierTransform.html) exists if f(x) continuous and integrable, F(u) integrable easily extended to 2D o discrete Fourier transform - with images we are operating in the discrete domain discrete Fourier transform (http://mathworld.wolfram.com/DiscreteFourierTransform.html) o equation 8.4 equation 8.5 - forward transform u and v specify spatial frequencies for a given u and v, F(u,v) represents the contribution of the corresponding basis images F(u,v) is a complex number Fourier coefficients - the set of F(u,v) for all u,v - also called the Fourier transform Fourier transform - the process of computing all F(u,v) equation 8.6 - inverse transform - errata reconstructs the image from the Fourier coefficients we can convert between the spatial and frequency domains without loss of information o o o o when we manipulate f(x,y) we are processing the image in the spatial domain when we manipulate F(x,y) we are processing the image in the frequency domain spectra of an image Fourier spectrum compute the magnitude of F(u,v) - equation 8.8 amplitude of the basis function power spectrum - square of the Fourier spectrum phase - equation 8.9 we typically manipulate just the Fourier spectrum and leave the phase alone Fast Fourier Transform o computation of a 1D discrete Fourier transform (DFT) of N samples requires N complex multiplications (http://mathworld.wolfram.com/ComplexMultiplication.html) N-1 complex additions (http://mathworld.wolfram.com/ComplexMultiplication.html) for each of the N values of u o a 1D DFT is O(N2) o a 2D DFT is of an N x N image is O(N4) o assuming 1 microsecond for a complex multiplication: 2D DFT with N = 256 takes 71 minutes 2D DFT with N = 1024 takes 12 days! o there are two ways to reduce the complexity - we'll use them both use the separability of the Fourier transform to implement a 2D DFT as a two-pass algorithm reduces complexity of the 2D DFT to O(N3) decompose the 1D DFT in such a way to make it O(N log2 N) this procedure is known as the fast Fourier transform algorithm (FFT) requires N to be a power of 2 - must either crop or pad the data an N-point transform can be decomposed into the sum of two N/2-point transforms we do this recursively until we are computing 2-point transforms we do this O(log2 N) process for each of the N values of u giving complexity O(N log2 N) requires reordering of the input using the bit-reversal rule reordering the input and then computing the FFT produces output in the correct order o Numerical Recipes online - http://lib-www.lanl.gov/numerical/ o Efford’s book page 198 o ImageFFT.java - CD Properties of the Fourier transform o periodicity - F(u,v) repeats itself endlessly in both directions o complex conjugate symmetry - for the amplitude spectrum, negative frequencies are mirror images of positive frequencies http://mathworld.wolfram.com/ComplexConjugate.html o spectrum is more easily interpreted (visually) if we shift the results Windowing o there is an implied periodicity of the image o discontinuities (in gray level) between the right and left (top and bottom) edges affect the spectrum o a windowing function is applied to cause the pixel values to taper off to zero Using the ImageFFT class SpectrumViewer application SpectralProbe application Images of spectra o scaling of spectrum for display purposes o o o spectra of periodic patterns spectra of edges spectra of simple shapes Filtering in the frequency domain o point-wise multiplication of the spectrum by a filter transfer function o convolution theorem convolution in the spatial domain is equivalent to multiplication in the frequency domain to perform filtering in the frequency domain given a convolution kernel take Fourier transform of the image and the kernel multiply (point-wise) the two transforms together take inverse Fourier transform of the product o low pass filtering ideal low pass filter ringing Butterworth low pass filter o high pass filtering o band pass and band stop filtering o removing periodic noise Filter support in ImageFFT.java Frequency domain filtering implementation o ImageFFT.java o ButterworthLowPassOp.java Deconvolution o the degradation of an image due to blurring and noise can be modeled o point spread function (PSF) - convolution kernel which models the blurring o our degraded image is produced through a convolution of the correct image and the PSF o deconvolution of the degraded image would give us the correct image o thanks to the convolution theorem, we can do deconvolution in the frequency domain take the Fourier transform of the degraded image and the kernel modulation transfer function (MTF) - the Fourier transform of the PSF divide the Fourier transform of the degraded image by the MTF (point-wise) take the inverse transform of the resulting deconvolved spectrum to get the deconvolved image o division by zero (in the MTF) is a problem o must also compensate for noise threshold on the MTF restoration cutoff frequency References : 1. 2D Frequency Domain Filtering and the 2D DFT http://www.owlnet.rice.edu/~elec301/Projects01/image_filt/transform.html 2. Image Filtering in the Frequency Domain http://astronomy.swin.edu.au/~pbourke/analysis/imagefilter/ 3. Frequency Filter http://www.dai.ed.ac.uk/HIPR2/freqfilt.htm 4. Filtering in the Frequency Domain http://www.netnam.vn/unescocourse/computervision/94.htm 5. The Wiener filter http://osl.iu.edu/~tveldhui/papers/MAScThesis/node15.html More Links: Frequency Filters, Deconvolution, Wiener Filtering: http://www.dai.ed.ac.uk/HIPR2/freqfilt.htm#7 Image Restoration, Point Spread Function (PSF): http://www.dai.ed.ac.uk/CVonline/LOCAL_COPIES/VELDHUIZEN/node8.html Wiener Filter: http://www.dai.ed.ac.uk/CVonline/LOCAL_COPIES/VELDHUIZEN/node15.html Wiener Filter: http://www.khoral.com/contrib/contrib/dip2001/html-dip/c7/s3/front-page.html Research paper; 3D restoration of tomosynthetic images, 3D Regularized Wiener Filtering: ftp://ftp.mthcsc.wfu.edu/pub/plemmons/tim_icis.ps.gz