chapter 5: image restoration - kasetsart universityjan/204584/05-image_restoration..pdfimage...

79
Digital Image Processing Chapter 5: Digital Image Processing Chapter 5: Chapter 5: Image Restoration Chapter 5: Image Restoration Image Restoration Image Restoration

Upload: others

Post on 31-May-2020

9 views

Category:

Documents


0 download

TRANSCRIPT

Page 1:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

Digital Image ProcessingChapter 5:

Digital Image ProcessingChapter 5: Chapter 5:

Image RestorationChapter 5:

Image RestorationImage RestorationImage Restoration

Page 2:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

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 η+∗=

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

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

Page 3:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

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

Concept of Image Restoration Concept of Image Restoration ),(),(),(),( yxyxhyxfyxg η+∗

We can perform the same operations in the frequency domain where convolution is replaced by multiplicationdomain, where convolution is replaced by multiplication, and addition remains as addition, because of the linearity of the Fourier transform.

),(),(),(),( vuNvuHvuFvuG +=If we knew the values of H and N we could recover F by writing the above equation as

),()()( vuNvuGvuF −=),(

),(),(vuH

vuGvuF =

However, as we shall see, this approach may not be practical. Even though we may have some statistical information about the noise, we will not know the value of n(x,y) or N(u,v) for all, or

l A ll di idi b H(i j) ill diff ltieven any, values. As well, dividing by H(i,j) will cause diffulties if there are values which are close to, or equal to, zero.

Page 4:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

NoiseNoise

W d fi i b d d i i h i i lWe may define noise to be any degradation in the image signal, caused by external disturbance. If an image is being sent electronically from one place to another via satellite or wirelesselectronically from one place to another, via satellite or wireless transmission, or through networked cable, we may expect errors to occur in the image signal. These errors will appear on the image g g pp goutput in different ways depending on the type of disturbance in the signal.

Usually we know what type of errors to expect, and hence the type of noise on the image; hence we can choose the most appropriateof noise on the image; hence we can choose the most appropriate method for reducing the effects. Cleaning an image corrupted bynoise is thus an important area of image restoration.g

We will investigate some of the standard noise forms, and the diff t th d f li i ti d i th i ff t thdifferent methods of eliminating or reducing their effects on the image.

Page 5:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

Salt and pepper noiseSalt and pepper noise

Al ll d i l i h t i bi i Thi d d ti bAlso called impulse noise, shot noise, or binary noise. This degradation can be caused by sharp, sudden disturbances in the image signal; its appearance is randomly scattered white or black (or both) pixels over the image. To add noise, we use the Matlab function imnoise, which takes a number of different parameters. To add salt and pepper noise:>> cameraman=imread('cameraman.tif');>> figure;imshow(cameraman);>> cameraman_sp=imnoise(cameraman,'salt & pepper');>> figure;imshow(cameraman_sp);to add more or less noise we include an optional parameter, being a value between 0 and 1 indicating the fraction of pixels to be corrupted. Thus,for example>> cameraman_sp20=imnoise(cameraman,'salt & pepper',0.2);

fi i h ( 20)>> figure;imshow(cameraman_sp20);

Page 6:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

Gaussian noiseGaussian noise

G i i i id li d f f hi i hi h iGaussian noise is an idealized form of white noise, which is caused by random fluctuations in the signal. We can observe white

noise by watching a television which is slightly mistuned to anoise by watching a television which is slightly mistuned to a particular channel. Gaussian noise is white noise which is normally distributed. If the image is represented as I, and the y g pGaussian noise by N, then we can model a noisy image by simply adding the two: I + N>> i i ( ‘ i ')>> cameraman_gn=imnoise(cameraman,‘gaussian');>> figure;imshow(cameraman_gn);The gaussian parameter also can take optional values, giving the mean and variance of the noise. The default values are 0 and 0.1

Page 7:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

Speckle noiseSpeckle noise

Wh G i i b d ll d b d l dd dWhereas Gaussian noise can be modelled by random values added to an image; speckle noise (or more simply just speckle) can be modelled by random values multiplied by pixel values hence it ismodelled by random values multiplied by pixel values, hence it isalso called multiplicative noise. Speckle noise is a major problem in some radar applications. As above, imnoise can do speckle:pp p>> cameraman_spk=imnoise(cameraman,'speckle');>> figure;imshow(cameraman_spk);In Matlab, speckle noise is implemented as I(1 + N)In Matlab, speckle noise is implemented as I(1 N)Although Gaussian noise and speckle noise appear superficially similar, they are formed by two totally different methods, and, as we shall see, require different approaches for their removaldifferent approaches for their removal.

Page 8:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

Periodic noisePeriodic noise

If h i i l i bj i di h h dIf the image signal is subject to a periodic, rather than a random disturbance, we might obtain an image corrupted by periodic noise The effect is of bars over the image The function imnoisenoise. The effect is of bars over the image. The function imnoise does not have a periodic option, but it is quite easy to create, by adding a periodic matrix (using a trigonometric function), to an g p ( g g )image:>> s=size(cameraman);>> [x y]=meshgrid(1:s(1) 1:s(2));>> [x,y]=meshgrid(1:s(1),1:s(2));>> p=sin(x/3+y/5)+1;>> cameraman_pn=(im2double(cameraman)+p/2)/2;>> fi i h ( )>> figure;imshow(cameraman_pn)

Salt and pepper noise, Gaussian noise and speckle noise can all be cleaned by using spatial filtering techniques Periodicall be cleaned by using spatial filtering techniques. Periodic noise, however, requires the use of frequency

domain filtering. This is because whereas the other forms of i b d ll d l l d d ti i di i inoise can be modelled as local degradations, periodic noise is

a global effect.

Page 9:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

Noise Models Noise Models

N i t b di t d b t b i t l d ib d iNoise cannot be predicted but can be approximately described instatistical way using the probability density function (PDF)

Gaussian noise:22 2/)(

21)( σμ−−= zezp

2)(

πσp

Rayleigh noise⎧2

⎪⎩

⎪⎨⎧

<

≥−=−−

azfor0

for )(2)(

/)( 2

azeazbzp

baz

⎪⎩ < azfor 0

Erlang (Gamma) noise⎧

⎪⎩

⎪⎨⎧

≥−−=

−−

0f0

0for )()!1()(1

zeazb

zazp

azbb

⎪⎩ < 0zfor 0

Page 10:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

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

Exponential noiseazaezp −=)(

Uniform noise

aezp =)(

⎪⎩

⎪⎨⎧ ≤≤=

h i0

afor a-b

1)( bzzp

I l ( lt & ) i

⎪⎩ otherwise 0

Impulse (salt & pepper) noise

⎧ =for azP

⎪⎩

⎪⎨

⎧==

otherwise0for for

)( bzPazP

zp b

a

⎩ otherwise 0

Page 11:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

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

PDF tells how mucheach z value occurs.

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

Page 12:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

Image Degradation with Additive Noise Image Degradation with Additive Noise

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

Degraded images

Original image

Histogram

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

Page 13:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

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

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

Degraded images

Original image

Histogram

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

Page 14:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

Estimation of Noise Estimation of Noise

We cannot use the image ghistogram to estimate noise PDF.

It i b tt t thIt is better to use the histogram of one areaof an image that hasof an image that has constant intensity to estimate noise PDF.

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

Page 15:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

Periodic Noise Periodic Noise

Periodic noisePeriodic noise looks like dotsIn the frequency

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

domain

Page 16:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

Periodic Noise Periodic Noise

Page 17:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

Periodic Noise Periodic Noise

Page 18:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

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

Degraded image DFTPeriodic noisecan be red ced bcan be reduced bysetting frequencycomponentscomponentscorresponding to noise to zero.

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

Band reject filter Restored image

Page 19:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

Band Reject Filters Band Reject Filters

U t li i t f t i b dUse to eliminate frequency components in some bands

Periodic noise from theprevious slide that is Fil dFiltered out.

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

Page 20:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

Notch Reject Filters Notch Reject Filters

A t h j t filt i d t li i t f tA notch reject filter is used to eliminate some frequency components.

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

Page 21:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

Notch Reject Filter: Notch Reject Filter: Notch filter

Degraded image DFT (freq. Domain)

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

Page 22:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

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

DFT( hift)(no shift)

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

Restored imageNoiseDFT of noise

Page 23:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

Mean Filters Mean Filters Degradation model:g

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

To remove this part

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

1 ∑∈

=xySts

tsgmn

yxf),(

),(1),(ˆy

Geometric mean filter mn = size of moving window

mn

tsgyxf

1

)()(ˆ⎟⎟⎞

⎜⎜⎛

= ∏Sts xy

tsgyxf),(

),(),( ⎟⎟⎠

⎜⎜⎝

= ∏∈

Page 24:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

Geometric Mean Filter: Example Geometric Mean Filter: Example

Original Image d

O gimage corrupted

by AWGN

Image Image gobtained

using a 3x3t i

Image obtained

using a 3x3geometric mean filter

arithmetic mean filter

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.AWGN: Additive White Gaussian Noise

Page 25:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

Harmonic and Contraharmonic FiltersHarmonic and Contraharmonic FiltersHarmonic mean filterHarmonic mean filter

=mnyxf ),(ˆ

W k ll f lt i∑

∈ xySts tsg

yxf

),( ),(1),( Works well for salt noise

but fails for pepper noise∈ xySts g),( ),(

Contraharmonic mean filter mn = size of moving window

∑∈

+

Sts

Qtsg)(

1),(ˆ

Positive Q is suitable for li i ti i

∑∈= xy

St

QSts

tsgyxf

)(

),(

),(),( eliminating pepper noise.

Negative Q is suitable for eliminating salt noise.∈ xySts ),(

Q = the filter order

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 26:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

Contraharmonic Filters: ExampleContraharmonic Filters: Example

Image corrupted b

Image corrupted

by pepper noise with prob = 0 1

by salt noise with

b 0 1prob. 0.1 prob. = 0.1

Image obtained

Image obtained

using a 3x3contra-

harmonic

using a 3x3contra-

harmonicharmonic mean filter

With Q = 1.5

harmonic mean filter

With Q=-1.5

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

Q Q

Page 27:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

Contraharmonic Filters: Incorrect Use ExampleContraharmonic Filters: Incorrect Use Example

Image corrupted b

Image corrupted

by pepper noise with prob = 0 1

by salt noise with

b 0 1prob. 0.1 prob. = 0.1

Image obtained

Image obtained

using a 3x3contra-

harmonic

using a 3x3contra-

harmonicharmonic mean filter

With Q=-1.5

harmonic mean filterWith Q=1.5

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

Q Q

Page 28:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

OrderOrder--Statistic Filters: RevisitStatistic Filters: RevisitOriginal image

subimageOriginal image

Statistic parametersM M di M dMean, Median, Mode, Min, Max, Etc.

Moving windowwindow

Output image

Page 29:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

OrderOrder--Statistics FiltersStatistics Filters

M di filtMedian filter

{ }),(median),(ˆ tsgyxf = { }),(ed a),(),(

gyfxySts ∈

Max filter

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

tsgyxfxySts ∈

= Reduce “dark” noise(pepper noise))( xy

Min filter

{ }ˆ

(pepper noise)

R d “b i h ” i{ }),(min),(),(

tsgyxfxySts ∈

= Reduce “bright” noise(salt noise)

Midpoint filter

{ } { }⎟⎞

⎜⎛ )()(1)(f̂ { } { }⎟

⎞⎜⎝

⎛ +=∈∈

),(min),(max2),(

),(),(tsgtsgyxf

xyxy StsSts

Page 30:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

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

Salt noisePepper noisePepper noiseMedian

Degraded image MovingSorted arrayDegraded image

Salt noise

Movingwindow

array

Filter outputPepper noise

Normally, impulse noise has high magnitudeand is isolated When we sort pixels in theand 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 31:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

Median Filter : Example Median Filter : Example 1 2

Image corrupted b lby salt-

and-pepper noise withnoise with pa=pb= 0.1

43

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

Images obtained using a 3x3 median filter

Page 32:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

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

Image corrupted b

Image corrupted

by pepper noise with prob = 0 1

by salt noise with

b 0 1prob. 0.1 prob. = 0.1

Image obtained

Image obtained

using a 3x3max filter

using a 3x3min filter

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

Page 33:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

AlphaAlpha--trimmed Mean Filtertrimmed Mean Filter

1

Formula:

∑∈−

=xySts

r tsgdmn

yxf),(

),(1),(ˆy

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

Total mn pixels

d/2 d/2Lowest Gray Level

HighestGray Level

Total mn pixels

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

Page 34:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

AlphaAlpha--trimmed Mean Filter: Exampletrimmed Mean Filter: ExampleImage1 2

Image d

Image additionallycorrupted

corrupted by additiveuniform

pby additivesalt-and-

uniform noise

pepper noise

Image 2 Image 2gobtained

using a 5x5ith ti

obtained using a 5x5geometricarithmetic

mean filtergeometric mean filter

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

Page 35:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

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

Image d

Image additionallycorrupted

corrupted by additiveuniform

pby additivesalt-and-

uniform noise

pepper noise

Image 2Image obtained

2g

obtained using a 5x5

di filt

using a 5x5alpha-

trimmedmedian filter trimmed mean filterwith d = 5

Page 36:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

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

Image obtained i 5 5

Image obtained i 5 5using a 5x5

arithmetic mean filter

using a 5x5geometric mean filtermean filter mean filter

Image Image obtained g

obtained using a 5x5

di filt

using a 5x5alpha-

trimmedmedian filter trimmed mean filterwith d = 5

Page 37:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

Adaptive FilterAdaptive Filter

G l t

-Filter behavior depends on statistical characteristics of local areas i id i i d

General concept:

inside mxn moving window

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

Statistical characteristics:

∑= tsgm )(1Local mean:

Noise variance:

∑∈

=xySts

L tsgmn

m),(

),(

Local variance:

ησ

Local variance:

∑ −= LL mtsg 22 )),((1σ ∑∈ xySts

LL gmn ),(

)),((

Page 38:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

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

Concept:

1. If ση2 is zero, No noisethe filter should return g(x,y) because g(x,y) = f(x,y)the 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 σ 2 = σ 2 Areas inside objects3. If σL2 = ση

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

Formula:

( )myxgyxgyxf )()()(ˆ2ση

Formula:

( )LL

myxgyxgyxf −−= ),(),(),( 2ση

Page 39:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

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

I IImage corrupted by additive

Imageobtained

using a 7x7by additiveGaussian noise with

using a 7x7arithmeticmean filter

zero meanand σ2=1000

Imageobtained

Imageobtained sing a 7 7obtained

using a 7x7geometric

using a 7x7adaptive

noisegmean filter

noise reduction

filter

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

Page 40:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

Adaptive Median Filter Adaptive Median Filter Purpose: want to remove impulse noise while preserving edges

Algorithm:Level A: A1= zmedian – zminA2

Purpose: want to remove impulse noise while preserving edges

A2= zmedian – zmaxIf A1 > 0 and A2 < 0, goto level BElse increase window sizeElse increase window size

If window size <= Smax repeat level AElse return zxyy

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

z = minimum gray level value in Swhere zmin = minimum gray level value in Sxyzmax = maximum gray level value in Sxyzmedian = median of gray levels in Sxy

where

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

Page 41:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

L l A A1

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

D iLevel A: A1= zmedian – zminA2= zmedian – zmax

If A1 > 0 d A2 < 0 t l l B

Determine whether zmedianis an impulse or not

Else Window is not big enoughincrease window size

If A1 > 0 and A2 < 0, goto level B is an impulse or not

increase window sizeIf window size <= Smax repeat level A

Else return zxyy

zmedian is not an impulseLevel B:Determine

B1= zxy – zminB2= zxy – zmax

Determine whether zxyis an impulse or noty

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

ElElse return zmedian to remove impulse

Page 42:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

Adaptive Median Filter: Example Adaptive Median Filter: Example

Image corrupted by salt-and-pepper

Image obtained using a 7x7

Image obtained using an adaptive

noise with pa=pb= 0.25

median filter median filter withSmax = 7

More small details are preserved

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

Page 43:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

Estimation of Degradation Model Estimation of Degradation Model Degradation model:Degradation model:

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

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

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

Wh ? If k l h( ) dl f i dWhy? If we know exactly h(x,y), regardless of noise, we can do deconvolution to get f(x,y) back from g(x,y).

Methods:1. Estimation by Image Observation

2. Estimation by Experiment

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

3. Estimation by Modeling

Page 44:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

Estimation by Image ObservationEstimation by Image ObservationOriginal image (unknown) Degraded image

f( ) f( )*h( ) ( )

Original image (unknown) Degraded image

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

Observation

Subimage),( vuGs )( yxg

DFTEstimated Transfer ),(s ),( yxgs

Restorationprocess by

ˆ),()()( vuGvuHvuH s=≈

function

Reconstructedbi

DFT)(ˆ vuF

p ocess byestimation),(ˆ),(),(

vuFvuHvuH

ss≈

This case is used when weSubimage

),(ˆ yxfs

),( vuFsknow only g(x,y) and cannot repeat the experiment!

Page 45:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

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

experiment.Input impulse image

Response image fromthe systemInput impulse image the system

SystemH( )H( )

),( yxg),( yxAδ

DFTDFT

),( vuG{ } AyxADFT =),(δ

AvuGvuH ),(),( =

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

Page 46:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

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

formation process that can be expressed mathematically.

Example:O i i l i S t b l

AtmosphericT b l d l

Example:Original image Severe turbulence

Turbulence model6/522 )(),( vukevuH +−=)(

k = 0.0025

Low turbulenceMild turbulence Low turbulenceMild turbulence

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

k = 0.00025k = 0.001

Page 47:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

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

T

dttyytxxfyxgT

))(),((),( 000

++= ∫h iwhere T = exposure time.

d dG vyuxj∫ ∫∞ ∞

+− )(2)()( π dxdyeyxgvuG

T

vyuxj∫ ∫⎤⎡

=

∞ ∞

∞− ∞−

+ )(2),(),( π

dxdyedttyytxxf vyuxj∫ ∫ ∫⎤⎡

⎥⎦

⎤⎢⎣

⎡++=

∞− ∞−

+− )(2

000 ))(),(( π

dtdxdyetyytxxfT

vyuxj∫ ∫ ∫ ⎥⎦

⎤⎢⎣

⎡++=

∞−

∞−

+−

0

)(200 ))(),(( π

Page 48:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

Estimation by Modeling: Motion Blurring (cont.)Estimation by Modeling: Motion Blurring (cont.)T ∞ ∞ ⎤⎡

dtdxdyetyytxxfvuG vyuxj∫ ∫ ∫∞− ∞−

+−⎥⎦

⎤⎢⎣

⎡++=

0

)(200 ))(),(( ),( π

[ ]dtevuFT

tvytuxj∫ +−=0

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

dtevuFT

tvytuxj∫ +−=0

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

0

Then we get, the motion blurring transfer function:T

dtevuH tvytuxj∫ +−=0

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

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

)()(2 ))(i ()( vbuajT

vbuaj bTdH ++∫ ππ )(

0

)(2 ))(sin()(

),( vbuajvbuaj evbuavbua

TdtevuH +−+− ++

== ∫ ππ ππ

Page 49:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

Motion Blurring ExampleMotion Blurring ExampleFor constant motionFor constant motion

)())(sin()(

),( vbuajevbuab

TvuH +−++

= πππ )( vbua +π

Original image Motion blurred imagea = b = 0 1 T = 1

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

a = b = 0.1, T = 1

Page 50:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

Motion Blur in Motion Blur in MatlabMatlab>> f=checkerboard(8);>> f=checkerboard(8);>> PSF=fspecial('motion',7,45);>> PSF

PSF =

0 0 0 0 0 0.0145 00 0 0 0 0 0376 0 1283 0 01450 0 0 0 0.0376 0.1283 0.01450 0 0 0.0376 0.1283 0.0376 00 0 0.0376 0.1283 0.0376 0 00 0.0376 0.1283 0.0376 0 0 0

0.0145 0.1283 0.0376 0 0 0 00 0 0145 0 0 0 0 00 0.0145 0 0 0 0 0

>> gb= imfilter(f PSF 'circular');

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

>> gb imfilter(f,PSF, circular );>> imshow(f);figure;imshow(gb);

Page 51:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

Inverse Filter Inverse Filter From degradation model:From degradation model:

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

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

),(),(),(

),(),(),(ˆ

vuHvuNvuF

vuHvuGvuF +==

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

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

In practical, the inverse filter is notPopularly used.

Page 52:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

Inverse Filter Inverse Filter

i d(' if')>> w=imread('cameraman.tif');;>> wf=fftshift(fft2(w));>> b=lbutter(256 256 15 2);>> b=lbutter(256,256,15,2);>> wb=wf.*b;

% image degraded>> wba=abs(ifft2(fftshift(wb)));

b i 8(255* 2 ( b ))>> wba=uint8(255*mat2gray(wba));>> figure;imshow(wba);

% recover>> w1=fftshift(fft2(wba))./b;>> w1a=abs(ifft2(fftshift(w1)));>> fi i h ( t2 ( 1 ))

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

>> figure;imshow(mat2gray(w1a));

Page 53:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

Inverse Filter: Example Inverse Filter: Example

Original imageResult of applying

the full filterResult of applying

the filter with D0=40

Blurred imageDue to Turbulence

Result of applyingthe filter with D0=70

Result of applyingthe filter with D0=85

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

Due to Turbulence the filter with D0 70 the filter with D0 85

Page 54:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

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

⎤⎡

Wiener Filter Formula:

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

),(),(),(ˆ

2

*

vuGvuSvuHvuS

vuSvuHvuF

f

f

⎥⎥⎦

⎢⎢⎣

+=

η

),()(/)()(

),( 2

*

vuGSSH

vuH

f

⎥⎥⎤

⎢⎢⎡

=

⎦⎣ η

)(),(1

),(/),(),(2

2

GvuH

vuSvuSvuH f

⎥⎤

⎢⎡

⎥⎦⎢⎣ + η

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

),(),(

1 2 vuGvuSvuSvuHvuH f ⎥

⎥⎦⎢

⎢⎣ +

wherewhereH(u,v) = Degradation functionS (u v) = Power spectrum of noise

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

Sη(u,v) Power spectrum of noiseSf(u,v) = Power spectrum of the undegraded image

Page 55:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

Approximation of Wiener FilterApproximation of Wiener FilterWiener Filter Formula:

),(),(1),(ˆ

2

2

vuGvuH

vuF ⎥⎤

⎢⎡

=

Wiener Filter Formula:

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

),( 2 vuSvuSvuHvuH f ⎥⎥⎦⎢

⎢⎣ + η

Approximated Formula:Difficult to estimate

),()(

),()(

1),(ˆ2

2

vuGKvuH

vuHvuH

vuF⎥⎥⎦

⎢⎢⎣

+=

),(),( KvuHvuH ⎥⎦⎢⎣ +

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

Page 56:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

Wiener Filter: Example Wiener Filter: Example

Original imageResult of the

full inverse filterResult of the inverse

filter with D0=70 0

Blurred imageDue to Turbulence

Result of the full Wiener filterDue to Turbulence full Wiener filter

Page 57:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

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

Original imageResult of the inverse

filter with D0=70 g g 0

Result of the Wi fil

Blurred imageD T b l Wiener filterDue to Turbulence

Page 58:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

Example: Wiener Filter and Motion Blurring Example: Wiener Filter and Motion Blurring Image Result of the Result of theImage degradedby motion

Result of theinverse filter

Result of theWiener filter

yblur +AWGN ση

2=650η

ση2=325

Note: K is chosenmanually

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

ση2=130

Page 59:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

Degradation model: W itt i t i f

Constrained Least Squares Filter Constrained Least Squares Filter Degradation model:

),(),(),(),( yxyxhyxfyxg η+∗=Written in a matrix form

ηHfg +=

Objective: to find the minimum of a criterion function

[ ]∑∑− −

∇=1 1 22 )(

M N

yxfC [ ]∑∑= =

∇0 0

),(x y

yxfC

Subject to the constraint22ˆ ηfHg =−

We get a constrained least square filter

where www T=2

),()()(

),(),(ˆ22

*

vuGPHvuHvuF

⎥⎥⎤

⎢⎢⎡

=

We get a constrained least square filter

),(),( 22 vuPvuH ⎥⎦⎢⎣ + γ

where⎥⎤

⎢⎡ − 010

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

⎦⎢⎢⎢

⎣ −−−010141

Page 60:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

Constrained Least Squares Filter: Example Constrained Least Squares Filter: Example Constrained least square filter

),(),(),(ˆ22

*

vuGvuHvuF⎥⎥⎤

⎢⎢⎡

=

Constrained least square filter

),(),(),(

),( 22 vuPvuH ⎥⎥⎦⎢

⎢⎣ + γ

γ is adaptively adjusted to achieve the best result.

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

Page 61:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

Constrained Least Squares Filter: Example (cont.) Constrained Least Squares Filter: Example (cont.) Image Result of the Result of theImage degradedby motion

Result of theConstrainedLeast square

Result of theWiener filter

yblur +AWGN

qfilter

ση2=650η

ση2=325

ση2=130

Page 62:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

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

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

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

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

1

2. Compute 2r

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

1a−< 22 ηrOtherwise return step 2 after increasing γ if

or decreasing γ if

a< ηr

a+> 22 ηrUse the new value of γ to recompute

)(),()(ˆ*

vuGvuHvuF ⎥⎤

⎢⎡

= ),(),(),(

),( 22 vuGvuPvuH

vuF⎥⎥⎦⎢

⎢⎣ +

Page 63:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

Constrained Least Squares Filter:Adjusting Constrained Least Squares Filter:Adjusting γ γ (cont.)(cont.)* ⎤⎡

),(),(),(

),(),(ˆ22

*

vuGvuPvuH

vuHvuF⎥⎥⎦

⎢⎢⎣

+=

γ

),(ˆ),(),(),( vuFvuHvuGvuR −=2rFor computing

∑∑−

=

=

=1

0

1

0

22 ),(1 M

x

N

y

yxrMN

ry

∑∑− −

=1 1

)(1 M N

yxm η

[ ]∑∑− −1 1

22 1 M N

∑∑= =0 0

),(x y

yxMN

m ηη

2ηFor computing[ ]∑∑= =

−=0 0

22 ),(1x y

myxMN ηη ησ

[ ]

ηFor computing

[ ]ηησ mMN −= 22η

Page 64:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

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

O i i l i Use correct noiseOriginal image Correct parameters:Initial γ = 10-5

Correction factor = 10-6

Use correct noise parameters

Correction factor = 10 6

a = 0.25ση

2 = 10-5η

Blurred imageDue to Turbulence

Use wrong noise parameters

Wrong noise parameterσ 2 = 10-2ση = 10

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

Results obtained from constrained least square filters

Page 65:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

Geometric Mean filter Geometric Mean filter This filter represents a family of filters combined into a

1 α−⎤⎡

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

)(),(),()(ˆ

1

**

GvuHvuHF

α

α

⎥⎥⎤

⎢⎢⎡

⎥⎤

⎢⎡

),(

),(),(

),(

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

22 vuG

vuSvuS

vuHvuH

vuF

f

ηβ⎥⎥⎥⎥

⎦⎢⎢⎢⎢

⎣⎥⎦

⎤⎢⎣

⎡+⎥

⎥⎦⎢

⎢⎣

=

),( vuS f ⎥⎦⎢⎣ ⎦⎣

α = 1 the inverse filterα 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 66:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

Geometric TransformationGeometric Transformation

Th t f ti ft ll d bb h t t f tiThese 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.to some predefine set of rules.

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

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

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

Page 67:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

Spatial TransformationSpatial Transformation

Page 68:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

Spatial TransformationSpatial Transformation

One of the most commonly used forms of spatial transformations is affine transform which can be writtenaffine transform, which can be written.

This transfomation can scale, rotate, translate, or shear f i d di h l h f h l fa set of points, depending on the values chosen for the elements of

T, which can be create in Matlab :

Page 69:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

Spatial TransformationSpatial Transformation

Page 70:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

Spatial TransformationSpatial Transformation

Page 71:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

Image RegistrationImage Registration

I i i h d k li i f hImage registration method seek to align two images of the same scene . For example, it may be of interest to align two ore more images taken at roughly the same time but using differentimages taken at roughly the same time, but using different instruments, such an MRI scan and a PET scan.

Page 72:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

Image RegistrationImage Registration

Page 73:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

Geometric Transformation : AlgorithmGeometric Transformation : Algorithm

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

Distorted image gImage f to be t d

1 3

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

restored

( y) f2. Compute

),( yxrx =′ 4. get pixel value atBy gray level interpolation

),( yxg ′′

),( yxsy =′

3. Go to pixel ),( yx ′′

By gray level interpolation

5. store that value in pixel f(x,y)3. Go to pixel in a distorted image g

),( y

5

Page 74:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

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

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

For a bilinear transformation mapping between a pair of Quadrilateral regionsQuadrilateral regions

4321),( cxycycxcyxrx +++==′

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

To obtain r(x,y) and s(x,y), we needt k 4 i f di tto know 4 pairs of coordinates

and its correspondingwhich are called tiepoints

),( yx ′′),( yx

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

which are called tiepoints.

Page 75:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

Gray Level Interpolation: Nearest NeighborGray Level Interpolation: Nearest Neighbor

i b i di d)( ′′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

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

Page 76:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

Gray Level Interpolation: Bilinear interpolationGray Level Interpolation: Bilinear interpolation

Page 77:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

Geometric Distortion and Restoration ExampleGeometric Distortion and Restoration ExampleOriginal image and Tiepoints of distortedOriginal image and

tiepointsTiepoints of distorted

image

Distorted image Restored image

Use nearestneighborneighbor intepolation

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

Page 78:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

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

Original image and Tiepoints of distortedOriginal image andtiepoints

Tiepoints of distortedimage

Distorted image Restored image

Use bilinear i t l tiintepolation

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

Page 79:   Chapter 5: Image Restoration - Kasetsart Universityjan/204584/05-image_restoration..pdfImage corrupted y pepper noise with prob = 01 by salt noise with . 0.1 prob01b. = 0.1 Image

Example: Geometric RestorationExample: Geometric RestorationOriginal image Geometrically distortedOriginal image Geometrically distorted

Image

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

Restored image

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

Difference between 2 above images