image restoration 影像復原 - diunitofarid/teaching/dip/liu - ch 5 - image restoration and... ·...

62
Image Restoration 影像復原 Spring 2005, Jen-Chang Liu

Upload: others

Post on 02-Aug-2020

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

Image Restoration 影像復原

Spring 2005, Jen-Chang Liu

Page 2: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

Outline A model of the image degradation / restoration

process Noise models Restoration in the presence of noise only – spatial

filtering Periodic noise reduction by frequency domain

filtering Linear, position-invariant degradations Estimating the degradation function Inverse filtering

Page 3: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

A model of the image degradation/restoration process

g(x,y)=f(x,y)*h(x,y)+η(x,y)

G(u,v)=F(u,v)H(u,v)+N(u,v)

Page 4: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

Noise models 雜訊模型

Source of noise Image acquisition (digitization) Image transmission

Spatial properties of noise Statistical behavior of the gray-level values of

pixels correlation with the image

Frequency properties of noise Fourier spectrum e.g., white noise (a constant Fourier spectrum)

Page 5: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

Noise probability density functions

Noises are taken as random variables Random variables

Probability density function (PDF)

Page 6: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

Gaussian noise Math. tractability in spatial and frequency

domain Electronic circuit noise and sensor noise

22 2/)(

21)( σµ

σπ−−= zezp

mean variance

∫∞

∞−

=1)( dzzpNote:

Page 7: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

Gaussian noise (PDF)

70% in [(µ−σ), (µ+σ)]95% in [(µ−2σ), (µ+2σ)]

Page 8: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

Uniform noise

≤≤

−=otherwise 0

if 1)( bza

abzp

12)(

22

2 ab

ba

−=

+=

σ

µMean:

Variance:

Less practical, used for random number generator

Page 9: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

Uniform PDF

Page 10: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

Impulse (salt-and-pepper) nosie

==

=otherwise 0for for

)( bzPazP

zp b

a

If either Pa or Pb is zero, it is called unipolar.Otherwise, it is called bipoloar.

•In practical, impulses are usually stronger than imagesignals. Ex., a=0(black) and b=255(white) in 8-bit image.

Quick transients, such as faulty switching during imaging

Page 11: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

Impulse (salt-and-pepper) nosie PDF

Page 12: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

14-May-18 12

Rayleigh Noise

2( ) /

The PDF of Rayleigh noise is given by2 ( ) for

( )0 for

z a bz a e z ap z b

z a

− − − ≥= <

2

The mean and variance of this density are given by

/ 4(4 )

4

z a bb

ππσ

= +−

=

Page 13: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

14-May-18 13

Rayleigh Noise

Page 14: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

14-May-18 14

Erlang (Gamma) Noise

1

The PDF of Erlang noise is given by

for 0 ( ) ( 1)!

0 for

b baza z e z

p z bz a

−−

≥= − <

2 2

The mean and variance of this density are given by

/ /

z b ab aσ

=

=

Page 15: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

14-May-18 15

Erlang (Gamma) Noise

Page 16: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

14-May-18 16

Exponential Noise

The PDF of exponential noise is given by

for 0 ( )

0 for

azae zp z

z a

− ≥=

<

2 2

The mean and variance of this density are given by

1/ 1/

z aaσ

=

=

Page 17: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

14-May-18 17

Exponential Noise

Page 18: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

14-May-18 18

Page 19: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

Test for noise behavior Test pattern

Its histogram:

0 255

Page 20: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

14-May-18 20

Page 21: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

14-May-18 21

Examples of Noise: Noisy Images(2)

Page 22: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

Periodic noise Arise from electrical or electromechanical

interference during image acquisition Spatial dependence Observed in the frequency domain

Page 23: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

Sinusoidal noise:Complex conjugatepair in frequencydomain

Page 24: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

Estimation of noise parameters Periodic noise

Observe the frequency spectrum Random noise with unknown PDFs

Case 1: imaging system is available Capture images of “flat” environment

Case 2: noisy images available Take a strip from constant area Draw the histogram and observe it Measure the mean and variance

Page 25: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

Observe the histogram

Gaussian uniform

Page 26: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

Histogram is an estimate of PDF

Measure the mean and variance

∑∈

=Sz

iii

zpz )(µ

∑∈

−=Sz

iii

zpz )()( 22 µσ

Gaussian: µ, σUniform: a, b

Page 27: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

Outline A model of the image degradation / restoration

process Noise models Restoration in the presence of noise only – spatial

filtering Periodic noise reduction by frequency domain

filtering Linear, position-invariant degradations Estimating the degradation function Inverse filtering

Page 28: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

Additive noise only

g(x,y)=f(x,y)+η(x,y)

G(u,v)=F(u,v)+N(u,v)

Page 29: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

Spatial filters for de-noising additive noise

Skills similar to image enhancement Mean filters Order-statistics filters Adaptive filters

Page 30: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

Mean filters Arithmetic mean

Geometric mean

∑∈

=xySts

tsgmn

yxf),(

),(1),(ˆ

Window centered at (x,y)

mn

Ststsgyxf

xy

/1

),(),(),(ˆ

∏=

Page 31: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

original NoisyGaussian

µ=0σ=20

Arith.mean

Geometricmean

Page 32: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

Mean filters (cont.) Harmonic mean filter

Contra-harmonic mean filter

+

=

xy

xy

Sts

QSts

Q

tsg

tsgyxf

),(

),(

1

),(

),(),(ˆ

∑∈

=

xySts tsg

mnyxf

),( ),(1),(ˆ

Q=-1, harmonic

Q=0, airth. mean

Page 33: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

PepperNoise黑點

SaltNoise白點

Contra-harmonicQ=1.5

Contra-harmonic

Q=-1.5

Page 34: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

Wrong sign in contra-harmonic filtering

Q=-1.5 Q=1.5

Page 35: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

Order-statistics filters Based on the ordering(ranking) of pixels

Suitable for unipolar or bipolar noise (salt and pepper noise)

Median filters Max/min filters Midpoint filters Alpha-trimmed mean filters

Page 36: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

Order-statistics filters Median filter

Max/min filters

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

tsgmedianyxfxySts ∈

=

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

tsgyxfxySts ∈

=

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

tsgyxfxySts ∈

=

Page 37: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

bipolarNoisePa = 0.1Pb = 0.1

3x3Median

FilterPass 1

3x3MedianFilterPass 2

3x3Median

FilterPass 3

Page 38: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

Peppernoise

Saltnoise

Maxfilter

Minfilter

Page 39: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

Order-statistics filters (cont.) Midpoint filter

Alpha-trimmed mean filter Delete the d/2 lowest and d/2 highest gray-level

pixels

+=

∈∈)},({min)},({max

21),(ˆ

),(),(tsgtsgyxf

xyxy StsSts

∑∈−

=xySts

r tsgdmn

yxf),(

),(1),(ˆMiddle (mn-d) pixels

Page 40: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

Uniform noiseµ=0σ2=800

Left +Bipolar NoisePa = 0.1Pb = 0.1

5x5Arith. Mean

filter

5x5Geometric

mean

5x5Medianfilter

5x5Alpha-trim.

Filterd=5

Page 41: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

Adaptive filters Adapted to the behavior based on the

statistical characteristics of the image inside the filter region Sxy

Improved performance v.s increased complexity

Example: Adaptive local noise reduction filter

Page 42: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

Adaptive local noise reduction filter

Simplest statistical measurement Mean and variance

Known parameters on local region Sxy g(x,y): noisy image pixel value σ2

η: noise variance (assume known a prior) mL : local mean σ2

L : local variance

Page 43: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

Adaptive local noise reduction filter (cont.)

Analysis: we want to do If σ2

η is zero, return g(x,y) If σ2

L> σ2η , return value close to g(x,y)

If σ2L= σ2

η , return the arithmetic mean mL

Formula

[ ]LL

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

2

σση

Page 44: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

µ=0σ2=1000

Gaussiannoise Arith.

mean7x7

Geometricmean7x7

adaptive

Page 45: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

Outline A model of the image degradation / restoration

process Noise models Restoration in the presence of noise only – spatial

filtering Periodic noise reduction by frequency domain

filtering Linear, position-invariant degradations Estimating the degradation function Inverse filtering

Page 46: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

Periodic noise reduction (cont.) Bandreject filters Bandpass filters Notch filters Optimum notch filtering

Page 47: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

Bandreject filters

* Reject an isotropic frequency

ideal Butterworth Gaussian

Page 48: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

noisy spectrum

bandreject

filtered

Page 49: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

Bandpass filters Hbp(u,v)=1- Hbr(u,v)

{ }),(),(1 vuHvuG bp−ℑ

Page 50: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

Notch filters Reject(or pass) frequencies in predefined

neighborhoods about a center frequency

ideal

Butterworth Gaussian

Page 51: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

HorizontalScan lines

NotchpassDFT

Notchpass

Notchreject

Page 52: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

Outline A model of the image degradation / restoration

process Noise models Restoration in the presence of noise only – spatial

filtering Periodic noise reduction by frequency domain

filtering Linear, position-invariant degradations Estimating the degradation function Inverse filtering

Page 53: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

A model of the image degradation /restoration process

g(x,y)=f(x,y)*h(x,y)+η(x,y)

G(u,v)=F(u,v)H(u,v)+N(u,v)

If linear, position-invariant system

Page 54: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

Linear, position-invariant degradation

Linear system H[af1(x,y)+bf2(x,y)]=aH[f1(x,y)]+bH[f2(x,y)]

Position(space)-invariant system H[f(x,y)]=g(x,y) H[f(x-α, y-β)]=g(x-α, y-β)

Properties of the degradation function H

Page 55: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

Estimating the degradation function

1. Estimation by Image observation2. Estimation by experimentation3. Estimation by modeling

Page 56: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

Estimation by image observation

Take a window in the image Simple structure Strong signal content

Estimate the original image in the window

),(ˆ),(),(

vuFvuGvuH

s

ss =

known

estimate

Page 57: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

Estimation by experimentation If the image acquisition system is ready Obtain the impulse response

impulse Impulse response

Page 58: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

Estimation by modeling (1) Ex. Atmospheric model

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

original k=0.0025

k=0.001 k=0.00025

Page 59: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

Estimation by modeling (2) Derive a mathematical model Ex. Motion of image

∫ −−=T

dttyytxxfyxg0 00 ))(),((),(

Planar motionFouriertransform

∫ +−=T tvytuxj dtevuFvuG0

)]()([2 00),(),( π

Page 60: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

Estimation by modeling: example

original Apply motion model

Page 61: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

Inverse filtering With the estimated degradation function

H(u,v)G(u,v)=F(u,v)H(u,v)+N(u,v)

=>),(),(),(

),(),(),(ˆ

vuHvuNvuF

vuHvuGvuF +==

Estimate oforiginal image

Problem: 0 or small values

Unknownnoise

Sol: limit the frequency around the origin

Page 62: Image Restoration 影像復原 - DiUniTofarid/teaching/DIP/Liu - Ch 5 - Image Restoration and... · A model of the image degradation / restoration process Noise models Restoration

Fullinversefilterfor

CutOutside40%

CutOutside70%

CutOutside85%

k=0.0025