Вы находитесь на странице: 1из 76

Digital Image Processing

Image Restoration

04/25/17 Dr. A. Nagaraja Rao


Image Restoration
Image restoration vs. image enhancement
Enhancement:
largely a subjective process
Priori knowledge about the degradation is not a must
(sometimes no degradation is involved)
Procedures are heuristic and take advantage of the
psychophysical aspects of human visual system
Restoration:
more an objective process
Images are degraded
Tries to recover the images by using the knowledge
about the degradation

04/25/17 Dr. A. Nagaraja Rao


An Image Degradation Model
Two types of degradation
Additive noise
Spatial domain restoration (denoising) techniques are preferred
Image blur
Frequency domain methods are preferred
We model the degradation process by a degradation function
h(x,y), an additive noise term, (x,y), as g(x,y)=h(x,y)*f(x,y)+
(x,y)
f(x,y) is the (input) image free from any degradation
g(x,y) is the degraded image
* is the convolution operator
The goal is to obtain an estimate of f(x,y) according to the
knowledge about the degradation function h and the additive noise
In frequency domain: G(u,v)=H(u,v)F(u,v)+N(u,v)
Three cases are considered in this Chapter
g(x,y)=f(x,y)+ (x,y) (5-2~5-4)
g(x,y)=h(x,y)*f(x,y) (5-5~5-6)
g(x,y)=h(x,y)*f(x,y)+ (x,y) (5-7~5-9)

04/25/17 Dr. A. Nagaraja Rao


A Model of the Image
Degradation/Restoration Process

04/25/17 Dr. A. Nagaraja Rao


Noise Model
We first consider the degradation due to noise
only
h is an impulse for now ( H is a constant)
White noise
Autocorrelation function is an impulse function
multiplied by a constant
N 1 M 1

a ( x, y ) ( s, t ) ( s x, t y ) N 0 ( x, y )
t 0 s 0

It means there is no correlation between any two pixels in


the noise image
There is no way to predict the next noise value
The spectrum of the autocorrelation function is a
constant (white)

04/25/17 Dr. A. Nagaraja Rao


Gaussian Noise
Noise (image) can be classified according the
distribution of the values of pixels (of the noise
image) or its (normalized) histogram
Gaussian noise is characterized by two
parameters, (mean) and 2 (variance), by

1 ( z ) 2 / 2 2
p( z ) e
2
70% values of z fall in the range [(-),(+)]
95% values of z fall in the range [(-2),(+2)]

04/25/17 Dr. A. Nagaraja Rao


Gaussian Noise

04/25/17 Dr. A. Nagaraja Rao


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

a and b can be obtained through


mean and variance
b( 4 )
a b / 4 and 2
4

04/25/17 Dr. A. Nagaraja Rao


Other Noise Models
Erlang (Gamma) noise
b b 1
a z
e az for z 0
p( z ) (b 1)!
0 for z 0
The mean and variance of this
density are given by

a and b can be obtained


through mean and variance
b
b / a and 2
a2

04/25/17 Dr. A. Nagaraja Rao


Other Noise Models

Exponential noise
ae az for z 0
p( z )
0 for z 0
The mean and variance of
this density are given by

Special case of Erlang


PDF with b=1
1
1 / a and 2 2
a

04/25/17 Dr. A. Nagaraja Rao


Other Noise Models
Uniform noise
1
if a z b
p( z ) b a
0 otherwise
The mean and
variance of this
density are given by
(b a ) 2
(a b) / 2 and 2
12

04/25/17 Dr. A. Nagaraja Rao


Other Noise Models
Impulse (salt-and-pepper)
noise Pa for z a
p( z ) P for z b
b
0 otherwise

If either Pa or Pb is zero,
the impulse noise is
called unipolar
a and b usually are
extreme values because
impulse corruption is
usually large compared
with the strength of the
image signal
It is the only type of
noise that can be
04/25/17 distinguished from Dr. A. Nagaraja Rao
A Sample Image

04/25/17 Dr. A. Nagaraja Rao


Effect of Adding Noise to Sample
Image

04/25/17 Dr. A. Nagaraja Rao


Effect of Adding Noise to Sample
Image

04/25/17 Dr. A. Nagaraja Rao


Periodic Noise
Arises typically from
electrical or
electromechanical
interference during image
acquisition
It can be observed by
visual inspection both in
the spatial domain and
frequency domain
The only spatially
dependent noise will be
considered

04/25/17 Dr. A. Nagaraja Rao


Estimation of Noise Parameters

