47
052600 VU Signal and Image Processing Image Restoration Torsten Möller + Hrvoje Bogunović + Raphael Sahann [email protected] [email protected] [email protected] vda.cs.univie.ac.at/Teaching/SIP/17s/ © Raphael Sahann

Image Restoration - univie.ac.atvda.univie.ac.at/.../LectureNotes/16_Image_Restoration.pdf052600 VU Signal and Image Processing Image Restoration Torsten Möller + Hrvoje Bogunović

  • Upload
    others

  • View
    13

  • Download
    1

Embed Size (px)

Citation preview

Page 1: Image Restoration - univie.ac.atvda.univie.ac.at/.../LectureNotes/16_Image_Restoration.pdf052600 VU Signal and Image Processing Image Restoration Torsten Möller + Hrvoje Bogunović

052600 VU Signal and Image Processing

Image Restoration

Torsten Möller + Hrvoje Bogunović + Raphael Sahann

[email protected] [email protected]

[email protected]

vda.cs.univie.ac.at/Teaching/SIP/17s/

1© Raphael Sahann

Page 2: Image Restoration - univie.ac.atvda.univie.ac.at/.../LectureNotes/16_Image_Restoration.pdf052600 VU Signal and Image Processing Image Restoration Torsten Möller + Hrvoje Bogunović

Overview

•Image Restoration –Noise Models –Spatial Noise Only Filtering –Periodic Noise Reduction by Frequency Domain Filtering –Estimating Degradation and Filtering Methods

2© Raphael Sahann

Page 3: Image Restoration - univie.ac.atvda.univie.ac.at/.../LectureNotes/16_Image_Restoration.pdf052600 VU Signal and Image Processing Image Restoration Torsten Möller + Hrvoje Bogunović

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

Page 4: Image Restoration - univie.ac.atvda.univie.ac.at/.../LectureNotes/16_Image_Restoration.pdf052600 VU Signal and Image Processing Image Restoration Torsten Möller + Hrvoje Bogunović

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

Page 5: Image Restoration - univie.ac.atvda.univie.ac.at/.../LectureNotes/16_Image_Restoration.pdf052600 VU Signal and Image Processing Image Restoration Torsten Möller + Hrvoje Bogunović

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

Page 6: Image Restoration - univie.ac.atvda.univie.ac.at/.../LectureNotes/16_Image_Restoration.pdf052600 VU Signal and Image Processing Image Restoration Torsten Möller + Hrvoje Bogunović

Sample Image for Illustration

6

Gonzalez & Woods - Digital Image Processing

(3rd Edition)

© Raphael Sahann

Page 7: Image Restoration - univie.ac.atvda.univie.ac.at/.../LectureNotes/16_Image_Restoration.pdf052600 VU Signal and Image Processing Image Restoration Torsten Möller + Hrvoje Bogunović

Samples and Histograms of Noise

7

Gonzalez & Woods - Digital Image Processing

(3rd Edition)

© Raphael Sahann

Page 8: Image Restoration - univie.ac.atvda.univie.ac.at/.../LectureNotes/16_Image_Restoration.pdf052600 VU Signal and Image Processing Image Restoration Torsten Möller + Hrvoje Bogunović

Samples and Histograms of Noise

8

Gonzalez & Woods - Digital Image Processing

(3rd Edition)

© Raphael Sahann

Page 9: Image Restoration - univie.ac.atvda.univie.ac.at/.../LectureNotes/16_Image_Restoration.pdf052600 VU Signal and Image Processing Image Restoration Torsten Möller + Hrvoje Bogunović

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

Page 10: Image Restoration - univie.ac.atvda.univie.ac.at/.../LectureNotes/16_Image_Restoration.pdf052600 VU Signal and Image Processing Image Restoration Torsten Möller + Hrvoje Bogunović

Overview

•Image Restoration –Noise Models –Spatial Noise Only Filtering –Periodic Noise Reduction by Frequency Domain Filtering –Estimating Degradation and Filtering Methods

