Fourier Transform and Image Enhancement in the Frequency Domain Gilad Lerman Math 5467 (stealing slides from Gonzalez&Woods, and Efros) DFT of images Camera man image Magnitude Phase of of Centered Centered DFT DFT How to interpret? DFT of a simple signal Discrete box signal Magnitude of centered DFT Phase of centered DFT Recall the Continuous Case… DFT of Simple images More DFT of simple images Phases of DFTs of Simple Images Another DFT of a Simple Image White-gray image Magnitude of Centered DFT Back to Camera Man Camera man image Magnitude of Centered DFT |DFT| of Another Image DFT of Natural Images • The magnitude spectra of all natural images quite similar (Heavy on low-frequencies, falling off in high frequences, sometimes lines of discontinuity) • Most information in the image is carried in the phase, not the amplitude • We demonstrate this idea next… This is the magnitude transform of the cheetah pic This is the phase transform of the cheetah pic This is the magnitude transform of the zebra pic This is the phase transform of the zebra pic Reconstruction with zebra phase, cheetah magnitude Reconstruction with cheetah phase, zebra magnitude Similar example from Textbook Image Enhancement in the Frequency Domain Input image: x(k1 , k2 ), k1=0,…,M-1, k2=0,…,N-1 1. Compute DFT xˆ (n1, n2 ), n1=0,…,M-1, n2=0,…,N-1 2. Generate a real symmetric filter function hˆ(n1, n2 ), centered at the origin and form the product yˆ (n1, n2 ) = xˆ(n1, n2 ) ×hˆ(n1, n2 ) 3. Compute IDFT of yˆ (n1 , n2 ) (take real part due to possible numerical errors) Image Enhancement 2 For visualization purposes you may have k1 + k2 ×x( k1 , k2 ). 1. For input: x (k1 , k2 ) := (- 1) 2. Center the real symmetric filter function hˆ(n1, n2 ), at (M/2,N/2) and then form the product: yˆ (n1, n2 ) = xˆ(n1, n2 ) ×hˆ(n1, n2 ). k1 + k2 ×y ( k1 , k2 ). 3. For output: y ( k1 , k2 ) := (- 1) Filters ĥ (or H) Ideal Lowpass Filter Butterworth Lowpass Filter Gaussian Lowpass Filter in Spatial Domain Ideal Lowpass Filter in Spatial Domain Butterworth Lowpass Filter in Spatial Domain Example: ILPF, BLPF & GLPF Highpass Filters hˆHP (n1, n2 ) = 1- hˆLP (n1, n2 ) Differentiation in Spatial and Frequency Domains Exercise: compute the filter in frequency domain Laplacian in Frequency Domains Continuous Setting In Frequency Domain ¶2 ¶2 Ñ = + 2 ¶ x1 ¶ x2 2 2 - 4p 2 (x12 + x22 ) For discrete Laplacian: exercise Unsharp and Highboost • Recall: gunsharp = f - f • That is, g unsharp = f - f lowpass = f highpass • Highboost: g highboost = f + k ×g unsharp Bandpass & Bandreject Filters Band-pass Example Image Enhancement 3 • We correct the convolution by padding with zeros Sampling and Aliasing (clarifying figures in the textbook)