Periodic noise
Parameters can be estimated by inspection of
the spectrum
Noise PDFs
From sensor specifications
If imaging sensors are available, capture a set
of images of plain environments
If only noisy images are available, parameters
of the PDF involved can be estimated from
small patches of constant regions of the noisy
images

04/25/17 Dr. A. Nagaraja Rao


04/25/17 Dr. A. Nagaraja Rao
Estimation of Noise Parameters

In most cases, only mean and variance


are to be estimated
Others can be obtained from the estimated
mean and variance
Assume a sub-image with plain scene is
available and is denoted by S

1
z ( xi , yi )
N S ( xi , yi )S

2 1 2 1
0 ( z ( xi , yi ) )
N S ( xi , yi )S
2
1
NS
i i
( z ( x ,
( xi , yi )S
y )
) 2

2 1
2 i i( z ( x , y )
N S 1 ( xi , yi )S Dr. A. Nagaraja Rao
) 2

04/25/17
Restoration in the Presence of Noise
Only (De-Noising)
Mean filters 1
Arithmetic mean filter
f ( x, y ) g ( s, t )
mn ( s ,t )S x , y
g(x,y) is the corrupted image 1
Sx,y is the mask mn

Geometric mean filters f ( x, y ) g ( s, t )


Tends to preserve more details ( s ,t )S x , y
Harmonic mean filter mn
f ( x, y )
1

( s ,t )S x , y g ( s, t )
Works well for salt noise but fails for pepper noise
Contraharmonic mean filter
Q: order of the filter g ( s, t ) Q 1

Positive Q works for pepper noise ( s ,t )S x , y


f ( x, y )


Negative Q works for salt noise
Q=0arithmetic mean filter
g ( s, t )
( s ,t )S x , y
Q

04/25/17 Dr. A. Nagaraja Rao


Q=-1harmonic mean filter
Corrupted by
Gaussian Noise
De-Noising

Mean
Filtering Geometric
Mean
Filtering

04/25/17 Dr. A. Nagaraja Rao


Corrupted Corrupted
by pepper by salt
De-Noising noise noise

3x3 3x3
Contraharmon Contraharmon
ic Q=1.5 ic Q=-1.5

04/25/17 Dr. A. Nagaraja Rao


De-Noising

04/25/17 Dr. A. Nagaraja Rao


Filters Based on Order Statistics
(De-Noising)
f ( x, y ) median{g ( s, t )}
Median filter (s,t)S x , y

Median represents the 50th percentile of a


ranked set of numbers
Max and min filter
Max filter uses the 100th percentile of a ranked
set of numbers
Good for removing pepper noise
Min filter uses the 1 percentile of a ranked set of
numbers
Good for removing salt noise
1
Midpoint filter f ( x, y ) max {g ( s, t )} min {g ( s, t )}
2 ( s ,t )S xy ( s ,t )S xy

Works best for noise with symmetric PDF like


Gaussian or uniform noise
04/25/17 Dr. A. Nagaraja Rao
Corrupted by salt One pass
& pepper noise median
De-Noising filtering

Two pass Three pass


median median
filtering filtering

04/25/17 Dr. A. Nagaraja Rao


Corrupted Corrupted
by pepper by salt
noise noise
De-Noising

04/25/17 Max Dr. A. Nagaraja Rao Min


Filtering Filtering
Alpha-Trimmed Mean Filter
(De-Noising)
Alpha-trimmed mean filter takes the mean value
of the pixels enclosed by an mn mask after
deleting the pixels with the d/2 lowest and the d/2
highest gray-level
values 1
f ( x, y )
mn d
g ( s, t )
( s ,t )S xy
r

gr(s,t) represent the remaining mn-d pixels


It is useful in situations involving multiple types
of noise like a combination of salt-and-pepper
and Gaussian

04/25/17 Dr. A. Nagaraja Rao


De-Noising Added salt
& pepper
Corrupted by
noise
additive Uniform
noise

5x5 Mean
Filtering 5x5 Geo-
Mean
Filtering

5x5 5x5 Alpha-


Median trimmed Mean
Filtering Filtering

04/25/17 Dr. A. Nagaraja Rao


Adaptive Filters
(De-Noising)
Adaptive Local Noise Reduction Filter
Assume the variance of the noise
2
is either
known or can be estimated satisfactorily
Filtering operation changes at 2 different regions
of an image according to local L variance
calculated within an MN region
If L , the filtering2 operation is defined as
2 2

f ( x, y ) g ( x, y ) [ g ( x, y ) m ]
L
2
L2 2 L
If , the output takes the mean value
2
That is: is set to be 1
L 2

