Noise and Restoration of Images Dr. Praveen Sankaran Department of ECE NIT Calicut February 24, 2013 Winter 2013 February 24, 2013 1 / 35
Outline 1 Noise Models 2 Restoration from Noise Degradation 3 Estimation of Degradation 4 Restoration from Degradation Inverse and Wiener Filtering Constrained Least Squares Filtering Winter 2013 February 24, 2013 2 / 35
Noise Models Degradation Model All digital images have some amount of noise and/or some form of degradation in them. Some have more due to varying sources Acquisition Environmental conditions. quality of sensing elements - CCD noise. Transmission Formation Blur Quantization noise Winter 2013 February 24, 2013 3 / 35
Noise Models Degradation Model g [x, y] = f [x, y] h [s, t] + η [x, y] (1) η uncorrelated noise (no relation between noise and pixel value of the image). think of an example where both could be correlated? Winter 2013 February 24, 2013 4 / 35
Noise Models Noise Models Winter 2013 February 24, 2013 5 / 35
Noise Models Noise Models - Explained Winter 2013 February 24, 2013 6 / 35
Noise Models In Color - Gaussian Winter 2013 February 24, 2013 7 / 35
Noise Models In Color - Uniform Winter 2013 February 24, 2013 8 / 35
Noise Models Periodic Noise Winter 2013 February 24, 2013 9 / 35
Noise Models Identifying System Noise Imaging system available Capture a set of images of at environments - image a solid gray board that is illuminated uniformly. Imaging system NOT available, we have only the images Estimate parameters from small patches of roughly constant background. We already know how to calculate mean and variance from a histogram. Winter 2013 February 24, 2013 10 / 35
Restoration from Noise Degradation Model - Simplied g [x, y] = f [x, y] + η [x, y] (2) G [u, v] = F [u, v] + N [u, v] (3) Noise term is unknown No blind subtraction possible. Spatial ltering is used mostly. Winter 2013 February 24, 2013 11 / 35
Restoration from Noise Degradation Typical Filters We have come across a lot of these already. Filter of size m n Arithmetic mean: Noise reduced as a result of blurring. Geometric mean: 1/mn { ˆf [x, y] = f [s, t]} (4) s,t Harmonic mean: works for salt, fails for pepper mn ˆf [x, y] = 1 g [s, t] s,t Contra-harmonic mean: works well to remove salt&pepper g [s, t] Q+1 s,t ˆf [x, y] = (6) g [s, t] Q s,t Winter 2013 February 24, 2013 12 / 35 (5)
Restoration from Noise Degradation Typical Filters We have come across a lot of these already. Filter of size m n Arithmetic mean: Noise reduced as a result of blurring. Geometric mean: 1/mn { ˆf [x, y] = f [s, t]} (4) s,t Harmonic mean: works for salt, fails for pepper mn ˆf [x, y] = 1 g [s, t] s,t Contra-harmonic mean: works well to remove salt&pepper g [s, t] Q+1 s,t ˆf [x, y] = (6) g [s, t] Q s,t Winter 2013 February 24, 2013 12 / 35 (5)
Restoration from Noise Degradation Typical Filters We have come across a lot of these already. Filter of size m n Arithmetic mean: Noise reduced as a result of blurring. Geometric mean: 1/mn { ˆf [x, y] = f [s, t]} (4) s,t Harmonic mean: works for salt, fails for pepper mn ˆf [x, y] = 1 g [s, t] s,t Contra-harmonic mean: works well to remove salt&pepper g [s, t] Q+1 s,t ˆf [x, y] = (6) g [s, t] Q s,t Winter 2013 February 24, 2013 12 / 35 (5)
Restoration from Noise Degradation Typical Filters We have come across a lot of these already. Filter of size m n Arithmetic mean: Noise reduced as a result of blurring. Geometric mean: 1/mn { ˆf [x, y] = f [s, t]} (4) s,t Harmonic mean: works for salt, fails for pepper mn ˆf [x, y] = 1 g [s, t] s,t Contra-harmonic mean: works well to remove salt&pepper g [s, t] Q+1 s,t ˆf [x, y] = (6) g [s, t] Q s,t Winter 2013 February 24, 2013 12 / 35 (5)
Restoration from Noise Degradation Illustration Winter 2013 February 24, 2013 13 / 35
Restoration from Noise Degradation Illustration Winter 2013 February 24, 2013 14 / 35
Restoration from Noise Degradation Order Static Filters 1 Median lter: ˆf [x, y] = median s,t Sxy {f [s, t]} (7) 2 MinMax lters: 3 Mid point lter: ˆf [x, y] = 1 2 { maxs,t Sxy {f [s, t]} + min s,t S xy {f [s, t]}} (8) Winter 2013 February 24, 2013 15 / 35
Restoration from Noise Degradation Adaptive Median Filter Key idea variable window area S xy to work with. So how do we decide what area to work with? provide conditions. Assumptions z min = minimum intensity, z max = maximum intensity, z med = median z xy = value at point [x, y] S max = maximum threshold of window size. Winter 2013 February 24, 2013 16 / 35
Restoration from Noise Degradation Adaptive - Conditions Stage 1 A 1 = z med z min A 2 = z med z max If A 1 > 0 and A 2 < 0, go to Stage 2. Else increase the window size. If window size S max, repeat Stage 1. Else output z med. Stage 2 B 1 = z xy z min B 2 = z xy z max If B 1 > 0 and B 2 < 0, output z xy. Else, output z xy. Winter 2013 February 24, 2013 17 / 35
Restoration from Noise Degradation Periodic Noise - Frequency Filtering Idea selectively lter out frequencies relating to noise. Can have band-reject, band-pass or notch lters. Example: band-reject Winter 2013 February 24, 2013 18 / 35
Illustration
Estimation of Degradation Estimation of Degradation 1 Observation 2 Experimentation 3 Mathematical modeling Winter 2013 February 24, 2013 20 / 35
Estimation of Degradation Degradation Model g [x, y] = H [f [x, y]] = H [x, y] F [x, y] (9) G [u, v] = H [u, v]f [u, v] (10) Let's assume for now, η [x, y] = 0 (11) Winter 2013 February 24, 2013 21 / 35
Modeling Atmospheric Turbulence H [u, v] = e k[u2 +v 2 ] 5 /6 (12)
Restoration from Degradation Inverse and Wiener Filtering Outline 1 Noise Models 2 Restoration from Noise Degradation 3 Estimation of Degradation 4 Restoration from Degradation Inverse and Wiener Filtering Constrained Least Squares Filtering Winter 2013 February 24, 2013 23 / 35
Restoration from Degradation Inverse and Wiener Filtering Inverse Filtering ˆF [u, v] = G [u, v] H [u, v] (13) Issue Presence of noise in the image. ˆF [u, v] = F [u, v] + N [u, v] H [u, v] (14) The degradation function may have zero or small values - a real possibility as we move away from the center point of the DFT image. N [u, v] H [u, v] large! Have to cut-o small values, so have to nd an optimal cut-o frequency in the DFT image. Winter 2013 February 24, 2013 24 / 35
Restoration from Degradation Inverse and Wiener Filtering Inverse Filtering Problem Illustration Winter 2013 February 24, 2013 25 / 35
Restoration from Degradation Inverse and Wiener Filtering Inverse Filtering Problem Illustration Winter 2013 February 24, 2013 26 / 35
Restoration from Degradation Inverse and Wiener Filtering Wiener Filtering - Variables Idea minimize mean square error between the uncorrupted image and the corrupted image. { ( ) } e 2 = E f ˆf 2 (15) H [u, v] = degradation function, H [u, v] = complex conjugate of H [u, v], S η [u, v] = N [u, v] 2 = power spectrum of the noise, (auto correlation of noise) S f [u, v] = F [u, v] 2 = power spectrum of the undegraded image. (auto correlation of the image) Winter 2013 February 24, 2013 27 / 35
Restoration from Degradation Inverse and Wiener Filtering Wiener Filter Equation [ ] H ˆF [u, v]s f [u, v] [u, v] = S f [u, v] H [u, v] 2 G [u, v] (16) + S η [u, v] [ ] 1 H [u, v] 2 = H [u, v] H [u, v] 2 G [u, v] (17) + S η [u,v]/s f [u,v] [ ] 1 H [u, v] 2 H [u, v] H [u, v] 2 G [u, v] (18) + K The last equation approximates the wiener lter equation since in most cases we do not know accurately the power spectrum of both noise and the un-degraded image. Winter 2013 February 24, 2013 28 / 35
Restoration from Degradation Inverse and Wiener Filtering Comparative Illustration between Inverse Filtering and Wiener Filtering Winter 2013 February 24, 2013 29 / 35
Restoration from Degradation Inverse and Wiener Filtering Comparative Illustration 2 Winter 2013 February 24, 2013 30 / 35
Restoration from Degradation Constrained Least Squares Filtering Outline 1 Noise Models 2 Restoration from Noise Degradation 3 Estimation of Degradation 4 Restoration from Degradation Inverse and Wiener Filtering Constrained Least Squares Filtering Winter 2013 February 24, 2013 31 / 35
Restoration from Degradation Constrained Least Squares Filtering Variables - Introduction g = Hf + η (19) g, f, η are vectorized form of the the 2D structure, of size MN 1. H MN MN. Objective is to minimize, Criterion function, C = M 1 N 1 x=0 y=0 [ 2 f [x, y] ] 2 (20) Laplacian again. So sort of reduce sharpness. With constraint: g H^f 2 = η 2 (21) Winter 2013 February 24, 2013 32 / 35
Restoration from Degradation Constrained Least Squares Filtering Final Frequency Domain Form [ ] H ˆF [u, v] [u, v] = H [u, v] 2 + γ P [u, v] 2 G [u, v] (22) 0 1 0 P [u, v] = I p [x, y] = 1 4 1 (23) 0 1 0 Okay! So we end up nding an approximation to γ here instead of K in Wiener ltering. γ is a scalar value, K was the ratio of two unknown frequency functions. Adjusting γ is easier and better. Note that we did not really make use of the constraint function till now. That can be made use of, if in need of optimal results. Winter 2013 February 24, 2013 33 / 35
Restoration from Degradation Constrained Least Squares Filtering Questions to solve 1-9 (you may write simple matlab codes and observe the eect for each). 10, 11 18 (We havent gone through this, you may solve this out of interest). 22,23 Winter 2013 February 24, 2013 34 / 35
Restoration from Degradation Constrained Least Squares Filtering Reference Lecture Notes: Reduction of Uncorrelated Noise: Richard Alan Peters II http://www.owlnet.rice.edu/~elec539/projects99/bach/proj2/inverse.ht Winter 2013 February 24, 2013 35 / 35