Top Banner
Digital Image Processing Chapter 5: Image Restoration Digital Image Processing Chapter 5: Image Restoration
67

Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

Aug 12, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

Digital Image ProcessingChapter 5:

Image Restoration

Digital Image ProcessingChapter 5:

Image Restoration

Page 2: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Concept of Image Restoration Concept of Image Restoration

Image restoration is to restore a degraded image back tothe original image while image enhancement is to manipulate the image so that it is suitable for a specificapplication.

Degradation model:

),(),(),(),( yxyxhyxfyxg η+∗=

where h(x,y) is a system that causes image distortion andη(x,y) is noise.

Page 3: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

Noise Models Noise Models

Noise cannot be predicted but can be approximately described instatistical way using the probability density function (PDF)

Gaussian noise:22 2/)(

21)( σμ

πσ−−= zezp

Rayleigh noise

⎪⎩

⎪⎨⎧

<

≥−=−−

azfor 0

for )(2)(

/)( 2

azeazbzp

baz

Erlang (Gamma) noise

⎪⎩

⎪⎨⎧

<

≥−−=

−−

0zfor 0

0for )()!1()(1

zeazb

zazp

azbb

Page 4: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

Noise Models (cont.) Noise Models (cont.)

Exponential noise

Uniform noise

Impulse (salt & pepper) noise

azaezp −=)(

⎪⎩

⎪⎨⎧ ≤≤=

otherwise 0

afor a-b

1)( bzzp

⎪⎩

⎪⎨

⎧==

=otherwise 0for for

)( bzPazP

zp b

a

Page 5: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

PDF: Statistical Way to Describe NoisePDF: Statistical Way to Describe Noise

PDF tells how mucheach z value occurs.

Page 6: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Image Degradation with Additive Noise Image Degradation with Additive Noise

Original image

Histogram

Degraded images

),(),(),( yxyxfyxg η+=

Page 7: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Original image

Histogram

Degraded images

Image Degradation with Additive Noise (cont.) Image Degradation with Additive Noise (cont.)

),(),(),( yxyxfyxg η+=

Page 8: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Chapter 42-D DFT Properties

Chapter 42-D DFT Properties

Page 9: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Chapter 42-D DFT Properties (cont.)

Chapter 42-D DFT Properties (cont.)

Page 10: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Chapter 42-D DFT Properties (cont.)

Chapter 42-D DFT Properties (cont.)

Page 11: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Chapter 42-D DFT Properties (cont.)

Chapter 42-D DFT Properties (cont.)

Page 12: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Estimation of Noise Estimation of Noise

We cannot use the image histogram to estimate noise PDF.

It is better to use the histogram of one areaof an image that has constant intensity to estimate noise PDF.

Page 13: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Periodic Noise Periodic Noise

Periodic noise looks like dotsIn the frequencydomain

Page 14: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Periodic Noise Reduction by Freq. Domain Filtering Periodic Noise Reduction by Freq. Domain Filtering

Band reject filter Restored image

Degraded image DFTPeriodic noisecan be reduced bysetting frequencycomponentscorresponding to noise to zero.

Page 15: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Band Reject Filters Band Reject Filters

Use to eliminate frequency components in some bands

Periodic noise from theprevious slide that is Filtered out.

Page 16: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Notch Reject Filters Notch Reject Filters

A notch reject filter is used to eliminate some frequency components.

Page 17: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Notch Reject Filter: Notch Reject Filter:

Degraded image DFTNotch filter

(freq. Domain)

Restored imageNoise

Page 18: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Example: Image Degraded by Periodic Noise Example: Image Degraded by Periodic Noise Degraded image

DFT(no shift)

Restored imageNoiseDFT of noise

Page 19: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

Mean Filters Mean Filters

Arithmetic mean filter or moving average filter (from Chapter 3)

∑∈

=xySts

tsgmn

yxf),(

),(1),(ˆ

Geometric mean filter

mn

Sts xy

tsgyxf

1

),(

),(),(ˆ⎟⎟⎠

⎞⎜⎜⎝

⎛= ∏

mn = size of moving window

Degradation model:

),(),(),(),( yxyxhyxfyxg η+∗=

To remove this part

Page 20: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Geometric Mean Filter: Example Geometric Mean Filter: Example

Original image

Image corrupted by AWGN

Image obtained

using a 3x3geometric mean filter

Image obtained

using a 3x3arithmetic mean filter

AWGN: Additive White Gaussian Noise

Page 21: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

Harmonic and Harmonic and ContraharmonicContraharmonic FiltersFiltersHarmonic mean filter

∑∈

=

xySts tsg

mnyxf

),( ),(1),(ˆ

Contraharmonic mean filter

+

=

xy

xy

Sts

QSts

Q

tsg

tsgyxf

),(

),(

1

),(

),(),(ˆ

mn = size of moving window

Works well for salt noisebut fails for pepper noise

Q = the filter order

Positive Q is suitable for eliminating pepper noise.Negative Q is suitable for eliminating salt noise.

For Q = 0, the filter reduces to an arithmetic mean filter.For Q = -1, the filter reduces to a harmonic mean filter.

Page 22: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

ContraharmonicContraharmonic Filters: ExampleFilters: Example

Image corrupted by pepper noise with prob. = 0.1

Image corrupted

by salt noise with prob. = 0.1

Image obtained

using a 3x3contra-

harmonic mean filter

With Q = 1.5

Image obtained

using a 3x3contra-

harmonic mean filter

With Q=-1.5

Page 23: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

ContraharmonicContraharmonic Filters: Incorrect Use ExampleFilters: Incorrect Use Example

Image corrupted by pepper noise with prob. = 0.1

Image corrupted

by salt noise with prob. = 0.1

Image obtained

using a 3x3contra-

harmonic mean filter

With Q=-1.5

Image obtained

using a 3x3contra-

harmonic mean filterWith Q=1.5

Page 24: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

OrderOrder--Statistic Filters: RevisitStatistic Filters: Revisit

subimageOriginal image

Moving window

Statistic parametersMean, Median, Mode, Min, Max, Etc.

Output image

Page 25: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

OrderOrder--Statistics FiltersStatistics Filters

Median filter

{ }),(median),(ˆ),(

tsgyxfxySts ∈

=

Max filter

{ }),(max),(ˆ),(

tsgyxfxySts ∈

=

Min filter

{ }),(min),(ˆ),(

tsgyxfxySts ∈

=

Midpoint filter

{ } { }⎟⎠

⎞⎜⎝

⎛ +=∈∈

),(min),(max21),(ˆ

),(),(tsgtsgyxf

xyxy StsSts

Reduce “dark” noise(pepper noise)

Reduce “bright” noise(salt noise)

Page 26: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

Median Filter : How it works Median Filter : How it works A median filter is good for removing impulse, isolated noise

Degraded image

Salt noise

Pepper noise

Movingwindow

Sorted array

Salt noisePepper noiseMedian

Filter output

Normally, impulse noise has high magnitudeand is isolated. When we sort pixels in themoving window, noise pixels are usuallyat the ends of the array.

Therefore, it’s rare that the noise pixel will be a median value.

Page 27: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Median Filter : Example Median Filter : Example

Image corrupted by salt-

and-pepper noise with pa=pb= 0.1

Images obtained using a 3x3 median filter

1

4

2

3

Page 28: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Max and Min Filters: Example Max and Min Filters: Example

Image corrupted by pepper noise with prob. = 0.1

Image corrupted

by salt noise with prob. = 0.1

Image obtained

using a 3x3max filter

Image obtained

using a 3x3min filter

Page 29: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

AlphaAlpha--trimmed Mean Filtertrimmed Mean Filter

∑∈−

=xySts

r tsgdmn

yxf),(

),(1),(ˆ

where gr(s,t) represent the remaining mn-d pixels after removing the d/2 highest and d/2 lowest values of g(s,t).

This filter is useful in situations involving multiple typesof noise such as a combination of salt-and-pepper and Gaussian noise.

Formula:

d/2 d/2Lowest Gray Level

HighestGray Level

Total mn pixels

Page 30: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

AlphaAlpha--trimmed Mean Filter: Exampletrimmed Mean Filter: Example

Image corrupted by additiveuniform

noise

Image obtained

using a 5x5arithmetic mean filter

Image additionallycorrupted by additivesalt-and-pepper noise

1 2

2 Image obtained

using a 5x5geometric mean filter

2

Page 31: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

AlphaAlpha--trimmed Mean Filter: Example (cont.)trimmed Mean Filter: Example (cont.)

Image corrupted by additiveuniform

noise

Image obtained

using a 5x5median filter

Image additionallycorrupted by additivesalt-and-pepper noise

1 2

2Image obtained

using a 5x5alpha-

trimmed mean filterwith d = 5

2

Page 32: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

AlphaAlpha--trimmed Mean Filter: Example (cont.)trimmed Mean Filter: Example (cont.)

Image obtained

using a 5x5arithmetic mean filter

Image obtained

using a 5x5geometric mean filter

Image obtained

using a 5x5median filter

Image obtained

using a 5x5alpha-

trimmed mean filterwith d = 5

Page 33: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

Adaptive FilterAdaptive Filter

-Filter behavior depends on statistical characteristics of local areas inside mxn moving window

- More complex but superior performance compared with “fixed”filters

Statistical characteristics:

General concept:

∑∈

=xySts

L tsgmn

m),(

),(1Local mean:

Local variance:

∑∈

−=xySts

LL mtsgmn ),(

22 )),((1σ

2ησ

Noise variance:

Page 34: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

Adaptive, Local Noise Reduction FilterAdaptive, Local Noise Reduction FilterPurpose: want to preserve edges

1. If ση2 is zero, No noisethe filter should return g(x,y) because g(x,y) = f(x,y)

2. If σL2 is high relative to ση

2, Edges (should be preserved), the filter should return the value close to g(x,y)

3. If σL2 = ση

2, Areas inside objectsthe filter should return the arithmetic mean value mL

( )LL

myxgyxgyxf −−= ),(),(),(ˆ2

2

σση

Formula:

Concept:

Page 35: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Adaptive Noise Reduction Filter: Example Adaptive Noise Reduction Filter: Example

Image corrupted by additiveGaussian noise with zero mean

and σ2=1000

Imageobtained

using a 7x7arithmeticmean filter

Imageobtained

using a 7x7geometricmean filter

Imageobtained

using a 7x7adaptive

noise reduction

filter

Page 36: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

Algorithm:Level A: A1= zmedian – zminA2= zmedian – zmaxIf A1 > 0 and A2 < 0, goto level BElse increase window size

If window size <= Smax repeat level AElse return zxy

Level B: B1= zxy – zminB2= zxy – zmaxIf B1 > 0 and B2 < 0, return zxyElse return zmedian

Adaptive Median Filter Adaptive Median Filter

zmin = minimum gray level value in Sxyzmax = maximum gray level value in Sxyzmedian = median of gray levels in Sxyzxy = gray level value at pixel (x,y)Smax = maximum allowed size of Sxy

where

Purpose: want to remove impulse noise while preserving edges

Page 37: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

Level A: A1= zmedian – zminA2= zmedian – zmax

Else Window is not big enoughincrease window sizeIf window size <= Smax repeat level A

Else return zxy

zmedian is not an impulse

B1= zxy – zminB2= zxy – zmaxIf B1 > 0 and B2 < 0, zxy is not an impulse

return zxy to preserve original detailsElse

return zmedian to remove impulse

Adaptive Median Filter: How it worksAdaptive Median Filter: How it works

If A1 > 0 and A2 < 0, goto level B

Level B:

Determine whether zmedianis an impulse or not

Determine whether zxyis an impulse or not

Page 38: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Adaptive Median Filter: Example Adaptive Median Filter: Example

Image corrupted by salt-and-pepper

noise with pa=pb= 0.25

Image obtained using a 7x7

median filter

Image obtained using an adaptivemedian filter with

Smax = 7

More small details are preserved

Page 39: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Estimation of Degradation Model Estimation of Degradation Model Degradation model:

),(),(),(),( yxyxhyxfyxg η+∗=

Purpose: to estimate h(x,y) or H(u,v)

),(),(),(),( vuNvuHvuFvuG +=

Methods:1. Estimation by Image Observation

2. Estimation by Experiment

3. Estimation by Modeling

or

Why? If we know exactly h(x,y), regardless of noise, we can do deconvolution to get f(x,y) back from g(x,y).

Page 40: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

Estimation by Image ObservationEstimation by Image Observation

f(x,y) f(x,y)*h(x,y) g(x,y)

Subimage

ReconstructedSubimage

),( vuGs ),( yxgs

),(ˆ yxfs

DFT

DFT),(ˆ vuFs

Restorationprocess byestimation

Original image (unknown) Degraded image

),(ˆ),(),(),(

vuFvuGvuHvuH

s

ss =≈

Estimated Transferfunction

Observation

This case is used when weknow only g(x,y) and cannot repeat the experiment!

Page 41: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

Estimation by ExperimentEstimation by ExperimentUsed when we have the same equipment set up and can repeat the

experiment.Input impulse image

SystemH( )

Response image fromthe system

),( vuG

),( yxg),( yxAδ

{ } AyxADFT =),(δ

AvuGvuH ),(),( =

DFTDFT

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Page 42: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Estimation by ModelingEstimation by ModelingUsed when we know physical mechanism underlying the image

formation process that can be expressed mathematically.

AtmosphericTurbulence model

6/522 )(),( vukevuH +−=

Example:Original image Severe turbulence

k = 0.00025k = 0.001

k = 0.0025

Low turbulenceMild turbulence

Page 43: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

Estimation by Modeling: Motion BlurringEstimation by Modeling: Motion BlurringAssume that camera velocity is ))(),(( 00 tytxThe blurred image is obtained by

dttyytxxfyxgT

))(),((),( 000

++= ∫where T = exposure time.

dtdxdyetyytxxf

dxdyedttyytxxf

dxdyeyxgvuG

Tvyuxj

vyuxjT

vyuxj

∫ ∫ ∫

∫ ∫ ∫

∫ ∫

⎥⎦

⎤⎢⎣

⎡++=

⎥⎦

⎤⎢⎣

⎡++=

=

∞−

∞−

+−

∞−

∞−

+−

∞−

∞−

+−

0

)(200

)(2

000

)(2

))(),((

))(),((

),(),(

π

π

π

Page 44: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

Estimation by Modeling: Motion Blurring (cont.)Estimation by Modeling: Motion Blurring (cont.)

[ ]

dtevuF

dtevuF

dtdxdyetyytxxfvuG

Ttvytuxj

Ttvytuxj

Tvyuxj

∫ ∫ ∫

+−

+−

∞−

∞−

+−

=

=

⎥⎦

⎤⎢⎣

⎡++=

0

))()((2

0

))()((2

0

)(200

00

00

),(

),(

))(),(( ),(

π

π

π

Then we get, the motion blurring transfer function:

dtevuHT

tvytuxj∫ +−=0

))()((2 00),( π

For constant motion ),())(),(( 00 btattytx =

)(

0

)(2 ))(sin()(

),( vbuajT

vbuaj evbuavbua

TdtevuH +−+− ++

== ∫ ππ ππ

Page 45: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Motion Blurring ExampleMotion Blurring ExampleFor constant motion

)())(sin()(

),( vbuajevbuavbua

TvuH +−++

= πππ

Original image Motion blurred imagea = b = 0.1, T = 1

Page 46: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Inverse Filter Inverse Filter

after we obtain H(u,v), we can estimate F(u,v) by the inverse filter:

),(),(),(

),(),(),(ˆ

vuHvuNvuF

vuHvuGvuF +==

From degradation model:

),(),(),(),( vuNvuHvuFvuG +=

Noise is enhancedwhen H(u,v) is small. To avoid the side effect of enhancing

noise, we can apply this formulation to freq. component (u,v) with in a radius D0 from the center of H(u,v).

In practical, the inverse filter is notPopularly used.

Page 47: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

Inverse Filter: Example Inverse Filter: Example

6/522 )(0025.0),( vuevuH +−=

Original image

Blurred imageDue to Turbulence

Result of applyingthe full filter

Result of applyingthe filter with D0=70

Result of applyingthe filter with D0=40

Result of applyingthe filter with D0=85

Page 48: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Wiener Filter: Minimum Mean Square Error Filter Wiener Filter: Minimum Mean Square Error Filter Objective: optimize mean square error: { }22 )ˆ( ffEe −=

),(),(/),(),(

),(),(

1

),(),(/),(),(

),(

),(),(),(),(

),(),(),(ˆ

2

2

2

*

2

*

vuGvuSvuSvuH

vuHvuH

vuGvuSvuSvuH

vuH

vuGvuSvuHvuS

vuSvuHvuF

f

f

f

f

⎥⎥⎦

⎢⎢⎣

+=

⎥⎥⎦

⎢⎢⎣

+=

⎥⎥⎦

⎢⎢⎣

+=

η

η

η

Wiener Filter Formula:

whereH(u,v) = Degradation functionSη(u,v) = Power spectrum of noiseSf(u,v) = Power spectrum of the undegraded image

Page 49: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

Approximation of Wiener FilterApproximation of Wiener Filter

),(),(/),(),(

),(),(

1),(ˆ2

2

vuGvuSvuSvuH

vuHvuH

vuFf ⎥

⎥⎦

⎢⎢⎣

+=

η

Wiener Filter Formula:

Approximated Formula:

),(),(

),(),(

1),(ˆ2

2

vuGKvuH

vuHvuH

vuF⎥⎥⎦

⎢⎢⎣

+=

Difficult to estimate

Practically, K is chosen manually to obtained the best visual result!

Page 50: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

Wiener Filter: Example Wiener Filter: Example

Original image

Blurred imageDue to Turbulence

Result of the full inverse filter

Result of the inversefilter with D0=70

Result of the full Wiener filter

Page 51: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

Wiener Filter: Example (cont.) Wiener Filter: Example (cont.)

Original imageResult of the inverse

filter with D0=70

Result of the Wiener filter

Blurred imageDue to Turbulence

Page 52: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Example: Wiener Filter and Motion Blurring Example: Wiener Filter and Motion Blurring Image degradedby motion blur +AWGN

Result of theinverse filter

Result of theWiener filter

ση2=650

ση2=325

ση2=130

Note: K is chosenmanually

Page 53: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

Degradation model:),(),(),(),( yxyxhyxfyxg η+∗=

Written in a matrix form

Constrained Least Squares Filter Constrained Least Squares Filter

ηHfg +=

Objective: to find the minimum of a criterion function

[ ]∑∑−

=

=

∇=1

0

1

0

22 ),(M

x

N

y

yxfC

Subject to the constraint22ˆ ηfHg =−

),(),(),(

),(),(ˆ22

*

vuGvuPvuH

vuHvuF⎥⎥⎦

⎢⎢⎣

+=

γ

We get a constrained least square filter

whereP(u,v) = Fourier transform of p(x,y) =

⎥⎥⎥

⎢⎢⎢

−−−

010141

010

where www T=2

Page 54: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

Constrained Least Squares Filter: Example Constrained Least Squares Filter: Example

),(),(),(

),(),(ˆ22

*

vuGvuPvuH

vuHvuF⎥⎥⎦

⎢⎢⎣

+=

γ

Constrained least square filter

γ is adaptively adjusted to achieve the best result.

Results from the previous slide obtained from the constrained least square filter

Page 55: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

Constrained Least Squares Filter: Example (cont.) Constrained Least Squares Filter: Example (cont.) Image degradedby motion blur +AWGN

Result of theConstrainedLeast squarefilter

Result of theWiener filter

ση2=650

ση2=325

ση2=130

Page 56: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

Constrained Least Squares Filter:Adjusting Constrained Least Squares Filter:Adjusting γγ

Define fHgr ˆ−= It can be shown that2)( rrr == Tγφ

We want to adjust gamma so that a±= 22 ηr

where a = accuracy factor1. Specify an initial value of γ

2. Compute

3. Stop if is satisfiedOtherwise return step 2 after increasing γ if

or decreasing γ ifUse the new value of γ to recompute

1

1

2r

a−< 22 ηr

a+> 22 ηr

),(),(),(

),(),(ˆ22

*

vuGvuPvuH

vuHvuF⎥⎥⎦

⎢⎢⎣

+=

γ

Page 57: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

Constrained Least Squares Filter:Adjusting Constrained Least Squares Filter:Adjusting γ γ (cont.)(cont.)

),(),(),(

),(),(ˆ22

*

vuGvuPvuH

vuHvuF⎥⎥⎦

⎢⎢⎣

+=

γ

),(ˆ),(),(),( vuFvuHvuGvuR −=

∑∑−

=

=

=1

0

1

0

22 ),(1 M

x

N

y

yxrMN

r

[ ]∑∑−

=

=

−=1

0

1

0

22 ),(1 M

x

N

y

myxMN ηη ησ

∑∑−

=

=

=1

0

1

0

),(1 M

x

N

y

yxMN

m ηη

[ ]ηησ mMN −= 22η

2rFor computing

For computing

Page 58: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Constrained Least Squares Filter: Example Constrained Least Squares Filter: Example

Original image

Blurred imageDue to Turbulence

Results obtained from constrained least square filters

Use wrong noise parameters

Correct parameters:Initial γ = 10-5

Correction factor = 10-6

a = 0.25ση

2 = 10-5

Wrong noise parameterση

2 = 10-2

Use correct noise parameters

Page 59: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

Geometric Mean filter Geometric Mean filter

),(

),(),(

),(

),(),(),(),(ˆ

1

2

*

2

*

vuG

vuSvuS

vuH

vuHvuHvuHvuF

f

α

η

α

β

⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

⎥⎦

⎤⎢⎣

⎡+⎥

⎥⎦

⎢⎢⎣

⎡=

This filter represents a family of filters combined into a single expression

α = 1 the inverse filterα = 0 the Parametric Wiener filterα = 0, β = 1 the standard Wiener filterβ = 1, α < 0.5 More like the inverse filterβ = 1, α > 0.5 More like the Wiener filter

Another name: the spectrum equalization filter

Page 60: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

Geometric TransformationGeometric Transformation

These transformations are often called rubber-sheet transformations: Printing an image on a rubber sheet and then stretch this sheet accordingto some predefine set of rules.

A geometric transformation consists of 2 basic operations:1. A spatial transformation :

Define how pixels are to be rearranged in the spatiallytransformed image.

2. Gray level interpolation :Assign gray level values to pixels in the spatiallytransformed image.

Page 61: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

Geometric Transformation : AlgorithmGeometric Transformation : Algorithm

Distorted image g

1. Select coordinate (x,y) in f to be restored2. Compute

),( yxrx =′

),( yxsy =′

3. Go to pixel in a distorted image g

),( yx ′′

Image f to be restored

4. get pixel value atBy gray level interpolation

),( yxg ′′

5. store that value in pixel f(x,y)

1 3

5

),( yx ′′),( yx

Page 62: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Spatial TransformationSpatial TransformationTo map between pixel coordinate (x,y) of f and pixel coordinate

(x’,y’) of g),( yxrx =′ ),( yxsy =′

For a bilinear transformation mapping between a pair of Quadrilateral regions

4321),( cxycycxcyxrx +++==′

8765),( cxycycxcyxsy +++==′ ),( yx ′′ ),( yx

To obtain r(x,y) and s(x,y), we needto know 4 pairs of coordinates

and its correspondingwhich are called tiepoints.

),( yx ′′),( yx

Page 63: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Gray Level Interpolation: Nearest NeighborGray Level Interpolation: Nearest Neighbor

Since may not be at an integer coordinate, we need to Interpolate the value of

),( yx ′′),( yxg ′′

Example interpolation methods that can be used:1. Nearest neighbor selection2. Bilinear interpolation3. Bicubic interpolation

Page 64: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

Gray Level Interpolation: Bilinear interpolationGray Level Interpolation: Bilinear interpolation

Page 65: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

Geometric Distortion and Restoration ExampleGeometric Distortion and Restoration ExampleOriginal image and

tiepointsTiepoints of distorted

image

Distorted image Restored image

Use nearestneighbor intepolation

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Page 66: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

Geometric Distortion and Restoration Example Geometric Distortion and Restoration Example (cont.)(cont.)

Original image andtiepoints

Tiepoints of distortedimage

Distorted image Restored image

Use bilinear intepolation

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Page 67: Chapter 5: Image Restorationjan/204584/05-image_restoration.pdf · Wood, Digital Image Processing, 2nd Edition. Concept of Image Restoration Image restoration is to restore a degraded

Example: Geometric RestorationExample: Geometric Restoration

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Original image Geometrically distortedImage

Difference between 2 above images

Restored image

Use the sameSpatial Trans (Bilinear).as in the previousexample