At edges, it is assumes thatL 2


2

04/25/17 Dr. A. Nagaraja Rao
Corrupted by Mean
Gaussian Filtering
De-Noising noise

Adaptive
Filtering

Geo-
Mean
Filtering

04/25/17 Dr. A. Nagaraja Rao


Adaptive Median Filter
(De-Noising)
Median filter is effective for removing salt-
and-pepper noise
The density of the impulse noise can not be too
large
Adaptive median filter
Notation
Zmin: minimum gray value in Sxy
Zmax: maximum gray value in Sxy
Zmed: median of gray levels in Sxy
Zxy: gray value of the image at (x,y)
Smax: maximum allowed size of Sxy

04/25/17 Dr. A. Nagaraja Rao


Adaptive Median Filter
(De-Noising)
Two levels of operations
Level A:
A1= Zmed Zmin Used to test whether
Zmed is part of s-and-p
A2= Zmed Zmax
noise. If yes, window
If A1 > 0 AND A2 < 0, Go to level B
size is increased
else increase the window size by 2
If window size <= Smax repeat level A
else output Zxy
Level B: Used to test whether Zxy
B1= Zxy Zmin is part of s-and-p noise.
B2= Zxy Zmax If yes, apply regular
If B1 > 0 AND B2 < 0, output Zxy median filtering
else output Zmed

04/25/17 Dr. A. Nagaraja Rao


De-Noising Median Filtering Adaptive
Median Filtering

04/25/17 Dr. A. Nagaraja Rao


Periodic Noise Reduction by
Frequency Domain Filtering
Lowpass and highpass filters for image
enhancement have been studied
Bandreject, bandpass, and notch filters as
tools for periodic noise reduction or removal
are to be studied in this section.

04/25/17 Dr. A. Nagaraja Rao


Bandreject Filters

Bandreject filters remove or attenuate a


band of frequencies about the origin of the
Fourier transform.
Similar to those LPFs and HPFs studied, we
can construct ideal, Butterworth, and
Gaussian bandreject filters

04/25/17 Dr. A. Nagaraja Rao


Bandreject Filters
Ideal bandreject filter
W
1 if D (u , v ) D0
2
W W
H (u, v) 0 if D0 D(u, v) D0
2 2
1 if D(u , v) D0 W
2

04/25/17 Dr. A. Nagaraja Rao


Bandreject Filters
Butterworth bandreject
filter
1
H (u, v) 2n
D(u , v)W
1 2 2
D (u , v ) D0

n =1

04/25/17 Dr. A. Nagaraja Rao


Bandreject Filters
Gaussian bandreject filter

1 D 2 ( u ,v ) D02

2 D ( u ,v )W
H (u, v) 1 e

04/25/17 Dr. A. Nagaraja Rao


Bandreject Filters

04/25/17 Dr. A. Nagaraja Rao


Bandbass Filters
Bandpass filter performs the opposite of a
bandreject filter

H bp (u, v) 1 H br (u , v)

04/25/17 Dr. A. Nagaraja Rao


Notch Filters

Notch filter rejects frequencies in predefined


neighborhoods about a center frequency.

It appears in symmetric pairs about the origin


because the Fourier transform of a real valued
image is symmetric.

04/25/17 Dr. A. Nagaraja Rao


Notch Filters

Ideal notch filter


0 if D1 (u, v) D0 or D2 (u, v) D0
H (u, v)
1 otherwise


D1 (u, v) u M / 2 u0 v N / 2 v0
2
2 1/ 2

D (u , v) u M / 2 u v N / 2 v
2 2 1/ 2
2 0 0

04/25/17 Dr. A. Nagaraja Rao


Notch Filters

Butterworth notch filter


1
H (u , v) 2n
D 2

1 0

D
1 (u , v ) D2 (u , v )

n=2

04/25/17 Dr. A. Nagaraja Rao


Notch Filters

Gaussian notch filter


1 D ( u ,v ) D2 ( u ,v )
1
2 D02
H (u , v) 1 e

04/25/17 Dr. A. Nagaraja Rao


Notch Filters

Notch filters that pass, rather than suppress:

H np (u , v) 1 H nr (u, v)

NR filters become highpass filtersu if v 0 0 0

NP filters become lowpass filters ifu v 0 0 0

04/25/17 Dr. A. Nagaraja Rao


Notch Filters
You can see the
effect of scan
lines

Notch pass
Spectrum of
filter
image

IFT of NP Result of
filtered image NR filter

