You are on page 1of 13

Restoration vs.

Enhancement
•Enhancement  mostly subjective process
Image Restoration I  to enhance image w.r.t. human visual system
 empirical
Noise .e.g. contrast stretching

•Restorationrecover original image from degradations


where degradations were incurred while
Ing-
Ing-Tsung Hsiao the digital image was being obtained.
Assistant Professor  objective process
Department of .e.g. deblurring
Medical Imaging & Radiological Sciences
Chang Gung University •Recover = model the degradation + apply inverse process

MIRS MIRS

Introduction II Introduction II
•Restorationrecover original image from degradations •Restoration  reconstruct or recover the original image
where degradations were incurred while • modeling the degradation
the digital image was being obtained. • inverse process : formulate a criterion of goodness for
optimal estimate of the original image.
•Two types of Degradations :
1. Blurring effect from optical systems, image motion.. restoration

2. Noise from electronic and photometric sources •Other degradations: sensor, digitizer, and display
degradations.

MIRS MIRS

1
Introduction III Degradation model I
•Spatial domain vs. frequency domain ?

•Same as in enhancement (chap 4), both spatial and n ( x, y )


frequency domain processing are useful. BUT,
f ( x, y ) H {}  g ( x, y )
•Additive noise  spatial processing

•Deblur  frequency processing

g  H{ f }  n
•Restoration  Know or model H and n, then apply the inverse
process to recover the original image f from g.
MIRS MIRS

Degradation model II Degradation model in Freq domain


g  H{ f }  n • Usually, the system model is just a convolution
• H: system operator, or system matrix g  H{ f }  n
• n : additive noise; Gaussian model ~N(0,  2 )
• Properties of H: (assume n is zero)
 Linear and additivity g ( x, y )  h ( x, y )  f ( x, y )  n ( x, y )
H {a1 f1  a2 f 2 }  a1 H { f1}  a2 H { f 2 }
• and its frequency domain representation
 Homogeneity H {a1 f1}  a1 H { f1}
 Position invariant
G (u, v)  H (u, v) F (u , v)  N (u, v)
H { f ( x   , y   )}  g ( x   , y   )
MIRS MIRS

2
Additive Noise Only Degradation
• Now let’s consider H is the identity operator (H=I)
g  H{ f }  n

Noise Models
g  f n

MIRS MIRS

Noise Model g  Hf  n Noise Model II g  Hf  n


•Noise models n: •Below, all the noise models considered are
•Arise during acquisition (digitization), transmission. • indep of spatial coordinates
•White noise (constant Fourier spectrum)white light carry all • uncorrelated w.r.t. the image itself
freq.
•Spatial characteristic by a pdf statistical behavior of • easy to handle
the gray-level values in noise component n.
• image = mean(signal) + std (variation)
noisy reault; g=f+n signal f Gaussian noise n; zero mean; std=0.25
•Spatially dep. And Correlated noise, e.g.
3 3 3
•Periodic noise
2 2 2
•Poisson noise (noise is ~ image (mean=variance)).
1 1 1
• difficult to deal with
0 0 0

-1 -1 -1
0 50 100 150 0 50 100 150 0 50 100 150

MIRS MIRS

3
Noise Model III g  Hf  n Noise Model III g  Hf  n
•the noise models n can be characterized by a probability •Examples of the noise models (pdf’s) n :
density function:
• characterized by its mean  and variance 2
• intensity fluctuation (variance) around a fixed value •Gaussian noise
(mean) 3
noisy reault; g=f+n •Rayleigh noise
2
•Erlang (Gamma) noise
• histogram •Exponential noise
1
•Uniform noise
0
• probability density function •Impulse noise (Salt-and-pepper)
-1
0.16 0 50 100 150
0.14

0.12

0.1

0.08

0.06

0.04

0.02

0
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
MIRS MIRS

Gaussian Noise Model Other Noise Models


•Gaussian noise ( z ) 2 •Rayleigh noise 2
 ( z  a )e  ( z  a ) / b za
2
1 
n( z )  e 2 2 p( z )   b
2 2  0 za
Gaussian noise; =0.25;  =0
0.16
Matlab; •Where a >0.

  a  b / 4
