Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 38

Digital Image Processing

Image Restoration
for getting more knowledge
according to miss aneeba
masood
H.R. Pourreza
H.R. Pourreza
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
H.R. Pourreza
H.R. Pourreza
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)

 The goal is to obtain an estimate of f(x,y) according to the knowledge


about the degradation function h and the additive noise 

• Three possible cases


 g(x,y)=f(x,y)+ (x,y)
 g(x,y)=h(x,y)*f(x,y)
 g(x,y)=h(x,y)*f(x,y)+ (x,y)
A Model of the Image
Degradation/Restoration Process
H.R. Pourreza
Noise Models(for adding noise)
Gaussian Noise

• Noise (image) can be classified according to 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σ)]
Noise Models
Gaussian Noise
Other Noise Models
• Rayleigh noise(for adding noise)
2
 ( z  a )e ( z  a ) 2 / b
for z  a
p( z )   b

0 for z  a

 The mean and variance of this


density are given by
b( 4   )
  a  b / 4 and  2 
4

 a and b can be obtained through


mean and variance
Other Noise Models
• Erlang (Gamma) noise
 a b z b 1  az
 e for z  0
p( z )   (b  1)!
0 for z  0
 The mean and variance of this
density are given by
b
  b / a and   2
2

 a and b can be obtained


through mean and variance
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
1
  1 / a and  2 
a2

 Special case of Erlang


PDF with b=1
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
Other Noise Models

• Impulse (salt-and-pepper)
noise
 Pa for z  a

p( z )   Pb for z  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 distinguished from
others visually
A Sample Image
Effect of Adding Noise to Sample Image
Effect of Adding Noise to Sample Image
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
Estimation of Noise Parameters

• Periodic noise(parameters, assign value


according color)
 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
H.R. Pourreza
Restoration in the Presence of Noise Only
(De-Noising,reverse)
• 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 fˆ ( x, y ) 
mn
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  g ( s, t ) Q

 Q=0arithmetic mean filter ( s ,t )S x , y

 Q=-1harmonic mean filter


H.R. Pourreza
Corrupted by
Gaussian Noise
De-Noising

Mean
Filtering Geometric
Mean Filtering
Corrupted by Corrupted by
pepper noise salt noise
De-Noising

3x3 3x3
Contraharmonic Contraharmonic
Q=1.5 Q=-1.5
De-Noising
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
• Midpoint filter ˆf ( x, y )  1  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
Corrupted by salt & One pass
pepper noise median filtering
De-Noising

Two pass Three pass


median filtering median filtering
Corrupted by Corrupted by
pepper noise salt noise

De-Noising

Max Filtering Min Filtering


Alpha-Trimmed Mean Filter
(De-Noising)

• Alpha-trimmed mean filter takes the mean value of


the pixels enclosed by an m×n 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
De-Noising Added salt &
pepper noise
Corrupted by
additive Uniform
noise

5x5 Mean
Filtering 5x5 Geo-Mean
Filtering

5x5 Median 5x5 Alpha-


Filtering trimmed Mean
Filtering
Adaptive Filters
(De-Noising)restoration filter technique
• Adaptive Local Noise Reduction Filter
 Assume the variance of the noise 2 is either known
or can be estimated satisfactorily
 Filtering operation changes at different regions of an
image according to local variance  L2 calculated within
an M×N region
 If  L2  2 , the filtering operation is defined as
ˆf ( x, y )  g ( x, y )    [ g ( x, y )  m ]
2

 2 L
L
 If    , the output takes the mean value
2
L
2

 2
 That is: is set to be 1
L 2

 At edges, it is assumes that  2


L   2

Corrupted by Mean
Gaussian noise Filtering
De-Noising

Adaptive
Filtering

Geo-Mean
Filtering
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
Adaptive Median Filter
(De-Noising)

• Two levels of operations


 Level A: Used to test whether
 A1= Zmed –Zmin 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
is part of s-and-p noise.
 B1= Zxy –Zmin
If yes, apply regular
 B2= Zxy –Zmax median filtering
 If B1 > 0 AND B2 < 0, output Zxy
else output Zmed
De-Noising Median Filtering Adaptive Median
Filtering

You might also like