Technion, CS department, SIPC Spring 2014 Tutorials 12,13 discrete signals and systems 1/39
Discrete LSI system 2/39
Discrete LSI system 3/39
Example 4/39
System is defined with its impulse response Discrete LSI system 5/39
Cyclic convolution 6/39 Convolution
Q: How can we use this system to calculate a linear convolution? A: Zero padding, and truncation of the result. Exercise 7/39 H Q: If both signals are of length N, how many zeros will we add? A: N-1 zeros
Q: How can we use this system to calculate a cyclic convolution? A: Duplicate one signal, and truncation of the result. Exercise 8/39 H Q: If both signals are of length N, how much should we duplicate A: N-1 cells
Infinite support ContiniuousContinuous Finite support Discrete Discrete Fourier Transform (DFT, FFT) 9/39
התמרות ה DFT ו DFT -1 מתבצעות בדרך הרגילה המקדמים מחזוריים : לכן במקום להתייחס לתחום [0,N-1] בד " כ מסתכלים על התחום [-N/2,N/2-1]. DFT 10/39
הפעלת DFT 11/39
דוגמאות DFT 12/39
Fourier transform – Time domain – non-periodic infinite signals – Continuous time (t) – Continuous frequency (f) – Formulas Summary – Fourier Transforms 13/39
DTFT: Discrete Time Fourier Transform – Time domain – non-periodic infinite signals – Discrete time (n) – Continuous frequency (f) – Formulas Summary – Fourier Transforms 14/39
Fourier series – Time domain – periodic infinite signals – Continuous time (t) – Discrete frequency (f) – Formulas Summary – Fourier Transforms 15/39
DFT or Discrete Time Fourier Series – Time domain – periodic infinite signals – Discrete time (n) – Discrete frequency (f) – Formulas Summary – Fourier Transforms 16/39
DFT ומערכת LSI 17/39
We have an N-length filter with impulse response h[n]. We create a new filter as follows: Express F[k] with H[k], where H[k]=DFT{h[n]},F[k]=DFT{f[n]} Instructions: calculate Exercise 18/39
Noisy image of size 256X256 Im_out[m,n]=Im_in[m,n]+noise[m,n] Harmonic noise: f = 1/(8 pixels) Amplitude A and phase φ are random and independent for each line. Example – discrete frequency filtration 19/39
Example – added noise in line /39
Example – discrete frequency filtration 21/39
Example – discrete frequency filtration - smoothing 22/39
Example – discrete frequency filtration – smoothing vs median (8 pixels) 23/39 No noise but image is blurred
DFT of the noise in line i Example – discrete frequency filtration 24/39
Design an LSI filter – Such filter multiplies each frequency with a complex number – Can handle each frequency separately In this example, we want to handle frequencies 32 and -32. – Notch filter – attenuates specific frequency Example – discrete frequency filtration 25/39
Example – discrete frequency filtration 26/39 Original signal in frequency domain Filtered signal in frequency domain
Noise removed completely Original image not fully restored – We cannot restore the attenuated frequencies Example – discrete frequency filtration 27/39
Example – discrete frequency filtration 28/39 Smoothing filter of 8 pixels Notch filter
Filter in freq. domain: Filter=ones(1,256); Filter(32+1)=0; Filter(224+1)=0; Filtration: For k=1:size(I,1), Y=fft(I(k,:)).*Filter; I(k,:)=ifft(Y); end Example –frequency filtration - implementation 29/39 Notch filter in freq. domain
Technion, CS department, SIPC Spring 2014 Tutorials 12,13 discrete signals and systems Part II: 2D 30/39
2D convolution: 2D - definitions 31/39
Cyclic 2D-convolution: 2D DFT: 32/39 2D - definitions
DFT is linear, we have an operation matrix: 2D-DFT can be implemented as: If the input is separable: 33/39 2D - notes
Noisy image 512X512 The noise: Add 100 gray levels for all 16i lines Example 34/39
Example 35/39 Noisy image Average filter
Example 36/39 Noisy image Average filter
How does the noise look like in the frequency domain? Example 37/39
Filter implementation in the freq. domain: H=ones(512,512); for n=1:32:512 H(n,1) = H(1,n) = 0; end H(1,1) = 1; Image filtration: out = ifft( fft(img).*H ); Example 38/39 After freq. filtration
לפני סינון תדר 39/39
לפני סינון תדר (הגדלה של מרכז) 40/39
אחרי סינון תדר (הגדלה של מרכז) 41/39
Image filtration 42/39
Roberts Prewitt Sobel Edge detection of Image A 43/39
Edge detection of Image A 44/44 Original Roberts Sobel Prewitt
Unsharp masking – edge enhancement 45/44