Professional Documents
Culture Documents
Chapter 05
Chapter 05
com
Chapter 5
Image Restoration
g ( x, y ) = h ( x , y ) ∗ f ( x, y ) + η ( x, y )
G ( u, v ) = H ( u, v ) ⋅ F ( u, v ) + N ( u, v )
Chapter 5
Image Restoration
• Source of noise
– Image acquisition (digitization)
– Image transmission
• Spatial properties of noise
– Statistical behavior of the gray-level values of pixels
– Noise parameters, correlation with the image
• Frequency properties of noise
– Fourier spectrum
– Ex. white noise (a constant Fourier spectrum)
Chapter 5
Image Restoration
• Noise Model
⎛ ( z − µ )2 ⎞
1 ⎛ ( z − a )2 ⎞
p(z) = exp ⎜ − ⎟ 2
p ( z ) = ( z − a ) exp ⎜ − ⎟u ( z − a)
2πσ 2 ⎜ 2σ 2
⎟ b ⎜ b ⎟
⎝ ⎠ ⎝ ⎠
a b z b −1 − az
p( z) = e u ( z) p ( z ) = ae − az u ( z )
( )
b − 1 !
1
p( z) = (u ( z − a ) − u ( z − b))
b−a p ( z ) = Paδ ( z − a ) + Pbδ ( z − b )
Chapter 5
Image Restoration
• Test Pattern
Chapter 5
Image Restoration
Chapter 5
Image Restoration
Chapter 5
Image Restoration
• Periodic Noise:
– Electronic Devices
Chapter 5
Image Restoration
• Periodic noise
– Observe the frequency spectrum
• Random noise with PDFs
– Case 1: imaging system is available
• Capture images of “flat” environment
– Case 2: noisy images available
• Take a strip from constant area
• Draw the histogram and observe it
• Measure the mean and variance
Chapter 5
Image Restoration
• Noise Estimation:
– Shape: Histogram of a subimage (Background)
Chapter 5
Image Restoration
• Noise Estimation:
– Parameters:
µ = ∑ zi p ( zi ) ⎫
zi ∈S ⎪
⎬ ⇒ {θ } : PDF Parameters
σ 2 = ∑ ( zi − µ ) p ( zi ) ⎪
2
zi ∈S ⎭
ML method:
⎧ NS ⎫
θ = arg max ⎨∏ p ( zi ,θ ) ⎬
⎩ i =1 ⎭
Chapter 5
Image Restoration
Chapter 5
Image Restoration
• Mean Filter:
– Arithmetic mean:
1
fˆ ( x, y ) = ∑ g ( s, t )
mn ( s ,t )∈S xy
Chapter 5
Image Restoration
• Mean Filter:
– Harmonic mean:
mn
fˆ ( x, y ) =
1
∑
( s ,t )∈S xy g ( s, t )
fˆ ( x, y ) =
( s ,t )∈S xy
(Q>0: Pepper, Q<0:Salt)
∑ g ( s, t )
Q
( s ,t )∈S xy
Chapter 5
Image Restoration
G+Noise
Original
Arithmetic
Geometric
More-Less
Blurring
© 2002 R. C. Gonzalez & R. E. Woods
Digital Image Processing, 2nd ed. www.imageprocessingbook.com
Chapter 5
Image Restoration
Pepper Salt
Q=+1.5 Q=-1.5
Chapter 5
Image Restoration
Q=-1.5 Q=+1.5
Contra Harmonic Incorrect Uses
Chapter 5
Image Restoration
Chapter 5
Image Restoration
Chapter 5
Image Restoration
– D = 0 → Mean Filter
– D = mn-1 → Median Filter
– Others: Combinational Properties
Chapter 5
Image Restoration
Chapter 5
Image Restoration
Chapter 5
Image Restoration
Chapter 5
Image Restoration
fˆ ( x, y ) = g ( x, y ) − 2 ( g ( x, y ) − mL )
η
σL
Chapter 5
Image Restoration
G- Mean Local
Chapter 5
Image Restoration
Chapter 5
Image Restoration
Chapter 5
Image Restoration
Chapter 5
Image Restoration
Chapter 5
Image Restoration
Spectrum
Noisy
BBRF(1)
De Noisy
Chapter 5
Image Restoration
Chapter 5
Image Restoration
Chapter 5
Image Restoration
INRF
BNRF
GNRF
NPF=1-NRF
© 2002 R. C. Gonzalez & R. E. Woods
Digital Image Processing, 2nd ed. www.imageprocessingbook.com
Chapter 5
Image Restoration
Notch Notch
Passed Rejected
Spectrum Spectrum
Vertical
© 2002 R. C. Gonzalez & R. E. Woods
Digital Image Processing, 2nd ed. www.imageprocessingbook.com
Chapter 5
Image Restoration
1) Images 2) Spectrum
Chapter 5
Image Restoration
Chapter 5
Image Restoration
∴
+d +d
1
σ 2
( x, y ) = ∑ ∑ {⎡⎣ g ( x + s, y + t ) − w ( x + s, y + t )η ( x + s, y + t )⎤⎦ −
fˆ
( 2d + 1)
2
s =− d t =− d
}
2
L ⎡ g ( x , y ) − w ( x , y )η ( x , y ) ⎤
⎣ ⎦
Smoothness of w( x, y ):
w ( x + s , y + t ) ≈ w ( x , y ) , w ( x , y )η ( x , y ) ≈ w ( x , y )η ( x , y )
Chapter 5
Image Restoration
}
2
L ⎡⎣ g ( x, y ) − w ( x, y )η ( x, y ) ⎤⎦
∂σ 2fˆ ( x, y ) g ( x , y )η ( x , y ) − g ( x , y )η ( x , y )
= 0 ⇒ w ( x, y ) =
∂w ( x, y ) η 2 ( x, y ) − η 2 ( x, y )
Chapter 5
Image Restoration
Chapter 5
Image Restoration
N(u,v) η(x,y)
Chapter 5
Image Restoration
Filtered Image
Chapter 5
Image Restoration
• Linear Degradation:
L-System:
g ( x, y ) = H ⎡⎣ f ( x, y ) ⎤⎦ + η ( x, y )
+∞ +∞
H ⎡⎣ f ( x, y ) ⎤⎦ = ∫ ∫ f (α , β )H ⎡⎣δ ( x − α , y − β )⎤⎦ dα d β
−∞ −∞
h ( x, y, α , β ) = H ⎡⎣δ ( x − α , y − β ) ⎤⎦
LSI-System:
+∞ +∞
H ⎡⎣ f ( x, y ) ⎤⎦ = ∫ ∫ f (α , β )h ( x − α , y − β ) dα d β
−∞ −∞
g ( x, y ) = f ( x, y ) ∗∗h ( x, y ) + η ( x, y )
G ( u , v ) = F ( x, y ) H ( x, y ) + N ( x, y )
Chapter 5
Image Restoration
• Degradation Estimation:
– Image Observation:
• Look at the image and
– Experiments:
• Acquire image using well defined object (Flat, pinhole,
and etc.)
– Modeling:
• Introduce certain model for certain degradation using
physical knowledge.
Chapter 5
Image Restoration
H s ( u, v )
H s ( u, v ) =
Fˆ ( u , v )
s
G ( u, v )
H s ( u, v ) =
APSF
© 2002 R. C. Gonzalez & R. E. Woods
Digital Image Processing, 2nd ed. www.imageprocessingbook.com
Chapter 5
Image Restoration
• Atmospheric Turbulence:
Chapter 5
Image Restoration
(
H ( u , v ) = exp − k ( u 2 + v 2 )
−5 6
)
Chapter 5
Image Restoration
• Motion Blurring:
– Camera Limitation;
– Object movement.
Chapter 5
Image Restoration
ℑ
⎛T
+∞ +∞
⎞ − j 2π ( ux + vy )
G ( u, v ) = ∫ ∫ ⎜ ∫ f ( x − x0 ( t ) , y − y0 ( t ) )dt ⎟e dxdy
−∞ −∞ ⎝ 0 ⎠
T
− j 2π ( ux0 ( t ) + vy0 ( t ) )
G ( u, v ) = F ( u, v ) ∫ e dt = F ( u , v ) H ( u, v )
0
Chapter 5
Image Restoration
Chapter 5
Image Restoration
Chapter 5
Image Restoration
Chapter 5
Image Restoration
• Inverse Filtering:
– Without Noise:
G ( u, v ) F ( u, v ) H ( u, v )
F ( u, v ) =
ˆ = ≈ F ( u, v )
Hˆ ( u , v ) Hˆ ( u , v )
Problem of division by zero!
– With Noise:
G ( u, v ) F ( u, v ) H ( u, v ) + N ( u, v ) N ( u, v )
Fˆ ( u , v ) = = ≈ F ( u, v ) +
Hˆ ( u , v ) Hˆ ( u , v ) Hˆ ( u , v )
Problem of division by zero!
Impossible to recover even if H(.,.) is known!!
Chapter 5
Image Restoration
Chapter 5
Image Restoration
70 Band 85 Band
Chapter 5
Image Restoration
Ghost
Threshold
Effect
Chapter 5
Image Restoration
• Phase Problem:
– Look at this formulation:
⎧ 1
⎪ Hˆ u , v Hˆ ( u , v ) ≥ H THR
⎪ ( )
Fˆ ( u, v ) = G ( u , v ) ⎨
⎪ 1 Hˆ ( u , v ) < H THR
⎪⎩ H THR
Chapter 5
Image Restoration
• Phase Problem:
Chapter 5
Image Restoration
S ( f ) = R ( f )U ( f )
C( f )
We seek for a optimal Filtering:U% ( f ) = W(f)
R( f )
© 2002 R. C. Gonzalez & R. E. Woods
Digital Image Processing, 2nd ed. www.imageprocessingbook.com
Chapter 5
Image Restoration
−∞
∫
−∞
2
+∞
2
+∞
S( f )+ N( f ) S( f )
∫ U% ( f ) − U ( f ) df = ∫ W ( f )−
2
E = df
−∞ −∞
R( f ) R( f )
{ } df
+∞
−2
R( f ) S ( f ) 1−W ( f ) + N ( f ) W ( f )
2 2 2 2
∫
2
E =
−∞
Chapter 5
Image Restoration
Chapter 5
Image Restoration
W(z) ~ w(n) +
x(n) y(n) + e(n)
-
d(n)
e (n) = d (n) − y (n) = d ( n) − x ( n) ∗ w( n)
Chapter 5
Image Restoration
w ( n ) = ( w0 ( n ) wo ( n ) L wN ( n ) )
T
x ( n ) = ( x0 ( n ) xo ( n ) L xN ( n ) )
T
∴
E {e 2 ( n )} = E {d 2 ( n )} − 2 w T ( n ) P + w T ( n ) Rw ( n )
P E {d ( k ) x ( k )}
R E { x ( k ) x T ( k )}
© 2002 R. C. Gonzalez & R. E. Woods
Digital Image Processing, 2nd ed. www.imageprocessingbook.com
Chapter 5
Image Restoration
Chapter 5
Image Restoration
Degradation De Degradation
f(x,y) g(x,y) g(x,y) f(x,y)
g ( x, y ) = s ( x, y ) + η ( x, y ) ⇔ G ( u , v ) = S ( u , v ) + N ( u , v )
Fˆ ( u , v ) = W ( u, v ) .G ( u, v )
E ( u, v ) = F ( u , v ) − Fˆ ( u , v ) = F ( u, v ) − W ( u , v ) .G ( u, v )
{
E E ( u, v )
2
} = E {( F − WG )( F − WG ) } ∗
Chapter 5
Image Restoration
∂E { E ( u, v ) }
2
P ( u, v )
= 0 ⇒ W ( u, v ) = FG
∂W PGG ( u , v )
PXX ( u, v ) = E X { } : Spectral Estimation
2
Chapter 5
Image Restoration
Chapter 5
Image Restoration
Chapter 5
Image Restoration
Chapter 5
Image Restoration
• No Phase compensation!
Chapter 5
Image Restoration
Chapter 5
Image Restoration
• Nonlinear Filter:
α α −1
Fˆ ( u, v ) = G ( u, v ) e j G ( u ,v )
= G ( u, v ) G ( u, v )
⎧α 1 HP like
⎨
⎩α >> 1 LP like
Fˆ ( u, v ) = ⎨
( )
⎧⎪log G ( u , v ) e j G ( u ,v )
G ( u , v ) > Gmin
⎪⎩0 O.W.
Chapter 5
Image Restoration
Chapter 5
Image Restoration
Inverse
Chapter 5
Image Restoration
• Algebraic Approach
– A Matrix Review:
• Matrix Diagonalization: Each square matrix A can be
decomposed into the very special form:
A = PDP -1
• P: Matrix composed of the eigenvectors of .
• D: Diagonal matrix constructed from the corresponding
eigenvalues of A.
Chapter 5
Image Restoration
• Algebraic Approach:
– Matrix Representation of Circular Convolution:
Periodicity: g ( i ) = g ( i ± N )
N −1
y ( n ) = f ( n ) ∗ g ( n ) = ∑ f ( j )g ( n − j )
j =0
In Matrix Form:
⎡ y0 ⎤ ⎡ g 0 g N −1 g N − 2 K g1 ⎤ ⎡ f 0 ⎤
⎢ y ⎥ ⎢g g g K g ⎥⎢ f ⎥
⎢ 1 ⎥ ⎢ 1 0 N −1 2⎥⎢ 1 ⎥
⎢ y2 ⎥ = ⎢ g 2 g1 g0 K g3 ⎥ ⎢ f 2 ⎥
⎢ ⎥ ⎢ ⎥⎢ ⎥
⎢ M ⎥ ⎢ M M M O M ⎥⎢ M ⎥
⎢⎣ yN −1 ⎥⎦ ⎢⎣ g N −1 g N − 2 g N −3 K g 0 ⎥⎦ ⎢⎣ f N −1 ⎥⎦
1444442444443
C
C : A Circulant Matrix!
C (k, j ) = g (k − j )
© 2002 R. C. Gonzalez & R. E. Woods
Digital Image Processing, 2nd ed. www.imageprocessingbook.com
Chapter 5
Image Restoration
• Algebraic Approach:
– Diagonalization of Circular Convolution:
C = WDW∗ = WDW −1 , W∗ = W −1
2π
jm n
W ( m, n ) = e N
⎡G ( 0 ) 0 L 0 ⎤
⎢ ⎥
0 G ( 0) L 0
D=⎢ ⎥
⎢ M M O M ⎥
⎢ ⎥
⎢⎣ 0 0 L G ( N − 1) ⎥⎦
G ( k ) = DFT ( g ( n ) ) K
Chapter 5
Image Restoration
• Algebraic Approach:
– Diagonalization of Circular Convolution:
⎛ ⎞
⎜ ⎛ ∗ ⎞⎟
∴ f ∗ g = ( WDW ) f = W ⎜ D ⎜ {
∗
W f ⎟⎟
⎜ 14⎝ DFT3⎠ ⎟
⎜ 24 ⎟
⎝
144244
Multiply
3⎠
IDFT
Chapter 5
Image Restoration
= −2HT ( g − Hf ) = 0
∂f
∴ fˆ = ( HT H ) HT g
−1
14 4244 3
Pseudo Inverse (Left)
( HT H ) HT H = I
−1
Chapter 5
Image Restoration
ˆf = ( HT H )−1 HT g = H −1g
Chapter 5
Image Restoration
∂J ( f )
= 2QTQf - 2λ H T ( g - Hf )
∂f
−1
⎛ 1 ⎞
∴ fˆ = ⎜ H T H + Q TQ ⎟ H T g = ( H T H + γ Q TQ ) H T g
−1
⎝ λ ⎠
2 2
λ : Lagrange Multiplier which should be be satisfy: g - Hf = n
Chapter 5
Image Restoration
T * −1 * *⎬
⇒⎨ 2
H = WD H W = WD H W ⎭⎪ ⎪ QT Q = W DQ W*
⎩
⎛ T
⎜
⎝
H H +
1 T ⎞
λ
Q Q ⎟
⎠
f = H T
g ⇒ W D H
2
+ γ D Q
2
(
W*f = WD*H W*g )
W ×
⎯⎯⎯
−1
(
→ D H + γ DQ
2 2
) (
W*f = D*H W*g ⇒ H ( u , v ) + γ C ( u , v )
2 2
) Fˆ (u, v ) = H (u, v ) G (u, v )
*
Chapter 5
Image Restoration
−1
⎛ 1 ⎞
fˆ = ⎜ H T H + Q TQ ⎟ H T g
⎝ λ ⎠
Chapter 5
Image Restoration
Chapter 5
Image Restoration
Chapter 5
Image Restoration
• How to estimate γ:
Residual Vector: r = g - Hfˆ
It can be shown that ϕ ( r ) = r = rT r is monotically increasing with r.
2
2 2
We seek for γ such that r = n ± δ , δ is our accuracy
1. Initial Guess on γ
2
2. Calculate r = g - Hfˆ
2
Chapter 5
Image Restoration
• How to estimate γ:
– Computational Tips:
2 2
We need r and n .
M −1 N −1
.R ( u , v ) = G ( u , v ) − H ( u , v ) Fˆ ( u , v ) ⇒ r = ∑ ∑ r 2 ( x, y )
2
x =0 y =0
M −1 N −1 2
1
σ n2 =
MN
∑ ∑ n ( x, y ) − m
x =0 y =0
n
M −1 N −1
1
mn =
MN
∑ ∑ n ( x, y )
x =0 y =0
M −1 N −1
n = ∑ ∑ n 2 ( x, y )
2
x =0 y =0
∴ n = MN (σ n2 + mn2 )
2
Chapter 5
Image Restoration
Chapter 5
Image Restoration
Chapter 5
Image Restoration
• Computation Efforts:
g = Hf + n ⇒ n = g − Hf
fˆ = ( HT H ) HT g
−1
Chapter 5
Image Restoration
( )
2. f( k +1) = f( k ) + µ HT g − Hf( k ) = µ HT g + ( I − µ HT H ) f( k ) = f( 0) + ( I − µ HT H ) f( k )
CLS :
∂J ( f )
J (f ) =
1
2
(Qf
2
(
+ λ g - Hf
2
− n
2
)) ⇒
∂f
= Q T Qf - λ H T ( g - Hf )
1. f( 0) = µ HT g
( ( ) ) (
2. f( k +1) = f( k ) + µ λ H T g - Hf( k ) − Q T Qf( k ) = µλ HT g + I − µ ( λ HHT + Q T Q ) f( k ) )
Uniform Gaussian
Blurring Blurring
GIF GIF
Thr=1e-3 Thr=1e-3
Uniform Gaussian
Blurring Blurring
GIF GIF
Thr=1e-1 Thr=1e-1
Gaussian
Uniform Blurring
Blurring
CLS CLS
γ=1 γ=1
Gaussian
Uniform Blurring
Blurring
CLS CLS
γ=1e-4 γ=1e-4
Chapter 5
Image Restoration
Chapter 5
Image Restoration
• Wiener!
Chapter 5
Image Restoration
g = Hf + n
( HR H + R n ) , T is Hermitian Transform!
−1
W = Rf H T
f
T
fˆ = Wf
R f : Autocorrelation of f
R n : Autocorrelation of n
Chapter 5
Image Restoration
Chapter 5
Image Restoration
2. W ( i + 1) = R f ( i ) HT ( HR f ( i ) HT + R n )
−1
3. fˆ ( i + 1) = W ( i + 1) g
{ }
4. R f ( i + 1) = E fˆ ( i + 1) fˆ T ( i + 1)
5. Repeat 2,3,4 until convergence.
Chapter 5
Image Restoration
• Noise Image:
g ( x, y ) = f ( x, y ) + v ( x, y ) , σ v : Constant over each region
Chapter 5
Image Restoration
fˆ ( x, y ) = ( g ( x, y ) − µ f ) ∗ wa ( x, y ) + µ f
σ 2
fˆ ( x, y ) = ( g ( x, y ) − µ f ) 2 + µf
f
σ f + σ v2
µ f ( x, y ) : Low-pass filtered on noisy image.
µ f ( x, y ) = µ g ( x, y ) , Zero mean assumption
g ( x, y ) − µ f ( x, y ) : Hi-pass filtered on noisy image.
σ f ( m, n )
2
∴ fˆ ( x, y ) = HP ( m, n ) 2 + LP ( m, n )
σ f ( m, n ) + σ v
2
Chapter 5
Image Restoration
• Parameter Estimation:
σ g2 = Local Noisy Image Variance
σ v2 = Variance in a smooth image region or background
σ 2f ( m, n ) = σ g2 ( m, n ) − σ v2
Chapter 5
Image Restoration
• Results:
Chapter 5
Image Restoration
• Results:
Chapter 5
Image Restoration
• Results:
Chapter 5
Image Restoration
• Results:
Chapter 5
Image Restoration
Chapter 5
Image Restoration
Chapter 5
Image Restoration
Chapter 5
Image Restoration
Chapter 5
Image Restoration
Chapter 5
Image Restoration
Chapter 5
Image Restoration
Chapter 5
Image Restoration