62
Digital Image Processing Chapter 5: Image Restoration 23 June 2006

Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

Embed Size (px)

Citation preview

Page 1: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

Digital Image ProcessingChapter 5:

Image Restoration

23 June 2006

Digital Image ProcessingChapter 5:

Image Restoration

23 June 2006

Page 2: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

(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: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

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/)(

2

1)(

zezp

Rayleigh noise

azfor 0

for )(2

)(/)( 2

azeazbzp

baz

Erlang (Gamma) noise

0zfor 0

0for )()!1()(

1

zeazb

zazp

azbb

Page 4: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

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

Exponential noise

Uniform noise

Impulse (salt & pepper) noise

azaezp )(

otherwise 0

afor a-b

1)( bzzp

otherwise 0

for

for

)( bzP

azP

zp b

a

Page 5: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

(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: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

(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: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

(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: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

(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 9: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

(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 10: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

(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 11: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

(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 12: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

(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 13: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

(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 14: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

(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 15: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

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 16: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

(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 17: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

Harmonic and Contraharmonic FiltersHarmonic and Contraharmonic Filters

Harmonic mean filter

xySts tsg

mnyxf

),( ),(1

),(ˆ

Contraharmonic mean filter

xy

xy

Sts

Q

Sts

Q

tsg

tsg

yxf

),(

),(

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 18: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

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

Contraharmonic Filters: ExampleContraharmonic Filters: 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 19: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

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

Contraharmonic Filters: Incorrect Use ExampleContraharmonic Filters: 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 20: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

Order-Statistic Filters: RevisitOrder-Statistic Filters: Revisit

subimage

Original image

Moving window

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

Output image

Page 21: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

Order-Statistics FiltersOrder-Statistics Filters

Median filter

),(median),(ˆ),(

tsgyxfxySts

Max filter

),(max),(ˆ),(

tsgyxfxySts

Min filter

),(min),(ˆ),(

tsgyxfxySts

Midpoint filter

),(min),(max2

1),(ˆ

),(),(tsgtsgyxf

xyxy StsSts

Reduce “dark” noise (pepper noise)

Reduce “bright” noise (salt noise)

Page 22: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

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 noise

Median

Filter output

Normally, impulse noise has high magnitude and is isolated. When we sort pixels in the moving window, noise pixels are usually at the ends of the array.

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

Page 23: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

(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 24: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

(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 25: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

Alpha-trimmed Mean FilterAlpha-trimmed 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:

Page 26: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

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

Alpha-trimmed Mean Filter: ExampleAlpha-trimmed Mean Filter: Example

Image corrupted by additive

uniform 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 27: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

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

Image corrupted by additive

uniform noise

Image obtained

using a 5x5 median filter

Image additionallycorrupted by additivesalt-and-pepper noise

1 2

2Image obtained

using a 5x5alpha-

trimmed mean filterwith d = 5

2

Page 28: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

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

Image obtained

using a 5x5arithmetic mean filter

Image obtained

using a 5x5geometric mean filter

Image obtained

using a 5x5 median filter

Image obtained

using a 5x5alpha-

trimmed mean filterwith d = 5

Page 29: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

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),(

),(1

Local mean:

Local variance:

xySts

LL mtsgmn ),(

22 )),((1

2

Noise variance:

Page 30: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

Adaptive, Local Noise Reduction FilterAdaptive, Local Noise Reduction Filter

Purpose: 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 31: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

(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 32: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

Algorithm:Level A: A1= zmedian – zmin

A2= zmedian – zmax

If A1 > 0 and A2 < 0, goto level BElse increase window size

If window size <= Smax repeat level AElse return zxy

Level B: B1= zxy – zmin

B2= zxy – zmax

If B1 > 0 and B2 < 0, return zxy

Else return zmedian

Adaptive Median Filter Adaptive Median Filter

zmin = minimum gray level value in Sxy

zmax = maximum gray level value in Sxy

zmedian = median of gray levels in Sxy

zxy = gray level value at pixel (x,y)Smax = maximum allowed size of Sxy

where

Purpose: want to remove impulse noise while preserving edges

Page 33: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

Level A: A1= zmedian – zmin

A2= zmedian – zmax

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

Else return zxy

zmedian is not an impulse

B1= zxy – zmin

B2= zxy – zmax

If B1 > 0 and B2 < 0, zxy is not an impulse return zxy to preserve original details

Else 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 zmedian

is an impulse or not

Determine whether zxy

is an impulse or not

Page 34: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

(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 35: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

(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 36: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

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

Restoration process byestimation

Original image (unknown) Degraded image

),(ˆ),(

),(),(vuF

vuGvuHvuH

s

ss

Estimated Transfer function

Observation

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

Page 37: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

Estimation by ExperimentEstimation by Experiment

Used 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 ),(

A

vuGvuH

),(),(

DFTDFT

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

Page 38: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

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

Estimation by ModelingEstimation by Modeling

Used 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 39: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

Estimation by Modeling: Motion BlurringEstimation by Modeling: Motion Blurring

Assume that camera velocity is ))(),(( 00 tytx

The blurred image is obtained by

dttyytxxfyxgT

))(),((),( 00

0

where T = exposure time.

dtdxdyetyytxxf

dxdyedttyytxxf

dxdyeyxgvuG

Tvyuxj

vyuxjT

vyuxj

0

)(200

)(2

0

00

)(2

))(),((

))(),((

),(),(

Page 40: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

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 41: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

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

Motion Blurring ExampleMotion Blurring Example

For constant motion

)())(sin()(

),( vbuajevbuavbua

TvuH

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

Page 42: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

(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:

),(

),(),(

),(

),(),(ˆ

vuH

vuNvuF

vuH

vuGvuF

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 43: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

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 44: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

(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

vuH

vuH

vuGvuSvuSvuH

vuH

vuGvuSvuHvuS

vuSvuHvuF

f

f

f

f

Wiener Filter Formula:

where

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

Page 45: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

Approximation of Wiener FilterApproximation of Wiener Filter

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

),(

),(

1),(ˆ

2

2

vuGvuSvuSvuH

vuH

vuHvuF

f

Wiener Filter Formula:

Approximated Formula:

),(),(

),(

),(

1),(ˆ

2

2

vuGKvuH

vuH

vuHvuF

Difficult to estimate

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

Page 46: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

Wiener Filter: Example Wiener Filter: Example

Original image

Blurred imageDue to Turbulence

Result of the full inverse filter

Result of the inverse filter with D0=70

Result of the full Wiener filter

Page 47: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

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 48: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

(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 49: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

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

where

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

010

141

010

where www T2

Page 50: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

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 51: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

Constrained Least Squares Filter: Example (cont.) Constrained Least Squares Filter: Example (cont.)

Image degradedby motion blur +AWGN

Result of theConstrainedLeast square filter

Result of theWiener filter

2=650

2=325

2=130

Page 52: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

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 53: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

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 54: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

(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 55: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

Geometric Mean filter Geometric Mean filter

),(

),(

),(),(

),(

),(

),(),(ˆ

1

2

*

2

*

vuG

vuS

vuSvuH

vuH

vuH

vuHvuF

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 56: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

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 57: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

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 58: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

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

Spatial TransformationSpatial Transformation To 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 need to know 4 pairs of coordinates and its correspondingwhich are called tiepoints.

),( yx ),( yx

Page 59: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

(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 60: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

Geometric Distortion and Restoration ExampleGeometric Distortion and Restoration Example

Original image and tiepoints

Tiepoints of distortedimage

Distorted image Restored image

Use nearestneighbor intepolation

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

Page 61: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

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

Original image and tiepoints

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 62: Digital Image Processing Chapter 5: Image Restoration 23 June 2006 Digital Image Processing Chapter 5: Image Restoration 23 June 2006

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.as in the previousexample