Enhancement vs.
Restoration
     Lecture 5: Image Restoration
                                                                                       o Same goal:
                                                                                         improve image in some predefined sense
                                                                                       o Image enhancement
                                                                                                • Subjective process
                                                                                                • Heuristic procedures
       BE 244: Biomedical Image Analysis                                                        • Example: contrast stretching
                                                                                       o Image restoration
                                                                                                • Objective process
                                                                                                • Criterion for image goodness
                                                                                                • Example: removal of image blur
Original slides by Tracy McKnight, modified by Piotr Habas, UCSF, 2009                 Original slides by Tracy McKnight, modified by Piotr Habas, UCSF, 2009                             2
Image Degradation                                                                      Image Restoration
o g(x,y) = H[f(x,y)] + (x,y)                                                           o Given g(x,y) and some a priori information about H and
                                                                                          (x,y), obtain an estimate f’(x,y) of the original image
     • f(x,y): original input image
     • H(): degradation function                                                       o We want the estimate f’(x,y) to be as close as possible
                                                                                         to the original input image f(x,y)
     • (x,y): additive noise
     • g(x,y): degraded output image                                                   o The more we know about H and                                        the closer f’(x,y) will
                                                                (x,y)                    be to f(x,y)
                                                                                                                                            (x,y)
   f(x,y)                          H                            +        g(x,y)
                                                                                        f(x,y)                H                             +       g(x,y)           ?               f’(x,y)
Original slides by Tracy McKnight, modified by Piotr Habas, UCSF, 2009            3    Original slides by Tracy McKnight, modified by Piotr Habas, UCSF, 2009                             4
Noise Probability Density Functions                                                    Noise PDFs
                                                                                      o Gaussian Noise              (z     )2
                                                                                                          1                     2   2
                                                                                                p( z )          e
o Noise is introduced into                                                                               2
  images during the                                                                     • “Normal” noise distribution
  acquisition and/or                                                                    • Electronic or sensor noise
  transmission processes                                                                • Common noise model – often
                                                                                          abused
o Noise can be correlated
  or uncorrelated with                                                                o Rayleigh Noise
                                                                                                   2          ( z a )2 b
  spatial coordinates                                                                                z ae                       for z   a
                                                                                       p( z )      b                                                                             a        b4
                                                                                                   0                            for z   a
                                                                                                                                                                             2   b4
                                                                                        • Useful for histogram analysis of                                                            4
                                                                                          images with significant
                                                                                          background component (ie
                                                                                          skewed)
Original slides by Tracy McKnight, modified by Piotr Habas, UCSF, 2009            5    Original slides by Tracy McKnight, modified by Piotr Habas, UCSF, 2009                             6
                                                                                                                                                                                               1
 Noise PDFs                                                                    Noise PDFs
oUniform Noise
                1
                        for a       z   b
   p( z )      b a
              0         otherwise
