ecg782 multidimensional
play

ECG782: Multidimensional Digital Signal Processing Filtering in - PowerPoint PPT Presentation

Professor Brendan Morris, SEB 3216, brendan.morris@unlv.edu ECG782: Multidimensional Digital Signal Processing Filtering in the Frequency Domain http://www.ee.unlv.edu/~b1morris/ecg782/ 2 Outline Background Concepts Sampling and


  1. Professor Brendan Morris, SEB 3216, brendan.morris@unlv.edu ECG782: Multidimensional Digital Signal Processing Filtering in the Frequency Domain http://www.ee.unlv.edu/~b1morris/ecg782/

  2. 2 Outline • Background Concepts • Sampling and Fourier Transform • Discrete Fourier Transform • Extension to Two Variables • Properties of 2D DFT • Frequency Domain Filtering Basics • Smoothing • Sharpening • Selective Filtering • Implementation

  3. 3 Motivation • Complicated signals (functions) can be constructed as a linear combination of sinusoids ▫ Mathematically compact representation with complex exponentials 𝑓 𝑘𝜕𝑢 • Introduced as Fourier series by Jean Baptiste Joseph Fourier ▫ Initially considered periodic signals ▫ Later extended to aperiodic signals • Powerful mathematical tool ▫ Can go between “time” and “frequency” domain processing

  4. 4 Preliminary Concepts • Complex numbers • Fourier Transform ▫ 𝐷 = 𝑆 + 𝑘𝐽 ▫ 𝐺 𝜈 = ℱ 𝑔 𝑢 = ▫ 𝐷 ∗ = 𝑆 − 𝑘𝐽 𝑔 𝑢 𝑓 −𝑘2𝜌𝜈𝑢 𝑒𝑢  𝜈 : continuous frequency ▫ 𝐷 = 𝐷 𝑓 𝑘𝜄 variable  Using Euler’s formula ▫ 𝑔 𝑢 = ℱ −1 𝐺 𝜈 =  𝑓 𝑘𝜄 = cos 𝜄 + 𝑘 sin 𝜄 𝐺 𝜈 𝑓 𝑘2𝜌𝜈𝑢 𝑒𝜈 • Fourier Series ▫ Express a periodic signal as a ▫ Notice for real 𝑔 𝑢 this sum of sines and cosines generally results in a complex ▫ 𝑔 𝑢 = 𝑑 𝑜 𝑓 𝑘𝜕 0 𝑜𝑢 𝑜 transform 1 𝑈 𝑔 𝑢 𝑓 −𝑘𝜕 0 𝑜𝑢 ▫ 𝑑 𝑜 = 𝑈  𝜕 0 = 2𝜌/𝑈

  5. 5 Rectangle Wave Example sin 𝜌𝜈𝑋 • 𝐺 𝜈 = 𝐵𝑋 𝜌𝜈𝑋 ▫ Rectangle in time gives sinc in frequency ▫ See book for derivation • Frequency spectrum = 𝐵𝑋 sin 𝜌𝜈𝑋 𝐺 𝜈 ▫ 𝜌𝜈𝑋  Consider only a real portion • Note zeros are inversely proportional to width of box ▫ Wider in time, narrow in frequency

  6. 6 Convolution Properties • Very important input-output relationship between a input signal 𝑔 𝑢 and an LTI system ℎ(𝑢) • 𝑔 𝑢 ∗ ℎ 𝑢 = 𝑔 𝜐 ℎ 𝑢 − 𝜐 𝑒𝜐 • Dual time-frequency relationship ▫ 𝑔 𝑢 ∗ ℎ 𝑢 ↔ 𝐺 𝜈 𝐼 𝜈 ▫ 𝑔 𝑢 ℎ 𝑢 ↔ 𝐺 𝜈 ∗ 𝐼 𝜈 ▫ Convolution-multiplication relationship

  7. 7 Sampling • Convert continuous signal to a discrete sequence ▫ Use impulse train sampling 𝑢 = 𝑔 𝑢 𝑡 Δ𝑈 𝑢 = • 𝑔 𝑔 𝑢 𝜀(𝑢 − 𝑜Δ𝑈) 𝑜 ▫ 𝜀 𝑢 − 𝑜Δ𝑈 - impulse response at time 𝑢 = 𝑜Δ𝑈 • Sample value ▫ 𝑔 𝑙 = 𝑔(𝑙Δ𝑈)

  8. 8 Fourier Transform of Sampled Signal 𝜈 = ℱ 𝑔 𝑢 • 𝐺 = 𝐺 𝜈 ∗ 𝑇(𝜈) 1 𝑜 ▫ 𝑇 𝜈 = Δ𝑈 𝜀 𝜈 − 𝑜 Δ𝑈 ▫ FT of impulse train is an impulse train  See section 4.2.3 in the book for details  Note spacing between impulses are inversely related 1 𝑜 𝜈 = ΔT 𝐺 𝜈 − • 𝐺 𝑜 Δ𝑈 ▫ Sampling creates copies of the original spectrum ▫ Must be careful with sampling period to avoid aliasing (overlap of spectrum)

  9. 9 Sampling Theorem • Conditions to be able to recover • Sampling theorem 𝑔 𝑢 completely after sampling 1 Δ𝑈 > 2𝜈 max ▫ • Requires bandlimited 𝑔(𝑢)  Nyquist rate 2𝜈 max ▫ 𝐺 𝜈 = 0 for |𝜈| > 𝜈 max • Recovery with lowpass filter ▫ Can isolate center spectrum ▫ 𝐼 𝜈 = Δ𝑈 for 𝜈 ≤ 𝜈 max copy from its neighbors

  10. 10 Aliasing • Corruption of recovered signal if not sampled at rate less than Nyquist rate ▫ Spectrum copies overlap ▫ High frequency components corrupt lower frequencies • In reality this is always present ▫ Most signals are not bandlimited ▫ Bandlimited signals require infinite time duration  Windowing to limit size naturally causes distortion ▫ Use anti-aliasing filter before sampling  Filter reduces high frequency components

  11. 11 Discrete Fourier Transform • Discussion has considered continuous signals (functions) ▫ Need to operate on discrete signals • DFT is a sampled version of the sampled signal FT in one period 𝜈 = 𝑔 𝑜 𝑓 −𝑘2𝜌𝜈𝑜Δ𝑈 ▫ 𝐺 𝑜 ▫ Sample in frequency evenly ( 𝑁 ) over a period 𝑛  𝜈 = 𝑁Δ𝑈 𝑜 𝑓 −𝑘2𝜌𝑛𝑜/𝑁 ▫ 𝐺 𝑛 = 𝑔 𝑜  𝑛 = 0,1,2, … , 𝑁 − 1 ▫ 𝑁 samples of 𝑔 𝑢 , 𝑔 𝑜 , results in 𝑁 DFT values ▫ Note: implicitly assumes samples come from one period of periodic signal • Inverse DFT 1 𝑛 𝑓 𝑘2𝜌𝑛𝑜/𝑁 ▫ 𝐺 𝑜 = 𝑁 𝐺 𝑛

  12. 12 Sampling/Frequency Relationship • 𝑁 samples of signal with sample period Δ𝑈 ▫ Total time  𝑈 = 𝑁Δ𝑈 • Spacing in discrete frequency 1 1 ▫ Δ𝑣 = 𝑁Δ𝑈 = 𝑈  Note the switch to 𝑣 for discrete frequency 1 ▫ Total frequency range  Ω = 𝑁Δ𝑣 = Δ𝑈 • Resolution of DFT is dependent on the duration 𝑈 of the sampled function ▫ Generally the number of samples • See fft.m in Matlab to test this

  13. 13 Extensions to 2D • All discussions can be extended to two variables easily ▫ Add second integral or summation for extra variable • 2D rectangle sin 𝜌𝜈𝑈 sin 𝜌𝜉𝑎 ▫ 𝐺 𝜈, 𝜉 = ATZ 𝜌𝜈𝑈 𝜌𝜉𝑎

  14. 14 Image Aliasing • Temporal aliasing appears in video ▫ Wheel effect – looks like it is spinning opposite direction • Spatial aliasing is the same as the previous discussion  now in two dimensions

  15. 15 Image Interpolation and Resampling • Used for image resizing ▫ Zooming – oversample and image ▫ Shrinking – undersample an image  Must be careful of aliasing  Generally smooth before downsample

  16. 16 Fourier Spectrum and Phase Angle • 𝐺 𝑣, 𝑤 = 𝐺 𝑣, 𝑤 𝑓 𝑘𝜚 𝑣,𝑤 • Spectrum ▫ Magnitude, spectrum 𝐺 𝑣, 𝑤 =  𝑆 2 𝑣, 𝑤 + 𝐽 2 𝑣, 𝑤 1/2 ▫ Phase angle  𝑓 𝑘𝜚 𝑣,𝑤 = arctan 𝐽 𝑣,𝑤 𝑆 𝑣,𝑤 • Spectrum is component we naturally specify while phase is a bit harder to visualize

  17. 17 Spectrum • Translation does not affect spectrum ▫ Wide in space  narrow in frequency • Orientation clearly visible in spectrum

  18. 18 Phase • Difficult to describe phase given image content ▫ a) centered rectangle ▫ b) translated rectangle ▫ c) rotated rectangle

  19. 19 Spectrum Phase Manipulation • Both spectrum and phase are important for image content

  20. 20 Frequency Domain Filtering Basics • Generally complicated relationship between image and transform ▫ Frequency is associated with patterns of intensity variations in image • Filtering modifies the image spectrum based on a specific objective ▫ Magnitude (spectrum) – most useful for visualization (e.g. match visual characteristics) ▫ Phase – generally not useful for visualization 45 degree lines Off center line

  21. 21 Fundamentals • Modify FT of image and inverse for result ▫ 𝑕 𝑦, 𝑧 = ℱ −1 [𝐼 𝑣, 𝑤 𝐺 𝑣, 𝑤 ]  𝑕(𝑦, 𝑧) : output image [𝑁 × 𝑂]  𝐺(𝑣, 𝑤) : FT of input image 𝑔 𝑦, 𝑧 [𝑁 × 𝑂]  𝐼(𝑣, 𝑤) : filter transfer function [𝑁 × 𝑂]  ℱ −1 : inverse FT (iFT) ▫ Product from element-wise array multiplication Remove DC (0,0) term from 𝐺(𝑣, 𝑤)

  22. 22 Example Filters Addition of small offset to retain DC component after HP

  23. 23 DFT Subtleties • Multiplication in frequency is convolution in time ▫ Must pad image since output is larger  Will pad 𝑔(𝑦, 𝑧) image but not ℎ(𝑦, 𝑧)  𝐼(𝑣, 𝑤) designed and sized for padded 𝐺(𝑣, 𝑤) ▫ DFT implicitly assumes a periodic function

  24. 24 Phase Angle • Generally, a filter can affect the phase of a signal • Zero-phase-shift filters have no effect on phase ▫ Focus of this chapter • Phase is very important to image ▫ Small changes can lead to unexpected results

  25. 25 Frequency Domain Filtering Steps Given image 𝑔(𝑦, 𝑧) of size 𝑁 × 𝑂 , get padding 1. (𝑄, 𝑅) Typically use 𝑄 = 2𝑁 and 𝑅 = 2𝑂 ▫ 2. Form zero-padded image 𝑔 𝑞 (𝑦, 𝑧) of size 𝑄 × 𝑅 𝑞 (𝑦, 𝑧) by −1 𝑦+𝑧 to center the 3. Multiply 𝑔 transform 4. Compute DFT 𝐺(𝑣, 𝑤) 5. Compute 𝐻 𝑣, 𝑤 = 𝐼 𝑣, 𝑤 𝐺(𝑣, 𝑤) Get real, symmetric filter function 𝐼(𝑣, 𝑤) of size ▫ 𝑄 𝑅 𝑄 × 𝑅 with center at coordinates 2 , 2 6. Obtain (padded) output image from iFT 𝑕 𝑞 𝑦, 𝑧 = {real ℱ −1 𝐻 𝑣, 𝑤 −1 𝑦+𝑧 ▫ 7. Obtain 𝑕(𝑦, 𝑧) by extracting 𝑁 × 𝑂 region from top left quadrant of 𝑕 𝑞 (𝑦, 𝑧)

  26. 26 Steps Example

  27. 27 Relationship to Spatial Filtering • Frequency multiplication  convolution in spatial domain ▫ ℎ(𝑦, 𝑧) ↔ 𝐼(𝑣, 𝑤) ▫ Use of a finite impulse response • Generally use small filter kernels which are more efficient to implement in spatial domain • Frequency domain can be better for the design of filters ▫ More natural space for definition ▫ Use iFT to determine the “shape” of the spatial filter

Recommend


More recommend