ELE 488 F06 ELE 488 Fall 2006 Image Processing and Transmission (10-5-06) Wiener Filtering Derivation Comments Re-sampling and Re-sizing 1D 2D 10/5/0 6
ELE 488 F06
ELE 488 Fall 2006Image Processing and Transmission
(10-5-06)
Wiener Filtering
Derivation Comments
Re-sampling and Re-sizing
1D 2D
10/5/06
ELE 488 F06
Linear Spatial-Invariant Distortion and Inverse Filtering
• Assumption – no noise, known distortion – often used to correct blur
• Consider 1D case first, then take up 2D• v = u * h, w = v * g = u * (h * g)• want w = u, so h * g = δ.• Inverse Filter: G(ω) = 1 / H(ω). (divide by 0?)• Pseudo Inverse Filter: G(ω) = 1 / H(ω) if | H(ω) | > ε
G(ω) = 0 if | H(ω) | < ε
2D: inverse filter: G(ω,λ) = 1 / H(ω,λ). pseudo inverse filter: G(ω,λ) = 1 / H(ω,λ) if | H(ω ,λ) | > ε
G(ω,λ) = 0 if | H(ω ,λ) | < ε
h, Hu v
g, Gw
UM
CP
EN
EE
63
1 S
lide
s (c
rea
ted
by
M.W
u ©
20
01
)
restorationdistortion
ELE 488 F06
Inverse & Pseudo-inverse Filtering
From Jain Fig.8.10
UM
CP
EN
EE
63
1 S
lide
s (c
rea
ted
by
M.W
u ©
20
01
)
ELE 488 F06
Another Solution – cut off high frequencies
Limit restoration to low frequency components to avoid amplifying noise at high freq and at nulls
(480x480 image through severe turbulence)
UM
CP
EN
EE
63
1 S
lide
s (c
rea
ted
by
M.W
u ©
20
04
)
Gonzalez/ Woods
ELE 488 F06
A Different Approach to Deconvolution
• Consider distortion correction and noise suppression:– Treat image and noise as random fields
– Minimize MSE between the original u and restored w:
E{ [ u – w ] 2 } , given v
– Best estimate is conditional mean: E { u | v }
• needs info not usually available
• usually difficult to solve, non-linear problem
– To find the best linear estimate Wiener filtering
• linear estimate from observed image by minimizing MSE
UM
CP
EN
EE
63
1 S
lide
s (c
rea
ted
by
M.W
u ©
20
01
/20
04
) h, Hu v
g, G w
ELE 488 F06
Wiener Filtering
• Best linear estimate – minimize MSE E{ [ w – u ] 2 }
– spatial invariant filter w = v * g – wide-sense stationary signal and noise – noise uncorrelated with original signal
power spectral densities: Suu(ω) Snn(ω)
• Solution: G(ω) = H*(ω) Suu(ω) / { |H|2(ω) Suu(ω) + Snn(ω) }
= 1 / { H + Snn / ( H* Suu) }
(Notation: Φuu Φnn for power spectral densities last time)
UM
CP
EN
EE
63
1 S
lide
s (c
rea
ted
by
M.W
u ©
20
01
)
h, Hu v
g, Gw
ELE 488 F06
Wiener Filtering (cont)
G = H* Suu / { |H|2 Suu + Snn }
• Consider deblurring noisy image, need to balance between: – HPF filter for de-blurring (undo H distortion)– LPF for suppressing noise
• Noiseless case ~ Snn = 0 (inverse filter)– Wiener filter becomes pseudo-inverse filter for Snn 0
– G(ω) = H* Suu / { |H|2 Suu + Snn }
G(ω) 1 / H(ω) , if H(ω) ≠ 0 G(ω) 0 , if H(ω) = 0
• No blur, H = 1 (smoothing Filter)– Wiener filter attenuates noise according to SNR at each freq.
G(ω) = Suu / {Suu + Snn } = (Suu / Snn)/ { 1 + Suu / Snn}
UM
CP
EN
EE
63
1 S
lide
s (c
rea
ted
by
M.W
u ©
20
01
)
ELE 488 F06
Comparisons
From Jain Fig.8.11
UM
CP
EN
EE
63
1 S
lide
s (c
rea
ted
by
M.W
u ©
20
01
) G = H* Suu / { |H|2 Suu + Snn }
ELE 488 F06
Wiener Filtering vs. Inverse Filtering
UM
CP
EN
EE
63
1 S
lide
s (c
rea
ted
by
M.W
u ©
20
04
)
Gonzalez - Woods
(480x480 image through severe turbulence)
ELE 488 F06
enlarged
ELE 488 F06
Wiener Filtering vs.
Inverse Filtering
UM
CP
EN
EE
63
1 S
lide
s (c
rea
ted
by
M.W
u ©
20
04
)
Gonzalez - Woods
ELE 488 F06
ELE 488 F06
ELE 488 F06
Real discrete-time, wide sense stationary random signals
Autocorrelation f unction: E[x(n+m)x(n)] = Rxx(m) = Rxx(-m)
Crosscorrelation function: E[x(n+m)y(n)] = Rxy(m) = Ryx(-m)
Power Spectral Densities: FT { Rxx(m) } = m
Rxx(m) exp(-mω) = Sxx(ω)
FT { Rxy(m) } = m
Rxy(m) exp(-mω) = Sxy(ω)
Sxx(ω) = Sxx(-ω), Sxy(ω) = Syx(-ω)*
Linear sif t invariant system: y(n) = x(n)*h(n)
Syy(ω) = Sxx(ω) |H(ω)|2 , Sxy(ω) = Sxx(ω) H(ω)*
ELE 488 F06
Derivation of Wiener Filter
h, Hu v
g, Gw
w = u * (h*g) + η * g error: z = w – u = u * [ (h*g) – δ ] + η * g
minimize E{ |w – u|2} = E{ |z|
2}
Szz(ω) = Suu(ω) |H(ω) G(ω) – 1|2 + Sηη(ω) |G(ω) |
2
Szz(ω) = Suu |H G - 1|2 + Sηη |G|
2
Minimize Szz(ω) by choosing G
∂ Szz(ω) / ∂ G(ω) = 0
ELE 488 F06
Derivation of Wiener Filter
Szz = Suu |H G - 1|2 + Sηη |G|
2, ∂ Szz / ∂ G = 0 (complex)
G G+d. G* G*+d*
Szz Suu [ H (G+d) – 1 ] [ H* (G*+d*) – 1 ] + Sηη [G+d] [G+d]*
Subtract Szz = Suu |H G - 1|2 + Sηη |G|
2 and drop d
2 terms:
Suu [ (H G – 1 ) H*d* + (H* G* – 1) Hd ] + Sηη ( G d* + G* d)
Divide by d and set to 0.
ELE 488 F06
Derivation of Wiener Filter
Suu [ (H G – 1 ) H*d* + (H* G* – 1) Hd ] + Sηη ( G d* + G* d)
Divide by d and set to 0. For real d, d=d*. Divide by d and set to zero:
Suu [ (H G – 1 ) H* + (H* G* – 1) H ] + Sηη ( G + G*)
For imaginary d, d=-d*. Divide by d and set to zero:
Suu [ - (H G – 1 ) H* + (H* G* – 1) H ] + Sηη ( - G + G*)
Subtract Suu (H G – 1 ) H* + Sηη G = 0.
G = H* / ( Suu |H|2 + Sηη)
ELE 488 F06
Wiener Filter: From Theory to Practice
• Have assumed knowing power spectral densities of image & noise and frequency response
• Assumptions valid?
• Implementation issues
UM
CP
EN
EE
63
1 S
lide
s (c
rea
ted
by
M.W
u ©
20
04
)
ELE 488 F06
Wiener Filter: Issues to Be Addressed
• Filter size
– Theoretically infinite impulse response large-size DFTs– Impose filter size constraint: find the best FIR that minimizes MSE
• Need to estimate power spectrum density (psd) Snn,Suu– Estimate psd of blurred image and compensate for effect of noise– Estimate pds from representative images similar to image to be
restored– Use statistical modeling for the image and estimate parameters– Constrained least square filter ~ (Jain Sec.8.8, Gonzalez Sec.5.9)
• Optimize smoothness in restored image (least-square of the rough transitions)
• Constrain differences between blurred image and blurred version of reconstructed image
• Estimate the restoration filter w/o the need of estimating p.s.d.• Unknown distortion H ~ Blind Deconvolution
UM
CP
EN
EE
63
1 S
lide
s (c
rea
ted
by
M.W
u ©
20
01
)
ELE 488 F06
Basic Ideas of Blind Deconvolution
• Three ways to estimate H: observation, experimentation, assume model• Estimate H via spectrum’s zero patterns
– Two major classes of blur (motion blur and out-of-focus)– H has nulls related to the type and the parameters of the blur
• Maximum-Likelihood blur estimation– Each set of image model and blur parameters gives a “typical”
blurred output. – Given the observation of blurred image, try to find the set of
parameters that is most likely to produce that blurred output• Iteration ~ Expectation-Maximization approach (EM)
• Given estimated parameters, restore image via Wiener filtering• Examine restored image and refine parameter estimation• Get local optimum
• “Blind Image Deconvolution” by Kundur et al, IEEE Sig. Proc. Magazine, vol.13, 1996
UM
CP
EN
EE
63
1 S
lide
s (c
rea
ted
by
M.W
u ©
20
01
/20
04
)
ELE 488 F06
Image Resizing: Scaling and Interpolation
512x512 image
resample to 216x216
and to 128x128
ELE 488 F06
ELE 488 F06
ELE 488 F06
Image Resampling
512x512 image
resample to 216x216
and to 128x128
ELE 488 F06
Image Resizing: Scaling and Interpolation
512x512 256x256 zoom in
ELE 488 F06
Image Resizing: Scaling and Interpolation
512x512 128x128 zoom in
ELE 488 F06
ELE 488 F06
ELE 488 F06
Image Resizing: Scaling and Interpolation
512x512 800x600
ELE 488 F06
Image Resizing: Scaling and Interpolation
512x512 320x200
ELE 488 F06
Integer Subsampling by L (=2)
Beware of Aliasing!
Review of 1 D sampling and re-sampling
ELE 488 F06
1 D Sampling and Reconstruction
signal x(t) samples x(nT)
h(t) = 1, 0<t<T h(t) = 0, other t
piecewise constant xr(t)
Reconstruction from samples : xr(t) =x(nT) h(t - nT)
ELE 488 F06
h(t) = 1 - | t |/T, 0<t<T h(t) = 0, other t
piecewise linear xr(t)
h(t) = sinc(t/T) = sin(πt /T) / (π t /T)
bandlimited xr(t)
Sampling Theorem (Shannon, Nyquist, Whittaker, Komogorov,. . .)
ELE 488 F06
Sampling, Reconstruction, Aliasing
Given CT signal xa(t), samples xa(kT) form DT signal xd(k).
xa(t) Xa (Ω) =
xa(t) e-jΩt
dt. xd(k) Xd(ω) =
k
xd[k] e-jωk
.
Xd(ω) = T
1
n
Xa(T
n2πω ). (period 2π)
Xa(Ω) /\ α<π/T /\ Xa(ω/T) / \ / \ --+-/----\-+-- Ω --+-/----\-+---- ω
-T
-α α T
-π –αT αT π
n=-1 n=0 n=1 n=2 Xd(ω) /\ /\ /\ /\ / \ / \ / \ / \ +-/----\-+-/----\-+-/----\-+-/----\-+- ω -2π -π –αT αT π 2π 3π
ELE 488 F06
Xd(ω) = T
1
n
Xa(T
n2πω ). (period 2π)
Xa(Ω) /\ α<π/T /\ Xa(ω/T) / \ / \ --+-/----\-+-- Ω --+-/----\-+---- ω
-T
-α α T
-π –αT αT π
n=-1 n=0 n=1 n=2 Xd(ω) /\ /\ /\ /\ / \ / \ / \ / \ +-/----\-+-/----\-+-/----\-+-/----\-+- ω -2π -π –αT αT π 2π 3π
If terms in Xd(ω) do not overlap. Thus Xd(ω) determines Xa(Ω).
xa(t) =n
xa(nT) sinc(t/ T – n), sinc(t) = sin(π t) / (π t ).
Overlap terms in Xd(ω) causes aliasing.
2D: f (u,v) =mn,
f (nT, mT) sinc(u/ T – n) sinc(v/ T – m)
ELE 488 F06
Decrease Sampling Rate by M
+----+ x(n)--->| ↓ M |---> y(n)=x(nM) +----+
Y(ω) =M
1
1M
0rX(
M
r2πω ). Y(ω/M) is X(ω) expanded by M.
May cause aliasing. So +-----+ +----+ x(n)--->| LPF |------->| ↓M |---> y(n) +-----+ v(n) +----+
stopband edge ωc of the lowpass filter must be ≤ π/M.
ELE 488 F06
Example +----+ x(n)--->| ↓ M |---> y(n)=x(nM) +----+
Y(ω) =M
1
1M
0rX(
M
r2πω ). M=2
ELE 488 F06
Increasing Sampling Rate by L
Use LPF (stopband edge ωc = π/M) to remove “image”.
+----+ x(n)--->| ↑L |---> y(nL)=x(n) +----+ y(Ln+k)=0 for 0<k<L Y(ω) = X(ωL). X(ω) ‘compressed’ by L.
+----+ +-----+ x(n)--->| ↑L |------->| LPF |---> v(n) +----+ y(n) +-----+
ELE 488 F06
Change Sampling Rate by L/M
+----+ +-----+ +----+ -->| ↑L |--->| LPF |--->| ↓M |--->
+----+ +-----+ +----+
ELE 488 F06
Integer Subsampling by L
L=2L=2Beware of Aliasing!
ELE 488 F06
Sampling
Subsampled
by 5
Noticable
aliasing!
Gaussian LPF
(2) then
Subsampled
by 5
Gaussian LPF
(4) then
Subsampled
by 5
ELE 488 F06
Resizing from M x N down to J x K
M x N
J x K
Sinc interpolation at new grid points – not practical
Use approximate reconstruction with reduced computation
sample reconstruct
sample
2D: f (u,v) =mn,
f (nT, mT) sinc(u/ T – n) sinc(v/ T – m)