04/25/17 Dr. A. Nagaraja Rao


Optimum Notch Filtering

04/25/17 Dr. A. Nagaraja Rao


Optimum Notch Filtering
In the ideal case, the original image can be
restored if the noise can be estimated
completely.f ( x, y ) g ( x, y ) ( x, y )
That is:

However, the noise can be only partially


f ( x, y )the
estimated. This means g restored
( x, y ) (image
x, y ) is
not exact.
( x,means
Which
y ) IFT H (u , v)G (u , v)

04/25/17 Dr. A. Nagaraja Rao


Optimum Notch Filtering
In this section, we try to improve the restored
image by introducing a modulation function
f ( x, y ) g ( x, y ) w( x, y ) ( x, y )
Here the modulation function is a constant within a
neighborhood of size (2a+1) by (2b+1) about a point
(x,y)
We optimize its performance by minimizing the local
variance of the1 restoreda image
b at the position (x,y) 2
f ( x s, y t ) f ( x, y )
2 ( x, y )
(2a 1)(2b 1)

s at b

a b
1
f ( x, y )
(2a 1)(2b 1) s at b
f ( x s, y t )

04/25/17 Dr. A. Nagaraja Rao


Optimum Notch Filtering
Points on or near Edge of the image can be treated by
considering partial neighborhoods
a b
1
( x, y )
2