10© Raphael Sahann

Page 11: Image Restoration - univie.ac.atvda.univie.ac.at/.../LectureNotes/16_Image_Restoration.pdf052600 VU Signal and Image Processing Image Restoration Torsten Möller + Hrvoje Bogunović

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

Page 12: Image Restoration - univie.ac.atvda.univie.ac.at/.../LectureNotes/16_Image_Restoration.pdf052600 VU Signal and Image Processing Image Restoration Torsten Möller + Hrvoje Bogunović

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

Page 13: Image Restoration - univie.ac.atvda.univie.ac.at/.../LectureNotes/16_Image_Restoration.pdf052600 VU Signal and Image Processing Image Restoration Torsten Möller + Hrvoje Bogunović

13

Gonzalez & Woods - Digital Image Processing

(3rd Edition)

© Raphael Sahann

Noise Filtering

Page 14: Image Restoration - univie.ac.atvda.univie.ac.at/.../LectureNotes/16_Image_Restoration.pdf052600 VU Signal and Image Processing Image Restoration Torsten Möller + Hrvoje Bogunović

14© Raphael Sahann

Gonzalez & Woods - Digital Image Processing

(3rd Edition)

Noise Filtering

Page 15: Image Restoration - univie.ac.atvda.univie.ac.at/.../LectureNotes/16_Image_Restoration.pdf052600 VU Signal and Image Processing Image Restoration Torsten Möller + Hrvoje Bogunović

Wrong Order in Contraharmonic Filter

15© Raphael Sahann

Gonzalez & Woods - Digital Image Processing (3rd Edition)

Page 16: Image Restoration - univie.ac.atvda.univie.ac.at/.../LectureNotes/16_Image_Restoration.pdf052600 VU Signal and Image Processing Image Restoration Torsten Möller + Hrvoje Bogunović

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)}

Page 17: Image Restoration - univie.ac.atvda.univie.ac.at/.../LectureNotes/16_Image_Restoration.pdf052600 VU Signal and Image Processing Image Restoration Torsten Möller + Hrvoje Bogunović

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)

Page 18: Image Restoration - univie.ac.atvda.univie.ac.at/.../LectureNotes/16_Image_Restoration.pdf052600 VU Signal and Image Processing Image Restoration Torsten Möller + Hrvoje Bogunović

18

Median Filter Application

Gonzalez & Woods - Digital Image Processing

(3rd Edition)

© Raphael Sahann

Page 19: Image Restoration - univie.ac.atvda.univie.ac.at/.../LectureNotes/16_Image_Restoration.pdf052600 VU Signal and Image Processing Image Restoration Torsten Möller + Hrvoje Bogunović

19

Min/Max Filter Application

Gonzalez & Woods - Digital Image Processing

(3rd Edition)

(Input image only used pepper noise)

© Raphael Sahann

Page 20: Image Restoration - univie.ac.atvda.univie.ac.at/.../LectureNotes/16_Image_Restoration.pdf052600 VU Signal and Image Processing Image Restoration Torsten Möller + Hrvoje Bogunović

20

Mean Filter Application

Gonzalez & Woods - Digital Image Processing

(3rd Edition)

© Raphael SahannGonzalez & Woods - Digital Image Processing (3rd Edition)

Page 21: Image Restoration - univie.ac.atvda.univie.ac.at/.../LectureNotes/16_Image_Restoration.pdf052600 VU Signal and Image Processing Image Restoration Torsten Möller + Hrvoje Bogunović

• 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]

Page 22: Image Restoration - univie.ac.atvda.univie.ac.at/.../LectureNotes/16_Image_Restoration.pdf052600 VU Signal and Image Processing Image Restoration Torsten Möller + Hrvoje Bogunović

Adaptive Filters

22© Raphael Sahann

Gonzalez & Woods - Digital Image Processing

(3rd Edition)

Page 23: Image Restoration - univie.ac.atvda.univie.ac.at/.../LectureNotes/16_Image_Restoration.pdf052600 VU Signal and Image Processing Image Restoration Torsten Möller + Hrvoje Bogunović

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.

