Lect07 Image Restoration

Post on 17-Feb-2016

239 views 0 download

Tags:

description

Techniques for Image Restoration

Transcript of Lect07 Image Restoration

Digital Image Processing

Lecture # 07

Image Restoration

Digital Image Processing Lecture # 7 2

Outline

► Noise in the context of image processing

► Noise Modelling

► Noise removal techniques are typically used in image processing?

► Deblurring techniques are typically used in image processing?

Digital Image Processing Lecture # 7 3

Image Restoration

► Image restoration: recover an image that has been degraded by using a prior knowledge of the degradation phenomenon.

► Model the degradation and applying the inverse process in order to recover the original image.

Digital Image Processing Lecture # 7 4

A Model of Image Degradation/Restoration Process

Digital Image Processing Lecture # 7 5

A Model of Image Degradation/Restoration Process

If is a process, then

the degraded image is given in the spatial domain by

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

H linear, position-invariant

g x y h x y f x y x y

Digital Image Processing Lecture # 7 6

A Model of Image Degradation/Restoration Process

The model of the degraded image is given in

the frequency domain by

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

Digital Image Processing Lecture # 7 7

Noise Sources

► The principal sources of noise in digital images arise during image acquisition and/or transmission

Image acquisition

e.g., light levels, sensor temperature, etc.

Transmission

e.g., lightning or other atmospheric disturbance in wireless network

Digital Image Processing Lecture # 7 9

Noise Models (1)

Gaussian noiseElectronic circuit noise, sensor noise due to poor illumination and/or high temperature

Rayleigh noiseRange imaging

Erlang (gamma) noise: Laser imaging

Exponential noise: Laser imaging

Uniform noise: Least descriptive; Basis for numerous random number generators

Impulse noise: quick transients,

such as faulty switching

Digital Image Processing Lecture # 7 10

Digital Image Processing Lecture # 7 17

Gaussian Noise (1)

2 2( ) /2

The PDF of Gaussian random variable, z, is given by

1 ( )

2

z zp z e

where, represents intensity

is the mean (average) value of z

is the standard deviation

z

z

Digital Image Processing Lecture # 7 18

Gaussian Noise (2)

2 2( ) /2

The PDF of Gaussian random variable, z, is given by

1 ( )

2

z zp z e

70% of its values will be in the range

