Title: Chapter 3: Image Restoration
1Chapter 3 Image Restoration
- Noise Removal Using Spatial Filters
2Overview
- Spatial filters can be used to remove various
types of noise in digital images. - These spatial filters typically operate on small
neighborhood, between 3x3 to 11x11. - We will use the degradation model defined before,
but we assume that h(r,c) causes no degradation.
3Overview
- Therefore, corruption on the image is only caused
by additive noise, n(r,c). - d(r,c) I(r,c) n(r,c)
- There are two primary categories of spatial
filters for noise removal. - Order filters arrange the pixels from smallest
to largest and select the correct value. - Mean filters calculate the average value.
4Overview
- The mean filters work best with gaussian or
uniform noise. - The order filters work best with salt-and-pepper,
negative exponential, or Rayleigh noise. - The mean filters are essentially low pass
filters - They tend to blur the edges or details.
5Overview
- The order filters are nonlinear filters
- The results are sometimes unpredictable.
- In general, there is a tradeoff between
preservation of image detail and noise
elimination. - In practical applications, a good approach is to
use an adaptive filter (a filter that can adapt
itself to the underlying pixel values).
6Order Filters
- Order filters are based on a specific type of
image statistics called order statistics. - Order statistics is a technique that arranges all
the pixels in sequential order, based on
gray-level value. - The placement of the value within this ordered
set is referred to as the rank.
7Order Filters
- Given an NxN window, the pixel values can be
ordered from smallest to largest as follows - I1? I2 ? I3?.....? IN2
- Where I1,I2,I3,.....,IN2 are the gray-level
values of the subset of pixels in the image, that
are in the NxN window. - Different types of order filters select different
values from the ordered pixel list.
8Order Filters
- Median filter
- Select the middle pixel value from the ordered
set. - Used to remove salt-and-pepper noise.
- Maximum filter
- Select the highest pixel value from the ordered
set. - Remove pepper-type noise.
9Order Filters
- Minimum filter
- Select the lowest pixel value from the ordered
set. - Remove salt-type noise.
- As the size of the window gets bigger, the more
information loss occurs. - With windows larger than about 5x5, the image
acquires an artificial, painted, effect.
10Order Filters
Minimum Filter
Image with salt noise Probability .04
Result of minimum filtering Mask 3 x 3
11Order Filters
Minimum filtering Mask 5 x 5
Minimum filtering Mask 9 x 9
12Order Filters
Maximum Filter
Maximum filtering Mask 3 x 3
Image with pepper noise Probability .04
13Order Filters
Maximum filtering Mask 9 x 9
Maximum filtering Mask 5 x 5
14Order Filters
- Order filters can also be defined to select a
specific pixel rank within the ordered set. - For example, we may find the second highest value
is the better choice than the maximum value for
certain pepper noise. - This type of ordered selection is application
specific. - Minimum filter tend to darken the image and
maximum filter tend to brighten the image.
15Order Filters
- Midpoint filter
- Average of the maximum and minimum within the
window. - Useful for removing gaussian and uniform noise.
16Order Filters
Image with gaussian noise. Variance 300, mean
0
Result of midpoint filter Mask size 3
17Order Filters
Result of midpoint filter Mask size 3
Image with uniform noise. Variance 300, mean
0
18Order Filters
- Alpha-trimmed mean filter
- The average of the pixel values within the
window, but with some endpoint-ranked values
excluded. - T is the number of pixels excluded at each end of
the ordered set
19Order Filters
- The alpha-trimmed mean filter ranges from a mean
to median filter, depending on the value selected
for the T parameter. - If T 0, ? mean filter.
- If T (N2 1) / 2, ? median filter.
- The alpha-trimmed mean filter is useful for
images containing multiple types of noise. - Example Gaussian salt-and-pepper.
20Order Filters
Image with gaussian noise Variance 200, mean
0. Salt-and-pepper noise probability 0.02
Result of alpha-trimmed mean filter Mask size
3 Trim size 0
21Order Filters
Result of alpha-trimmed mean filter Mask size
3 Trim size 1
Result of alpha-trimmed mean filter Mask size
3 Trim size 4
22Mean Filters
- The mean filters function by finding some form of
an average within the NxN window. - The most basic of these filters is the arithmetic
mean filter. - This filter mitigates the noise effect, but at
the same time tend to blur the image. - The blurring effect is not desirable, and
therefore other mean filters are designed to
minimize this loss of detail information.
23Mean Filters
- Arithmetic mean filter
- Find the arithmetic average of the pixel values
in the window. - Smooth out local variations in an image.
- Tend to blur the image.
- Works best with gaussian and uniform noise.
24Mean Filters
Image with gaussian noise Variance300, mean 0
Result of arithmetic mean filter Mask size 3
25Mean Filters
Result of arithmetic mean filter Mask size 5
Result of arithmetic mean filter Mask size 9
26Mean Filters
Image with gamma noise Variance300, mean 0
Result of arithmetic mean filter Mask size 3
27Mean Filters
Result of arithmetic mean filter Mask size 5
Result of arithmetic mean filter Mask size 9
28Mean Filters
- Contra-harmonic mean filter
- Works for salt OR pepper noise, depending on the
filter order R. - Negative R ? Eliminate salt-type noise.
- Positive R ? Eliminate pepper-type noise.
29Mean Filters
Image with salt noise Probability .04
Result of contra-harmonic filter Mask size 3
order 0
30Mean Filters
Result of contra-harmonic filter Mask size 3
order -1
Result of contra-harmonic filter Mask size 3
order -5
31Mean Filters
Image with pepper noise Probability .04
Result of contra-harmonic filter Mask size 3
order 0
32Mean Filters
Result of contra harmonic filter Mask size 3
order 5
Result of contra harmonic filter Mask size 3
order 1
33Mean Filters
- Geometric mean filter
- Works best with gaussian noise.
- Retains detail better than arithmetic mean
filter. - Ineffective in the presence of pepper noise (if
very low values present in the window, the
equation will return a very small number).
34Mean Filters
Image with gaussian noise Variance 300, mean
0
Result of geometric filter Mask size 3
35Mean Filters
Image with pepper noise Probability .04
Result of geometric filter Mask size 3
36Mean Filters
Image with salt noise Probability.04
Result of geometric filter Mask size 3
37Mean Filters
- Harmonic mean filter
- Works with gaussian noise.
- Retains detail better than arithmetic mean
filter. - Works well with pepper noise.
38Mean Filters
Image with pepper noise Probability .04
Result of harmonic filter Mask size 3
39Mean Filters
Image with salt noise Probability.04
Result of harmonic filter Mask size 3
40Mean Filters
- Yp mean filter
- Remove salt noise for negative values of P.
- Remove pepper noise for positive values of P.
41Adaptive Filters
- An adaptive filter alters its basic behavior as
the image is processed. - It may act like a mean filter on some parts of
the image and a median filter on other parts of
the image. - The typical character used to determine the
filter behavior are the local image
characteristics. - Measured by local gray-level statistics.
42Adaptive Filters
- The minimum mean-square error (MMSE) filter is a
good example of an adaptive filter. - sn2 noise variance.
- sl2 local variance (in the window).
- ml local mean (average in the window).
43Adaptive Filters
- MMSE filter exhibits varying behavior based on
local image statistics - No noise ? variance 0 ? equation returns
original image. - Regions with fairly constant value (no
edge/details) ? noise variance local variance
? equation reduces to mean filter. - Regions with high details (edges) ? local
variance gtgt noise variance ? equation returns
values close to original image.
44Adaptive Filters
- In general, MMSE filter modifies the image based
on the noise to local variance ratio. - High ratio implies the existence of noise in the
window, and therefore the filter returns
primarily the local average to reduce the noise. - Low ratio implies high local detail, therefore
the filter returns more of the original
unfiltered image to preserve the detail.
45Adaptive Filters
- By being able to adapt itself to the local image
statistics, the MMSE filter can preserve the
details while at the same time remove the noise. - MMSE filter works best with gaussian or uniform
noise, and can perform better compared to the
other filters discussed before.
46Adaptive Filters
Image with gaussian noise Variance300, mean 0
Original Image
47Adaptive Filters
Result of MMSE Mask size 5
Result of MMSE Mask size 3
48Adaptive Filters
Result of MMSE Mask size 9
Result of MMSE Mask size 7