Image Restoration
Image Restoration
                                                                                                                     Gaussian       Rayleigh
                                                                          models for the image
                                                                          noise term η(x, y):
                                                                             – Gaussian
                                                                                  • Most common model           Erlang          Exponential
                                                                             –   Rayleigh
                                                                             –   Erlang (Gamma)
                                                                             –   Exponential
                                                                                                                    Uniform
                                                                             –   Uniform                                                  Impuls
                                                                             –   Impulse
                                                                                  • Salt and pepper noise
                                                                      8                                  Noise Example
                                                                          • The test pattern to the right is
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
                                                                                                                    Histogram
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
                                                                            9
                                                                      Noise Example (cont…)
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
                                                                            10
                                                                      Noise Example (cont…)
11
         Restoration in the presence of noise
                                         only
     • We can use spatial filters of different kinds
        to remove different kinds of noise
     • The arithmetic mean filter is a very simple
        one and is calculated as follows:
                        ˆ         1
                       f (x, y) mn
                                =
                                      ∑
                                            g(s, t)
                                            x
                                  ( s,t )   y
     1     1    1
                     This is implemented
                                ∈S        as the
      /9   /9   /9   simple smoothing filter
     1     1    1
      /9   /9   /9   It blurs the image.
     1     1    1
      /9   /9   /9
12
      Restoration in the presence of noise
                               only (cont.)
     • There are different kinds of mean filters all
        of which exhibit slightly different
       behaviour:
       – Geometric Mean
       – Harmonic Mean
       – Contraharmonic Mean
13
      Restoration in the presence of noise
                               only (cont.)
     Geometric Mean:
                                      1
                            ⎡
                                            ⎤
                                      mn
               ˆ
                        ⎢∏
               f (x, y) =          g(s, t) ⎥
                                          ⎥
                        ⎢⎣
                           ( s,t )
                        ∈Sxy
     • Achieves similar smoothing to        ⎦ the
       arithmetic mean, but tends to lose less
       image detail.
14
      Restoration in the presence of noise
                               only (cont.)
     Harmonic Mean:
                                       mn
                 ˆ
                f (x, y) =
                                ∑
                                             1
                                       x
                                           g(s, t)
                             ( s,t )   y
                             ∈S
     • Works well for salt noise, but fails for
        pepper noise.
     • Also does well for other kinds of noise
        such as Gaussian noise.
