DigitalFilters_note

# DigitalFilters_note - Digital Filters Definition – A...

This preview shows page 1. Sign up to view the full content.

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Digital Filters Definition: – A digital filter is a digital system that transforms a sequence, applied at the input of the filter, by changing its frequency characteristics in a predetermined manner. EE EE 338 – Digital Filters Vicky Zhao Electrical and Computer Eng. Dept. University of Alberta, Edmonton Classification: – Based on the magnitude/phase spectrum Low pass filter, high pass filter, band pass filter, band stop filter – Based on the length of the unit impulse response Finite impulse response (FIR) filter, infinite impulse response (IIR) filter Which domain to implement the filtering: – Time-domain convolution = frequency-domain multiplication V Zhao: EE 338 Discrete-time Signals and Systems V Zhao: EE 338 Discrete-time Signals and Systems 2 Ideal Lowpass Filter H(ω) 1 -2π -π -ωc ωc π Ideal Lowpass Filter (cont’d) Low frequency ωc = 0.5π 2π High frequency Terminology: Stop Pass band band Stop band Non-causal – Pass band: the range of frequencies passed by the filter – Stop band: the range of frequencies blocked by the filter – Cutoff frequency ωc Frequency response: ⎧1 ω < ωc H ILP (ω ) = ⎨ 0 ωc < ω < π ⎩ – Pass the low frequencies and reject the high frequencies – Sharp transition between the pass band and the stop band V Zhao: EE 338 Discrete-time Signals and Systems filter! Time domain: unit impulse response hILP [n] = Infinite impulse response (IIR) Non-causal 3 V Zhao: EE 338 Discrete-time Signals and Systems sin( nωc ) ωc ⎛ nω ⎞ sin c⎜ c ⎟ = π nπ ⎝π⎠ 4 Ideal Ideal Highpass Filter H(ω) 1 -2π -π -ωc ωc π 2π -2π Ideal Bandpass Filter H(ω) 1 Pass band Stop band -π-ωc2 -ωc1 ωc1 ωc2π 2π Low frequency High frequency frequency Pass Stop band band Pass band Frequency response: H IBP (ω ) = H ILP (cutoff freq = ωc 2 ) − H ILP (cutoff freq = ωc1 ) ⎧1 =⎨ ⎩0 Frequency response – Pass the high frequencies and reject the low frequencies H IHP (ω ) = 1 − H ILP ⎧1 ωc < ω < π =⎨ ω < ωc ⎩0 ωc1 < ω < ωc 2 ω < ωc1and ω < ωc 2 Unit impulse response Unit impulse response: hIBP [n] = 5 ω ⎛ nω ⎞ hIHP [n] = δ [n] − hILP [n] = δ [n] − c sin c⎜ c ⎟ π ⎝π ⎠ V Zhao: EE 338 Discrete-time Signals and Systems ωc 2 ⎛ nω ⎞ ω ⎛ nω ⎞ sin c⎜ c 2 ⎟ − c1 sin c⎜ c1 ⎟ π ⎝π⎠ π ⎝π⎠ 6 V Zhao: EE 338 Discrete-time Signals and Systems Ideal Bandstop filter H(jω) 1 Pass band Stop band -2π -π-ωc2 -ωc1 ωc1 ωc2π 2π Filter Design Issues BIBO stable: bounded input bounded output Causality – application dependent: – A critical issue for real-time processing of time signals (audio, video) – Causality is usually not that important for spatial signal processing Causal processing of 2D images: from top to bottom, from left to right (raster scan) Frequency response response ⎧0 H IBS (ω ) = 1 − H IBP (ω ) = ⎨ ⎩1 X Current pixel pixel Causal part Non-causal part ωc1 < ω < ωc 2 ω < ωc1 and ω < ωc 2 X Unit impulse response hIBS [n] = δ [n] − Real-world multimedia data are real in value – Given a real-value input, the output should be real too – h[n] is real Freq. resp. H(w) is symmetric with respect to the origin h[n] is real resp H(w) is symmetric with respect to the origin 7 V Zhao: EE 338 Discrete-time Signals and Systems 10 ωc 2 ⎛ nω ⎞ ω ⎛ nω ⎞ sin c⎜ c 2 ⎟ + c1 sin c⎜ c1 ⎟ π ⎝π⎠ π ⎝π⎠ V Zhao: EE 338 Discrete-time Signals and Systems Zero-Phase/LinearZero-Phase/Linear-Phase Filters Multimedia data are sensitive to phase distortion Zero phase (no phase distortion) is preferred freq. resp. H(w) is real h[n] is symmetric about the origin in the time/spatial domain non-causal Introducing small phase distortion small phase distortion FIR versus IIR Implementation issues – number of delays – IIR: h[n] is of infinite duration and is often implemented using a feedback loop y[n] + a1 y[n − 1] + ... + a N y[n − N ] = b0 x[n] + b1 x[n − 1] + ... + bM x[n − M ] H ( z) = Y ( z ) b0 + b1 z −1 + ... + aM z − M = X ( z ) 1 + a1 z −1 + ... + a N z − N Feedback loop To meet the causality requirement, we can introduce linear phase, which corresponds to time which corresponds to time delay (tolerable). Will discuss more about linear phase later linear phase later – FIR: h[n] is of finite duration, no feedback loops y[n] = b0 x[n] + b1 x[n − 1] + ... + bM x[n − M ] Y ( z) = b0 + b1 z −1 + ... + aM z − M X ( z) (M+1)-tap filter h[n] = b0δ [n] + b1δ [n − 1] + ... + aM δ [n − M ] – Usually, FIR filters require longer delays than IIR filters fil fil H ( z) = V Zhao: EE 338 Discrete-time Signals and Systems 12 V Zhao: EE 338 Discrete-time Signals and Systems From [Gonzalez] 11 FIR versus IIR (cont’d) Stability – FIR: guaranteed to be stable, the only pole is at z=0 – IIR: cannot guarantee stability, need to carefully design the poles such that the ROC includes the unit circile. Zero or linear phase – will discuss more later – FIR: can ensure linear phase – IIR: usually nonlinear phase Image Filtering V Zhao: EE 338 Discrete-time Signals and Systems 13 V Zhao: EE 338 Discrete-time Signals and Systems What What is an Image? UMCP ENEE631 Slides (created by M.Wu © 2007) Noise Removal using LPF Grayscale image: a pattern of light intensity over a 2-D plane – Pixel: picture element – Intensity: 8-bit unsigned integer Color images – Can be represented by three functions: R(x,y) for red, G(x,y) for green, B(x,y) for blue. 255 (white) y Original image 0 (black) Noisy image Passing through a LPF Matlab demo pixel x From M Wu ENEE631 UMD 15 V Zhao: EE 338 Discrete-time Signals and Systems V Zhao: EE 338 Discrete-time Signals and Systems From V Zhao ECE644 UA 16 Edge Detection using HPF UMCP ENEE408G Slides (created by M.Wu & R.Liu © 2002) Unsharp Masking and Highboost Filtering Use LPF to generate HPF – Subtract a low pass filtered result from the original signal – HPF extracts edges and transitions 50 50 40 30 20 Enhance edges I0 ILP IHP = I0 – ILP I1 = I0 + a*IHP 40 30 20 10 0 smoothing blurred signal 0 20 40 60 80 100 original signal 0 20 40 60 80 100 10 0 10 5 0 50 40 30 20 Original image Passing through a HPF -- Gradient Map Binary Edge Map Matlab demo sharpening sharpened signal 0 20 40 60 80 100 Matlab demo -5 -10 unsharped mask 0 20 40 60 80 100 10 0 V Zhao: EE 338 Discrete-time Signals and Systems From V Zhao ECE644 UA 17 V Zhao: EE 338 Discrete-time Signals and Systems From M Wu ENEE631 UMD 18 UMCP ENEE408G Slides (created by M.Wu & R.Liu © 2002) Original moon image is from Matlab Image Toolbox. Example Example of Image Sharpening Periodic Noise Removal using BSF V Zhao: EE 338 Discrete-time Signals and Systems 19 V Zhao: EE 338 Discrete-time Signals and Systems From [Gonzalez] 20 More Examples of Image Filtering UMCP ENEE631 Slides (created by M.Wu © 2001) UMCP ENEE631 Slides (created by M.Wu © 2001) Imperfectness Imperfectness in Image Capturing u(n1, n2 ) H v(n1, n2 ) N(n1, n2 ) Blurring ~ linear spatial-invariant filter model w/ additive noise Impulse response h(n1, n2) & H(ω1, ω2) – Point Spread Function (PSF) ~ non-negative I/O – [No blur] bl h(n1, n2) = δ(n1, n2) ⎧1 ⎪L ⎪ ⎪ h( x, y; L,φ ) = ⎨ ⎪ ⎪ ⎪0 ⎩ if x2 + y2 ≤ and x y L 2 – [Linear translational motion blur] local average along motion direction = − tan φ otherwise – [Uniform out-of-focus blur] local average in a circular neighborhood From Matlab ImageToolbox Documentation pp12-4 V Zhao: EE 338 Discrete-time Signals and Systems 22 – Atomspheric turbulence blur, etc. turbulence blur etc V Zhao: EE 338 Discrete-time Signals and Systems ⎧1 if x 2 + y 2 ≤ R 2 ⎪ h ( x , y ; R ) = ⎨ πR 2 ⎪0 otherwise ⎩ From M Wu ENEE631 UMD 23 Blurred image Recovered image Undo Undo Linear Spatial-Invariant Distortion SpatialUMCP ENEE631 Slides (created by M.Wu © 2001) Image Deblurring Assume noiseless and PSF of distortion h(n1, n2) is known u: original/clean image u: original/clean image u(n1, n2) H w(n1, n2) v: blurred image bl u’: recovered image recovered image v(n1, n2) G u’(n1, n2) H: blurring process η(n1, n2)=0 G: restoration/deblurring process Restoration by Deconvolution / Inverse-Filtering – Often used for deblurring used for deblurring – Want to find g(n1, n2) satisfies h(n1, n2) ⊗ g(n1, n2) = δ(n1, n2) ΣΣ h(k1, k2) g(n1 -k1, n2-k2) = δ(n1, n2) for all n1, n2 – Easy to solve in spectrum domain 1 2 Convolution Multiplication H (ω1 , ω 2 ) H(ω1, ω2) G(ω1, ω2) = 1 Interpretation: choose G to compensate distortions from H V Zhao: EE 338 Discrete-time Signals and Systems Noise energy decreases G (ω , ω ) = 1 From [Gonzalez] V Zhao: EE 338 Discrete-time Signals and Systems 25 From M Wu ENEE631 UMD 24 ...
View Full Document

## This note was uploaded on 12/20/2010 for the course E E 338 taught by Professor Vicky during the Spring '10 term at University of Alberta.

Ask a homework question - tutors are online