0.14

0.12 n=randn(1,10)*sigma
0.1

0.08

b( 4   )
70% in the range of
[   ,    ]
2 
0.06

0.04

0.02 95% in 4
0
-1 -0.5  0  0.5 1
[   2 ,   2 ]
MIRS MIRS

4
Other Noise Models Other Noise Models
a zb b 1
•Erlang (Gamma) noise
 e  az z0
•Exponential noise ae  az z0
p ( z )   (b  1)! p( z )  
  0 z0
0 z0
•Where a >0, and b is positive. •Where a >0.
b 1
 3
exponential pdf

a 2.5

2
a
b 1
  2 2 
1.5
2
1

a 0.5 a2
0
0 1 2 3 4 5
MIRS MIRS

Other Noise Models Other Noise Models


•Uniform noise  1 •Salt and pepper noise (impulse)
p za
 bza
p( z )   b  a p( z )   a
 0 others  pb z b
•If b>a, b bright pixel  salt
1 ab
ba  • a dark pixel  pepper

2
(b  a ) 2
  2

12
a b MIRS MIRS

5
Other Noise Models Examples of Noise Models

MIRS MIRS

Examples of Noise Models Gaussian Noise generator

Function g=Gaussnoise(f,sigma)
If nargin<2, sigma = 0.05; %define std
g = randn(size(f))*sigma+f;

Gaussian noise

MIRS MIRS

6
Salt Pepper Noise generator Parameter estimation
•Salt and pepper noise generator •Use data for pdf parameter estimation: select subimage S
0.16

•Function g=saltpeppernoise(f,p1) •Histogram h( zi )


0.14

0.12

0.1

If nargin<2, P1 = 0.05; %Noise density 0.08

g = f; •Normalized histogram p ( zi ) 0.06

0.04

0.02

x = rand(size(f));
̂   zi p ( zi )
0
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1

d = find(x < P1/2); •Mean


b(d) = 0; %for pepper noise zi S
d = find(x >= P1/2 & x < P1);
b(d) = 255; %for salt noise •Variance ˆ 2   ( zi  ˆ ) 2 p ( zi )
zi S

•How about salt or pepper only noise? •Parameter estimation use ̂ and ̂ 2 to solve for
parameters a and b for various pdf (pdf ‘s shape
MIRS MIRS
from histogram).

Spatial Restoration for noisy image Mean filters


•Noise-only degradation: g(x, y)  f(x, y)  n(x, y) •Arithmetic mean filter: (lowpass mask=averaging mask)
1
G(u, v)  F(u, v)  N (u, v) fˆ ( x,y )   g (m, n)
AB ( m ,n )S xy

•Substraction of noise n from g is usually difficult • s xy is the mask window; A and B are the sizes of the window
 noise is unknown
•Smoothing out the local noise in an image  blurring
1
•Geometric mean filter:   AB
•Noise-reduction spatial filters
fˆ ( x,y )    g (m, n)
( m ,n )S xy 
•Similar to those in image enhancement
•Comparable to the arithmetic mean filter but lose less detail
MIRS MIRS

7
Mean filters II Adaptive, local noise reduction filter
•Harmonic mean filter: •Suppose we know the overall variance of an image  n2
•(What if we do not know?)
AB
fˆ ( x,y )  •Now an adaptive filter is designed as:
 1
 2
fˆ ( x,y )  g ( x, y )  n2 g ( x, y )  ˆ L 
g ( m ,n )
( m , n )S xy
•Good for Gaussian noise ˆ L
•Contraharmonic mean filter: •Where: ̂ L and ˆ L2 are the local mean and variance
 g ( m, n )
( m , n )S xy
Q 1 of the local image (window) s xy
fˆ ( x,y )   n 2 =0, fˆ ( x,y )  g ( x, y )  f ( x, y )
 g (m, n)
( m , n )S xy
Q •If
•Q: order of the filter
•Q= 0  arithmetic mean filter •If  n 2   L 2 , fˆ ( x,y )  g ( x, y )
•Q=-1  harmonic mean filter
• if    , f ( x,y )  ̂
MIRS
2 2 ˆ MIRS
n L L

