Image Enhancement and Restoration Digital Image from sensor Too dark, Too bright, or Noisy Better quality Image Pixel (Spatial Domain) Frequency Domain i/p Frequency Transform Adjust freq. coefficient Inverse Transform o/p
Fourier Analysis Color lights DFT Signals with different frequencies White Light Signals with different frequencies Signal DFT . Fourier Analysis
Frequency Components Frequency Domain Time Domain
Fourier Analysis & Transform นักคณิตศาสตร์ชาวฝรั่งเศส ชื่อเต็มว่า Jean Baptiste Joseph Fourier ทฤษฎีของ Fourier ได้ถูกตีพิมพ์ในหนังสือของ Fourier ชื่อ 1822: “La The’orie Analitique de la Chaleur” 1878: ถูกนำมาแปลเป็นภาษาอังกฤษโดย Freeman “ฟังก์ชันใดๆ ที่มีคุณสมบัติการวนซ้ำค่า (repeat periodically) สามารถแสดงในรูปของผลรวมของสัญญาณ sine และ cosine ของความถี่ที่แตกต่างกันได้ ซึ่ง sine และ cosine แต่ละความถี่จะมีขนาดหรือถูกคูณด้วยค่าสัมประสิทธิ์ที่มีค่าแตกต่างกันไป” Fourier Analysis & Transform
Fourier Theory Any functions or signals = Fourier Fourier Series Fourier Transform Periodic function Aperiodic function Continuous Discrete Continuous Discrete Fourier Theory
1D Discrete Fourier Transform Forward 1D DFT: Inverse 1D DFT (IDFT): 1D Discrete Fourier Transform
Basis Set: Generalized Harmonics The set of generalized harmonics -> an orthonormal basis set for functions: {ei2pst} where each harmonic has a different frequency s. Remember: ei2pst = cos(2pst) + i sin(2pst) The real part is a cosine of frequency s. The imaginary part is a sine of frequency s.`
How to Interpret the Weights F(u) The weights F(u) are complex numbers: Real part Imaginary part How much of a cosine of frequencys you need. How much of a sine of frequencys you need. Magnitude Phase How much of a sinusoid of frequencys you need. What phase that sinusoid needs to be.
4-point 1D DFT x 4 12 x 4 - 4 +
b0 = 0 a0 = 36 8-point DFT
8-point DFT b1= -9.6569 a1 = - 4 b2 = -4 a2 = 4 [0.7071, 0, -0.7071, -1, -0.7071, 0, 0.7071, 1] [0.7071, 1, 0.7071, 0, -0.7071, -1, -0.7071, 0] b2 = -4 a2 = 4 8-point DFT [0, -1, 0, 1, 0, -1, 0, 1] [1, 0, -1, 0, 1, 0, -1, 0]
8-point DFT a7 = -4 b7 = 9.6569 b0 = 0 a0 = 36 a1 = - 4 b1= -9.6569 [0.7071, 0, -0.7071, -1, -0.7071, 0, 0.7071, 1] [-0.7071, -1, -0.7071, 0, 0.7071, 1, 0.7071, 0] b0 = 0 a0 = 36 a1 = - 4 b1= -9.6569 a2 = 4 b2 = -4 … a7 = -4 b7 = 9.6569 a0 – j b0 = 36 a1 – j b1 = - 4 + j 9.6569 a2 – j b2 = 4 + j 4 a7 – j b7 = - 4 – j 9.6569 8-point DFT
8-point 1D DFT x x x x x x x x x x x x x x x x
2D Discrete Fourier Transform (DFT) f(x,y) M N F(u,v) M N 2D DFT Forward 2D DFT: Inverse 2D DFT (IDFT): 2D Discrete Fourier Transform (DFT)
Sine Wave Image (1) 1D sine wave v = 3; A = 127; v = 6; A = 127;
Sine Wave Image (2) 2D sine wave u = 4; v = 0; A = 127;
2D DFT Basic Functions
Fourier Transform Properties Shifting property
2D DFT Cosine Periodic Property
2D DFT Shifted Sine Periodic Property
Fourier Transform property (1) 1 = 4* 1 2 2 = 3* 3 4
Fourier Shifting
Fourier Transform property (2) Unshifted Magnitude Spectrum Shifted Magnitude Spectrum Fourier Transform property (2)
2D DFT Separable Property 1D DFT (row) 1D DFT (column)
Fast Fourier Transform (FFT) 1D DFT (x-direction) 2D image 1D DFT (y-direction) 1D DFT 1D Fast Fourier Transform (FFT) Separate discrete data points into several groups Calculate DFT in hierarchical manner
Fast Fourier Transform If we let WN = e-i2p /N the Discrete Fourier Transform can be written F(u) = f [x] WN If N is a multiple of 2, N = 2M for some positive integer M, substituting 2M for N gives F(u) = f [x] W2M 1 N N -1 S n = 0 sn 1 2M 2M -1 S n = 0 ux
Fast Fourier Transform Separating out the M even and M odd terms, F(u) = f [2x] W2M + f [2x+1] W2M Notice that W2M = e-i2p u (2x)/(2M) = e-i2p u x /M =WM and W2M = e-i2p u (2 x+1)/(2M) = e-i2p u x/M e-i2p u /2M = WM W2M So, F(u) = f [2x] WM + f [2x+1] WM W2M { } 1 2 1 M M -1 S n = 0 1 M M -1 S n = 0 u(2x) u(2x+1) u(2x) ux u(2x+1) ux u { } M -1 S n = 0 1 M 2 ux u
Fast Fourier Transform { } M -1 S n = 0 1 M 2 ux u F(u) = f [2x] WM + f [2x+1] WM W2M Can be written as F(u) = {Feven(u) + Fodd(u)W2M} Simplifying further, the first M terms of the Fourier transform of 2M items can be computed by F(u) = {Feven(u) + Fodd(u)W2M} and the last M terms can be computed by F(u) = {Feven(u) - Fodd(u)W2M} 1 2 u 1 2 u 1 2 u
Fast Fourier Transform If M is itself a multiple of 2, do it again! If N is a power of 2, keep recursively subdividing until you have one element, which is its own Fourier Transform. FourierTransform FFT(Signal f) { if (length(f) == 1) return f; evenpart = FFT(EvenTerms(f)); oddpart = FFT( OddTerms(f)); for (s = 0; s < length(f) / 2; s++) { result[s ] = evenpart[s] + W_2M ^ s * oddpart[s]; result[s+M] = evenpart[s] – W_2M ^ s * oddpart[s]; }
DIT-FFT (Scalable) (1) 2-point FFT butterfly 2-point a b a+b a-b a b weight 2-point FFT - 1 f(0) f(2) f(1) f(3) F(0) F(1) F(2) F(3) butterfly DIT-FFT (Scalable) (1)
DIT-FFT (Scalable) (2) 8-point FFT weight butterfly 4-point 4-point 8 W 1 2 3 - ) ( F 4 5 6 7 f(4) f(2) f(6) f(1) 4-point FFT f(5) f(3) f(7) DIT-FFT (Scalable) (2)
Fast Fourier Transform (DIT-FFT) Direct calculation = N2 FFT = 2log2N 8-point FFT Fast Fourier Transform (DIT-FFT)
Fast Fourier Transform Computational Complexity: Remember: The Fast Fourier Transform is just a faster algorithm for computing the Discrete Fourier Transform — it does not produce a different result. Discrete Fourier Transform O(N2) Fast Fourier Transform O(2 log2 N)
Processing Time (DFT vs FFT)
DFT Magnitude response |F(u,v)| Unit step response
DFT Magnitude response |F(u,v)| Small vertical line response -45 degree rotated line response Linear Combination response