430 likes | 547 Views
Tutorials 11,12,13 discrete signals and systems. Technion, CS department, SIPC 236327 Winter 2012-2013. 1. Discrete LSI system. Linear Space invariant. 2. Discrete LSI system. Linear Space invariant. 3. E xample.
E N D
Tutorials 11,12,13discrete signals and systems Technion, CS department, SIPC 236327 Winter 2012-2013 1
Discrete LSI system • Linear • Space invariant 2
Discrete LSI system • Linear • Space invariant 3
Example • For compression, a rule to predict the pixel value is used:Is the system linear? Space invariant? 4
Discrete LSI system • System is defined with its impulse response 5
Cyclic convolution Convolution • Infinite support • DTFT • Finite support • DFT • Efficient implementation 6
Exercise Q: How can we use this system to calculate a linear convolution? A: Zero padding, and truncation of the result. H Q: If both signals are of length N, how many zeros will we add? A: N-1 zeros 7
Exercise Q: How can we use this system to calculate a cyclic convolution? A: Duplicate one signal, and truncation of the result. H Q: If both signals are of length N, how much should we duplicate A: N-1 cells 8
Discrete Fourier Transform (DFT, FFT) Infinite support infinite support Continiuous continuous Finite support Finite support Discrete Discrete 9
DFT • התמרות הDFT וDFT-1מתבצעות בדרך הרגילה • המקדמים מחזוריים: • לכן במקום להתייחס לתחום [0,N-1] בד"כ מסתכלים על התחום [-N/2,N/2-1]. 10
הפעלת DFT 11
דוגמאות DFT 12
Summary – Fourier Transforms • Fourier transform • Time domain – non-periodic infinite signals • Continuous time (t) • Continuous frequency (f) • Formulas
Summary – Fourier Transforms • DTFT: Discrete Time Fourier Transform • Time domain – non-periodic infinite signals • Discrete time (n) • Continuous frequency (f) • Formulas לא נלמד בקורס
Summary – Fourier Transforms • Fourier series • Time domain – periodic infinite signals • Continuous time (t) • Discrete frequency (f) • Formulas
Summary – Fourier Transforms • DFTor Discrete Time Fourier Series • Time domain – periodic infinite signals • Discrete time (n) • Discrete frequency (f) • Formulas
Exercise • 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 18
Example – discrete frequency filtration • 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– smoothing vs median (8 pixels) No noisebut image is blurred
Example – discrete frequency filtration • DFT of the noise in line i
Example – discrete frequency filtration • 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 Original signal in frequency domain Filtered signal in frequency domain
Example – discrete frequency filtration • Noise removed completely • Original image not fully restored • We cannot restore the attenuated frequencies
Example – discrete frequency filtration 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 Notch filter in freq. domain
Tutorials 11,12,13discrete signals and systemsPart II: 2D Technion, CS department, SIPC 236327 Winter 2012-2013 30
2D - definitions 2Dconvolution: 31
2D - definitions • Cyclic 2D-convolution: • 2D DFT: 32
2D - notes • DFT is linear, we have an operation matrix: • 2D-DFT can be implemented as: • If the input is separable: 33
Example • Noisy image 512X512 • The noise:Add 100 gray levels for all 16i lines 34
Example Noisy image Average filter 35
Example Noisy image Average filter 36
Example • How does the noise look like in the frequency domain? 37
Example After freq. filtration • 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 ); 38