ECE468_15 - ECE 468: Digital Image Processing Lecture 14...

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

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ECE 468: Digital Image Processing Lecture 14 Prof. Sinisa Todorovic sinisa@eecs.oregonstate.edu Outline • • • • Filtering of images in the frequency domain (Textbook 4.7) Homographic Filtering (Textbook 4.9.6) Image Restoration (Textbook 5.1) Noise Models (Textbook 5.2) Filtering in the Frequency Domain Filtering in the Frequency Domain f (x, y ) |F (u, v )| H (u, v ) = ￿ 0 1 , , u = 0, v = 0 otherwise F −1 {H (u, v )F (u, v )} Filtering in the Frequency Domain Steps in Frequency Domain Filtering Steps in Frequency Domain Filtering 1. Input: f(x,y) of size MxN 2. Compute padding fp(x,y) of size PxQ, where P = 2M, Q = 2N 3. Multiply fp(x,y)(-1)x+y to center its DFT 4. Compute DFT of fp(x,y)(-1)x+y --> F(u,v) 5. Use filter H(u,v) of size PxQ, with center at coordinates (P/2,Q/2) 6. Multiply element-wise G(u,v) = H(u,v)F(u,v) 7. Compute the real part of IDFT, gp(x,y) = real[ IDFT(G(u,v)) ] (-1)x+y 8. Crop the top left MxN region to get g(x,y) Ideal Lowpass Filter H (u, v ) = ￿ 1 0 , , D(u, v ) ≤ D0 D(u, v ) > D0 ￿2 ￿ ￿2 D(u, v ) = ￿￿ P u− 2 Q + v− 2 Example: Lowpass Filtering Example: Lowpass Filtering Butterworth Lowpass Filter H (u, v ) = 1+ ￿￿ ￿ 1 D (u,v ) D0 ￿2n ￿2 D(u, v ) = P u− 2 ￿2 Q + v− 2 ￿ Butterworth Lowpass Filter Ringing for large n Butterworth Lowpass Filter Ringing for large n Example: Butterworth Lowpass Filter Lowpass Gaussian Filter D (u, v ) H (u, v ) = exp − 2 2D0 2 ￿ ￿ D(u, v ) = ￿￿ P u− 2 ￿2 Q + v− 2 ￿ ￿2 Example: Lowpass Gaussian Filter Example: Lowpass Gaussian Filter Example: Lowpass Gaussian Filter After this goes sharpening for Hollywood!! Highpass Filtering in the Frequency Domain HHP (u, v ) = 1 − HLP (u, v ) Highpass Filters Example: Highpass Filtering Ideal Butterworth Gaussian Bandpass and Bandreject Filtering HBP = 1 − HBR Laplacian Filter (Homework) H (u, v ) = −4π (u + v ) 2 2 2 Image Sharpening in the Frequency Domain g (x, y ) = f (x, y ) ± c∇ f (x, y ) 2 G(u, v ) = F (u, v ) − H (u, v )F (u, v ), c = −1 needs scaling g (x, y ) = F −1 {[1 + 4π (u + v )]F (u, v )} 2 2 Image Sharpening in the Frequency Domain Unsharp Masking ¯ g (x, y ) = f (x, y ) + c[f (x, y ) − f (x, y )] ¯(x, y ) = F −1 {HLP (u, v )F (u, v )} f g (x, y ) = F −1 {[1 + c(1 − HLP (u, v ))]F (u, v )} g (x, y ) = F −1 {[1 + cHHP (u, v )]F (u, v )} high frequency emphasis filter Example: Lowpass Gaussian Filter After this goes sharpening for Hollywood!! Unsharp Masking in the Frequency Domain Highpass Filtering in the Frequency Domain HHP (u, v ) = 1 − HLP (u, v ) Highpass Filters Example: Highpass Filtering Ideal Butterworth Gaussian Homomorphic Filtering = Separation of intensity from reflectance + Intensity range compression + Contrast Enhancement Image Formation f (x, y ) = i(x, y )r(x, y ) illumination reflectance r(x, y ) ∈ [0, 1] i(x, y ) ∈ [0, ∞) Homomorphic Filtering z (x, y ) = ln f (x, y ) = ln i(x, y ) + ln r(x, y ) i (x, y ) = ln i(x, y ) ↔ I (u, v ) ￿ ￿ r (x, y ) = ln r(x, y ) ↔ R (u, v ) ￿ ￿ Homomorphic Filtering S (u, v ) = H (u, v )I ￿ (u, v ) + H (u, v )R￿ (u, v ) s(x, y ) = F −1 {H (u, v )I (u, v ) + H (u, v )R (u, v )} ￿ ￿ Homomorphic Filtering g (x, y ) = e (F −1 {H (u,v )I (u,v )}) (F ￿ e −1 {H (u,v )R (u,v )}) ￿ affects both low- and high-frequency components Homomorphic Filtering example: affects both low- and high-frequency components dynamic range compression and contrast enhancement Homomorphic Filtering Image Restoration vs. Image Enhancement • • Unlike enhancement, improve an image in an objective sense Model the degradation and use the model for image restoration Model of Image Degradation/Restoration g (x, y ) = h(x, y ) ￿ f (x, y ) + η (x, y ) G(u, v ) = H (u, v )F (u, v ) + N (u, v ) Noise Models Assumptions: • • Noise is independent of image coordinates Noise is not correlated with the image Noise Modeling g (x, y ) = h(x, y ) ￿ f (x, y ) + η (x, y ) G(u, v ) = H (u, v )F (u, v ) + N (u, v ) Noise Modeling ) ,y (x δ = ) ￿ f (x, y ) + η (x, y ) g (x, y ) = h(x, y G(u, v ) = H (u, v )F (u, v ) + N (u, v ) = 1 Noise in the Image original image Noise in the Image examples of noise corrupted image Important Noise PDFs 1 (z − µ) exp − p(z ) = √ 2σ 2 2πσ ￿ 2 ￿ Noise in the Image Important Noise PDFs Noise in the Image Important Noise PDFs ￿ p(z ) = a exp(−az ) , z ≥ 0 0 , z<0 Noise in the Image Important Noise PDFs Noise in the Image Gaussian Noise + Arithmetic vs. Geometric Mean Filter Sxy filter window g (x, y ) = f (x, y ) + η (x, y ) output input ˆ(x, y ) = 1 f mn (s,t)∈Sxy ￿ g (s, t) arithmetic mean filtering ˆ f (x, y ) = (s,t)∈Sxy ￿ geometric mean filtering g (s, t) 1 mn arithmetic mean geometric mean Gaussian Noise + Arithmetic vs. Geometric Mean Filter Sxy filter window g (x, y ) = f (x, y ) + η (x, y ) output input ˆ(x, y ) = 1 f mn (s,t)∈Sxy ￿ g (s, t) arithmetic mean filtering ˆ f (x, y ) = (s,t)∈Sxy ￿ geometric mean filtering g (s, t) 1 mn arithmetic mean geometric mean Salt-and-Pepper Noise + Median Filter Sxy filter window g (x, y ) = f (x, y ) + η (x, y ) output input ˆ f (x, y ) = median(s,t)∈Sxy g (s, t) median filtering repeated application of median filter Gaussian Noise + Adaptive Filter arithmetic mean mSxy 1 = mn (s,t)∈Sxy ￿ g (s, t) arithmetic variance 2 σSxy 1 = mn (s,t)∈Sxy ￿ (g (s, t) − mSxy )2 2 ￿ ση ￿ ˆ f (x, y ) = g (x, y ) − 2 g (x, y ) − mSxy σSxy Properties: • • Zero-noise On edges 2 ση = 0 ˆ ⇒ f (x, y ) = g (x, y ) ˆ ⇒ f (x, y ) = g (x, y ) 2 2 ση ￿ σSxy Gaussian Noise + Adaptive Filter Outline • Restoration by Frequency-Domain Filtering (Textbook 5.3) Image Restoration in the Frequency Domain G(u, v ) = H (u, v )F (u, v ) + N (u, v ) ˆ (u, v ) = G(u, v )HR (u, v ) F Periodic Noise = 2D Sinusoid filtering in the frequency domain Bandreject Filters in the Frequency Domain Degradation Modeling Degradation Modeling g (x, y ) = h(x, y ) ￿ f (x, y ) + η (x, y ) G(u, v ) = H (u, v )F (u, v ) + N (u, v ) Modeling Degradation Due to Atmospheric Turbulence H (u, v ) = e −k(u2 +v 2 )5/6 Modeling Uniform Linear Motion Blur Modeling Uniform Linear Motion Blur T - duration of the exposure blurred output: g (x, y ) = ￿ T 0 f (x − x0 (t), y − y0 (t))dt Modeling Uniform Linear Motion Blur T - duration of the exposure blurred output: g (x, y ) = ￿ T 0 f (x − x0 (t), y − y0 (t))dt ￿ T G(u, v ) = F (u, v ) e −2j π [ux0 (t)+vy0 (t)] dt 0 Modeling Uniform Linear Motion Blur T - duration of the exposure blurred output: g (x, y ) = ￿ T 0 f (x − x0 (t), y − y0 (t))dt ￿ T G(u, v ) = F (u, v ) ￿ e −2j π [ux0 (t)+vy0 (t)] dt 0 ⇒ H (u, v ) = T e −2j π [ux0 (t)+vy0 (t)] dt 0 Modeling Uniform Linear Motion Blur at x0 (t) = T ￿ bt y0 (t) = T H (u, v ) = = T e −2j π [ux0 (t)+vy0 (t)] dt 0 T −j π (ua+ub) sin[π (ua + vb)]e π (ua + vb) Image Restoration Image Restoration by Inverse Filtering G(u, v ) = H (u, v )F (u, v ) + N (u, v ) G(u, v ) ˆ F (u, v ) = H (u, v ) Image Restoration by Inverse Filtering G(u, v ) = H (u, v )F (u, v ) + N (u, v ) Image Restoration by Inverse Filtering G(u, v ) = H (u, v )F (u, v ) + N (u, v ) N (u, v ) ˆ F (u, v ) = F (u, v ) + H (u, v ) Inverse Filtering N (u, v ) ˆ F (u, v ) = F (u, v ) + H (u, v ) Bad news: • • Even when H(u,v) is known, there is always unknown noise Often H(u,v) has values close to zero Example: Inverse Filtering Atmospheric turbulence effect ￿￿ ￿5/6 ￿ 2 2 H (u, v ) = exp −k (u − M/2) + (v − N/2) Example: Inverse Filtering G(u, v ) H (u, v ) Wiener Filtering = Mean Square Error Filtering • Incorporates both: • • Degradation function Statistical characteristics of noise • • Assumption: noise and the image are uncorrelated Optimizes the filter so that MSE is minimized ￿ ￿ 2 ˆ(x, y )]2 e = E [f (x, y ) − f Wiener Filter ￿ ￿ 2 ˆ(x, y )]2 e = E [f (x, y ) − f Wiener Filter ￿ ￿ 2 ˆ(x, y )]2 e = E [f (x, y ) − f degraded image G(u, v ) = H (u, v )F (u, v ) + N (u, v ) Wiener Filter ￿ ￿ 2 ˆ(x, y )]2 e = E [f (x, y ) − f degraded image G(u, v ) = H (u, v )F (u, v ) + N (u, v ) restored output ˆ F (u, v ) = G(u, v )HR (u, v ) = [H (u, v )F (u, v ) + N (u, v )]HR (u, v ) Wiener Filter ￿ ￿ 2 ˆ(x, y )]2 e = E [f (x, y ) − f degraded image G(u, v ) = H (u, v )F (u, v ) + N (u, v ) restored output ˆ F (u, v ) = G(u, v )HR (u, v ) = [H (u, v )F (u, v ) + N (u, v )]HR (u, v ) ￿ 2 = arg min E [F − (F H + N )HR ] HR HW ￿ Wiener Filter 1 HW (u, v ) = H (u, v ) |H (u, v )|2 |SN (u, v )|2 |H (u, v )|2 + |SF (u, v )|2 ∗ SN (u, v ) = E {N (u, v )N (u, v )} SF (u, v ) = E {F (u, v )F (u, v )} ∗ Wiener Filter 1 HW (u, v ) = H (u, v ) |H (u, v )|2 |SN (u, v )|2 |H (u, v )|2 + |SF (u, v )|2 ∗ SN (u, v ) = E {N (u, v )N (u, v )} SF (u, v ) = E {F (u, v )F (u, v )} ∗ Wiener Filter 1 HW (u, v ) = H (u, v ) |H (u, v )|2 |SN (u, v )|2 |H (u, v )|2 + |SF (u, v )|2 ∗ inverse filter SN (u, v ) = E {N (u, v )N (u, v )} SF (u, v ) = E {F (u, v )F (u, v )} ∗ Wiener Filter 1 HW (u, v ) = H (u, v ) |H (u, v )|2 |SN (u, v )|2 |H (u, v )|2 + |SF (u, v )|2 inverse filter ∗ unknown SN (u, v ) = E {N (u, v )N (u, v )} SF (u, v ) = E {F (u, v )F (u, v )} ∗ Signal to Noise Ratio 1 HW (u, v ) = H (u, v ) |H (u, v )|2 |SN (u, v )|2 |H (u, v )|2 + |SF (u, v )|2 Signal to Noise Ratio 1 HW (u, v ) = H (u, v ) |H (u, v )|2 |SN (u, v )|2 |H (u, v )|2 + |SF (u, v )|2 SNR = u=0 v =0 M −1 N −1 ￿￿ u=0 v =0 M −1 N −1 ￿￿ |F (u, v )| 2 |N (u, v )| 2 Wiener Filter -- Approximation 1 HW (u, v ) ≈ H (u, v ) |H (u, v )|2 |H (u, v )|2 1 + SNR Example: Wiener Filtering Example: Wiener Filtering Next Class • • Image reconstruction from projections (Textbook 5.11) Radon Transform (Textbook 5.11.3) ...
View Full Document

This note was uploaded on 12/05/2010 for the course ECE 468 taught by Professor Lucchese during the Fall '08 term at Oregon State.

Ask a homework question - tutors are online