noise and restoration of images · outline 1 noise models 2 restoration from noise degradation 3...
TRANSCRIPT
Noise and Restoration of Images
Dr. Praveen Sankaran
Department of ECE
NIT Calicut
February 24, 2013
Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP Winter 2013 February 24, 2013 1 / 35
Outline
1 Noise Models
2 Restoration from Noise Degradation
3 Estimation of Degradation
4 Restoration from DegradationInverse and Wiener FilteringConstrained Least Squares Filtering
Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP Winter 2013 February 24, 2013 2 / 35
Noise Models
Degradation Model
All digital images have some amount of noise and/or some form ofdegradation in them.
Some have more due to varying sources
Acquisition
Environmental conditions.
quality of sensing elements - CCD noise.
TransmissionFormation
Quantization noise
Blur
Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP 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 ofthe image).
think of an example where both could be correlated?
Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP Winter 2013 February 24, 2013 4 / 35
Noise Models
Noise Models
Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP Winter 2013 February 24, 2013 5 / 35
Noise Models
Noise Models - Explained
Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP Winter 2013 February 24, 2013 6 / 35
Noise Models
In Color - Gaussian
Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP Winter 2013 February 24, 2013 7 / 35
Noise Models
In Color - Uniform
Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP Winter 2013 February 24, 2013 8 / 35
Noise Models
Periodic Noise
Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP 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 boardthat 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.
Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP Winter 2013 February 24, 2013 10 / 35
Restoration from Noise Degradation
Model - Simpli�ed
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.
Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP 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×nArithmetic mean: Noise reduced as a result of blurring.
Geometric mean:
f [x ,y ] =
{∏s,t
f [s, t]
}1/mn
(4)
Harmonic mean: works for salt, fails for pepper
f [x ,y ] =mn
∑s,t
1
g [s, t]
(5)
Contra-harmonic mean: works well to remove salt&pepper
f [x ,y ] =
∑s,t
g [s, t]Q+1
∑s,t
g [s, t]Q(6)
Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP Winter 2013 February 24, 2013 12 / 35
Restoration from Noise Degradation
Typical Filters
We have come across a lot of these already. Filter of size m×nArithmetic mean: Noise reduced as a result of blurring.
Geometric mean:
f [x ,y ] =
{∏s,t
f [s, t]
}1/mn
(4)
Harmonic mean: works for salt, fails for pepper
f [x ,y ] =mn
∑s,t
1
g [s, t]
(5)
Contra-harmonic mean: works well to remove salt&pepper
f [x ,y ] =
∑s,t
g [s, t]Q+1
∑s,t
g [s, t]Q(6)
Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP Winter 2013 February 24, 2013 12 / 35
Restoration from Noise Degradation
Typical Filters
We have come across a lot of these already. Filter of size m×nArithmetic mean: Noise reduced as a result of blurring.
Geometric mean:
f [x ,y ] =
{∏s,t
f [s, t]
}1/mn
(4)
Harmonic mean: works for salt, fails for pepper
f [x ,y ] =mn
∑s,t
1
g [s, t]
(5)
Contra-harmonic mean: works well to remove salt&pepper
f [x ,y ] =
∑s,t
g [s, t]Q+1
∑s,t
g [s, t]Q(6)
Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP Winter 2013 February 24, 2013 12 / 35
Restoration from Noise Degradation
Typical Filters
We have come across a lot of these already. Filter of size m×nArithmetic mean: Noise reduced as a result of blurring.
Geometric mean:
f [x ,y ] =
{∏s,t
f [s, t]
}1/mn
(4)
Harmonic mean: works for salt, fails for pepper
f [x ,y ] =mn
∑s,t
1
g [s, t]
(5)
Contra-harmonic mean: works well to remove salt&pepper
f [x ,y ] =
∑s,t
g [s, t]Q+1
∑s,t
g [s, t]Q(6)
Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP Winter 2013 February 24, 2013 12 / 35
Restoration from Noise Degradation
Illustration
Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP Winter 2013 February 24, 2013 13 / 35
Restoration from Noise Degradation
Illustration
Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP Winter 2013 February 24, 2013 14 / 35
Restoration from Noise Degradation
Order Static Filters
1 Median �lter:f [x ,y ] =medians,t∈Sxy {f [s, t]} (7)
2 MinMax �lters:
3 Mid point �lter:
f [x ,y ] =1
2
{maxs,t∈Sxy {f [s, t]}+mins,t∈Sxy {f [s, t]}
}(8)
Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP Winter 2013 February 24, 2013 15 / 35
Restoration from Noise Degradation
Adaptive Median Filter
Key idea → variable window area Sxy to work with.
So how do we decide what area to work with? → provide conditions.
Assumptions
zmin = minimum intensity,zmax = maximum intensity,zmed = medianzxy = value at point [x ,y ]Smax = maximum threshold of window size.
Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP Winter 2013 February 24, 2013 16 / 35
Restoration from Noise Degradation
Adaptive - Conditions
Stage 1
A1 = zmed − zmin
A2 = zmed − zmax
If A1 > 0 and A2 < 0, goto Stage 2.
Else increase the windowsize.
If window size ≤ Smax ,repeat Stage 1.
Else output zmed .
Stage 2
B1 = zxy − zmin
B2 = zxy − zmax
If B1 > 0 and B2 < 0,output zxy .
Else, output zxy .
Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP Winter 2013 February 24, 2013 17 / 35
Restoration from Noise Degradation
Periodic Noise - Frequency Filtering
Idea → selectively �lter out frequencies relating to noise. Can haveband-reject, band-pass or notch �lters.
Example: band-reject
Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP Winter 2013 February 24, 2013 18 / 35
Illustration
Estimation of Degradation
Estimation of Degradation
1 Observation
2 Experimentation
3 Mathematical modeling
Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP 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)
Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP Winter 2013 February 24, 2013 21 / 35
Modeling Atmospheric Turbulence
H [u,v ] = e−k[u2+v2]
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 DegradationInverse and Wiener FilteringConstrained Least Squares Filtering
Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP 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 realpossibility 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.
Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP Winter 2013 February 24, 2013 24 / 35
Restoration from Degradation Inverse and Wiener Filtering
Inverse Filtering Problem Illustration
Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP Winter 2013 February 24, 2013 25 / 35
Restoration from Degradation Inverse and Wiener Filtering
Inverse Filtering Problem Illustration
Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP 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 andthe corrupted image.
e2 = 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 correlationof noise)
Sf [u,v ] = |F [u,v ]|2 = power spectrum of the undegraded image.(auto correlation of the image)
Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP Winter 2013 February 24, 2013 27 / 35
Restoration from Degradation Inverse and Wiener Filtering
Wiener Filter Equation
F [u,v ] =
[H∗ [u,v ]Sf [u,v ]
Sf [u,v ] |H [u,v ]|2+Sη [u,v ]
]G [u,v ] (16)
=
[1
H [u,v ]
|H [u,v ]|2
|H [u,v ]|2+ Sη [u,v ]/Sf [u,v ]
]G [u,v ] (17)
≈
[1
H [u,v ]
|H [u,v ]|2
|H [u,v ]|2+K
]G [u,v ] (18)
The last equation approximates the wiener �lter equation since inmost cases we do not know accurately the power spectrum of bothnoise and the un-degraded image.
Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP Winter 2013 February 24, 2013 28 / 35
Restoration from Degradation Inverse and Wiener Filtering
Comparative Illustration between Inverse Filtering and
Wiener Filtering
Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP Winter 2013 February 24, 2013 29 / 35
Restoration from Degradation Inverse and Wiener Filtering
Comparative Illustration 2
Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP 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 DegradationInverse and Wiener FilteringConstrained Least Squares Filtering
Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP 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
∑x=0
N−1
∑y=0
[∇2f [x ,y ]
]2(20)
Laplacian again. So sort of reduce sharpness.With constraint: ∥∥∥g− Hf∥∥∥2 = ‖η‖2 (21)
Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP Winter 2013 February 24, 2013 32 / 35
Restoration from Degradation Constrained Least Squares Filtering
Final Frequency Domain Form
F [u,v ] =
[H∗ [u,v ]
|H [u,v ]|2+ γ |P [u,v ]|2
]G [u,v ] (22)
P [u,v ] = ℑ
p [x ,y ] =
0 −1 0−1 4 −10 −1 0
(23)
Okay! So we end up �nding an approximation to γ here instead of Kin 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 tillnow. That can be made use of, if in need of optimal results.
Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP 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 e�ect foreach).
10, 11
18 (We havent gone through this, you may solve this out of interest).
22,23
Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP Winter 2013 February 24, 2013 34 / 35
Restoration from Degradation Constrained Least Squares Filtering
Reference
Lecture Notes: Reduction of Uncorrelated Noise: Richard Alan PetersII
http://www.owlnet.rice.edu/~elec539/Projects99/BACH/proj2/inverse.html
Dr. Praveen Sankaran (Department of ECE NIT Calicut )DIP Winter 2013 February 24, 2013 35 / 35