Page 24: Image Restoration - univie.ac.atvda.univie.ac.at/.../LectureNotes/16_Image_Restoration.pdf052600 VU Signal and Image Processing Image Restoration Torsten Möller + Hrvoje Bogunović

Adaptive Median Filter

24

Gonzalez & Woods - Digital Image Processing (3rd Edition)

© Raphael Sahann

Page 25: Image Restoration - univie.ac.atvda.univie.ac.at/.../LectureNotes/16_Image_Restoration.pdf052600 VU Signal and Image Processing Image Restoration Torsten Möller + Hrvoje Bogunović

Overview

•Image Restoration –Noise Models –Spatial Noise Only Filtering –Periodic Noise Reduction by Frequency Domain Filtering –Estimating Degradation and Filtering Methods

25© Raphael Sahann

Page 26: Image Restoration - univie.ac.atvda.univie.ac.at/.../LectureNotes/16_Image_Restoration.pdf052600 VU Signal and Image Processing Image Restoration Torsten Möller + Hrvoje Bogunović

Frequency Domain Filtering• Bandreject Filters:

26© Raphael Sahann

Gonzalez & Woods - Digital Image Processing (3rd Edition)

Page 27: Image Restoration - univie.ac.atvda.univie.ac.at/.../LectureNotes/16_Image_Restoration.pdf052600 VU Signal and Image Processing Image Restoration Torsten Möller + Hrvoje Bogunović

Bandreject Filtering

27© Raphael Sahann

Gonzalez & Woods - Digital Image Processing

(3rd Edition)

Page 28: Image Restoration - univie.ac.atvda.univie.ac.at/.../LectureNotes/16_Image_Restoration.pdf052600 VU Signal and Image Processing Image Restoration Torsten Möller + Hrvoje Bogunović

Frequency Domain Filtering

• Bandpass Filter:

28

Gonzalez & Woods - Digital Image Processing

(3rd Edition)

© Raphael Sahann

Page 29: Image Restoration - univie.ac.atvda.univie.ac.at/.../LectureNotes/16_Image_Restoration.pdf052600 VU Signal and Image Processing Image Restoration Torsten Möller + Hrvoje Bogunović

Notch Filters

29

Gonzalez & Woods - Digital Image Processing

(3rd Edition)

© Raphael Sahann

Page 30: Image Restoration - univie.ac.atvda.univie.ac.at/.../LectureNotes/16_Image_Restoration.pdf052600 VU Signal and Image Processing Image Restoration Torsten Möller + Hrvoje Bogunović

Notch Filtering

• Has to appear in symmetric pairs about the origin

• Removes periodic interference

30© Raphael Sahann

Gonzalez & Woods - Digital Image Processing

(3rd Edition)

Page 31: Image Restoration - univie.ac.atvda.univie.ac.at/.../LectureNotes/16_Image_Restoration.pdf052600 VU Signal and Image Processing Image Restoration Torsten Möller + Hrvoje Bogunović

Optimum Notch Filtering

31

Gonzalez & Woods - Digital Image Processing (3rd Edition)

© Raphael Sahann

Page 32: Image Restoration - univie.ac.atvda.univie.ac.at/.../LectureNotes/16_Image_Restoration.pdf052600 VU Signal and Image Processing Image Restoration Torsten Möller + Hrvoje Bogunović

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

Page 33: Image Restoration - univie.ac.atvda.univie.ac.at/.../LectureNotes/16_Image_Restoration.pdf052600 VU Signal and Image Processing Image Restoration Torsten Möller + Hrvoje Bogunović

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

Page 34: Image Restoration - univie.ac.atvda.univie.ac.at/.../LectureNotes/16_Image_Restoration.pdf052600 VU Signal and Image Processing Image Restoration Torsten Möller + Hrvoje Bogunović

Optimum Notch Filtering

34

Input ResultGonzalez & Woods - Digital Image Processing (3rd Edition)

