Sie sind auf Seite 1von 66

Digital Image Processing

Lecture # 07

Image Restoration

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

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

A Model of Image Degradation/Restoration


Process

Digital Image Processing

Lecture # 7

A Model of Image Degradation/Restoration


Process

If H is a linear,

position-invariant process, then

the degraded image is given in the spatial domain by


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

Digital Image Processing

Lecture # 7

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

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

Noise Models (1)

Gaussian noise

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

Rayleigh noise
Range imaging

Erlang (gamma) noise: Laser imaging

Exponential noise:

Uniform noise: Least descriptive;

Impulse noise: quick transients,

Laser imaging

generators

Basis for numerous random number

such as faulty switching

Digital Image Processing

Lecture # 7

Digital Image Processing

Lecture # 7

10

Gaussian Noise (1)


The PDF of Gaussian random variable, z, is given by
1
( z z )2 /2 2
p(z )
e
2
where, z represents intensity
z is the mean (average) value of z
is the standard deviation

Digital Image Processing

Lecture # 7

17

Gaussian Noise (2)


The PDF of Gaussian random variable, z, is given by
1
( z z )2 /2 2
p(z )
e
2
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

18

Rayleigh Noise
The PDF of Rayleigh noise is given by
2
( z a )2 / b
for z a
( z a )e
p( z ) b
0
for z a
The mean and variance of this density are given by
z a b / 4
b(4 )
2

4

Digital Image Processing

Lecture # 7

19

Erlang (Gamma) Noise


The PDF of Erlang noise is given by
ab z b1 az
e

p( z ) (b 1)!
0

for z 0
for z a

The mean and variance of this density are given by


z b/a

2 b / a2

Digital Image Processing

Lecture # 7

20

Exponential Noise
The PDF of exponential noise is given by
ae az
p( z )
0

for z 0
for z a

The mean and variance of this density are given by


z 1/ a

2 1/ a 2

Digital Image Processing

Lecture # 7

21

Uniform Noise
The PDF of uniform noise is given by
1

p( z ) b a
0

for a z b
otherwise

The mean and variance of this density are given by


z (a b) / 2

2 (b a)2 /12

Digital Image Processing

Lecture # 7

22

Impulse (Salt-and-Pepper) Noise


The PDF of (bipolar) impulse noise is given by
Pa

p( z ) Pb
0

for z a
for z b
otherwise

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


while level a will appear like a dark dot.
If either Pa or Pb is zero, the impulse noise is called
unipolar
Digital Image Processing

Lecture # 7

23

Examples of Noise: Original Image

Digital Image Processing

Lecture # 7

24

Examples of Noise: Noisy Images(1)

Digital Image Processing

Lecture # 7

25

Examples of Noise: Noisy Images(2)

Digital Image Processing

Lecture # 7

26

Effects of
noise on
images and
histograms
Gaussian
Exponential

Impulse

(salt-andpepper)

Digital Image Processing

Lecture # 7

27

Effects of
noise on
images and
histograms
Rayleigh
Gamma

(Erlang)

Uniform
Digital Image Processing

Lecture # 7

28

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

29

An Example of Periodic Noise

Digital Image Processing

Lecture # 7

30

Noise estimation

Digital Image Processing

Lecture # 7

31

Estimation of Noise Parameters (1)


The shape of the histogram identifies the closest PDF match

Digital Image Processing

Lecture # 7

32

Estimation of Noise Parameters (2)


Consider a subimage denoted by S , and let ps ( zi ), i 0, 1, ..., L -1,
denote the probability estimates of the intensities of the pixels in S .
The mean and variance of the pixels in S:
L 1

z zi ps ( zi )
i 0

L 1

and

2 ( zi z )2 ps ( zi )
i 0

Digital Image Processing

Lecture # 7

33

Restoration in the Presence of Noise Only

Spatial Filtering
Noise model without degradation
g ( x, y ) f ( x, y ) ( x, y )
and
G (u, v) F (u, v) N (u, v)

Digital Image Processing

Lecture # 7

34

Spatial Filtering: Mean Filters (1)


Let S xy represent the set of coordinates in a rectangle
subimage window of size m n, centered at ( x, y ).

Arithmetic mean filter


1
f ( x, y )
g (s, t )

mn ( s ,t )Sxy

Digital Image Processing

Lecture # 7

35

Spatial Filtering: Mean Filters (2)


Geometric mean filter

f ( x, y ) g ( s , t )
( s ,t )S xy

1
mn

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

36

Spatial Filtering: Mean Filters (3)


Harmonic mean filter
f ( x, y )

mn

( s ,t )S xy

1
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

37

Spatial Filtering: Mean Filters (4)


Contraharmonic mean filter
f ( x, y )

g ( s, t )Q 1

g ( s, t )Q

( s ,t )S xy

( s ,t )S xy

Q is the order of the filter.


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

Lecture # 7

38

Spatial Filtering: Example (1)

39
Digital Image Processing

Lecture # 7

39

Spatial Filtering: Example (2)

11/5/2015
Digital Image Processing

40
Lecture # 7

40

Spatial Filtering: Example (3)

Digital Image Processing

Lecture # 7

41

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

