lect07 image restoration

66
Digital Image Processing Lecture # 07 Image Restoration

Upload: durre-shehwar

Post on 17-Feb-2016

254 views

Category:

Documents


0 download

DESCRIPTION

Techniques for Image Restoration

TRANSCRIPT

Page 1: Lect07 Image Restoration

Digital Image Processing

Lecture # 07

Image Restoration

Page 2: Lect07 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?

Page 3: Lect07 Image Restoration

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.

Page 4: Lect07 Image Restoration

Digital Image Processing Lecture # 7 4

A Model of Image Degradation/Restoration Process

Page 5: Lect07 Image Restoration

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

Page 6: Lect07 Image Restoration

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

Page 7: Lect07 Image Restoration

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

Page 8: Lect07 Image Restoration

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

Page 9: Lect07 Image Restoration

Digital Image Processing Lecture # 7 10

Page 10: Lect07 Image Restoration

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

Page 11: Lect07 Image Restoration

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(

Page 12: Lect07 Image Restoration

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

Page 13: Lect07 Image Restoration

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

Page 14: Lect07 Image Restoration

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

Page 15: Lect07 Image Restoration

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

Page 16: Lect07 Image Restoration

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

Page 17: Lect07 Image Restoration

Digital Image Processing Lecture # 7 24

Examples of Noise: Original Image

Page 18: Lect07 Image Restoration

Digital Image Processing Lecture # 7 25

Examples of Noise: Noisy Images(1)

Page 19: Lect07 Image Restoration

Digital Image Processing Lecture # 7 26

Examples of Noise: Noisy Images(2)

Page 20: Lect07 Image Restoration

Digital Image Processing Lecture # 7 27

Effects of noise on

images and histograms

►Gaussian

► Exponential

► Impulse (salt-and-pepper)

Page 21: Lect07 Image Restoration

Digital Image Processing Lecture # 7 28

Effects of noise on

images and histograms►Rayleigh

►Gamma (Erlang)

►Uniform

Page 22: Lect07 Image Restoration

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

Page 23: Lect07 Image Restoration

Digital Image Processing Lecture # 7 30

An Example of Periodic Noise

Page 24: Lect07 Image Restoration

Digital Image Processing Lecture # 7 31

Noise estimation

Page 25: Lect07 Image Restoration

Digital Image Processing Lecture # 7 32

Estimation of Noise Parameters (1)

The shape of the histogram identifies the closest PDF match

Page 26: Lect07 Image Restoration

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

Page 27: Lect07 Image Restoration

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

Page 28: Lect07 Image Restoration

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

Page 29: Lect07 Image Restoration

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

Page 30: Lect07 Image Restoration

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.

Page 31: Lect07 Image Restoration

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.

Page 32: Lect07 Image Restoration

Digital Image Processing Lecture # 7 39

39

Spatial Filtering: Example (1)

Page 33: Lect07 Image Restoration

Digital Image Processing Lecture # 7 40

11/5/2015 40

Spatial Filtering: Example (2)

Page 34: Lect07 Image Restoration

Digital Image Processing Lecture # 7 41

Spatial Filtering: Example (3)

Page 35: Lect07 Image Restoration

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

Page 36: Lect07 Image Restoration

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.

Page 37: Lect07 Image Restoration

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

Page 38: Lect07 Image Restoration

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

Page 39: Lect07 Image Restoration

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

Page 40: Lect07 Image Restoration

11/5/2015 47

Page 41: Lect07 Image Restoration
Page 42: Lect07 Image Restoration
Page 43: Lect07 Image Restoration

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

Page 44: Lect07 Image Restoration

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

Page 45: Lect07 Image Restoration

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

Page 46: Lect07 Image Restoration

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

Page 47: Lect07 Image Restoration
Page 48: Lect07 Image Restoration

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

Page 49: Lect07 Image Restoration

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

Page 50: Lect07 Image Restoration

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

Page 51: Lect07 Image Restoration

Example:Adaptive Median Filters

Page 52: Lect07 Image Restoration

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

Page 53: Lect07 Image Restoration

Digital Image Processing Lecture # 7 60

Perspective Plots of Bandreject Filters

Page 54: Lect07 Image Restoration

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

Page 55: Lect07 Image Restoration

Digital Image Processing Lecture # 7 62

Noise reduction – frequency domain

►Bandreject filter

Butterworth bandreject filter

Gaussian bandreject filter

Page 56: Lect07 Image Restoration

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

Page 57: Lect07 Image Restoration

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

Page 58: Lect07 Image Restoration

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

Page 59: Lect07 Image Restoration

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

Page 60: Lect07 Image Restoration

Digital Image Processing Lecture # 7 67

11/5/2015

Page 61: Lect07 Image Restoration

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

Page 62: Lect07 Image Restoration

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

Page 63: Lect07 Image Restoration

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.

Page 64: Lect07 Image Restoration

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.

Page 65: Lect07 Image Restoration

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.

Page 66: Lect07 Image Restoration

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.