Chapter5 Image Restoration: I Fil I Inverse Filtering Wiener Filtering
Chapter5 Image Restoration: I Fil I Inverse Filtering Wiener Filtering
• Preview
• 5 1 Introduction
5.1 I d i
• 5.2 Diagonalization
• 5.3 Unconstrained
i d Restoration(
i ( inverse
i filtering)
fil i )
• 5.4 Constrained Restoration( wiener filtering)
• 5.5 Estimating the Degradation Function
• 5.6 Geometric Distortion Correction
• 5.7 image inpaiting
f( )
f(x,y) H + g(x y)
g(x,y)
g ( x, y ) = f ( x, y ) * h ( x, y ) + n ( x, y )
h h(x,y)
Where h( ) is
i called
ll d as Point
i Spreadd Function
i (PSF)
( )
M −1 N −1
g ( x, y ) = ∑∑ f (m, n)h( x − m, y − n) + n( x, y)
m =0 n =0
2003 Digital Image Processing 3
Prof.Zhengkai Liu Dr.Rong Zhang
5.1 Introduction
5.1.4 Methods
g ( x ) = f ( x ) * h( x )
⎧ f ( x) 0 ≤ x ≤ A − 1
f e ( x) = ⎨
⎩ 0 else
⎧ h( x ) 0 ≤ x ≤ B − 1
he ( x) = ⎨
⎩ 0 else
M −1 M=A+B-1
g e ( x) = ∑ f e (m)he ( x − m) + ne ( x)
m= 0 xx=00,1,…,M
1 M-11
he ( x) = he ( x + M )
⎡ he (0) he ( M − 1) " he (1) ⎤
⎢ h (1) he (0) " he (2) ⎥⎥
H= ⎢ e
⎢ # # % # ⎥
⎢ ⎥
⎢⎣ he ( M − 1) he ( M − 2) " he (0) ⎥⎦
H is circulant
⎧ f ( x, y ) 0 ≤ x ≤ A − 1 and 0 ≤ y ≤ B − 1
f e ( x) = ⎨
⎩ 0 A ≤ x ≤ M − 1 or B ≤ y ≤ N − 1
⎧ h ( x, y ) 0 ≤ x ≤ C − 1 and 0 ≤ y ≤ D − 1
he ( x) = ⎨
⎩ 0 A ≤ x ≤ M − 1 or B ≤ y ≤ N − 1
M −1 N −1
x=0,1,…,M-1
g e ( x, y ) = ∑ ∑ f e (m, n)he ( x − m, y − n)
m =0 n =0
yy=00,1,…,N
1 N-11
H is block-circulant
2003 Digital Image Processing 9
Prof.Zhengkai Liu Dr.Rong Zhang
5.2 Diagonalization
5.2.1 Matrix expression of degradation model: 2-D
where
⎡ he (i, 0) he (i, N − 1) 1) ⎤
" he (i,1)
⎢ h (i,1) he (i, 0) " he (i, 2) ⎥⎥
Hi = ⎢ e
⎢ # # % # ⎥
⎢ ⎥
⎢⎣ he (i, N − 1) he (i, N − 2) " he (i, 0) ⎥⎦
⎛ 2π j ⎞ ⎛ 2π j ⎞
λ (k ) = he (0) + he ( M − 1) exp ⎜ − k ⎟ + " + he (1) exp ⎜ − ( M − 1)k ⎟
⎝ M ⎠ ⎝ M ⎠
Combine the M eigenvectors
g to a matrix
W = [ w(0) w(1) " w( M − 1)]
then the H can be expressed as
H = WDW −1 where D(k , k ) = λ (k )
for g = Hf + n
W −1 g = W −1 Hf + W −1n
= W −1WDW −1 f + W −1n
= DW −1 f + W −1n
G (u ) = H (u ) F (u ) + N (u )
⎛ 2π ⎞
W (i, m) = exp ⎜ j im ⎟ WN
⎝ M ⎠
⎛ 2π ⎞
WN (k , n) = exp ⎜ j kn ⎟
⎝ N ⎠
H = WDW −1 G (u , v) = H (u , v) F (u , v) + N (u, v)
F(u,v) H G( )
G(u,v)
G (u , v) = H (u, v) F (u , v)
1 deconvolution
H I (u, v) =
H (u , v)
5.3.4 properties G (u , v)
Fˆ (u , v) =
H (u , v)
H (u , v) F (u , v) + N (u , v)
=
H (u, v)
N (u , v)
= F (u, v) +
H (u, v)
5.3.5 improvements
p
or
⎧k if H (u, v) < d
u,v M (u , v) = ⎨
⎩1/ H (u , v) else
e =E (f − f)
2 ˆ {2
}
Fˆ (u , v) = G (u , v) HW (u , v)
1 H (u , v)
2 Wi
Wiener filter,
filt
HW (u , v) = × 1942
H (u, v) H (u , v) 2 + S n (u , v) / S f (u, v)
H (u , v)*
=
H (u , v) + S n (u , v) / S f (u , v)
2
where
Sn (u , v) = N (u, v)
2
Power spectrum of the noise
S f (u, v) = F (u , v)
2
Power spectrum of the undegraded image
Sn(u,v)
S g (u , v) = H (u , v) S f (u , v) + S n (u, v)
2
u,v
Sg(u,v)
5.4.4 properties
•optimal in terms of the mean square error
Wh H(u,v)=0
•When H( ) 0, Hw(u,v)=0
( ) 0
If f(x,y)=δ(x,y)
δ(x y)
δ(x,y) h(x y)
h(x,y) g(x y)
g(x,y) Impulse
response
then
g ( x, y ) = δ ( x, y ) * h ( x, y ) = h ( x, y )
g ( x, y ) = ∫ f [ x − x0 (t ), y − y0 (t ) ] dt
T
−∞ −∞ ⎢
⎣ 0 ⎥⎦
2003 Digital Image Processing 29
Prof.Zhengkai Liu Dr.Rong Zhang
5 5Estimating the Degradation Function
5.5Estimating
5.5.3 Estimation by modeling :restoration of uniform linear motion
G (u, v) = ∫
T
⎡ ∞ ∞ f [ x − x (t ), y − y (t )]e −2π j (ux + vy ) dxdy ⎤dt
0 ⎢⎣ ∫−∞ ∫−∞ 0 0 ⎥⎦
T
G (u , v) = ∫ F (u , v)e−2π j[ux0 (t ) + vy0 (t )]dt
0
T
= F (u , v) ∫ e−2π j[ux0 (t ) + vy0 (t )]dt
0
then G (u , v) = H (u, v) F (u , v)
Suppose
pp that the image
g in qquestion undergoes
g uniform linear
motion in the x-direction only, at a rate given by x0 (t ) = at / T
T
H (u , v) = ∫ e −2π j[ux0 (t )+ vy0 (t )]dt
0
T
= ∫ e −2π juat / T dt
0
T
= sin(π ua)e− jπ ua
π ua
2003 Digital Image Processing 31
Prof.Zhengkai Liu Dr.Rong Zhang
5 5Estimating the Degradation Function
5.5Estimating
5.5.3 Estimation by modeling :restoration of uniform linear motion
If we allow the y-component to wary as well with the motion
given by y0 (t ) = bt / T then the degradation function becomes
T
H (u, v) = sin[π (ua + vb)]e− jπ (ua + vb )
π (ua + vb)
f(x,y) T g(x,y)
g ( x, y ) = T [( f ( x, y )] = f ( x ', y ')
where
x ' = r ( x, y ) y ' = s ( x, y )
for example: zoom out x' = x/ 2 y' = y / 2
zoom in x ' = 2x y ' = 2 y
.
(x,y)
空间变换
灰度赋值
.. ( x, , y, ) Direct transform
Linear correction
r ( x, y ) = a1 x + a2 y + a3
s ( x, y ) = b1 x + b2 y + b3
Quadratic correction
r ( x, y ) = a1 x 2 + a2 y 2 + a3 xy + a4 x + a5 y + a6
s ( x, y ) = b1 x 2 + b2 y 2 + b3 xy + b4 x + b5 y + b6
•Bi-linear interpolation
f(i,j)
A
f ( x ',' y ') = f (i + u , j + v) (x’,y’)
f(i j+1)
f(i,j+1)
u, v ∈ (0,1) i, j ∈ Z
(i j+1)
(i,j+1)
= (1 − u )(1 − v) f (i, j ) + (1 − u )vf (i, j + 1) f(i+1,j+1)
(i,j) B
+ u (1 − v) f (i + 1,
1 j ) + uvf (i + 1,
1 j + 1) f(i+1,j)
(i+1,j+1)
It can be operated by a mask
(i 1 j)
(i+1,j)
(1 − u )(1 − v) (1 − u )v
u (1 − v) uv
x = r cos α y = r sin α
y θ = 45D 3. Interpolation
p is
2003 Digital Image Processing
needed 42
Prof.Zhengkai Liu Dr.Rong Zhang
5 6 Geometric Distortion Correction
5.6
5.6.4 experimental results
• It is
i possible
ibl to
t restore
t an image
i without
ith t having
h i specific ifi
knowledge of degradation filter and additive noise. However, not
knowing the degradation filter h imposes the strictest limitations
on our restoration capabilities.