95% of its values will be in the range

)(),(

)2(),2(

Digital Image Processing Lecture # 7 19

Rayleigh Noise

2( ) /

The PDF of Rayleigh noise is given by

2( ) 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 b

b

Digital Image Processing Lecture # 7 20

Erlang (Gamma) Noise

1

The PDF of Erlang noise is given by

for 0 ( ) ( 1)!

0 for

b baza z

e zp z b

z a

2 2

The mean and variance of this density are given by

/

/

z b a

b a

Digital Image Processing Lecture # 7 21

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 a

a

Digital Image Processing Lecture # 7 22

Uniform Noise

The PDF of uniform noise is given by

1 for a

( )

0 otherwise

z bp z b a

2 2

The mean and variance of this density are given by

( ) / 2

( ) /12

z a b

b a

Digital Image Processing Lecture # 7 23

Impulse (Salt-and-Pepper) Noise

The PDF of (bipolar) impulse noise is given by

for

( ) for

0 otherwise

a

b

P z a

p z P z b

If either or is zero, the impulse noise is calleda bP P

unipolar

if , gray-level will appear as a light dot,

while level will appear like a dark dot.

b a b

a

Digital Image Processing Lecture # 7 24

Examples of Noise: Original Image

Digital Image Processing Lecture # 7 25

Examples of Noise: Noisy Images(1)

Digital Image Processing Lecture # 7 26

Examples of Noise: Noisy Images(2)

Digital Image Processing Lecture # 7 27

Effects of noise on

images and histograms

►Gaussian

► Exponential

► Impulse (salt-and-pepper)

Digital Image Processing Lecture # 7 28

Effects of noise on

images and histograms►Rayleigh

►Gamma (Erlang)

►Uniform

Digital Image Processing Lecture # 7 29

Periodic Noise

► Periodic noise in an image arises typically from electrical or electromechanical interference during image acquisition.

► It is a type of spatially dependent noise

► Periodic noise can be reduced significantly via frequency domain filtering

Digital Image Processing Lecture # 7 30

An Example of Periodic Noise

Digital Image Processing Lecture # 7 31

Noise estimation

Digital Image Processing Lecture # 7 32

Estimation of Noise Parameters (1)

The shape of the histogram identifies the closest PDF match

Digital Image Processing Lecture # 7 33

Estimation of Noise Parameters (2)

Consider a subimage denoted by , and let ( ), 0, 1, ..., -1,

denote the probability estimates of the intensities of the pixels in .

The mean and variance of the pixels in :

s iS p z i L

S

S

1

0

12 2

0

( )

and ( ) ( )

L

i s i

i

L

i s i

i

z z p z

z z p z

Digital Image Processing Lecture # 7 34

Restoration in the Presence of Noise Only

Spatial Filtering

Noise model without degradation

( , ) ( , ) ( , )

and

( , ) ( , ) ( , )

g x y f x y x y

G u v F u v N u v

Digital Image Processing Lecture # 7 35

Spatial Filtering: Mean Filters (1)

Let represent the set of coordinates in a rectangle

subimage window of size , centered at ( , ).

xyS

m n x y

( , )

Arithmetic mean filter

1 ( , ) ( , )

xys t S

f x y g s tmn

Digital Image Processing Lecture # 7 36

Spatial Filtering: Mean Filters (2)

1

( , )

Geometric mean filter

( , ) ( , )xy

mn

s t S

f x y g s t

Generally, a geometric mean filter achieves smoothing comparable to the arithmetic mean filter, but it tends to lose less image detail in the process

Digital Image Processing Lecture # 7 37

Spatial Filtering: Mean Filters (3)

( , )

Harmonic mean filter

( , )1

( , )xys t S

mnf x y

g s t

It works well for salt noise, but fails for pepper noise.It does well also with other types of noise like Gaussian noise.

Digital Image Processing Lecture # 7 38

Spatial Filtering: Mean Filters (4)

1

( , )

( , )

Contraharmonic mean filter

( , )

( , )( , )

xy

xy

Q

s t S

Q

s t S

g s t

f x yg s t

Q is the order of the filter.

It is well suited for reducing the effects of salt-and-pepper noise. Q>0 for pepper noise and Q<0 for salt noise.

Digital Image Processing Lecture # 7 39

39

Spatial Filtering: Example (1)

Digital Image Processing Lecture # 7 40

11/5/2015 40

Spatial Filtering: Example (2)

Digital Image Processing Lecture # 7 41

Spatial Filtering: Example (3)

Digital Image Processing Lecture # 7 42

Noise reduction – Mean filters

► FIGURE: (a) Original image; (b) image with Gaussian noise; (c) result of 3 × 3 arithmetic mean filtering; (d) result of 5 × 5 arithmetic mean filtering; (e) result of 3 × 3 geometric mean filtering; (f) result of 3 × 3 harmonic mean filtering

Digital Image Processing Lecture # 7 43

Noise reduction – Mean filters

► FIGURE: (a) Image with salt and pepper noise; (b) result of 3 × 3 arithmetic mean filtering; (c) result of 3 × 3 geometric mean filtering; (d) result of 3 × 3 harmonic mean filtering; (e) result of 3 × 3 contraharmonicmean filtering with R = 0.5; (f) result of 3 × 3 contraharmonicmean filtering with R = −0.5.

Spatial Filtering: Order-Statistic Filters (1)

( , )

Max filter

( , ) max ( , )xys t S

f x y g s t

( , )

Median filter

( , ) ( , )xys t S

f x y median g s t

( , )

Min filter

( , ) min ( , )xys t S

f x y g s t

Spatial Filtering: Order-Statistic Filters (2)

( , )( , )

Midpoint filter

1 ( , ) max ( , ) min ( , )

2 xyxy s t Ss t Sf x y g s t g s t

Spatial Filtering: Order-Statistic Filters (3)

( , )

Alpha-trimmed mean filter

1 ( , ) ( , )

xy

r

s t S

f x y g s tmn d

We delete the / 2 lowest and the / 2 highest intensity values of

( , ) in the neighborhood . Let ( , ) represent the remaining

- pixels.

xy r

d d

g s t S g s t

mn d

11/5/2015 47

Spatial Filtering: Adaptive Filters (1)

Adaptive filters

The behavior changes based on statistical characteristics of the image inside the filter region defined by the mхn rectangular window.

The performance is superior to that of the filters discussed

Adaptive Filters:

Adaptive, Local Noise Reduction Filters (1)

2

: local region

The response of the filter at the center point (x,y) of

is based on four quantities:

(a) ( , ), the value of the noisy image at ( , );

(b) , the variance of the noise corrupti

xy

xy

S

S

g x y x y

2

ng ( , )

to form ( , );

(c) , the local mean of the pixels in ;

(d) , the local variance of the pixels in .

L xy

L xy

f x y

g x y

m S

S

Adaptive Filters:

Adaptive, Local Noise Reduction Filters (2)

2

2

The behavior of the filter:

(a) if is zero, the filter should return simply the value

of ( , ).

(b) if the local variance is high relative to , the filter

should return a value cl

g x y

ose to ( , );

(c) if the two variances are equal, the filter returns the

arithmetic mean value of the pixels in .xy

g x y

S

Adaptive Filters:

Adaptive, Local Noise Reduction Filters (3)

2

2

An adaptive expression for obtaining ( , )

based on the assumptions:

( , ) ( , ) ( , ) L

L

f x y

f x y g x y g x y m

Adaptive Filters:

Adaptive Median Filters (1)

min

max

med

max

The notation:

minimum intensity value in

maximum intensity value in

median intensity value in

intensity value at coordinates ( , )

maximum all

xy

xy

xy

xy

z S

z S

z S

z x y

S

owed size of xyS

Adaptive Filters:

Adaptive Median Filters (2)

med min med max

max

The adaptive median-filtering works in two stages:

Stage A:

A1 = ; A2 =

if A1>0 and A2<0, go to stage B

Else increase the window size

if window size , re

z z z z

S

med

min max

med

peat stage A; Else output

Stage B:

B1 = ; B2 =

if B1>0 and B2<0, output ; Else output

xy xy

xy

z

z z z z

z z

Adaptive Filters:

Adaptive Median Filters (2)

med min med max

max

The adaptive median-filtering works in two stages:

Stage A:

A1 = ; A2 =

if A1>0 and A2<0, go to stage B

Else increase the window size

if window size , re

z z z z

S

med

min max

med

peat stage A; Else output

Stage B:

B1 = ; B2 =

if B1>0 and B2<0, output ; Else output

xy xy

xy

z

z z z z

z z

Example:Adaptive Median Filters

Digital Image Processing Lecture # 7 59

Periodic Noise Reduction by Frequency

Domain Filtering

The basic idea

Periodic noise appears as concentrated bursts of energy in the Fourier transform, at locations corresponding to the frequencies of the periodic interference

Approach

A selective filter is used to isolate the noise

Digital Image Processing Lecture # 7 60

Perspective Plots of Bandreject Filters

Digital Image Processing Lecture # 7 61

Noise reduction – frequency domain

►Bandreject filter

attenuates frequency components within a certain range (the stopband of the filter) while leaving all other frequency components untouched (or amplifying them by a certain gain).

Ideal bandreject filter

Digital Image Processing Lecture # 7 62

Noise reduction – frequency domain

►Bandreject filter

Butterworth bandreject filter

Gaussian bandreject filter

Digital Image Processing Lecture # 7 63

A Butterworth bandreject filter of order 4, with the appropriate radius and

width to enclose completely the noise

impulses

Digital Image Processing Lecture # 7 64

Linear, Position-Invariant Degradations

1 2 1 2

1 2

is linear

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

and are any two input images.

H

H af x y bf x y aH f x y bH f x y

f f

An operator having the input-output relationship

( , ) ( , ) is said to be position invariant

if

( , ) ( , )

for any ( , ) and any and .

g x y H f x y

H f x y g x y

f x y

Digital Image Processing Lecture # 7 65

Estimating the Degradation Function

► Three principal ways to estimate the degradation function

1. Observation

2. Experimentation

3. Mathematical Modeling

Digital Image Processing Lecture # 7 66

Mathematical Modeling (1)

► Environmental conditions cause degradation

A model about atmospheric turbulence

2 2 5/6( ) ( , )

: a constant that depends on

the nature of the turbulence

k u vH u v e

k

Digital Image Processing Lecture # 7 67

11/5/2015

Digital Image Processing Lecture # 7 68

Image deblurring techniques

Goal: to process an image that has been subject to blurring caused, e.g., by camera motion during image capture or poor focusing of the lenses.

Simplest technique: inverse filtering

where: 1/H(u, v) is the FT of the restoration filter

Problems: Division by zero 0/0 indetermination If there is also noise, it will heavily influence the

calculations

Digital Image Processing Lecture # 7 69

Image deblurring techniques

► Inverse filtering

Division by zero problem has 2 possible solutions:

Apply a (Butterworth) lowpass filter with transfer function L(u,v) to the division, thus limiting the restoration to a range of frequencies below the restoration cutoff frequency:

Use constrained division, where a threshold value T is chosen such that, if |H(u,v)| < T, the division does not take place and the original value is kept untouched, i.e.:

Digital Image Processing Lecture # 7 70

Image deblurringtechniques

► FIGURE: Example of image restoration using inverse filtering: (a) input (blurry) image; (b) result of naive inverse filtering; (c) applying a 10th-order Butterworth low-pass filter with cutoff frequency of 20 to the division; (d) same as (c), but with cutoff frequency of 50; (e) results of using constrained division, with threshold T = 0.01; (f) same as (e), but with threshold T = 0.001.

Digital Image Processing Lecture # 7 72

Image deblurring techniques

Wiener filtering (1942)

Image restoration solution that can be applied to images that have been subject to a degradation function and also contain noise (worst-case scenario).

Attempt to model the error in the restored image through statistical methods, particularly the minimum mean-square estimator: once the error is modeled, the average error is mathematically minimized.

The transfer function of a Wiener filter is given by:

where H(u, v) is the degradation function and K is a constant used to approximate the amount of noise.

Digital Image Processing Lecture # 7 73

Image deblurring techniques► FIGURE: Example of

image restoration using Wiener filtering: (a) input image (blurry and noisy); (b) result of inverse filtering, applying a 10th-order Butterworth low-pass filter with cutoff frequency of 50 to the division; (c) results of Wiener filter, with K = 10−3; (d) same as (c), but with K = 0.1.

Digital Image Processing Lecture # 7 74

Image deblurring techniques

► FIGURE: Example of image restoration using Wiener filtering: (a) input (blurry) image; (b) result of inverse filtering, applying a 10th-order Butterworth low-pass filter with cutoff frequency of 50 to the division; (c) results of Wiener filter, with K = 10−5; (d) same as (c), but with K = 0.1.