ELE 488 F06 ELE 488 Fall 2006 Image Processing and Transmission 10-3-06 Image Restoration distortion...

20
ELE 488 F06 ELE 488 Fall 2006 Image Processing and Transmission 10-3-06 Image Restoration distortion noise Inverse Filtering Wiener Filtering Ref: Jain, Sec 8.1 – 8.3. Gonzalez–Woods, Sec 5.5 – 5.8 10/3/0 6

Transcript of ELE 488 F06 ELE 488 Fall 2006 Image Processing and Transmission 10-3-06 Image Restoration distortion...

Page 1: ELE 488 F06 ELE 488 Fall 2006 Image Processing and Transmission 10-3-06 Image Restoration distortion noise Inverse Filtering Wiener Filtering Ref: Jain,

ELE 488 F06

ELE 488 Fall 2006Image Processing and Transmission

10-3-06

Image Restoration

distortion noise

Inverse Filtering

Wiener Filtering

Ref: Jain, Sec 8.1 – 8.3. Gonzalez–Woods, Sec 5.5 – 5.8

10/3/06

Page 2: ELE 488 F06 ELE 488 Fall 2006 Image Processing and Transmission 10-3-06 Image Restoration distortion noise Inverse Filtering Wiener Filtering Ref: Jain,

ELE 488 F06From Matlab ImageToolbox Documentation pp12-4

UM

CP

EN

EE

63

1 S

lide

s (c

rea

ted

by

M.W

u ©

20

01

)

Image Restoration

Page 3: ELE 488 F06 ELE 488 Fall 2006 Image Processing and Transmission 10-3-06 Image Restoration distortion noise Inverse Filtering Wiener Filtering Ref: Jain,

ELE 488 F06

Imperfection in Image Capturing

• Imaging system

– point spread function (impulse response):

h(m,n) ≠ (m,n).

– out of focus blur caused by local averaging in a circular neighborhood

– camera motion: blur caused by local averaging along motion direction

– Atomspheric turbulence blur, etc.

otherwise 0

tan and

x if L

