Document Sample

REPRESENTATION OF THE LAPLACIAN IN THE FOURIER DOMAIN f f 2 2 f 2 2 2 x y Taking the Fourier transform of this equation, we have: f exp(2j (ux vy))dxdy 2 2 f 2 f 2 x 2 y exp(2j(ux vy))dxdy Integrating by parts, we have, f f x exp(2jux) | x (2ju) exp(2jux)dx Any function whose Fourier transform should have the property that the function and all its derivatives should go to 0 at infinity, therefore the first term disappears and we evaluate the second term (the integral) by parts. (2ju) f ( x, y) exp(2jux) | f ( x, y)(2ju) exp(2jux)dx 2 Till now, we have not written the integration over y (for clarity). Writing all the terms together, we have 4 (u v ) exp(2j (ux vy))dxdy 2 2 2 = - 42 (u2+v2)F(u,v) Laplacian in the Fourier Domain Let us now look at the number of computations involved in calculating the Fourier transform. 1 M 1 2jux F (u ) f ( x) exp M M x 0 for u 0,1,2,.... - 1 .M Calculation of F for each value of u involves M multiplications and M-1 additions. We have to repeat this process for M values of u, therefore the number of operations is of the order of : M2 HOW TO REDUCE THIS NUMBER? The Fast Fourier Transform: We re-write the summation (FT) as : 1 M 1 F (u ) f ( x) WM ux M x 0 WM exp(2j / M ) We assume that M = 2n Therefore M=2K ; K is some positive integer. Re-writing the summation once again, we have: 1 2 K 1 F (u ) ux f ( x) W2 K 2 K x 0 W2K exp(2j / 2 K ) 1 1 K 1 1 K 1 u ( 2 x 1) K f (2 x)W2 K f (2 x 1)W2 K u (2 x) 2 x 0 K x 0 1 1 K 1 1 K 1 u K f (2 x)WK K f (2 x 1)WK W2 K ux ux 2 x 0 x 0 K 1 1 f (2 x)W We define : Feven(u ) ux K K x 0 K 1 1 Fodd (u ) f (2 x 1)W ux K K x 0 Therefore, the original equation can be written as: 1 2 F (u ) Feven(u ) Fodd (u )W2 K u Also let us try to evaluate F(u+K): 1 2 F (u K ) Feven(u ) Fodd (u )W2 K u Therefore if we divide the original summation into even and odd terms, we have to evaluate only one half of F(u), the other half follows with no extra multiplications! In fact we need not stop here, we can go on dividing each summation into even and odd terms and this can be continued till we reach a 2 point transform! This process is called the successive doubling method or Decimation. Let us now calculate the number of operations involved in this new method and hence the computational advantage. Let m(n) and a(n) represent the number of multiplications and additions respectively. For a two point transform M=2 and n=1. For a 2-pt transform, the summation runs from 0 to k- 1(=0) and we have to compute F(0) and F(1). Evaluation of Feven(0) and Fodd(0) requires no multiplications since Wux =1. One addition and one multiplication is required to evaluate F(0) =Feven +Fodd W2K u F(1) follows with one more addition. Therefore : m(1)=1 and a(1)=2 A 4-pt transform can be split into two 2-pt transforms Therefore m(2) = 2m(1) + 2 and a(2) = 2a(1) + 4 Similarly: m(3) = 2m(2) + 4 and a(3) = 2a(2) + 8 We can generalize these results: m(n) = 2m(n-1) + 2n-1 a(n) = 2a(n-1) + 2n Therefore : m(n) = 2[2m(n-2) + 2n-2] + 2n-1 = 2.2.2….2m(n-(n-1)) + 2n-1 +………2n-1 = 2n-1m(1) + (n-1)2n-1 = 2n-1 ( 1 + (n-1))= (n/2) 2n = (M/2) log2 M a(n) = 2[2a(n-2) + 2n-1] + 2n = 2n-1a(1) + (n-1)2n = 2n ( 1+ n-1) = n 2n = M log2 M The computational advantage of the FFT over a direct implementation of the 1-D DFT is defined as: 2 n M M 2 C (M ) M log 2 M log 2 M n This advantage increases with n For example, when n=15 (32,768 pixels) , C(M) = 2200 Therefore we can expect for this case that the FFT is computed 2200 times faster than the DFT Computational advantage of the FFT over the DFT Implementation of the FFT Algorithm Consider a 8-pt transform for simplicity 1 7 2jux F (u ) f ( x) exp 8 x 0 8 for u 0,1,2,.... .7 1 1 3 1 3 u f (2 x)W4 f (2 x 1)W4 W8 ux ux 2 4 x 0 4 x 0 1 1 1 1 3 2u f (4 x)W2 f (4 x 2)W2 W8 ux ux 1 2 2 x 0 2 x 0 2 1 1 1 1 1 2u f (4 x 1)W2 f (4 x 3)W2 W8 W8 ux ux u 2 2 x 0 2 x 0 1 1 1 4u 1 2u 2 2 f (0) f (4)W8 2 f (2) f (6)W8 W8 4u 2 1 1 4u 1 f (1) f (5)W8 f (3) f (7)W8 W8 W8 4u 2u u 2 2 2 BUTTERFLY DIAGRAM f(0) F(0) wo f(1) F(4) f(2) F(2) F(6) f(3) f(4) F(1) w4 W2 F(5) f(6) F(3) F(7) Determination of the Wp factor: 1. Write x in binary with n bits 2. Slide this binary number n-l bits to the right & fill the newly opened bit positions on the left with zeros 3. Bit reversal Comparison of filtering in the spatial and Fourier Domains: •Filtering in the Fourier domain is supposed to be more efficient (why?) •Some filters can be more easily specified in the Fourier domain (eg: Ideal low pass filter is difficult to specify in the spatial domain) Averaging in Spatial and Fourier Domains: Instead of convolving the image with a mask, we can take the Fourier transform of both and multiply them in the Fourier domain and then inverse transform them to the spatial domain. Number of operations in 1-D convolution = N2 Number of operations involved if we use Fourier domain filtering: 2Nlog2 N additions + Nlog2N multiplications + N multiplications in Fourier domain + Nlog2N additions + (N/2) log2N multiplications for the inverse = 3Nlog2N additions + 3N/2 log2N +N multiplications For N=1024 N2 = 1048576 In Fourier domain number of operations = 30720 additions + 16384 multiplications h(x) f(x) 3 2 0 1 2 3 x 0 1 2 3 x g(x) = f(x) x h(x) M 1 1 g ( x) M f ( m) h ( x m) m 0 1 7 g ( x ) f ( m) h ( x m) 8 m 0 For x < 0 h(x-m) is zero 1 7 g (0) f (m)h(m) f (0).h(0) 1 6 8 m 0 8 8 g (1) f (0).h(1) f (1)h(0) 1 12 8 8 g (2) f (0).h(2) f (1)h(1) f (2)h(0) 1 18 8 8 g (3) f (1)h(2) f (2)h(1) f (3)h(0) 1 18 8 8 g (4) f (2).h(2) f (3)h(1) 1 12 8 8 g (5) f (3).h(2) 1 6 8 8 g(x) 18/8 12/8 6/8 0 1 2 3 4 5 6 7 x Periodic nature of the DFT Convolution – Need for Padding CONVOLUTION – NEED FOR PADDING For correct evaluation of the convolution in the Fourier domain, we have to pad the image with zeros such that: P A + B –1 Where A and B are the number of points in the functions f and h (which we are convolving) And P is number of points (after padding) Computing the Inverse Transform Using a Forward Transform Algorithm: 1 M 1 2jux F (u ) M f ( x) exp M x 0 M 1 2jux f ( x) F (u ) exp u 0 M Taking the complex conjugate of both sides of the inverse transform and dividing by M we have: 1 1 M 1 2jux M f * ( x) M F * (u) exp M u 0 Therefore we can use the forward transform algorithm for computing the inverse transform, if we substitute F*(u) instead of F(u). Then we take complex conjugate of the result and then multiply by M.

DOCUMENT INFO

Shared By:

Categories:

Tags:

Stats:

views: | 0 |

posted: | 2/16/2013 |

language: | Unknown |

pages: | 31 |

OTHER DOCS BY yanyanliu123

Docstoc is the premier online destination to start and grow small businesses. It hosts the best quality and widest selection of professional documents (over 20 million) and resources including expert videos, articles and productivity tools to make every small business better.

Search or Browse for any specific document or resource you need for your business. Or explore our curated resources for Starting a Business, Growing a Business or for Professional Development.

Feel free to Contact Us with any questions you might have.