15
       Restoration in the presence of noise
                                only (cont.)
     Contraharmonic Mean:
                                ∑
                                       g(s, t)Q+1
                             ( s,t )
                fˆ(x,
                ∈S
                      y) =
                  xy
                              ( s,t )∈Sxy
                                  ∑
                                       g(s, t)Q
     • Q is the order of the filter.
     • Positive values of Q eliminate pepper noise.
     • Negative values of Q eliminate salt noise.
     • It cannot eliminate both simultaneously.
                                                                  16                   Noise Removal Examples
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
                                                                                                     Image
                                                                      Original image                 corrupted
                                                                                                     by Gaussian
                                                                                                     noise
                                                                                                     3x3
                                                                                                     Geometric
                                                                       3x3                           Mean Filter
                                                                       Arithmetic                    (less blurring
                                                                       Mean Filter                   than AMF, the
                                                                                                     image is
                                                                                                     sharper)
                                                                  17   Noise Removal Examples (cont…)
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
                                                                       Image corrupted by
                                                                       pepper noise at 0.1
                                                                       Image corrupted by
                                                                       salt noise at 0.1
     Min Filter:
                    ˆ
                   f (x, y) = min {g(s,t)}
                           (s,t )∈Sxy
        ˆ        1⎡                                   ⎤
       f (x, y) = ⎢ maxxy{g(s,
                            xy           )∈S {g(s, t)}⎥
                               t)}+ (s,tmin           ⎦
                 2 (s,t )∈S
                  ⎣
     • Good for random Gaussian and
       uniform noise.
24                Alpha-Trimmed Mean Filter
     Alpha-Trimmed Mean Filter:
                 ˆ          1
                f (x, y) = mn −              r
                                    ∑
                                  ( s,t )   g (s, t)
                            d     ∈Sxy
                                                                                                                                1 pass with a
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
                                                                       Salt And
                                                                       Pepper at 0.2                                            3x3 median
                                                                         Repeated passes remove the noise better but also blur the image
                                                                  26       Noise Removal Examples (cont…)
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
                                                                       Image                     Image
                                                                       corrupted                 corrupted
                                                                       by Pepper                 by Salt
                                                                       noise                     noise
                                                                       Filtering                 Filtering
                                                                       above                     above
                                                                       with a 3x3                with a 3x3
                                                                       Max Filter                Min Filter
                                                                  27          Noise Removal Examples (cont…)
                                                                       Image corrupted           Image further corrupted
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
                                                                      35
                                                                      Adaptive, local noise reduction filter
                                                                                                         Periodic Noise reduction by
                                                                  36
                                                                                                         frequency domain filtering
                                                                         electrical or electromagnetic
                                                                         interference.
                                                                       • Gives rise to regular noise
                                                                         patterns in an image.
                                                                       • Frequency domain techniques
                                                                           in the Fourier domain are
                                                                         most effective at removing
                                                                         periodic noise.
37                              Band Reject Filters
     • One of the principal applications of bandreject
       filtering is for noise removal in applications where
       the general location of the noise component(s) in
       the frequency domain is approximately known.
     • A good example is an image corrupted by additive
       periodic noise that can be approximated as
       two-dimensional sinusoidal functions.
                                                                  38                   Band Reject Filters (cont…)
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
                                                                          burst).
                                                                       • Removing completely the star-like components
                                                                          may also remove image information.
                                                                  42         Optimum Notch Filtering (cont.)
N(k,l) = H (k,l)G(k,l)
                                                                                     ˆ
                                                                                    f (m, n) = g(m, n) − w(m, n)η(m, n)
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
                                                                                       +1)                     n) a
                                                                                                                  ⎥⎦
                                                                                                                 ∑    ∑ fˆ(m + k, n +
                                                                                                   1
                                                                        with         ˆ                             b
                                                                                    f (m, n) (2a +1)(2b         k =−a l =−b
                                                                                    =          +1)                          l)
                                                                       • Substituting the estimate in σ(m,n): yields:
                                                                  45                       Optimum Notch Filtering (cont.)
                                                                                                        a    b
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
                                                                                              ∑+1)
                                                                                                ∑ k =−a l
                                                                       σ (m, n)          1
                                                                                     (2a +1)(2b                       g(m + k, n + l) − w(m + k, n + l)η(m + k, n +
                                                                       =                                         {[                               2
                                                                                                            − ⎡⎣l) g−⎦(m, n) − w(m,η (m, ⎤       }
                                                                                     =−b
                                                                                                            n) ]                   n)
                                                                        • A simplification is to assume that the weight remains
                                                                          constant over the neighbourhood:
                                                                                  w(m + k, n + l) = w(m, n), − a ≤ k ≤ a, − b ≤ l ≤ b
                                                                                                            a         b
                                                                                                    ∑+1)
                                                                                                      ∑ k =−a l
                                                                          σ (m, n)             1
                                                                                           (2a +1)(2b                          g(m + k, n + l) − w(m, n)η(m + k, n +
                                                                          =
                                                                                           =−b
                                                                                                                          {[
                                                                                                            − g l)
                                                                                                                (m,−n) − w(m, n)η (m,
                                                                                                                 [         ]
                                                                                                                      2
                                                                                                            n)
                                                                                                                 ]
                                                                  46           Optimum Notch Filtering (cont.)
                                                                                             ∂σ (m, n)
                                                                                                         =0
                                                                                             ∂w(m, n)