1

),;,( yx

222

Ly

Lyxh

otherwise 0

x if R

1);,(

2222

RyRyxh

UM

CP

EN

EE

63

1 S

lide

s (c

rea

ted

by

M.W

u ©

20

01

)

h, Horiginal image u (object)

available image v

noise η

g, G

restored image w

Page 4: ELE 488 F06 ELE 488 Fall 2006 Image Processing and Transmission 10-3-06 Image Restoration distortion noise Inverse Filtering Wiener Filtering Ref: Jain,

ELE 488 F06

Undo Linear Spatial-Invariant Distortion

• Choose G to correct distortion from H• Consider special case

– 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 = δ.• Easy to solve in frequency domain: G(ω) = 1 / H(ω).• What if H(ω) = 0?

h, Hu v

g, Gw

UM

CP

EN

EE

63

1 S

lide

s (c

rea

ted

by

M.W

u ©

20

01

)

restorationdistortion

Page 5: ELE 488 F06 ELE 488 Fall 2006 Image Processing and Transmission 10-3-06 Image Restoration distortion noise Inverse Filtering Wiener Filtering Ref: Jain,

ELE 488 F06

Example

• Distortion h(n): .25 .5 .25 non causal

• H(w) = .5 (cos(w/2)2, G(w)=1 / H(w), g(n)=?

n=5; dw=pi/n; m=-n+1:1:n-1; w=m*dw; mm=-n:1:n;Hw=(cos(w/2)).^2; Gw=1./Hw; gg=fftshift(ifft(ifftshift(Gw)));

gh=conv(gg,[.25 .5 .25]);

• 3 pt inverse: -0.3333 1.6667 -0.3333

• 5 pt inverse: 0.2630 -0.9296 2.3333 -0.9296 0.2630

• 9 pt inverse: 0.2228 -0.7019 1.2958 -2.1501 3.6667 -2.1501 1.2958 -0.7019 0.2228

1N

1N

π

π

jnω N./πΔnΔkexp(jΔ)G(k2π

ΔdωeG(ω(

1g(n) )

Page 6: ELE 488 F06 ELE 488 Fall 2006 Image Processing and Transmission 10-3-06 Image Restoration distortion noise Inverse Filtering Wiener Filtering Ref: Jain,

ELE 488 F06

.25 .5 .25

3 sample inverse 9 sample inverse

5 sample inverse

Page 7: ELE 488 F06 ELE 488 Fall 2006 Image Processing and Transmission 10-3-06 Image Restoration distortion noise Inverse Filtering Wiener Filtering Ref: Jain,

ELE 488 F06

3 sample averager: 1 1 1

Page 8: ELE 488 F06 ELE 488 Fall 2006 Image Processing and Transmission 10-3-06 Image Restoration distortion noise Inverse Filtering Wiener Filtering Ref: Jain,

ELE 488 F06

Page 9: ELE 488 F06 ELE 488 Fall 2006 Image Processing and Transmission 10-3-06 Image Restoration distortion noise Inverse Filtering Wiener Filtering Ref: Jain,

ELE 488 F06

Page 10: ELE 488 F06 ELE 488 Fall 2006 Image Processing and Transmission 10-3-06 Image Restoration distortion noise Inverse Filtering Wiener Filtering Ref: Jain,

ELE 488 F06

Page 11: ELE 488 F06 ELE 488 Fall 2006 Image Processing and Transmission 10-3-06 Image Restoration distortion noise Inverse Filtering Wiener Filtering Ref: Jain,

ELE 488 F06

Page 12: ELE 488 F06 ELE 488 Fall 2006 Image Processing and Transmission 10-3-06 Image Restoration distortion noise Inverse Filtering Wiener Filtering Ref: Jain,

ELE 488 F06

Page 13: ELE 488 F06 ELE 488 Fall 2006 Image Processing and Transmission 10-3-06 Image Restoration distortion noise Inverse Filtering Wiener Filtering Ref: Jain,

ELE 488 F06

Page 14: ELE 488 F06 ELE 488 Fall 2006 Image Processing and Transmission 10-3-06 Image Restoration distortion noise Inverse Filtering Wiener Filtering Ref: Jain,

ELE 488 F06

Page 15: ELE 488 F06 ELE 488 Fall 2006 Image Processing and Transmission 10-3-06 Image Restoration distortion noise Inverse Filtering Wiener Filtering Ref: Jain,

ELE 488 F06

Problems With Inverse Filtering Under Noise

• Zeros in H()

– Interpretation: distortion by H removes all info. in those freq.

– Inverse filter tries to “compensate” by assigning infinite gains

– Amplifies noise: W (ω) = (V+N) / H N/H for small V

• Solutions ~ Pseudo-inverse Filtering– Assign zero to G at spectrum nulls of H

G(ω) = 1 / H(ω) , if | H(ω) | > ε

G(ω) = 0 , if | H(ω) | < ε

– Interpretation: not possible to restore lost information

UM

CP

EN

EE

63

1 S

lide

s (c

rea

ted

by

M.W

u ©

20

01

)

Page 16: ELE 488 F06 ELE 488 Fall 2006 Image Processing and Transmission 10-3-06 Image Restoration distortion noise Inverse Filtering Wiener Filtering Ref: Jain,

ELE 488 F06

Handling Spectrum Nulls Via High-Freq Cut-off

Limit restoration to lower frequency components to avoid amplifying noise at high frequencies and at nulls

UM

CP

EN

EE

63

1 S

lide

s (c

rea

ted

by

M.W

u ©

20

04

)

Gonzalez/ Woods (Chapter 5)

Page 17: ELE 488 F06 ELE 488 Fall 2006 Image Processing and Transmission 10-3-06 Image Restoration distortion noise Inverse Filtering Wiener Filtering Ref: Jain,

ELE 488 F06

Examples of 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

)

Page 18: ELE 488 F06 ELE 488 Fall 2006 Image Processing and Transmission 10-3-06 Image Restoration distortion noise Inverse Filtering Wiener Filtering Ref: Jain,

ELE 488 F06

Handling Noise in Deconvolution

• Inverse filtering is sensitive to noise– Does not explicitly handle noise

• To balance between deblurring vs. noise suppression:– Minimize MSE between the original u and restored w:

e = E{ [ u – w ] 2 } , given v– Best estimate is conditional mean: E { u | v}– usually difficult to solve

• needs info not usually available, non-linear problem

– To find the best linear estimate instead Wiener filtering– Consider the (desired) image and noise as random fields– Produce linear estimate from observed image v to minimize 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, Gw

Page 19: ELE 488 F06 ELE 488 Fall 2006 Image Processing and Transmission 10-3-06 Image Restoration distortion noise Inverse Filtering Wiener Filtering Ref: Jain,

ELE 488 F06

Wiener Filtering

• Best linear estimate (minimum MSE) – assume:– spatial-invariant filter w = v * g

– wide-sense stationarity for original signal and noise

– noise zero-mean and uncorrelated with original signal

• Solution– from orthogonal condition

E{ [ u(n) – w(n) ] v(m) }=0

– Represent in correlation functions: Ruv(k) = g(k) * Rvv(k)

– Take DFT to get representation in power spectrum density

– G(ω) = H*(ω) Φuu(ω) / { |H|2(ω) Φuu(ω) + Φnn(ω) }

= 1 / { H + Φnn / ( H* Φuu) }

UM

CP

EN

EE

63

1 S

lide

s (c

rea

ted

by

M.W

u ©

20

01

)

Page 20: ELE 488 F06 ELE 488 Fall 2006 Image Processing and Transmission 10-3-06 Image Restoration distortion noise Inverse Filtering Wiener Filtering Ref: Jain,

ELE 488 F06

Wiener Filtering (cont)

• To deblur noisy image, need to balance between: – HPF filter for de-blurring (undo H distortion)

– LPF for suppressing noise

• Noiseless case ~ Φnn = 0 (inverse filter)

– Wiener filter becomes pseudo-inverse filter for Φnn 0

– G(ω) = 1 / { H + Φnn / ( H* Φuu) }

G(ω) 1 / H(ω) , if H(ω) ≠ 0

G(ω) 0 , if H(ω) = 0

• No blur, H = 1 (smoothing Filter)– Attenuate noise according to SNR at each freq.

– G(ω) = Φuu / {Φuu + Φnn } = (Φuu / Φnn)/ { 1 + Φuu / Φnn}

UM

CP

EN

EE

63

1 S

lide

s (c

rea

ted

by

M.W

u ©

20

01

)