image restoration - univie.ac.atvda.univie.ac.at/.../lecturenotes/16_image_restoration.pdf052600 vu...
TRANSCRIPT
052600 VU Signal and Image Processing
Image Restoration
Torsten Möller + Hrvoje Bogunović + Raphael Sahann
[email protected] [email protected]
vda.cs.univie.ac.at/Teaching/SIP/17s/
1© Raphael Sahann
Overview
•Image Restoration –Noise Models –Spatial Noise Only Filtering –Periodic Noise Reduction by Frequency Domain Filtering –Estimating Degradation and Filtering Methods
2© Raphael Sahann
Model of the Image Degradation/Restoration Process
3
g(x, y) = f(x, y) ? h(x, y) + ⌘(x, y)
Gonzalez & Woods - Digital Image Processing
(3rd Edition)
spatial domain:
frequency domain: G(u, v) = F (u, v)H(u, v) +N(u, v)
© Raphael Sahann
Noise Probability Density Functions
4
p(z) =1p2⇡�
e�(z�z̄)2/2�2
p(z) =
⇢2b (z � a)e�(z�a)2/b
for z � a0 for z < a
p(z) =
(abzb�1
(b�1)! e�az
for z � 0
0 for z < 0
z̄mean
variance
z̄ =b
az̄ = a+
p⇡b/4
�2 �2 =b(4� ⇡)
4�2 =
b
a2
© Raphael Sahann
Noise Probability Density Functions
5
p(z) =
⇢ 1(b�a) if a z b
0 otherwise
p(z) =
⇢ae�az
for z � 0
0 for z < 0
p(z) =
8<
:
Pa for z = aPb for z = b0 otherwise
mean
variance
z̄ =1
az̄ =
a+ b
2/
/�2 =1
a2�2 =
(b� a)2
12© Raphael Sahann
Sample Image for Illustration
6
Gonzalez & Woods - Digital Image Processing
(3rd Edition)
© Raphael Sahann
Samples and Histograms of Noise
7
Gonzalez & Woods - Digital Image Processing
(3rd Edition)
© Raphael Sahann
Samples and Histograms of Noise
8
Gonzalez & Woods - Digital Image Processing
(3rd Edition)
© Raphael Sahann
Periodic Noise
• usually present due to electrical or electromechanical interference during the image acquisition process
9
Gonzalez & Woods - Digital Image Processing
(3rd Edition)
© Raphael Sahann
Overview
•Image Restoration –Noise Models –Spatial Noise Only Filtering –Periodic Noise Reduction by Frequency Domain Filtering –Estimating Degradation and Filtering Methods
10© Raphael Sahann
Noise Only Filtering
11
g(x, y) = f(x, y) + ⌘(x, y)
reduced model of degradation where only noise is present:
Gonzalez & Woods - Digital Image Processing
(3rd Edition)
© Raphael Sahann
Noise Only Filtering
12
Arithmetic Mean Filter Geometric Mean Filter
f̂(x, y) =
P(s,t)2S
xy
g(s, t)Q+1
P(s,t)2S
xy
g(s, t)Qf̂(x, y) =
mnP(s,t)2S
xy
1g(s,t)
f̂(x, y) =
2
4Y
(s,t)2S
xy
g(s, t)
3
5
1mn
f̂(x, y) =1
mn
X
(s,t)2S
xy
g(s, t)
Harmonic Mean Filter Contraharmonic Mean Filter
© Raphael Sahann
13
Gonzalez & Woods - Digital Image Processing
(3rd Edition)
© Raphael Sahann
Noise Filtering
14© Raphael Sahann
Gonzalez & Woods - Digital Image Processing
(3rd Edition)
Noise Filtering
Wrong Order in Contraharmonic Filter
15© Raphael Sahann
Gonzalez & Woods - Digital Image Processing (3rd Edition)
Order-Statistic Filters• Median Filter (50th percentile):
• Max Filter (100th percentile):
• Min Filter (1st percentile):
16© Raphael Sahann
f̂(x, y) = median(s,t)2S
xy
{g(s, t)}
ˆ
f(x, y) = max
(s,t)2S
xy
{g(s, t)}
f̂(x, y) = min(s,t)2S
xy
{g(s, t)}
Order-Statistic Filters• Midpoint Filter:computes the midpoint between minimum and maximum values
• Alpha-Trimmed Mean Filter:deletes the d/2 lowest and d/2 highest pixels and computes the mean from the remaining pixels
17© Raphael Sahann
ˆ
f(x, y) =
1
2
max
(s,t)2S
xy
{g(s, t)}+ min
(s,t)2S
xy
{g(s, t)}�
f̂(x, y) =1
mn� d
X
(s,t)2S
xy
gr(s, t)
18
Median Filter Application
Gonzalez & Woods - Digital Image Processing
(3rd Edition)
© Raphael Sahann
19
Min/Max Filter Application
Gonzalez & Woods - Digital Image Processing
(3rd Edition)
(Input image only used pepper noise)
© Raphael Sahann
20
Mean Filter Application
Gonzalez & Woods - Digital Image Processing
(3rd Edition)
© Raphael SahannGonzalez & Woods - Digital Image Processing (3rd Edition)
• Adaptive Local Noise Reduction Filter:- if bra is zero, the filter should return the value of g(x,y) - if the local variance is high relative to bra,an edge is found and a value close to g(x,y) should be returned - if the variances are equal we want the arithmetic mean of the pixels in the window to reduce noise by blurring
21
Adaptive Filters
© Raphael Sahann
g(x, y)
g(x, y)
�2⌘
�2⌘
f̂(x, y) = g(x, y)��
2⌘
�
2L
[g(x, y)�mL]
Adaptive Filters
22© Raphael Sahann
Gonzalez & Woods - Digital Image Processing
(3rd Edition)
Adaptive Median Filter
23© Raphael Sahann
A1 = zmed
� zmin
A2 = zmed
� zmax
if A1 > 0 and A2 < 0, go to stage B
else increase window size
if window size Smax
repeat stage A
else output zmed
B1 = zxy
� zmin
B2 = zxy
� zmax
if B1 > 0 and B2 < 0, output zxy
else output zmed
Stage A: Stage B:
This filter aims to: remove salt-and-pepper noise, provide smoothing of other noise and reduce distortion such as thinning or thickening
Stage A tries to determine whether zmed is an impulse or not. If it is no impulsestage B tries to estimate whether the center of the window zxy is an impulse.
Adaptive Median Filter
24
Gonzalez & Woods - Digital Image Processing (3rd Edition)
© Raphael Sahann
Overview
•Image Restoration –Noise Models –Spatial Noise Only Filtering –Periodic Noise Reduction by Frequency Domain Filtering –Estimating Degradation and Filtering Methods
25© Raphael Sahann
Frequency Domain Filtering• Bandreject Filters:
26© Raphael Sahann
Gonzalez & Woods - Digital Image Processing (3rd Edition)
Bandreject Filtering
27© Raphael Sahann
Gonzalez & Woods - Digital Image Processing
(3rd Edition)
Frequency Domain Filtering
• Bandpass Filter:
28
Gonzalez & Woods - Digital Image Processing
(3rd Edition)
© Raphael Sahann
Notch Filters
29
Gonzalez & Woods - Digital Image Processing
(3rd Edition)
© Raphael Sahann
Notch Filtering
• Has to appear in symmetric pairs about the origin
• Removes periodic interference
30© Raphael Sahann
Gonzalez & Woods - Digital Image Processing
(3rd Edition)
Optimum Notch Filtering
31
Gonzalez & Woods - Digital Image Processing (3rd Edition)
© Raphael Sahann
Optimum Notch Filtering• Generate a notch pass filter by observing the spectrum G(u,v)
• After selecting the filter obtain corresponding spatial domain representation
• To minimize impact on image information subtract noise weighted by a weighting or modulating function w(x,y):
32
N(u, v) = HNP(u, v)G(u, v)
⌘(u, v) = F�1 {HNP(u, v)G(u, v)}
f̂(x, y) = g(x, y)� w(x, y)⌘(x, y)
© Raphael Sahann
Optimum Notch Filtering• Weighting function can be chosen according to need; one
approach minimizes the local variance
33
Gonzalez & Woods - Digital Image Processing (3rd Edition)
© Raphael Sahann
Optimum Notch Filtering
34
Input ResultGonzalez & Woods - Digital Image Processing (3rd Edition)
© Raphael Sahann
Overview
•Image Restoration –Noise Models –Spatial Noise Only Filtering –Periodic Noise Reduction by Frequency Domain Filtering –Estimating Degradation and Filtering Methods
35© Raphael Sahann
Estimating the Degradation Function
36© Raphael Sahann
Gonzalez & Woods - Digital Image Processing (3rd Edition)
g(x, y) = h(x, y) ? f(x, y) + ⌘(x, y)
G(u, v) = H(u, v)F (u, v) +N(u, v)
Estimating the Degradation Function• Estimation by Image Observation
- Manually looking for areas with the least amount of possible noise- process the area to obtain the closest estimate to the original image- calculate the difference between the observed and processed area to construct a degradation function H(u,v) - use resulting function in restoration process
• very laborious process, which is only used under specific circumstances, such as the restoration of an old photograph of historical value
37© Raphael Sahann
• Estimation by Experimentation- prerequisite: similar equipment to the equipment used to acquire the degraded image is available - obtain the impulse response of the equipment by imaging a bright dot of light - Fourier Transform of an impulse is a constant, therefore:G(u.v) … Fourier transform of observed imageA … constant describing strength of impulse
38
Estimating the Degradation Function
H(u, v) =G(u, v)
A
© Raphael Sahann
Estimation by Experimentation
39© Raphael Sahann
Gonzalez & Woods - Digital Image Processing (3rd Edition)
• Estimation by Modeling - can take physical characteristics into account (see Turbulence Model by Hufnagel and Stanley) - mathematical model can be obtained by starting from basic principles — e.g. blurring by uniform linear motion between the image and the sensor during the image acquisition
• consistently used for many years, because of the insight it affords into the image restoration problem
40
Estimating the Degradation Function
© Raphael Sahann
Estimation by Modeling
41
Gonzalez & Woods - Digital Image Processing
(3rd Edition)
© Raphael Sahann
Estimation by Modeling
42
Gonzalez & Woods - Digital Image Processing
(3rd Edition)
© Raphael Sahann
Inverse Filtering• simple estimate of the transform by dividing the transform by the
degradation function
43
F̂ (u, v) =G(u, v)
H(u, v)
F̂ (u, v) = F (u, v) +N(u, v)
H(u, v)
• cannot recover undegraded image fully, because N(u,v) is not known — very small values of H(u,v) will dominate the estimate
© Raphael Sahann
Inverse Filtering
44© Raphael Sahann
Gonzalez & Woods - Digital Image Processing
(3rd Edition)
© Raphael Sahann
Wiener Filtering• Minimum Mean Square Error (Wiener) Filtering
• incorporates degradation and noise into restoration
45
S⌘ ... power spectrum of the noise
Sf ... power spectrum of the undegraded image
F̂ (u, v) =
2
4 1
H(u, v)
|H(u, v)|2
|H(u, v)|2 + S⌘(u,v)Sf (u,v)
3
5G(u, v)
F̂ (u, v) =
1
H(u, v)
|H(u, v)|2
|H(u, v)|2 +K
�G(u, v)
© Raphael Sahann
Wiener Filtering
46© Raphael Sahann
Gonzalez & Woods - Digital Image Processing (3rd Edition)
Wiener Filtering
47
• Optimal value for K needs to be guessed/iteratively adjusted to yield optimal result
© Raphael Sahann
Gonzalez & Woods - Digital Image Processing
(3rd Edition)