o Impulse Noise
               Pa     for z     a
    p( z )     Pb     for z     b                           a b
               0      otherwise                              2
                                                                   2
  • “Bipolar” , “Salt-and-Pepper”,                      2    b a
    “Shot”, or “Spike” noise                                  12
  • Impulses can be negative or
    positive and are typically at
    saturation levels
 Original slides by Tracy McKnight, modified by Piotr Habas, UCSF, 2009   7    Original slides by Tracy McKnight, modified by Piotr Habas, UCSF, 2009         8
 Noise PDFs                                                                    Noise Estimation
                                                                               o Noise characteristics may be estimated from the Fourier spectrum
                                                                                 of an image
                                                                                    • Periodic (spatially correlated) noise will appear as frequency spikes
                                                                               o Characteristics may be empirically derived for a given acquistion
                                                                                 system by imaging a flat (typically all black) environment
                                                                               o Regions of interest in existing images may also be used to
                                                                                 characterize noise
 Original slides by Tracy McKnight, modified by Piotr Habas, UCSF, 2009   9    Original slides by Tracy McKnight, modified by Piotr Habas, UCSF, 2009         10
 Noise reduction                                                               Image Degradation
 o Mean filters
      • Arithmetic mean filter
                                                                               o H is linear
      • Geometric mean filter                                                      H[k1f1(x,y) + k2f2(x,y)] = k1H[f1(x,y)] + k2H[f2(x,y)]
      • Harmonic mean filter (salt noise, Gaussian noise)
                                                                                   and position-invariant
 o Order-statistics filters
      •      Median filter (salt and pepper noise)                                  H[f(x - ,y - )] = g(x - ,y - )
      •      Min filter (salt noise)                                           o Spatial domain
      •      Max filter (pepper noise)
      •      Midpoint filter (uniform noise, Gaussian noise)
                                                                                   g(x,y) = h(x,y) * f(x,y) + (x,y)
                                                                               o Frequency domain
                                                                                   G(u,v) = H(u,v) F(u,v) + N(u,v)
 Original slides by Tracy McKnight, modified by Piotr Habas, UCSF, 2009   11   Original slides by Tracy McKnight, modified by Piotr Habas, UCSF, 2009         12
                                                                                                                                                                   2
      Image Degradation, example                                                                               Image Restoration
                                                                                                               o Estimation of degradation function H
                                                                                                                    • Image observation, Hs(u,v) = Gs(u,v) / Fs’(u,v)
                                                                                                                    • Experimentation
                                              =                        *                                            • Mathematical modeling
                        g(x,y)                =           h(x,y)
                                                                        *               f(x,y)                 o Direct inverse filtering
                                                                                                                   F’(u,v) = G(u,v) / H(u,v)
                                                                                                                   f’(x,y) = F-1 [F’(u,v)] = F--1 [G(u,v) / H(u,v)]
      Original slides by Tracy McKnight, modified by Piotr Habas, UCSF, 2009                         13        Original slides by Tracy McKnight, modified by Piotr Habas, UCSF, 2009                 14
      Image Restoration, example                                                                               Inverse Filtering, problems
                                                                                                               o F’(u,v) = G(u,v) / H(u,v)
50                                                                                                                 F’(u,v) = F(u,v) + N(u,v) / H(u,v)
100
                                                                                                                   F(u,v) = F’(u,v) - N(u,v) / H(u,v)
150
                                                                                                                   N(u,v) = ?
                                                                                                               o H(u,v) small -> N(u,v) / H(u,v) large
                                                                                        f’(x,y)
200
                 f(x,y)                              g(x,y)
                                           f(x,y) blurred with a 7x7 mean   f(x,y) restored with the inverse
                                                                                                                   may dominate the estimate F’(u,v)
250
        50        100      150      200      250         filter                           filter
                                                                                                                   we need to limit the analysis to frequencies near the
                                                                                                                   origin H(0,0)
      Original slides by Tracy McKnight, modified by Piotr Habas, UCSF, 2009                         15        Original slides by Tracy McKnight, modified by Piotr Habas, UCSF, 2009                 16
                                                                                                               Wiener Filter
      Wiener Filter
      o For g = Hf + n
                                    1               | H (u, v) |2
             F ' (u, v)                                                      G (u, v)
                                 H (u, v) H (u, v) 2 S n (u, v) / S f (u, v)
             S n (u, v) | N (u, v) |2 noise power spectrum
             S f (u, v) | F (u, v) |2 original image power spectrum
                                                                                                                             f                             g = Hf                       gn = Hf + n
      o Also called “least squares filter” because it minimizes
             2   = E{[f(u,v) - f’(u,v)]}
      o For S (u,v) = 0 => inverse filter
      o For “white noise” Sn(u,v) => constant
                                                                                                                        inverse(g)                        inverse(gn)                   wiener(gn)
      Original slides by Tracy McKnight, modified by Piotr Habas, UCSF, 2009                         17        Original slides by Tracy McKnight, modified by Piotr Habas, UCSF, 2009                 18