© Raphael Sahann

Page 35: Image Restoration - univie.ac.atvda.univie.ac.at/.../LectureNotes/16_Image_Restoration.pdf052600 VU Signal and Image Processing Image Restoration Torsten Möller + Hrvoje Bogunović

Overview

•Image Restoration –Noise Models –Spatial Noise Only Filtering –Periodic Noise Reduction by Frequency Domain Filtering –Estimating Degradation and Filtering Methods

35© Raphael Sahann

Page 36: Image Restoration - univie.ac.atvda.univie.ac.at/.../LectureNotes/16_Image_Restoration.pdf052600 VU Signal and Image Processing Image Restoration Torsten Möller + Hrvoje Bogunović

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)

Page 37: Image Restoration - univie.ac.atvda.univie.ac.at/.../LectureNotes/16_Image_Restoration.pdf052600 VU Signal and Image Processing Image Restoration Torsten Möller + Hrvoje Bogunović

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

Page 38: Image Restoration - univie.ac.atvda.univie.ac.at/.../LectureNotes/16_Image_Restoration.pdf052600 VU Signal and Image Processing Image Restoration Torsten Möller + Hrvoje Bogunović

• 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

Page 39: Image Restoration - univie.ac.atvda.univie.ac.at/.../LectureNotes/16_Image_Restoration.pdf052600 VU Signal and Image Processing Image Restoration Torsten Möller + Hrvoje Bogunović

Estimation by Experimentation

39© Raphael Sahann

Gonzalez & Woods - Digital Image Processing (3rd Edition)

Page 40: Image Restoration - univie.ac.atvda.univie.ac.at/.../LectureNotes/16_Image_Restoration.pdf052600 VU Signal and Image Processing Image Restoration Torsten Möller + Hrvoje Bogunović

• 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

Page 41: Image Restoration - univie.ac.atvda.univie.ac.at/.../LectureNotes/16_Image_Restoration.pdf052600 VU Signal and Image Processing Image Restoration Torsten Möller + Hrvoje Bogunović

Estimation by Modeling

41

Gonzalez & Woods - Digital Image Processing

(3rd Edition)

© Raphael Sahann

Page 42: Image Restoration - univie.ac.atvda.univie.ac.at/.../LectureNotes/16_Image_Restoration.pdf052600 VU Signal and Image Processing Image Restoration Torsten Möller + Hrvoje Bogunović

Estimation by Modeling

42

Gonzalez & Woods - Digital Image Processing

(3rd Edition)

© Raphael Sahann

Page 43: Image Restoration - univie.ac.atvda.univie.ac.at/.../LectureNotes/16_Image_Restoration.pdf052600 VU Signal and Image Processing Image Restoration Torsten Möller + Hrvoje Bogunović

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

Page 44: Image Restoration - univie.ac.atvda.univie.ac.at/.../LectureNotes/16_Image_Restoration.pdf052600 VU Signal and Image Processing Image Restoration Torsten Möller + Hrvoje Bogunović

Inverse Filtering

44© Raphael Sahann

Gonzalez & Woods - Digital Image Processing

(3rd Edition)

© Raphael Sahann

Page 45: Image Restoration - univie.ac.atvda.univie.ac.at/.../LectureNotes/16_Image_Restoration.pdf052600 VU Signal and Image Processing Image Restoration Torsten Möller + Hrvoje Bogunović

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

Page 46: Image Restoration - univie.ac.atvda.univie.ac.at/.../LectureNotes/16_Image_Restoration.pdf052600 VU Signal and Image Processing Image Restoration Torsten Möller + Hrvoje Bogunović

Wiener Filtering

46© Raphael Sahann

Gonzalez & Woods - Digital Image Processing (3rd Edition)

Page 47: Image Restoration - univie.ac.atvda.univie.ac.at/.../LectureNotes/16_Image_Restoration.pdf052600 VU Signal and Image Processing Image Restoration Torsten Möller + Hrvoje Bogunović

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)