Ch15 transforms

995 views

Published on

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
995
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
471
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Ch15 transforms

  1. 1. Transforms
  2. 2. A sine wave 8 5*sin (2π4t) 6 Amplitude = 5 4 Frequency = 4 Hz 2 0 -2 -4 -6 -8 0 0.1 0.2 0.3 0.4 0.5 seconds 0.6 0.7 0.8 0.9 1
  3. 3. A sine wave signal 8 5*sin(2π4t) 6 Amplitude = 5 4 Frequency = 4 Hz 2 Sampling rate = 256 samples/second 0 -2 Sampling duration = 1 second -4 -6 -8 0 0.1 0.2 0.3 0.4 0.5 seconds 0.6 0.7 0.8 0.9 1
  4. 4. An undersampled signal sin(2π8t), SR = 8.5 Hz 2 1.5 1 0.5 0 -0.5 -1 -1.5 -2 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
  5. 5. The Nyquist Frequency • The Nyquist frequency is equal to one-half of the sampling frequency. • The Nyquist frequency is the highest frequency that can be measured in a signal.
  6. 6. Fourier series • Periodic functions and signals may be expanded into a series of sine and cosine functions
  7. 7. The Fourier Transform • A transform takes one function (or signal) and turns it into another function (or signal)
  8. 8. The Fourier Transform • A transform takes one function (or signal) and turns it into another function (or signal) • Continuous Fourier Transform: close your eyes if you don’t like integrals
  9. 9. The Fourier Transform • A transform takes one function (or signal) and turns it into another function (or signal) • Continuous Fourier Transform: ∞ H ( f ) = ∫ h ( t ) e 2πift dt −∞ ∞ h ( t ) = ∫ H ( f ) e −2πift df −∞
  10. 10. The Fourier Transform • A transform takes one function (or signal) and turns it into another function (or signal) • The Discrete Fourier Transform: N −1 H n = ∑ hk e 2πikn N k =0 1 N −1 hk = ∑ H n e −2πikn N N n =0
  11. 11. Fast Fourier Transform • The Fast Fourier Transform (FFT) is a very efficient algorithm for performing a discrete Fourier transform • FFT principle first used by Gauss in 18?? • FFT algorithm published by Cooley & Tukey in 1965 • In 1969, the 2048 point analysis of a seismic trace took 13 ½ hours. Using the FFT, the same task on the same machine took 2.4 seconds!
  12. 12. Famous Fourier Transforms 2 1 Sine wave 0 -1 -2 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 300 250 200 Delta function 150 100 50 0 0 20 40 60 80 100 120
  13. 13. Famous Fourier Transforms 0.5 0.4 Gaussian 0.3 0.2 0.1 0 0 5 10 15 20 25 30 35 40 45 50 6 5 4 Gaussian 3 2 1 0 0 50 100 150 200 250
  14. 14. Famous Fourier Transforms 1.5 1 Sinc function 0.5 0 -0.5 -1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1 6 5 4 Square wave 3 2 1 0 -100 -50 0 50 100
  15. 15. Famous Fourier Transforms 1.5 1 Sinc function 0.5 0 -0.5 -1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1 6 5 4 Square wave 3 2 1 0 -100 -50 0 50 100
  16. 16. Famous Fourier Transforms 1 0.8 Exponential 0.6 0.4 0.2 0 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 30 25 20 Lorentzian 15 10 5 0 0 50 100 150 200 250
  17. 17. FFT of FID 2 1 0 f = 8 Hz SR = 256 Hz T2 = 0.5 s -1 -2 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 70 60 50 40 30 20 10 0 0 20 40 60 80 100 ( t ) = sin( 2πft ) exp − t  F   T 2 120
  18. 18. FFT of FID 2 f = 8 Hz SR = 256 Hz T2 = 0.1 s 1 0 -1 -2 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 14 12 10 8 6 4 2 0 0 20 40 60 80 100 120
  19. 19. FFT of FID 2 1 0 -1 -2 f = 8 Hz SR = 256 Hz T2 = 2 s 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 200 150 100 50 0 0 20 40 60 80 100 120
  20. 20. Effect of changing sample rate 2 1 0 -1 -2 f = 8 Hz T2 = 0.5 s 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 70 35 60 30 50 25 40 20 30 15 20 10 10 5 0 0 10 20 30 40 50 60 0
  21. 21. Effect of changing sample rate 2 SR = 256 Hz SR = 128 Hz 1 0 -1 -2 f = 8 Hz T2 = 0.5 s 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 70 35 60 30 50 25 40 20 30 15 20 10 10 5 0 0 10 20 30 40 50 60 0
  22. 22. Effect of changing sample rate • Lowering the sample rate: – Reduces the Nyquist frequency, which – Reduces the maximum measurable frequency – Does not affect the frequency resolution
  23. 23. Effect of changing sampling duration 2 1 0 -1 -2 f = 8 Hz T2 = .5 s 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 0 2 4 6 8 10 12 14 16 18 20 70 60 50 40 30 20 10 0
  24. 24. Effect of changing sampling duration 2 1 ST = 2.0 s ST = 1.0 s 0 -1 -2 f = 8 Hz T2 = .5 s 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 0 2 4 6 8 10 12 14 16 18 20 70 60 50 40 30 20 10 0
  25. 25. Effect of changing sampling duration • Reducing the sampling duration: – Lowers the frequency resolution – Does not affect the range of frequencies you can measure
  26. 26. Effect of changing sampling duration 2 1 0 -1 -2 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 200 150 100 50 0 f = 8 Hz T2 = 2.0 s 0 2 4 6 8 10 12 14 16 18 20
  27. 27. Effect of changing sampling duration 2 ST = 2.0 s ST = 1.0 s 1 0 f = 8 Hz T2 = 0.1 s -1 -2 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 0 2 4 6 8 10 12 14 16 18 20 14 12 10 8 6 4 2 0
  28. 28. Measuring multiple frequencies 3 f = 80 Hz, T2 = 1 s 1 2 1 f = 90 Hz, T2 = .5 s 2 2 f = 100 Hz, T2 = 0.25 s 1 3 3 0 -1 -2 -3 SR = 256 Hz 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 120 100 80 60 40 20 0 0 20 40 60 80 100 120
  29. 29. Measuring multiple frequencies 3 f = 80 Hz, T2 = 1 s 1 2 1 f = 90 Hz, T2 = .5 s 2 2 f = 200 Hz, T2 = 0.25 s 1 3 3 0 -1 -2 -3 SR = 256 Hz 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 120 100 80 60 40 20 0 0 20 40 60 80 100 120
  30. 30. L: period; u and v are the number of cycles fitting into one horizontal and vertical period, respectively of f(x,y).
  31. 31. Discrete Fourier Transform 1 w−1 h −1   2π (ux + vy )   2π (ux + vy )   F (u , v) = ∑∑ f ( x, y) cos  wh ÷+ j sin  wh ÷ wh x =0 y =0      1 w−1 h −1 − j 2π ( ux + vy ) / wh F (u , v) = ∑∑ f ( x, y)e wh x =0 y =0
  32. 32. Discrete Fourier Transform (DFT). • When applying the procedure to images, we must deal explicitly with the fact that an image is: – Two-dimensional – Sampled – Of finite extent • These consideration give rise to the The DFT of an NxN image can be written:
  33. 33. Discrete Fourier Transform • For any particular spatial frequency specified by u and v, evaluating equation 8.5 tell us how much of that particular frequency is present in the image. • There also exist an inverse Fourier Transform that convert a set of Fourier coefficients into an image. 1 f ( x, y ) = N N −1 N −1 F (u , v)e j 2π ( ux +vy ) / N ∑∑ x =0 y =0
  34. 34. 2 P (u , v) = F (u , v) = R (u , v) + I (u , v) 2 2 PSD • The magnitudes correspond to the amplitudes of the basic images in our Fourier representation. • The array of magnitudes is termed the amplitude spectrum (or sometime ‘spectrum’). • The array of phases is termed the phase spectrum. • The power spectrum is simply the square of its amplitude spectrum:
  35. 35. FFT • The Fast Fourier Transform is one of the most important algorithms ever developed – Developed by Cooley and Tukey in mid 60s. – Is a recursive procedure that uses some cool math tricks to combine sub-problem results into the overall solution.
  36. 36. DFT vs FFT
  37. 37. DFT vs FFT
  38. 38. DFT vs FFT
  39. 39. Periodicity assumption • The DFT assumes that an image is part of an infinitely repeated set of “tiles” in every direction. This is the same effect as “circular indexing”.
  40. 40. Periodicity and Windowing • Since “tiling” an image causes “fake” discontinuities, the spectrum includes “fake” highfrequency components Spatial discontinuities
  41. 41. Discrete Cosine Transform Real-valued  π( 2i + 1) m  π( 2k + 1) n  Gc ( m, n) = α ( m)α ( n)∑ ∑ g( i, k ) cos   cos  2 N   2N    i= 0 k = 0 with an inverse N −1 N −1  π( 2i + 1) m  π ( 2k + 1) n  gc ( i, k ) = ∑ ∑ α ( m)α ( n)Gc ( m, n) cos   cos  2 N   2N    m= 0 n = 0 where N −1 N −1 α ( 0) = 1 N and α ( m) = 2 N for 1≤ m ≤ N
  42. 42. DCT in Matrix Form G c = CgC where the kernel elements are Ci , m  π( 2i + 1) m  = α( m) cos    2N 
  43. 43. Discrete Sine Transform Most Convenient when N=2 p - 1 2 N −1 N −1  π( i + 1) ( m + 1)   π( k + 1) ( n + 1)  Gsin ( m, n) = g( i, k ) sin  ∑∑  sin   N + 1 i=0 k =0 N +1 N +1     with an inverse 2 N −1 N −1  π( i + 1) ( m + 1)   π( k + 1) ( n + 1)  gsin ( i, k ) = ∑0 ∑ Gs ( m, n) sin  N + 1  sin  N + 1  N + 1 m= n = 0    
  44. 44. DST in Matrix Form G c = TgT where the kernel elements are Ti , k = 2  π( i + 1) ( k + 1)  sin   N +1  N +1 
  45. 45. DCT Basis Functions*
  46. 46. (Log Magnitude) DCT Example*
  47. 47. Hartley Transform • Alternative to Fourier • Produces N Real Numbers • Use Cosine Shifted 45o to the Right cas( θ) = cos( θ) + sin( θ) π  = 2 cos θ −   4
  48. 48. Square Hartley Transform  2π ( im + kn )  1 N −1 N −1 GHartley ( m, n ) = ∑0 ∑= 0 g H ( i, k ) cas  N  N * N i= k   with an inverse  2π ( im + kn )  g Hartley ( i, k ) = ∑ ∑ GH ( m, n ) cas   N m= 0 n= 0   N −1 N −1
  49. 49. Rectangular Hartley Transform 1  2π mx 2π ny  GHartley ( m, n ) = ∑ ∑ g H ( x, y ) cas  + wh y = 0 x = 0 w h    h − 1 w− 1 m ∈ [ 0..h ] , n ∈ [ 0..w] with an inverse  2π mx 2π ny  g Hartley ( m, n ) = ∑ ∑ GH ( x, y ) cas  + w h    y= 0 x= 0 h − 1 w− 1
  50. 50. Hartley in Matrix Form G Hartley = TgT where the kernel elements are Ti , k 1  2πik  = cas N  N  
  51. 51. What is an even function? • the function f is even if the following equation holds for all x in the domain of f:
  52. 52. Hartley Convolution Theorem • Computational Alternative to Fourier Transform • If One Function is Even, Convolution in one Domain is Multiplication in Hartley Domain g( x ) = f ( x )* h( x ) ⇔ G( ν) = F ( ν) H even ( ν) + F ( − ν) H odd ( ν)
  53. 53. Rectangular Wave Transforms • Binary Valued {1, -1} • Fast to Compute • Examples – – – – Hadamard Walsh Slant Haar
  54. 54. Hadamard Transform • Consists of elements of +/- 1 • A Normalized N x N Hadamard matrix satisfies the relation H Ht = I 1 1 1  H2 = 2 1 −1   Walsh Tx can be constructed as H 2N 1 H N = 2 H N  HN  −H N  
  55. 55. Walsh Transform, N=4 Gonzalez, Wintz *
  56. 56. Non-ordered Hadamard Transform H8 +1 +1  +1 +1 H8 =  +1  +1 +1  +1 +1 −1 +1 −1 +1 −1 +1 −1 +1 +1 −1 −1 +1 +1 −1 −1 +1 −1 −1 +1 +1 −1 −1 +1 +1 +1 +1 +1 −1 −1 −1 −1 +1 −1 +1 −1 −1 +1 −1 +1 +1 +1 −1 −1 −1 −1 +1 +1 +1 −1  −1 +1 −1  +1 +1  −1
  57. 57. Sequency • In a Hadamard Transform, the Number of Sign Changes in a Row Divided by Two • It is Possible to Construct an H matrix with Increasing Sequency per row
  58. 58. Ordered Hadamard Transform 1 F ( u, v ) = N N −1 N −1 ∑ ∑ F ( j, k )( −1) q ( j , k , u, v ) j =0 k =0 where N −1 q( j, k , u, v ) = ∑ [ g i ( u) ji + g i ( v ) k i ] i=0 and g 0 (u ) ≡ un −1 g1 (u) ≡ un −1 + un − 2 g 2 ( u ) ≡ un − 2 + un − 3 g n-1 (u ) ≡ u1 + u0
  59. 59. Ordered Hadamard Transform* Gonzalez, Wintz *
  60. 60. Haar Transform • Derived from Haar Matrix • Sampling Process in which Subsequent Rows Sample the Input Data with Increasing Resolution • Different Types of Differential Energy Concentrated in Different Regions – Power taken two at a time – Power taken a power of two at a time, etc.
  61. 61. 1 1 2 0   H4 =     * 1 1 2 0 Castleman Haar Transform*, H4 1 1  −1 −1   0 0  2 − 2 
  62. 62. Karhunen-Loeve Transform • Variously called the K-L, Hotelling, or Eignevector • Continuous Form Developed by K-L • Discrete Version Credited to Hotelling • Transforms a Signal into a Set of Uncorrelated Representational Coefficients • Keep Largest Coefficients for Image Compression
  63. 63. Discrete K-L N −1 N −1 F (u, v ) = ∑ ∑ F ( j, k ) A( j, k ; u, v ) j =0 k =0 where the kernel satisfies N −1 N −1 λ( u, v ) A( j, k ; u, v ) = ∑ ∑ K F ( j, k ; j ′, k ′) A( j ′, k ′; u, v ) j =0 k =0 where K F ( j, k ; j ′, k ′ ) is the image covariance function λ( u, v ) is a constant for a fixed ( u, v ) , the eigenvalues of K F
  64. 64. Singular Value Decomposition An NxN matrix A can be expressed as A = UΛV t where Columns of U are Eigenvectors of AA t Columns of V are Eigenvectors of A t A L is the NxN diagonal matrix of singular values Λ = U t AV
  65. 65. Singular Value Decomposition • If A is symmetric, then U=V • Kernel Depends on Image Being Transformed • Need to Compute AAt and AtA and Find the Eigenvalues • Small Values can be Ignored to Yield Compression
  66. 66. Transform Domain Filtering • Similar to Fourier Domain Filtering • Applicable to Images in which Noise is More Easily Represented in Domain other than Fourier – Vertical and horizontal line detection: Haar transform produces non-zero entries in first row and/or first column

×