42

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 contraharmonic
mean filtering with R
= 0.5; (f) result of 3
3 contraharmonic
mean filtering with R
= 0.5.

Digital Image Processing

Lecture # 7

43

Spatial Filtering: Order-Statistic Filters (1)


Median filter
f ( x, y ) median g (s, t )
( s ,t )S xy

Max filter
f ( x, y ) max g (s, t )
( s ,t )S xy

Min filter
f ( x, y ) min g (s, t )
( s ,t )S xy

Spatial Filtering: Order-Statistic Filters (2)

Midpoint filter
1
f ( x, y ) max g ( s, t ) min g ( s, t )
( s ,t )S xy
2 ( s ,t )S xy

Spatial Filtering: Order-Statistic Filters (3)

Alpha-trimmed mean filter


1
f ( x, y)
gr ( s, t )

mn d ( s ,t )Sxy
We delete the d / 2 lowest and the d / 2 highest intensity values of
g ( s, t ) in the neighborhood S xy . Let g r ( s, t ) represent the remaining
mn - d pixels.

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 mn
rectangular window.
The performance is superior to that of the filters
discussed

Adaptive Filters:
Adaptive, Local Noise Reduction Filters (1)
S xy : local region
The response of the filter at the center point (x,y) of S xy
is based on four quantities:
(a) g ( x, y ), the value of the noisy image at (x, y );
(b) 2 , the variance of the noise corrupting f ( x, y )
to form g ( x, y );
(c) mL , the local mean of the pixels in S xy ;
(d) L2 , the local variance of the pixels in S xy .

Adaptive Filters:
Adaptive, Local Noise Reduction Filters (2)
The behavior of the filter:
(a) if 2 is zero, the filter should return simply the value
of g ( x, y ).
(b) if the local variance is high relative to 2 , the filter
should return a value close to g ( x, y);
(c) if the two variances are equal, the filter returns the
arithmetic mean value of the pixels in S xy .

Adaptive Filters:
Adaptive, Local Noise Reduction Filters (3)

An adaptive expression for obtaining f ( x, y)


based on the assumptions:

f ( x , y ) g ( x , y ) 2 g ( x , y ) mL
L
2

Adaptive Filters:
Adaptive Median Filters (1)

The notation:
zmin minimum intensity value in S xy
zmax maximum intensity value in S xy
zmed median intensity value in S xy
z xy intensity value at coordinates ( x, y )
Smax maximum allowed size of S xy

Adaptive Filters:
Adaptive Median Filters (2)
The adaptive median-filtering works in two stages:
Stage A:
A1 = zmed zmin ; A2 = zmed zmax
if A1>0 and A2<0, go to stage B
Else increase the window size
if window size Smax , repeat stage A; Else output zmed
Stage B:
B1 = z xy zmin ;

B2 = z xy zmax

if B1>0 and B2<0, output z xy ; Else output zmed

Adaptive Filters:
Adaptive Median Filters (2)
The adaptive median-filtering works in two stages:
Stage A:
A1 = zmed zmin ; A2 = zmed zmax
if A1>0 and A2<0, go to stage B
Else increase the window size
if window size Smax , repeat stage A; Else output zmed
Stage B:
B1 = z xy zmin ;

B2 = z xy zmax

if B1>0 and B2<0, output z xy ; Else output zmed

Example:
Adaptive Median Filters

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

59

Perspective Plots of Bandreject Filters

Digital Image Processing

Lecture # 7

60

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

61

Noise reduction frequency


domain
Bandreject

filter

Butterworth bandreject filter

Gaussian bandreject filter

Digital Image Processing

Lecture # 7

62

A Butterworth bandreject
filter of order 4, with the
appropriate radius and
width to enclose
completely the noise
impulses

Digital Image Processing

Lecture # 7

63

Linear, Position-Invariant Degradations


H is linear
H af1 ( x, y ) bf 2 ( x, y ) aH f1 ( x, y ) bH f 2 ( x, y )
f1 and f 2 are any two input images.
An operator having the input-output relationship
g ( x, y ) H f ( x, y ) is said to be position invariant
if
H f ( x , y ) g ( x , y )
for any f ( x, y ) and any and .
Digital Image Processing

Lecture # 7

64

Estimating the Degradation Function

Three principal ways to estimate the degradation function

1. Observation
2. Experimentation
3. Mathematical Modeling

Digital Image Processing

Lecture # 7

65

Mathematical Modeling (1)

Environmental conditions cause degradation


A model about atmospheric turbulence
k ( u 2 v 2 )5/6

H (u, v) e
k : a constant that depends on
the nature of the turbulence

Digital Image Processing

Lecture # 7

66

11/5/2015
Digital Image Processing

Lecture # 7

67

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

68

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

69

Image deblurring
techniques

FIGURE: Example of image


restoration using inverse
filtering: (a) input (blurry)
image; (b) result of naive
inverse filtering; (c) applying a
10th-order Butterworth lowpass 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

70

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

72

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 =
103; (d) same as
(c), but with K = 0.1.

Digital Image Processing

Lecture # 7

73

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 =
105; (d) same as
(c), but with K = 0.1.

Digital Image Processing

Lecture # 7

74

Das könnte Ihnen auch gefallen