450 likes | 626 Views
Tutorials 12,13 discrete signals and systems. Technion, CS department, SIPC 236327 Spring 2014. Discrete LSI system. Linear Space invariant. Discrete LSI system. Linear Space invariant. Example.
E N D
Tutorials 12,13discrete signals and systems Technion, CS department, SIPC 236327 Spring 2014
Discrete LSI system • Linear • Space invariant
Discrete LSI system • Linear • Space invariant
Example • For compression, a rule to predict the pixel value is used:Is the system linear? Space invariant?
Discrete LSI system • System is defined with its impulse response
Cyclic convolution Convolution • Infinite support • DTFT • Finite support • DFT • Efficient implementation
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
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
Discrete Fourier Transform (DFT, FFT) Infinite support Infinite support Continiuous Continuous Finite support Finite support Discrete Discrete
DFT • התמרות הDFT וDFT-1מתבצעות בדרך הרגילה • המקדמים מחזוריים: • לכן במקום להתייחס לתחום [0,N-1] בד"כ מסתכלים על התחום [-N/2,N/2-1].
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
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
Example –frequency filtration - implementation Notch filter in freq. domain • 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
Tutorials 12,13discrete signals and systemsPart II: 2D Technion, CS department, SIPC 236327 Spring 2014
2D - definitions 2Dconvolution:
2D - definitions • Cyclic 2D-convolution: • 2D DFT:
2D - notes • DFT is linear, we have an operation matrix: • 2D-DFT can be implemented as: • If the input is separable:
Example • Noisy image 512X512 • The noise:Add 100 gray levels for all 16i lines
Example Noisy image Average filter
Example Noisy image Average filter
Example • How does the noise look like in the frequency domain?
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 );
Edge detection of Image A • Roberts • Prewitt • Sobel
Edge detection of Image A Original Roberts Prewitt Sobel