Filters vs. Noise I Filters vs. Noise II


• Arithmetic mean filter: •Adaptive mean filter:
•1. Smooth local variation (blurring) •1. Similar to Arithmetic and Geometric mean
•2. Good for Gaussian noise filters
•Geometric mean filter: •2. Sharper image (less blurring)
•1. Same as arithmetic mean filter
•2. But with less blurring •Also: the window size matters
•Harmonic mean filter:
•1. Good for Gaussian, Salt noise
•Contraharmonic mean filter:
•1. Q>0  pepper noise
•2. Q<0  salt noise
MIRS MIRS

8
Order-
Order-Statistics filters Examples
•Rank the pixels and choose a specific ordered pixel t
min median max •Original image •Gaussian noisy image
•Median filter:
fˆ ( x,y )  median{g (m, n)}
( m , n )S xy

•Max and min filter: fˆ ( x,y )  max {g (m, n)}


( m , n )S xy

fˆ ( x,y )  min {g (m, n)}


( m , n )S xy

1
•Midpoint: fˆ ( x,y )  [ max {g (m, n)}  min {g (m, n)}]
2 ( m ,n )S xy ( m , n )S xy •3x3 geometric
•3x3 arithmetic mean mean filtered image
•Alpha-trimmed mean filter: filtered image
•use only AB-C number of pixels for arithmetic mean
•Remove C/2 lowest and C/2 highest pixels in s xy MIRS MIRS

Examples Examples
t t
•(a) Pepper and salt noise •(b) median filtered once
•(a) Pepper noise (p=0.1) •(b) Salt noise (p=0.1) (pp=ps=0.1)

•Contraharmonic filter •Contraharmonic filter •Median filtered twice •Median filtered 3 times
With Q=1.5 on (a) With Q=-1.5 on (b) MIRS MIRS

9
Adaptive Median Filter I Adaptive Median Filter II
• zmin  min gray level value in S xy •Level A: A1  zmed  z min
A2  zmed  z max
• zmax  max gray level value in S xy
•If A1>0 and A2<0, Go to Level B
• zmed  median gray level value in S xy •Else increase the window size
•If window size S maxthen repeat level A
• z xy  gray level value at coordinates (x,y) •Else output z xy

• Smax  max allowed size of S xy •Level B: B1  z xy  z min


B 2  z xy  z max
•If B1>0 and B2<0, output z xy
MIRS •Else output zmed MIRS

Periodic Noise Periodic Noise: Example


• Periodic noise: appears typically from electrical or • Periodic noise: pairs of conjugate impulses
electromechanical interference during image
acquisition

•Example: sinusoidal noise of various frequencies


a pair of conjugate impulses in freq. domain

Periodic
noise Fourier Transform

MIRS MIRS

10
Periodic Noise: Example Periodic Noise Component
• Rescaled Fourier Spectrum • Periodic noise: pairs of conjugate impulses

Fourier Transform Noise component

MIRS MIRS

Periodic Noise Reduction Ideal Band-reject filter


0 if D0  W / 2  D (u , v)  D0  W / 2
•Band-reject filters: H (u, v)  
1 otherwise
0 if D0  W / 2  D(u, v)  D0  W / 2
H (u , v)  
1 otherwise

D0 MIRS MIRS

11
Butterworth Band-reject filter Gaussian Band-reject filter
H (u, v)  1 2
1  D 2 ( u ,v )  D0 
2n 2
 D(u, v)W    
1  2 2 2  D ( u ,v )W 
 D (u , v)  D0  H (u , v)  1  e

MIRS MIRS

Filtered Results Ideal Bandreject filtered Result


the phantom Ideal Bandreject filtered f •The Fourier Spectrum of the filtered image.

Rejected Frequency Band

Butterworth Bandreject filtered f Gaussian Bandreject filtered f

MIRS MIRS

12
BandPass and Notch filters
•Bandpass = 1 – bandreject

• to extract the noise effect on selected


frequency bands

•Notch Filter : to reject or pass freq. components


in predefined neighborhoods about a center freq.

MIRS

13

You might also like