(2a 1)(2b 1) s at b
{[ g ( x s, y t )

w( x s, y t ) ( x s, y t )]
[ g ( x, y ) w( x, y ) ( x, y ]}2

Assumption:
w( x s, y t ) w( x, y ) for a s a and b t b

w( x, y ) ( x, y ) w( x, y ) ( x, y )
04/25/17 Dr. A. Nagaraja Rao
Optimum Notch Filtering
b
1
s a
a
( x, y )
2
{[ g ( x s, y t )
(2a 1)(2b 1) t b

w( x s, y t ) ( x s, y t )]
[ g ( x, y ) w( x, y ) ( x, y )}2

To minimize 2 ( x, y )
2 ( x, y )
0
w( x, y )
solve
g ( x, y ) ( x, y ) g ( x, y ) ( x, y )
w( x, y )
2 ( x, y ) 2 ( x, y )

04/25/17 Dr. A. Nagaraja Rao


Optimum Notch Filtering

f ( x, y ) g ( x, y ) w( x, y ) ( x, y ) w( x, y )

g ( x, y ) ( x, y )

04/25/17 Dr. A. Nagaraja Rao


Optimum Notch Filtering

04/25/17 Dr. A. Nagaraja Rao


Optimum Notch Filtering

04/25/17 Dr. A. Nagaraja Rao


Optimum Notch Filtering

g ( x, y ) f ( x, y )
Image size: 512x512
a=b=15
04/25/17 Dr. A. Nagaraja Rao
Linear, Position-Invariant
Degradation
Degradation Model
g ( x, y ) H [ f ( x, y )] ( x, y )
In the absence of additive noise:
For scalar values of a and b, H is
linear
H [if:
a f ( x, y ) b f ( x, y )] a H [ f ( x, y )] b H [ f 2 ( x, y )]
1 2 1

H is Position-Invariant if:
g ( x, y ) H [ f ( x, y )] H [ f ( x , y )] g ( x , y )

04/25/17 Dr. A. Nagaraja Rao


Linear, Position-Invariant
Degradation
In the presence of additive noise:

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

g ( x, y ) h ( x, y ) * f ( x, y ) ( x, y )
G (u, v) H (u , v) F (u, v) N (u , v)

Many types of degradation can be


approximated by linear, position-invariant
processes
Extensive tools of linear system theory are
available
04/25/17 Dr. A. Nagaraja Rao
Estimating the Degradation Function
Principal way to estimate the degradation
function for use in image restoration:
Observation
Experimentation
Mathematical modeling

04/25/17 Dr. A. Nagaraja Rao


Estimating by Image Observation
We look for a small section of the image
that has strong g s ( x, ysignal
) content ( )
and then construct an undegradation of
fs ( xby
this section , y )using sample
gray levels ( ).
Gs (u , v)
H s (u , v)
Fs (u , v)

H (u, v)
Now, we construct a function on a large
scale, but having the same shape.

04/25/17 Dr. A. Nagaraja Rao


Estimating by Experimentation
We try to obtain impulse response of the
degradation by imaging an impulse (small
dot of light) using the system. Therefore
G (u, v)
H (u , v)
A

04/25/17 Dr. A. Nagaraja Rao


Estimating by Modeling
k ( u 2 v 2 )5 / 6
H (u , v) e
Atmospheric turbulence model:

High
turbulence
k=0.0025

Negligible
turbulence

Low
Mid turbulence
turbulence k=0.00025
k=0.001
04/25/17 Dr. A. Nagaraja Rao
Estimating by Modeling
Blurring by linearT motion:
g ( x, y ) f [ x x0 (t ), y y0 (t )]dt
T
H (u , v) e 2uat / T dt 0
0

T
sin( ua )e j ua
ua T
G (u, v) F (u, v) e j 2 [ux0 ( t ) vy0 (t )]dt
T 0
H (u, v) e j 2 [ ux0 ( t ) vy0 ( t )]
dt
0

if x0 (t ) at / T and y0 (t ) 0

04/25/17 Dr. A. Nagaraja Rao


Estimating by Modeling
if x0 (t ) at / T and y0 (t ) bt / T
T
H (u , v) sin[ (ua vb)]e j (ua vb )
(ua vb)

04/25/17 Dr. A. Nagaraja Rao


Inverse Filtering
The simplest approach to restoration is direct
inverse filtering:
G (u, v) Even if we know the
F (u , v) degradation function,
H (u , v)
we cannot recover
N (u , v) the un-degraded
F (u, v) F (u , v) image
H (u , v)

If the degradation has zero or very small values, then


the ratio N/H could easily dominate our estimation of F .

One approach to get around the zero or small-value


problem is to limit the filter frequencies to value near
the origin.
04/25/17 Dr. A. Nagaraja Rao
Degraded
Inverse Filtering Image

Filtering with H
cut off outside
a radius of 40
Full inverse
Filtering

Filtering with H
cut off outside a
radius of 70

Filtering with H
cut off outside
04/25/17 Dr. A. Nagaraja Rao a radius of 85
Minimum Mean Square Error Filtering
(Wiener Filtering)
This approach incorporate both the degradation
function and statistical characteristic of noise
into the restoration process.
Image and
noise are
random process

e 2 E[( f f ) 2 ]

The objective is to find an estimation for f such that


minimized e2

04/25/17 Dr. A. Nagaraja Rao


Minimum Mean Square Error Filtering
(Wiener Filtering)
H * (u , v) S f (u , v)
F (u , v) 2
G (u , v)
S f (u , v) H (u , v) S (u , v)
If the noise is zero,
*
H (u , v) then the Wiener
2
G (u , v) Filter reduces to the
H (u , v) S (u , v) / S f (u , v) inverse filter.
1 H (u , v)
2

2
G (u , v)
H (u , v) H (u , v) S (u , v) / S f (u , v)

2
S (u , v) N (u , v) power spectrum of the noise
2
S f (u , v) F (u , v) power spectrum of the undegraded image

04/25/17 Dr. A. Nagaraja Rao


Minimum Mean Square Error Filtering
(Wiener Filtering)
1 H (u , v )
2

F (u , v) 2
G (u, v)
H (u , v) H (u, v) S (u, v) / S f (u , v)

Constan Unknow
t n

1 H (u , v)
2

F (u , v) 2
G (u , v)
H (u , v) H (u , v) K

04/25/17 Dr. A. Nagaraja Rao


Wiener Filtering

Radially limited Wiener filtering


Full inverse
filtering inverse filtering (K was chosen
interactively)
04/25/17 Dr. A. Nagaraja Rao
Inverse Wiener
filtering
Wiener Filtering filtering

Reduce
d noise
varianc
e

04/25/17 Dr. A. Nagaraja Rao


Geometric Transformations
Unlike the techniques discussed so far,
geometric transformations modify the
spatial relationships between pixels in an
image.

Geometric transformation: RUBBER-SHEET


TRANSFORMATION
Basic Operations:
1. Spatial
Transformation
2. Gray-level
04/25/17 Interpolation
Dr. A. Nagaraja Rao
Spatial Transformations

x r ( x, y )
y s ( x, y )

x r ( x, y ) c1 x c2 y c3 xy c4
y s ( x, y ) c5 x c6 y c7 xy c8

04/25/17 Dr. A. Nagaraja Rao


Spatial Transformations

04/25/17 Dr. A. Nagaraja Rao


Gray-level Interpolation

v( x, y ) ax by cxy d

04/25/17 Dr. A. Nagaraja Rao


Geometric Transformations

04/25/17 Dr. A. Nagaraja Rao


Geometric Transformations

04/25/17 Dr. A. Nagaraja Rao

Вам также может понравиться