0% found this document useful (0 votes)
6 views58 pages

Image Restoration Techniques in Processing

The document covers Chapter 5 of Digital Image Processing, focusing on image restoration techniques to recover degraded images caused by various distortions. It discusses the differences between image enhancement and restoration, models of image degradation, and various noise types and their probability density functions. Key restoration methods include spatial and frequency domain filtering, inverse filtering, and Wiener filtering.

Uploaded by

ammupinku789
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views58 pages

Image Restoration Techniques in Processing

The document covers Chapter 5 of Digital Image Processing, focusing on image restoration techniques to recover degraded images caused by various distortions. It discusses the differences between image enhancement and restoration, models of image degradation, and various noise types and their probability density functions. Key restoration methods include spatial and frequency domain filtering, inverse filtering, and Wiener filtering.

Uploaded by

ammupinku789
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Digital Image Processing Notes 17EC72/15EC72

Module-5

Chapter-5:
Restoration: A model of the Image Degradation/Restoration Process, Noise models,
Restoration in the Presence of Noise Only using Spatial Filtering and Frequency
Domain Filtering, Inverse Filtering, Minimum Mean Square Error (Wiener) Filtering.
[Text 1: Chapter 5: Sections 5.1, to 5.4.3, 5.7, 5.8]
Text Books:
[Link] Image Processing - Rafel C Gonzalez and Richard E. Woods, PHI 3rd Edition
2010.
Reference Books:
[Link] Image Processing - [Link], [Link], [Link], TataMcGraw
2. Fundamentals of Digital Image Processing-A. K. Jain, Pearson 2004.

Chapter-5
RESTORATION
5.1 Introduction

 Image degradation can happen due to


1. Sensor distortion [involves quantization, sampling, sensor noise, spectral sensitivity,
nonlinearity of sensor etc.]
2. Optical distortion [are geometric distortion, blurring due to camera misfocus,etc.]
3. Atmospheric distortion [haze, turbulence, etc.]
4. Other distortion [Low illumination, motion between camera and object, etc.]
 As in image enhancement, the goal of restoration techniques is to improve an image in some
predefined sense.
 Image enhancement is a subjective process, while image restoration is an objective process.
 Restoration attempts to recover an image that has been degraded by using a priori knowledge
of the degradation phenomenon.
 Restoration techniques are oriented toward modeling the degradation and applying the
inverse process in order to recover the original image.

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 1


Digital Image Processing Notes 17EC72/15EC72

 Contrast enhancement techniques designed to manipulate an image; contrast stretching is


considered an enhancement technique, whereas removal of image blur by applying a
deblurring function is considered a restoration technique.
 Some restoration techniques are best formulated in the spatial domain, while others are better
suited for the frequency domain.
Example: spatial processing is applicable when the only degradation is additive noise.
Frequency processing is applicable when the degradations such as image blur, noise.
Enhancement Vs Restoration
Sl no. Enhancement Restoration
1 It gives better visual representation It removes effects of sensing environment
2 No model required Mathematical model of degradation is required
3 It is subjective process Objective process
4 Contrast stretching, histogram equalization Inversing filtering, wiener filtering, denoising
etc. are some enhancement techniques. are some restoration techniques

5.2 A Model of the Image Degradation/Restoration Process

FIGURE 5.1: A model of the image degradation/ restoration process

 Fig. 5.1 shows, the degradation process is modeled as a degradation function together with
an additive noise term, operates on an input image f(x, y) to produce a degraded image
g(x, y).
 Given g(x, y), some knowledge about the degradation function H, and some knowledge about
the additive noise term η(x, y), the objective of restoration is to obtain an estimate ̂(x, y) of
the original image.

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 2


Digital Image Processing Notes 17EC72/15EC72

 We want the estimate to be as close as possible to the original input image and, in general,
the more we know about H and η, the closer ̂(x, y) will be to f(x, y).
 The degraded image in spatial domain is given by
g(x, y) = h(x, y) f(x, y) + η(x, y)……………….. (1)
where
h(x, y) is the spatial representation of the degradation function
“ ” Symbol indicates convolution.
 Convolution in the spatial domain is analogous to multiplication in the frequency domain, so
Eq. (1) in an equivalent frequency domain representation is:
G(u, v) = H(u, v)F(u, v) + N(u, v)………………. (2)
5.3 Noise Models
 Sources of noise in digital images arise during image acquisition and/or transmission.
During image acquisition:
 Performance of imaging sensors is affected by a variety of factors, such as environmental
conditions during image acquisition, and by the quality of the sensing elements themselves.
 Acquiring images with a CCD camera, light levels and sensor temperature are major factors
affecting the amount of noise in the resulting image.
During transmission:
 Images are corrupted during transmission due to interference in the channel used for
transmission.
Example: Image transmitted using a wireless network might be corrupted as a result of
lightning or other atmospheric disturbance.

5.3.1Spatial and Frequency Properties of Noise

1) Frequency properties refer to the frequency content of noise in the Fourier sense.
Example: when the Fourier spectrum of noise is constant, the noise usually is called
white noise.
2) Noise is assumed to be independent of spatial coordinates, and that it is uncorrelated with
respect to the image itself (that is, there is no correlation between pixel values and the
values of noise components).

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 3


Digital Image Processing Notes 17EC72/15EC72

5.3.2 Some Important Noise Probability Density Functions


 Spatial noise descriptor is the statistical behavior of the intensity values in the
noise component of the model in Fig. 5.1.

 Noise intensity is considered as a random variables characterized by a certain


probability density function (PDF).

 The following are the most common PDFs found in image processing
applications.

1. Gaussian noise
 PDF of a Gaussian random variable, z, is given by

̅ ⁄
P(z)= …………………(1)

Where
z represents intensity,
̅ the mean (average) value of z,
σ Standard deviation,
Standard deviation squared is called the variance of z.
 A plot of this function is shown in below Fig.

FIGURE 5.2(a): PDF of Gaussian noise.

 When z is described by Eq(1),approximately 70% of its value will be in the range [( ̅


̅ ,and about 95% will be in the range[( ̅-2σ), ̅ .
 Gaussian noise arises in an image due to factors such as electronic circuit noise and
sensor noise due to poor illumination and/or high temperature.

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 4


Digital Image Processing Notes 17EC72/15EC72

2. Rayleigh noise
 PDF of Rayleigh noise is given by

{ ……………………….. (2)

 Mean and variance of this density are given by

̅=a+√ ⁄ .............................. (3)

= ……………….(4)

•Plot of this function is shown in below Fig.

FIGURE 5.2(b): PDF of Rayleigh noise.

 Displacement from the origin and the fact that the basic shape of this density is skewed
to the right.
 Rayleigh density can be quite useful for approximating skewed histograms.
 Rayleigh density is helpful in characterizing noise phenomena in range imaging.

3. Erlang (gamma) noise


 PDF of Erlang noise is given by

{ ………………………….(5)

a ,b is a positive integer, ! Indicates factorial.


 Mean and variance of this density are given by
̅ …………………(6)

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 5


Digital Image Processing Notes 17EC72/15EC72

= ……………….(7)

 This PDF is a special case of the Erlang PDF, with b=1.


 Plot of this function is shown in below Fig.

FIGURE 5.2(c): PDF of Erlang (gamma) noise

 Eq. (5) is referred to as the gamma density, only when the denominator is the gamma
function Г(b), When the denominator is as shown, the density is called the Erlang density.
 Gamma densities find application in laser imaging.
4. Exponential noise
 PDF of exponential noise is given by

{ ………………………..(8)

Where a>0.
 Mean and variance of this density function are

̅ ……………………(9)
= ………………….(10)

 Plot of this function is shown in below Fig.

FIGURE 5.2(d): PDF of Exponential noise.


 The exponential find application in laser imaging.

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 6


Digital Image Processing Notes 17EC72/15EC72

5. Uniform noise
 PDF of uniform noise is given by

P(z)={ ……………………(11)

 Mean & variance of this density function are given by

̅ …………… (12)
………………..(13)
 Plot of this function is shown in below Fig.

FIGURE 5.2(e): PDF of Uniform noise

 Uniform density is possibly the least descriptive of practical situations.


 Uniform density is quite useful as the basis for numerous random number generators
that are used in simulations.

6. Impulse (Salt-and-Pepper) noise

 PDF of (bipolar) impulse noise is given by

{ ……………….. (14)

 If b a, intensity b will appear as a light dot in the image and Level a will appear
like a dark dot. This is a bipolar noise
 If Pa =0 or Pb =0, the impulse noise is called unipolar noise.
 If neither probability is zero, and if they are approximately equal, impulse noise
values will resemble salt-and-pepper granules randomly distributed over the image.
For this reason, bipolar impulse noise also is called salt- and-pepper noise.

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 7


Digital Image Processing Notes 17EC72/15EC72

 Noise impulses can be negative or positive.


 Generally a and b values are saturated (very high or very low value), resulting in
Negative impulses appear as black (pepper) points in an image and Positive impulses
appear as white (salt) noise. For an 8-bit image this means that a = 0 (black) and b =
255 (white).
 Plot of this function is shown in below Fig.

FIGURE 5.2(f): PDF of Impulse (Salt-and-Pepper) noise

EXAMPLE: Noisy images and their histograms.

FIGURE 5.3 Test pattern used to illustrate the characteristics of the noise PDFs

 Figure 5.3 shows a test pattern well suited for illustrating the noise models. This is a
suitable pattern to use because it is composed of simple, constant areas that span the
gray scale from black to near white in only 3 increments.
 This facilitates visual analysis of the characteristics of the various noise components
added to the image.

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 8


Digital Image Processing Notes 17EC72/15EC72

FIGURE 5.4 Images and histograms resulting from adding Gaussian, Rayleigh and gamma noise to the image in
Fig.5.3

FIGURE 5.4 (continued) Images and histograms resulting from adding Exponental, uniform and salt and pepper
noise to the image in Fig.5.3
 Figure 5.4 shows the test pattern after addition of the 6 types of noise, each image is
the histogram computed directly from that image.
 The parameters of the noise were chosen in each case so that the histogram
corresponding to the 3 intensity levels in the test pattern would start to merge. This

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 9


Digital Image Processing Notes 17EC72/15EC72

made the noise quite visible, without obscuring the basic structure of the underlying
image.
 The histogram for the salt-and-pepper example has an extra peak at the white end of
the intensity scale because the noise components were pure black and white, and the
lightest component of the test pattern (the circle) is light gray.
 With the exception of slightly different overall intensity, it is difficult to differentiate
visually between the first 5 images in Fig. 5.4, even though their histograms are
significantly different.
 The salt-and- pepper appearance of the image corrupted by impulse noise is the only
one that is visually indicative of the type of noise causing the degradation.

5.3.3Periodic Noise
 Periodic noise is a spatially dependent noise.
 Periodic noise in an image arises from electrical or electromechanical interference during
image acquisition.
 Periodic noise can be reduced significantly via frequency domain filtering.
Example:

FIGURE 5.5
(a) Image corrupted by sinusoidal noise.
(b) Spectrum (each pair of conjugate impulses corresponds to one sine wave).
 Consider the image in Fig. 5.5(a). This image is severely corrupted by sinusoidal noise of
various frequencies.

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 10


Digital Image Processing Notes 17EC72/15EC72

 The Fourier transform of a pure sinusoid is a pair of conjugate impulses located at the
conjugate frequencies of the sine wave.
 Thus, if the amplitude of a sine wave in the spatial domain is strong enough, we would
expect to see in the spectrum of the image a pair of impulses for each sine wave in the image.
 As shown in Fig. 5.5(b), this is indeed the case, with the impulses appearing in an
approximate circle because the frequency values in this particular case are so arranged.
5.3.4 Estimation of Noise Parameters
 Parameters of periodic noise are estimated by frequency domain. Periodic noise tends to
produce frequency spikes that can be detected even by visual analysis.
 Parameters of noise PDFs may be known partially from sensor specifications, but it is often
necessary to estimate them for a particular imaging arrangement.
Imaging system is available
 If the imaging system is available, way to study the characteristics of system noise is to
capture a set of images of “flat” environments.
Example: in the case of an optical sensor, this is as simple as imaging a solid gray board that
is illuminated uniformly.
 The resulting images are good indicators of system noise.
Imaging system not available
 Images already generated by a sensor are available; it is possible to estimate the parameters
of the PDF from small patches of reasonably constant background intensity.
Example: Vertical strips (of 150 * 20 pixels) shown in Fig. 5.6 were cropped from the Gaussian,
Rayleigh, and uniform images in Fig. 5.4.

FIGURE 5.6 Histograms computed using small strips (shown as inserts) from (a) the Gaussian, (b) the Rayleigh, and
(c) the uniform noisy images in Fig. 5.4.

 Histograms shown were calculated using image data from these small strips.
 Middle Histograms in the Figs. 5.4(d), (e), and (k) match to the histograms in Fig. 5.6. Their

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 11


Digital Image Processing Notes 17EC72/15EC72

heights are different due to scaling, but the shapes are similar.
 Consider a strip (subimage) denoted by S, and let pS(zi), i = 0, 1, 2, …… , L - 1, denote the
normalized histogram values of the intensities of the pixels in S, L is the number of possible
intensities in the entire image.
 Mean and variance of the pixels in S as follows:
̅=∑ ………………..(1)

∑ ̅ ……………..(2)
5.4 Restoration in the Presence of Noise Only—Spatial Filtering
 The degraded image in spatial domain is given by
g(x, y) = h(x, y) f(x, y) + η(x, y)……………….. (1)
 Eq. (1) in an equivalent frequency domain representation is:
G(u, v) = H(u, v)F(u, v) + N(u, v)………………. (2)
 When the only degradation present in an image is noise, Eqs. (1) and (2) become
g(x, y) = f(x, y) + η(x, y)……….. (3)
G(u, v) = F(u, v) + N(u, v)……….. (4)
 The noise terms are unknown, f(x, y)=g(x,y)- η(x, y) is not a realistic.
 In the case of periodic noise, it is possible to estimate N (u, v) from the spectrum of G (u, v).
 In this case N(u, v) can be subtracted from G(u, v) to obtain an estimate of the original
image.
 Spatial filtering is used when only additive random noise is present.
Types Spatial Filtering
Spatial filters

Mean filters Order-Statistic Filters Adaptive filters


Arithmetic mean filter Adaptive local noise
Median filter
reduction filter
Max and min filters Adaptive median filter
Midpoint filter
Alpha-trimmed mean filter

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 12


Digital Image Processing Notes 17EC72/15EC72

5.4.1 Mean Filters


1. Arithmetic mean filter
 Arithmetic mean filter computes the average value of the corrupted image g(x, y) in the area
defined by Sxy.
 Let Sxy represent the set of coordinates in a rectangular subimage window (neighborhood) of
size m * n, centered at point (x, y).
 The value of the restored image ̂ at point (x, y) is the arithmetic mean computed using the
pixels in the region defined by Sxy. In other words

 This operation can be implemented using a spatial filter of size m * n in which all
coefficients have value 1/ mn.
 A mean filter smooths local variations in an image, and noise is reduced as a result of
blurring.
Problem: show the effect of 3*3 Arithmetic mean filter on a simple image shown in below
figure.
0 0 0 7 7 7 7
0 0 0 7 7 7 7
7 7 7 7 7 7 7
1 1 1 1 1 1 1
1 1 1 1 1 1 1
1 1 1 1 1 1 1
Solution:

0 0 0 7 7 7 7
0 0 0 7 7 7 7
0+0+0+0+0+0+7+7+7= =2.33
7 7 7 7 7 7 7 Replace center pixel value 0 with 2 in the filtered image
1 1 1 1 1 1 1
1 1 1 1 1 1 1
1 1 1 1 1 1 1

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 13


Digital Image Processing Notes 17EC72/15EC72

0 0 0 7 7 7 7
0 0 0 7 7 7 7
0+0+7+0+0+7+7+7+7= =3.8
7 7 7 7 7 7 7 Replace center pixel value 0 with 4 in the filtered image.
1 1 1 1 1 1 1
1 1 1 1 1 1 1
1 1 1 1 1 1 1

0 0 0 7 7 7 7
0 0 0 7 7 7 7
7 7 7 7 7 7 7 0+7+7+0+7+7+7+7+7= =5.4
Replace center pixel value 7 with 5 in the filtered image.
1 1 1 1 1 1 1
1 1 1 1 1 1 1
1 1 1 1 1 1 1

 Continue the process till all the values in the image matrix are replaced by the new
value.
 The new filtered image matrix is
* * * * * * *
* 2 4 5 7 7 *
* 3 3 4 5 5 *
* 3 3 3 3 3 *
* 1 1 1 1 1 *
* * * * * * *
2. Geometric mean filter
 Image restored using a geometric mean filter is given by the expression

 Each restored pixel is given by the product of the pixels in the subimage window, raised to
the power 1/mn.
 Geometric mean filter achieves smoothing comparable to the arithmetic mean filter, but it
tends to lose less image detail in the process

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 14


Digital Image Processing Notes 17EC72/15EC72

Problem: show the effect of 3*3 Geometric mean filter on a simple image shown in below
figure.
30 10 20
10 250 25
20 25 30

Solution:

30 10 20
* * *
10 250 25 Geometric mean filter
* 1.436 *
20 25 30
* * *

=1.436

3. Harmonic mean filter


 Harmonic mean filtering operation is given by the expression

 Harmonic mean filter works well for salt noise, but fails for pepper noise.
 It does well also with other types of noise like Gaussian noise.
Problem: show the effect of 3*3 Harmonic mean filter on a simple image shown in below
figure. 30 10 20
10 250 25
20 25 30
Solution:

30 10 20
Harmonic mean filter * * *
10 250 25
* 4.36 *
20 25 30
* * *
=4.36

4. Contraharmonic mean filter


 Contraharmonic mean filter yields a restored image based on the expression

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 15


Digital Image Processing Notes 17EC72/15EC72

where Q is called the order of the filter.


 This filter is well suited for reducing or eliminating the effects of salt-and-pepper noise.
 For Q>0, the filter eliminates pepper noise. For Q<0 it eliminates salt noise. It cannot do
both simultaneously.
Note:
1. If Q = 0, Contraharmonic filter reduces to the arithmetic mean filter

2. If Q = -1, Contraharmonic filter reduces to the harmonic mean filter

EXAMPLE: Illustration of mean filters


Arithmetic mean filter and a Geometric mean filter

FIGURE 5.7:(a) X-ray image. (b) Image corrupted by additive Gaussian noise. (c) Result of filtering with an
arithmetic mean filter of size 3 * 3. (d) Result of filtering with a geometric mean filter of the same size.

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 16


Digital Image Processing Notes 17EC72/15EC72

 Figure 5.7(a) shows an 8-bit X-ray image of a circuit board, and Fig. 5.7(b) shows the
same image, but corrupted with additive Gaussian noise of zero mean and variance of
400. For this type of image this is a significant level of noise.
 Figures 5.7(c) and (d) shows, the result of filtering the noisy image with an arithmetic
mean filter of size 3 * 3 and a geometric mean filter of the same size. Both filters
attenuating the contribution due to noise, the geometric mean filter did not blur the image as
much as the arithmetic filters.
 Connector fingers at the top of the image are sharper in fig 5.7(d) than in (c).The same is
true in other parts of the image.
 Arithmetic and Geometric mean filters are well suited for random noise like Gaussian or
uniform noise.

Contraharmonic mean filter

FIGURE 5.8: (a) Image corrupted by pepper noise with a probability of 0.1. (b) Image corrupted by salt noise
with the same probability.(c)Result of filtering (a) with a 3 * 3 contraharmonic filter of order 1.5.(d)
Result of filtering (b) with Q = -1.5.
 Figure 5.8(a) shows the same circuit image, but corrupted now by pepper noise with
probability of 0.1.
 Fig. 5.8(b) shows the image corrupted by salt noise with the same probability.

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 17


Digital Image Processing Notes 17EC72/15EC72

 Figure 5.8(c) shows the result of filtering Fig. 5.8(a) using a contraharmonic mean filter with
Q = 1.5, and Fig. 5.8(d) shows the result of filtering Fig. 5.8(b) with Q = -1.5. Both filters did
a good job in reducing the effect of the noise.
 Positive-order filter did a better job of cleaning the background, at the expense of slightly
thinning and blurring the dark areas. Opposite was true of the negative order filter.
 Contraharmonic filter is well suited for impulse noise, but it has the disadvantage that it must
be known whether the noise is dark or light in order to select the proper sign for Q.
5.4.2 Order-Statistic Filters

 Response is based on ordering (ranking) the values of the pixels contained in the image area
encompassed by the filter. The ranking result determines the response of the filter.
1. Median filter
 Replaces the value of a pixel by the median of the intensity levels in the neighborhood of that
pixel:

 The value of the pixel at (x, y) is included in the computation of the median.
 Median filters are quite popular because, for certain types of random noise, they provide
excellent noise-reduction capabilities, with considerably less blurring than linear smoothing
filters of similar size.
 Median filters are particularly effective in the presence of both bipolar and unipolar impulse
noise.
Problem: show the effect of 3*3 median filter on a simple image shown in below figure.

30 10 20
10 250 25
20 25 30
Solution:

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 18


Digital Image Processing Notes 17EC72/15EC72

2. Max and min filters


 Median represents the 50th percentile of a ranked set of numbers.
 Max filter represents the 100th percentile of a ranked set of numbers, given by

 This filter is useful for finding the brightest points in an image. Also it reduces pepper noise
as a result of the max operation.
 The 0th percentile filter is the min filter:

 This filter is useful for finding the darkest points in an image. Also, it reduces salt noise as a
result of the min operation.
Problem: show the effect of 3*3 ma/min filter on a simple image shown in below figure.

Solution:

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 19


Digital Image Processing Notes 17EC72/15EC72

3. Midpoint filter
 Midpoint filter computes the midpoint between the maximum and minimum values in the
area encompassed by the filter

 This filter combines order statistics and averaging.


 It works best for randomly distributed noise, like Gaussian or uniform noise
Problem: show the effect of 3*3 mid point filter on a simple image shown in below figure.

30 10 20
10 250 25
20 25 30
Solution:

30 10 20 * * *
Mid-point filter
10 250 25 * 130 *
20 25 30 * * *

4. Alpha-trimmed mean filter


 Delete the lowest and the highest intensity values of g(s, t) in the neighborhood Sxy.

 Let gr(s, t) represent the remaining mn-d pixels. A filter formed by averaging these remaining
pixels is called an alpha- trimmed mean filter:

Value of d can range from 0 to mn - 1.


 When d = 0, the alpha- trimmed filter reduces to the arithmetic mean filter
 If we choose d = mn - 1, the filter becomes a median filter.
 For other values of d, the alpha-trimmed filter is useful in situations involving multiple types
of noise, such as a combinat
 ion of salt-and-pepper and Gaussian noise.

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 20


Digital Image Processing Notes 17EC72/15EC72

Problem: show the effect of 3*3 alpha-trimmed filter on a simple image shown in below
figure. 30 10 20
10 250 25
20 25 30
Solution:

30 10 20 Alpha-trimmed filter * * *
10 250 25 d=2 * 23 *
* * *
20 25 30

 if d=2
Remove ,remove

EXAMPLE: Illustration of order-statistic filters


Median filtering

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 21


Digital Image Processing Notes 17EC72/15EC72

FIGURE 5.10
(a)Image corrupted by salt- and-pepper noise with probabilities Pa = Pb = 0.1.
(b)Result of one pass with a median filter of size 3 * 3.
(c)Result of processing (b) with this filter.
(d)Result of processing (c) with the same filter.

 Figure 5.10(a) shows the circuit board image corrupted by salt-and-pepper noise with
probabilities Pa = Pb = 0.1.
 Figure 5.10(b) shows the result of median filtering with a filter of size 3 * 3. The
improvement over Fig. 5.10(a) is significant, but several noise points still are visible.
 A second pass [on the image in Fig. 5.10(b)] with the median filter removed most of these
points, leaving only few, barely visible noise points. These were removed with a third pass of
the filter. These results are good examples of the power of median filtering in handling
impulse-like additive noise. Keep in mind that repeated passes of a median filter will blur the
image, so it is desirable to keep the number of passes as low as possible.

Max filter & Min filter

FIGURE 5.11: (a) Result of filtering Fig. 5.8(a) with a max filter of size 3 * 3. (b) Result of filtering 5.8(b) with
a min filter of the same size.

 Figure 5.11(a) shows the result of applying the max filter to the pepper noise image of Fig.
5.8(a).
 The filter did a reasonable job of removing the pepper noise, but we note that it also
removed some dark pixels from the borders of the dark objects.

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 22


Digital Image Processing Notes 17EC72/15EC72

 Figure 5.11(b) shows the result of applying the min filter to the image in Fig. 5.8(b). In this
case, the min filter did a better job than the max filter on noise removal, but it removed some
white points around the border of light objects.
 These made the light objects smaller and some of the dark objects larger because white
points around these objects were set to a dark level.
Arithmetic mean, Geometric mean, median, and alpha-trimmed mean:

FIGURE 5.12: (a) Image corrupted by additive uniform noise. (b)Image additionally corrupted by additive
salt-and- pepper noise. Image (b) filtered with a 5 * 5.(c) arithmetic mean filter; (d)geometric mean
filter;(e) median filter; and (f) alpha- trimmed mean filter with d = 5.

 Figure 5.12(a) shows the circuit board image corrupted this time by additive, uniform noise
of variance 800 and zero mean.
 This is a high level of noise corruption that is made worse by further addition of salt-
and-pepper noise with Pa = Pb = 0.1, as Fig. 5.12(b) shows.
 The high level of noise in this image warrants use of larger filters.
 Figures 5.12(c) through (f) show the results obtained using arithmetic mean, geometric
mean, median, and alpha-trimmed mean (with d = 5) filters of size 5 * 5.
 Arithmetic and geometric mean filters did not do well because of the presence of

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 23


Digital Image Processing Notes 17EC72/15EC72

impulse noise.
 Median and alpha-trimmed filters performed much better, with the alpha-trimmed filter
giving slightly better noise reduction.
Note: fourth connector finger from the top left is slightly smoother in the alpha-trimmed
result. This is not unexpected because, for a high value of d, the alpha-trimmed filter
approaches the performance of the median filter, but still retains some smoothing
capabilities.

5.4.3 Adaptive filters


 Adaptive filters behavior changes based on statistical characteristics of the image
inside the filter region defined by the m * n rectangular window Sxy.
 Performances of Adaptive filters are superior to that of the mean and order statistics
filter but increase in filter complexity.
1. Adaptive, local noise reduction filter
 Statistical measures of a random variable are its mean and variance. These parameters are
important in adaptive filter because they are quantities closely related to the appearance of an
image.
 Mean gives a measure of average intensity in the region over which the mean is computed,
Variance gives a measure of contrast in that region.
 Our filter is to operate on a local region, Sxy.
 Expression of the adaptive local noise reduction filter is given by

Where
g(x, y)= Value of the noisy image at (x, y).
= Variance of the noise corrupting f(x, y) to form g(x, y).
mL= Local mean of the pixels in Sxy.
= Local variance of the pixels in Sxy .
 The behavior of the filter to be as follows:
1. If =0, ̂(x, y) = g(x, y).

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 24


Digital Image Processing Notes 17EC72/15EC72

2. If , ̂(x, y) g(x, y). A high local variance is associated with edges, and these
should be preserved.
3. If = , ̂(x, y)= mL. This condition occurs when the local area has the same properties as
the overall image, and local noise is to be reduced simply by averaging.

 If the ratio( ⁄ is set to 1 to avoid the chances of getting negative value.

This makes this filter nonlinear.


 The variance of the overall noise needs to be known or estimated.

EXAMPLE: Illustration of adaptive, local noise-reduction filtering.

FIGURE 5.13
(a)Image corrupted by additive Gaussian noise of zero mean and variance 1000.
(b)Result of arithmetic mean filtering.
(c)Result of geometric mean filtering.
(d)Result of adaptive noise reduction filtering. All filters were of size 7 * 7.

 Figure 5.13(a) shows the circuit-board image, corrupted this time by additive
Gaussian noise of zero mean and a variance of 1000.
 Figure 5.13(b) is the result of processing the noisy image with an arithmetic mean
filter of size 7 * 7. The noise was smoothed out, but at the cost of significant blurring
in the image.

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 25


Digital Image Processing Notes 17EC72/15EC72

 Fig. 5.13(c) shows the result of processing the noisy image with a geometric mean
filter, also of size 7 * 7.
 Differences between these 2 filtered images are only the degree of blurring is
different.
 Figure 5.13(d) shows the result of using the adaptive filter of Eq. (1) with = 1000.
The improvements in this result compared with the 2 previous filters are significant. In
terms of overall noise reduction, the adaptive filter achieved results similar to the
arithmetic and geometric mean filters. The image filtered with the adaptive filter is
much sharper.
Example: Connector fingers at the top of the image are significantly sharper in Fig.
5.13(d). Other features, such as holes and the eight legs of the dark component on the
lower left-hand side of the image are much clearer in Fig. 5.13(d).
 The preceding results used a value for that matched the variance of the noise
exactly.
 If this quantity is not known and an estimate is used that is too low, the algorithm will
return an image that closely resembles the original because the corrections will be
smaller than they should be.
 Estimates that are too high will cause the ratio of the variances to be clipped at 1.0, and the
algorithm will subtract the mean from the image more frequently than it would normally.
 If negative values are allowed and the image is rescaled at the end, the result will be a loss of
dynamic range, as mentioned previously.
2. Adaptive median filter
 Median filter performs well if the spatial density of the impulse noise is not large (less than
0.2). Adaptive median filtering can handle impulse noise with probabilities larger than these.
 Additional benefit of the adaptive median filter is that it seeks to preserve detail while
smoothing non impulse noise, traditional median filter does not do.
 As in all the filters discussed in the preceding sections, the adaptive median filter also works
in a rectangular window area Sxy .Unlike those filter, the adaptive median filter changes
(increases) the size of Sxy during filter operation, depending on certain conditions.
 Output of the filter is a single value used to replace the value of the pixel at (x, y), the point
on which the window Sxy is centered at a given time.

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 26


Digital Image Processing Notes 17EC72/15EC72

 Consider the following notation:


zmin = minimum intensity value in Sxy
zmax = maximum intensity value in Sxy
zmed = median of intensity values in Sxy
zxy = intensity value at coordinates (x, y)
Smax = maximum allowed size of Sxy
 Adaptive median-filtering algorithm works in 2 stages, stage A and stage B, as follows:
Stage A:
A1 = zmed - zmin
A2 = zmed - zmax
If A1 0 AND A2 0, go to stage B
Else increase the window size
If window size Smax repeat stage A
Else output zmed
Stage B:
B1 = zxy - zmin
B2 = zxy - zmax
If B1 0 AND B2 0, output zxy
Else output zmed
 Purpose of the algorithm:
1. To remove salt-and-pepper (impulse) noise.
2. To provide smoothing of other noise that may not be impulsive.
3. To reduce distortion, such as excessive thinning or thickening of object boundaries.
 Result and analysis of the algorithm
(a)The purpose of stage A is to determine if the median filter output, zmed, is an impulse (black or
white) or not. If the condition zmin zmed zmax holds, then zmed cannot be an impulse, In this
case, we go to stage B and test to see if the point in the center of the window, z xy, is itself an
impulse.
(b) If the condition B1 0 AND B2 0 is true, then zmin zxy zmax, and zxy cannot be an
impulse. In this case, the algorithm outputs the pixel value, zxy.
But If the condition B1 0 AND B2 0 is false, then either zxy = zmin or zxy = zmax.

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 27


Digital Image Processing Notes 17EC72/15EC72

(c) If the condition zmin zmed zmax does not holds in stage A. The algorithm then increases the
size of the window and repeats stage A. If the maximum window size is reached the algorithm
returns the value of z med..
 Every time the algorithm outputs a value, the window Sxy is moved to the next location in the
image. The algorithm then is reinitialized and applied to the pixels in the new location.
EXAMPLE: Illustration of adaptive median filtering.

FIGURE 5.14 (a) Image corrupted by salt-and-pepper noise with probabilities Pa = Pb = 0.25. (b) Result of
filtering with a 7 * 7 median filter. (c) Result of adaptive median filtering with Smax = 7.

 Figure 5.14(a) shows the circuit-board image corrupted by salt-and-pepper noise with
probabilities Pa = Pb = 0.25. Here the noise level is high enough to unclear most of the detail
in the image.
 The image was filtered first using the median filter required to remove most visible traces of
impulse noise. A 7 * 7 median filter was required to do this, and the result is shown in Fig.
5.14(b). Although the noise was effectively removed, the filter caused significant loss of
detail in the image.
 Connector fingers at the top of the image appear distorted or broken. Other image details are
similarly distorted.
 Figure 5.14(c) shows the result of using the adaptive median filter with Smax = 7. Noise
removal performance was similar to the median filter. The adaptive filter did a better job of
preserving sharpness and detail.
 Connector fingers are less distorted, and some other features that were either obscured or
distorted beyond recognition by the median filter appear sharper and better defined in Fig.
5.14(c).

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 28


Digital Image Processing Notes 17EC72/15EC72

 Two notable examples are the feed-through small white holes throughout the board, and the
dark component with eight legs in the bottom, left quadrant of the image.
 Considering the high level of noise in Fig. 5.14(a), the adaptive algorithm performed
quite well.
 The choice of maximum allowed window size depends on the application, but a
reasonable starting value can be estimated by experimenting with various sizes of the
standard median filter first.
 This will establish a visual baseline regarding expectations on the performance of the
adaptive algorithm.
5.5 Periodic Noise Reduction by Frequency Domain Filtering
 Periodic noise can be analyzed and filtered effectively using frequency domain techniques.
Basic idea is that periodic noise appears as concentrated bursts of energy in the Fourier
transform, at locations corresponding to the frequencies of the periodic interference.
 Approach is to use a selective filter to isolate the noise. 3 types of selective filters
(bandreject, bandpass, and notch) are used for periodic noise reduction. We also develop an
optimum notch filtering approach.
1. Bandreject Filters
 Removing periodic noise from an image involves removing a particular range of frequencies
from the image.

 Transfer function of the ideal band reject filter is

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 29


Digital Image Processing Notes 17EC72/15EC72

 Where is the distance from the origin and is given by

=[ ⁄ ⁄ ]

 W is the width of the band and is the radial Centre.


 Transfer function of the Butterworth band reject filter of order’ n’ is given by.

=
[ ]

 Transfer function of the Gaussian band reject filter is given by

[ ]
H(u,v)=

 Figure 5.15 shows perspective plots of ideal,Butterworth,Gaussian band reject filters

FIGURE 5.15 From left to right, perspective plots of ideal, Butterworth (of order 1), and Gaussian bandreject
filters.

EXAMPLE: Use of Bandreject filtering for periodic noise removal.

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 30


Digital Image Processing Notes 17EC72/15EC72

FIGURE 5.16 :( a) Image corrupted by sinusoidal noise.(b)Spectrum of (a).(c)Butterworth bandreject filter


(white represents 1). (d) Result of filtering.

 Figure 5.16(a), shows an image heavily corrupted by sinusoidal noise of various frequencies.
 Noise components are easily seen as symmetric pairs of bright dots in the Fourier spectrum
shown in Fig. 5.16(b). Components lie on an approximate circle about the origin of the
transform, so a circularly symmetric Bandreject filter is a good choice.
 Figure 5.16(c) shows a Butterworth Bandreject filter of order 4, with the appropriate radius
and width to enclose completely the noise impulses. It is necessary to remove as little as
possible from the transform, sharp, narrow filters are common in Bandreject filtering.
 The result of filtering Fig. 5.16(a) with this filter is shown in Fig. 5.16(d). Small details and
textures were restored effectively by this filtering approach.
2. Bandpass Filters
 Bandpass filter performs the opposite operation of a Bandreject filter.
 Transfer function of a bandpass filter is obtained from a corresponding Bandreject filter.
HBP(u, v) = 1 - HBR(u, v) (1)
HBP(u, v)= Transfer function of a Bandpass filter
HBR(u, v)= Transfer function of a Bandreject filter

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 31


Digital Image Processing Notes 17EC72/15EC72

 Transfer function of the ideal band pass filter is

{
 Butterworth band pass filter of order’ n’ is given by.

=
[ ]

 Gaussian band pass filter is given by

[ ]
= [ ]

EXAMPLE : Bandpass filtering for extracting noise patterns

FIGURE 5.17
Noise pattern of the image in Fig. 5.16(a) obtained by bandpass filtering.

 Performing straight bandpass filtering on an image is not a common procedure because it


removes too much image detail. Bandpass filtering is useful in isolating the effects on an

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 32


Digital Image Processing Notes 17EC72/15EC72

image caused by selected frequency bands.


 This is illustrated in Fig. 5.17. This image was generated by
(1) Using Eq. (1) to obtain the Bandpass filter corresponding to the Band reject filter used in
Fig. 5.16.
(2) Taking the inverse transform of the Bandpass-filtered transform.
 Most image detail was lost, but the information that remains is most useful, as it is clear that
the noise pattern recovered using this method is quite close to the noise that corrupted the
image in Fig. 5.16(a). (or) Bandpass filtering helped isolate the noise pattern.
 This is a useful result because it simplifies analysis of the noise, reasonably independently of
image content.

3. Notch Filters
 Notch filter rejects or passes frequencies in predefined neighborhoods about a center
frequency.
 Due to the symmetry of the Fourier transform, notch filters must appear in symmetric pairs
about the origin in order to obtain meaningful results.
 If the notch filter is located at the origin, in which case it appears by itself. Although we
show only one pair for illustrative purposes, the number of pairs of notch filters that can be
implemented is arbitrary.
 The shape of the notch areas also can be arbitrary (rectangular).
Notch reject filter
H (u, v)
1
D0 D0
D (u, v)
(-u0,-v0) (u0, v0)

 Transfer function of the ideal notch reject filter with centers ( ) and ( ) is

Where the center of frequency rectangles is at ( ⁄ ⁄

=[ ⁄ ⁄ ]

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 33


Digital Image Processing Notes 17EC72/15EC72

=[ ⁄ ⁄ ]

 Transfer function of the Butterworth notch reject filter of order n is given by

=
[ ]
 Transfer function of the Gaussian notch reject filter is given by
[ ]
H(u,v)=
 Figure 5.18 shows 3-D plots of ideal, Butterworth, and Gaussian notch (reject) filters.

FIGURE 5.18: Perspective plots of (a) ideal, (b)Butterworth (of order 2),(c) Gaussian notch (reject) filters.

Notch pass filters


 Notch pass filters perform the opposite function as the notch reject filters, their transfer
functions are given by

HNP(u, v)= Transfer function of the notch pass filter


HNR(u, v)= Transfer function of the notch reject filter
H (u, v)
1
D0 D0
D (u, v)
(-u0,-v0) (u0, v0)
Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 34
Digital Image Processing Notes 17EC72/15EC72

 Transfer function of the ideal notch pass filter is

 Transfer function of the Butterworth notch pass filter of order n is given by

=
[ ]

 Transfer function of the Gaussian notch pass filter is given by

[ ]
H(u,v)= [ ]

EXAMPLE: Removal of periodic noise by notch filtering.

FIGURE 5.19: (a) Satellite image of Florida and the Gulf of Mexico showing horizontal scan lines.
(b)Spectrum. (c)Notch pass filter superimposed on (b). (d) Spatial noise pattern. (e) Result of notch reject
filtering.

 The notch filtering approach that reduces the noise in this image, without introducing the

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 35


Digital Image Processing Notes 17EC72/15EC72

appreciable blurring.

 Horizontal lines of the noise pattern in Fig. 5.19(a), its contribution in the frequency domain
to be concentrated along the vertical axis. Noise is not dominant enough to have a clear
pattern along this axis, as is evident from the spectrum shown in Fig. 5.19(b).
 Fig. 5.19(c) shows simple ideal notch pass filter along the vertical axis of the Fourier
transform.
 Fig. 5.19(d) shows the spatial representation of the noise pattern (inverse transform of the
notch-pass–filtered result). This noise pattern corresponds closely to the pattern in Fig.
5.19(a).
 Having thus constructed a suitable notch pass filter that isolates the noise to a reasonable
degree, we can obtain the corresponding notch reject filter from Eq. (1).
 The result of processing the image with the notch reject filter is shown in Fig. 5.19(e). This
image contains significantly fewer visible noise scan lines than Fig. 5.19(a).
4. Optimum Notch Filtering

FIGURE 5.20: Image of the Martian terrain taken by Mariner 6. (b)Fourier spectrum showing
periodic interference.

 Figure 5.20(a), another example of periodic image degradation, shows a digital image of the
Martian terrain taken by the Mariner 6 spacecraft.
 Interference pattern is somewhat similar to the one in Fig. 5.16(a), but the former pattern is
considerably more delicate and, consequently, harder to detect in the frequency plane.
 Figure 5.20(b) shows the Fourier spectrum of the image in question.
 Starlike components were caused by the interference, and several pairs of components are
present, indicating that the pattern contains more than one sinusoidal component.

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 36


Digital Image Processing Notes 17EC72/15EC72

 When several interference components are present, the methods discussed in the preceding
sections are not always acceptable because they may remove too much image information in
the filtering process.
 In addition, the interference components generally are not single frequency bursts. Instead,
they tend to have broad skirts that carry information about the interference pattern.
 These skirts are not always easily detectable from the normal transform background.
Alternative filtering methods that reduce the effect of these degradations are quite useful in
many application.
 The method discussed here is optimum; it minimizes local variances of the restored estimate
̂(x, y).
Optimum
 Procedure consists of first isolating the principal contributions of the interference pattern and
then subtracting a variable, weighted portion of the pattern from the corrupted image.
 First step is to extract the principal frequency components of the interference [Link] can
be done by placing a notch pass filter, HNP(u, v), at the location of each spike.
 If the filter is constructed to pass only components associated with the interference pattern,
then the Fourier transform of the interference noise pattern is given by the expression
N(u,v)=HNP(u,v)G(u,v)………………….(1)
where, G(u, v)= Fourier transform of the corrupted image.
HNP(u,v)=optimum notch pass filter transform function.
N(u,v)= Fourier transform of the noise .
 After a particular filter has been selected, the corresponding pattern in the spatial domain is
obtained from the expression
η(x,y)= HNP(u,v)G(u,v)}……………(2)
 Because the corrupted image is assumed to be formed by the addition of the uncorrupted
image f(x, y) and the interference, if η(x, y) were known completely, subtracting the pattern
from g(x, y) to obtain f(x, y) would be a simple matter.
 The effect of components not present in the estimate of η(x, y) can be minimized instead by
subtracting from g(x, y) a weighted portion of η(x, y) to obtain an estimate of f(x, y):
̂ =g(x,y)-w(x,y) η(x, y)………………….. (3)
Where

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 37


Digital Image Processing Notes 17EC72/15EC72

̂ =Estimate of f(x,y)
w(x,y)= weighting or modulation function
 The objective of the procedure is to select this function w(x,y) so that the result is optimized
in some meaningful way. One approach is to select w(x,y) so that the variance of the estimate
̂ is minimized over a specified neighborhood of every point (x, y).
 Consider a neighborhood of size (2a+1) by (2b+1) about a point (x, y). “Local” variance
of ̂ at coordinates (x, y) can be estimated from the samples, as follows:
∑ ∑ ̂ ̂̅ ……………………… (4)

̂̅ =average value of ̂ in the neighborhood

̂̅ = ∑ ∑ ̂ …….. (5)
 Points on or near the edges of the image can be treated by considering partial neighborhoods
or by padding the border with 0s.
 Substituting eq.( 3) in to Eq.( 4) yields
∑ ∑ [
̅ ̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅] ……………………… (6)

 Assuming that w(x,y) remains essentially constant over the neighborhood gives the
approximation
=w(x,y) …………..(7)

 for –a s a and –b t [Link] assumption also results in the expression

̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅ =w(x,y) ̅ ……..(8)

 substituting eqn(8) in eqn(6) we get


∑ ∑ [ ̅

̅ ] ……………………… (9)
 To minimize ,we solve For w(x,y).

…………………………. (10)
 The result is

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 38


Digital Image Processing Notes 17EC72/15EC72

̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅ ̅ ̅
w(x,y)= ̅̅̅̅ ̅ ……..(11)

 To obtain the restored image ̂ we compute w(x,y) from eq.(11) and then use eq.(3).
 As w(x,y) is assumed to be constant in a neighborhood, computing this function for every
value of x and y in the image is unnecessary. Instead w(x, y) is computed for one point in
each nonoverlapping neighborhood (center point) and then used to process all the image
points constrained in that neighborhood.
EXAMPLE: Illustration of optimum notch filtering.

FIGURE 5.21:Fourier spectrum (without shifting) of the image shown in Fig. 5.20(a).

FIGURE 5.22:(a)Fourier spectrum of N(u, v), and (b)corresponding noise interference pattern h(x, y).

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 39


Digital Image Processing Notes 17EC72/15EC72

FIGURE 5.23 Processed image.

 Figures 5.21 through 5.23 show the result of applying the preceding technique to the
image in Fig. 5.20(a). This image is of size 512 * 512 pixels, and a neighborhood with a
= b = 15 was selected.
 Figure 5.21 shows the Fourier spectrum of the corrupted image. The origin was not
shifted to the center of the frequency plane in this particular case, so u = v = 0 is at the
top left corner of the transform image in Fig. 5.21.
 Figure 5.22(a) shows the spectrum of N(u, v), where only the noise spikes are present.
 Figure 5.22(b) shows the interference pattern η(x, y) obtained by taking the inverse
Fourier transform of N(u, v). Note the similarity between this pattern and the structure of
the noise present in Fig. 5.20(a).
 Fig. 5.23 shows the processed image obtained by using Eq. (3).The periodic interference
was removed for all practical purposes.
5.6Linear, Position-Invariant Degradations

 Input-output relationship before the restoration stage is expressed as

g(x, y) = f(x,y)*h(x,y)+ η(x, y)


= H[ f(x, y)] + η(x, y)……………..(1)
 Let us assume that η(x, y) = 0
g(x, y) = H[ f(x, y)]……………………….(2)
1. Linearity:
 If H is linear
H[af1(x, y) + bf2(x, y)] = aH[ f1(x, y)] + bH[ f2(x, y)]……………..(3)
Where
a and b are scalars
f1(x, y) and f2(x, y) are any two input images.
Additivity property:
 If a = b = 1, Eq. (3) becomes
H[ f1(x, y) + f2(x, y)] = H[ f1(x, y)] + H[ f2(x, y)] ………………..(4)
This is called the property of Additivity.
Homogeneity property:

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 40


Digital Image Processing Notes 17EC72/15EC72

 If f2(x, y) = 0, Eq. (3) becomes


H[af1(x, y)] = aH[ f1(x, y)]…………..(5)
This is called the property of homogeneity.
Note: Linear operator possesses both the property of additivity and of homogeneity.
2. Position-Invariant:
 An operator having the input-output relationship g(x, y) = H[ f(x, y)] is said to be position
invariant if
H[ f(x - a, y - b)] = g(x - a, y - b)………………..(6)
for any f(x, y) and any a and b.
 The definition of the discrete impulse function f(x,y) can be expressed in terms of
continuous impulse function as:
f(x,y)=∫ ∫ ]…………….( 7)

 Then, substitution of Eq. (7) into Eq. (2) results in the expression
g(x,y)=H[f(x,y)]=H[∫ ∫ ]…( 8)
 If H is a linear operator and we extend the Additivity property to integrals, then

g(x,y)=∫ ∫ …………….(9)

 Because f( is independent of x and y ,and using homogeneity property,it follows


that

g(x,y)=∫ ∫ ……..(10)
the term

H = h(x,α,y,β)…………( 11)
is called the impulse response of H.
 Substituting Eq. (11) into Eq. (10) yields the expression
g(x,y)= ∫ ∫ ……………..(12)

 If H is position invariant
H[ (x - a, y - b)] = h(x - a, y - b)………………….. (13)
g(x,y)= ∫ ∫ ……(14)

 In the presence of additive noise Eq. (12) becomes


g(x,y)= ∫ ∫ ………….( 15)

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 41


Digital Image Processing Notes 17EC72/15EC72

 If H is position invariant, Eq. (15) becomes

g(x,y)= ∫ ∫ ………….( 16)

 Values of the noise term η(x, y) are random, and are assumed to be independent of position.

 Using the notation for convolution, we can write Eq. (16) as

g(x,y)=h(x,y) f(x,y)+η(x,y)………………….( 17)


 we can express it in the frequency domain as
G(u, v) = H(u, v)F(u, v) + N(u, v)…………….( 18)
 Many types of degradations can be approximated by linear, position-invariant processes. The
advantage of this approach is that the extensive tools of linear system theory then become
available for the solution of image restoration problems.
 Because degradations are modeled as result of convolution, restoration seeks the filters
performing reverse procedure. Such filters are frequently called deconvolution filters.
5.7 Estimating the Degradation Function
 There are 3 principal ways to estimate the degradation function for use in image restoration:
(1) Observation.
(2) Experimentation.
(3) Mathematical modeling.
 The process of restoring an image by using a degradation function that has been estimated is
called blind deconvolution.
1. Estimation by Image Observation
 Considered a degraded image without any knowledge about the degradation function H.
 Based on the assumption that the image was degraded by a linear, position-invariant
process, one way to estimate H is to gather information from the image itself.
Example:

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 42


Digital Image Processing Notes 17EC72/15EC72

 If the image is blurred, we can look at a small rectangular section of the image containing
sample structures, like part of an object and the background. To reduce the effect of noise,
look for an area in which the signal content is strong (high contrast).
 The next step would be to process the subimage to arrive at a result that is as unblurred as
possible. Ex: sharpening the subimage with a sharpening filter and even by processing small
areas by hand.
 Subimage be denoted by gs(x, y), and the processed subimage be denoted by ̂s(x, y).
 Degradation can be estimated for the sub image by

̂
……………….(1)

 From the characteristics of this function, we then deduce the complete degradation function
H(u, v) based on our assumption of position invariance. Example: If Hs(u, v) has the
approximate shape of a Gaussian curve. We can use that information to construct a function
H(u, v) on a larger scale, but having the same basic shape.
2. Estimation by Experimentation
 If equipment similar to the equipment used to acquire the degraded image is available, it is
possible to obtain an accurate estimate of the degradation.
 Images similar to the degraded image can be acquired with various system settings until they
are degraded as closely as possible to the image we wish to restore.
 Then the idea is to obtain the impulse response of the degradation by imaging an impulse
(small dot of light) using the same system settings.

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 43


Digital Image Processing Notes 17EC72/15EC72

 An impulse is simulated by a bright dot of light, as bright as possible to reduce the effect of
noise to negligible values.
 From the above figure the impulse response is given by

H (u, v) = …………….(2)
G(u, v)= Fourier transform of the observed image
A = Constant describing the strength of the impulse.

3. Estimation by Modeling
 The Degradation modeling can even take into account environmental conditions that
cause degradations.
Example: Degradation model is based on the physical characteristics of atmospheric
turbulence. This model has a familiar form:
H(u,v)= …………………(3)
where
k= constant that depends on the nature of the turbulence.
 With the exception of the 5 6 power on the exponent, this equation has the same
form as the Gaussian lowpass filter.

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 44


Digital Image Processing Notes 17EC72/15EC72

 In fact, the Gaussian LPF is used sometimes to model mild, uniform blurring.

FIGURE 5.25:
Illustration of the atmospheric turbulence model.
(a)Negligible turbulence.
(b)Severe turbulence, k = 0.0025.
(c)Mild turbulence, k = 0.001.
(d)Low turbulence, k = 0.00025.

 Figure 5.25 shows examples. Obtained by simulating blurring an image using Eq. (3) with
values k = 0.0025 (severe turbulence), k = 0.001 (mild turbulence), and k = 0.00025 (low
turbulence). All images are of size 480 * 480 pixels.

Mathematical model
 Image has been blurred by uniform linear motion between the image and the sensor during
image acquisition. Image f(x, y) undergoes planar motion and that x0(t) and y0(t) are the time
varying components of motion in the x and y directions, respectively.
 The total exposure at any point of the recording medium (film or digital memory) is obtained
by integrating the instantaneous exposure over the time interval during which the imaging
system shutter is open.
 Assuming that shutter opening and closing takes place instantaneously, and that the optical
imaging process is perfect, isolates the effect of image motion.
 Then, if T is the duration of the exposure, it follows that
g(x,y)=∫ …………………….(1)

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 45


Digital Image Processing Notes 17EC72/15EC72

where
g(x,y) = Blurred image.
 Fourier transform of the 2-D image g(x,y) is given by
G(u,v)=∫ ∫ ……………..(2)
 Substitute (1) in (2) we get

=∫ ∫ ∫ ………………(3)
 Reversing the order of the integration

=∫ ∫ ∫ ………………(4)
 The term inside the outer brackets is the fourier transform of the displaced function
.

G(u,v)=∫

G(u,v)= ∫ …………….(5)
 F(u,v) is independent of t.

 By defining H(u,v)=∫ …………….(6)


 Eq.(5) can be expressed in the familiar form
G(u,v)=H(u,v) F(u,v)…………………..(7)
 If the motion variables and are known,As an illustration,suppose that the image
in question undergoes uniform linear motion in the x direction only,at a rate by

 =0,
Eq.(6) yields

H(u,v)=∫

H(u,v)=∫ (8)

 Observe that H vanishes at values of u given by u=n/a, where n is an integer.


 If we allow the y Component to vary as well, with the motion given by

H(u,v)= ……………………(9)

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 46


Digital Image Processing Notes 17EC72/15EC72

EXAMPLE: Image blurring due to motion

FIGURE 5.26: (a) Original image.(b) Result of blurring using the function in Eq. (5.6-11) with a = b = 0.1 and T
= 1.
 Figure 5.26(b) is an image blurred by computing the Fourier transform of the image in
Fig. 5.26(a), multiplying the transform by H(u, v) from Eq. (9), and taking the inverse
transform.
 The images are of size 688 * 688 pixels, and the parameters used in Eq. (9) were a = b
= 0.1 and T = 1.
 Recovery of the original image from its blurred counter part presents some interesting
challenges, particularly when noise is present in the degraded image.
5.8 Inverse Filtering

 Simplest approach to restoration is direct inverse filtering, dividing the transform of the
degraded image, G(u, v), by the degradation function H(u,v):
̂ (u, v) = …………. (1)

 We know that G(u, v) = H(u, v)F(u, v) + N(u, v)…………..(2)


 Substitute eq(2) in eq(1) yields
̂ =F(u,v)+ ……………….(3)

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 47


Digital Image Processing Notes 17EC72/15EC72

 Even if we know the degradation function we cannot recover the undegraded image
exactly because N(u,v) is not known.
 If the degradation function has zero or very small values, then the ratio N(u, v)/
H(u, v) could easily dominate the estimate ̂ (u, v).
 One approach to get around the zero or small-value problem is to limit the filter
frequencies to values near the origin. We know that H (0, 0) is usually the highest
value of H(u, v) in the frequency domain.
 Thus, by limiting the analysis to frequencies near the origin, we reduce the probability
of encountering zero values. This approach is illustrated in the following example.

EXAMPLE: Inverse filtering.

 Image in Fig.5.25 (b) was inverse filtered with Eq. (1) using the exact inverse of the
degradation function that generated that image. The degradation function used was
H(u,v)=
with k = 0.0025.
 M/2 and N/2 constants are offset values; they center the function so that it will
correspond with the centered Fourier transform. In this case, M = N = 480.

FIGURE 5.27: Restoring Fig. 5.25(b) with Eq. (1). (a) Result of using the full filter. (b) Result with H cut off

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 48


Digital Image Processing Notes 17EC72/15EC72

outside a radius of 40; (c) outside a radius of 70; and (d) outside a radius of 85.

 Degradation values became so small that the result of full inverse filtering [Fig. 5.27(a)]
is useless. The reasons for this poor result are as discussed in connection with Eq. (3).
 Figures 5.27(b) through (d) show the results of cutting off values of the ratio G(u, v)/
H(u, v) outside a radius of 40, 70, and 85, respectively.
 Cut off was implemented by applying to the ratio a Butterworth lowpass function
of order 10. This provided a sharp (but smooth) transition at the desired radius.
 Radii near 70 yielded the best visual results [Fig. 5.27(c)].
 Radius values below that tended toward blurred images, as shown in Fig. 5.27(b), which was
obtained using a radius of 40.
 Values above 70 started to produce degraded images, as shown in Fig. 5.27(d), which was
obtained using a radius of 85. The image content is almost visible in this image behind a
“curtain” of noise, but the noise definitely dominates the result.
 Further increases in radius values produced images that looked more and more like Fig.
5.27(a).
 The results in the preceding example are illustrative of the poor performance of direct inverse
filtering in general.
5.8 Minimum Mean Square Error (Wiener) Filtering

 In this section, we discuss an approach that incorporates both the degradation function and
statistical characteristics of noise into the restoration process.
 The objective is to find an estimate ̂ of the uncorrupted image f such that the mean square
error between them is minimized.
 This error measure is given by
=E { ̂ (1)
Where E{.} is the expected value of the argument.
 It is assumed that
 The noise and the image are uncorrelated
 One or the other has zero mean
 Intensity levels in the estimate are a linear function of the levels in the degraded image.
 Based on these conditions, the minimum of the error function in Eq. (1) is given in the

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 49


Digital Image Processing Notes 17EC72/15EC72

frequency domain by the expression

 The terms in Eq. (2) are as follows:


H(u, v) = degradation function
H*(u, v) = complex conjugate of H(u, v)
| | = H*(u, v)H(u, v)
Sη(u, v) = | | = Power spectrum of the noise
Sf(u, v) = | | = Power spectrum of the undegraded image
 The filter, which consists of the terms inside the brackets, also is commonly referred to as the
minimum mean square error filter or the least square error filter.
 Wiener filter does not have the same problem as the inverse filter with zeros in the
degradation function, unless the entire denominator is zero for the same value(s) of u and v.
 If the noise is zero, then the noise power spectrum vanishes and the Wiener filter reduces to
the inverse filter.
 The power spectrum of the undegraded image not often is known. An approach used
frequently when these quantities are not known or cannot be estimated is to approximate
Eq. (2) by the expression.

 Where K is a specified constant.


Performance measures of the restoration algorithms:
Signal-to-noise ratio
 Signal-to-noise ratio, in frequency domain is given by

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 50


Digital Image Processing Notes 17EC72/15EC72

 This ratio gives a measure of the level of information bearing signal power (original) to the
level of noise power.
 Images with low noise have a high SNR and, same image with a higher level of noise has a
lower SNR.
 This ratio by itself is of limited value, but it is an important metric used in characterizing the
performance of restoration algorithms.
 Square root of SNR is called root-mean-square-signal-to-noise ratio.
Mean square error
 Mean square error given in statistical form in Eq. (1) can be approximated also in terms
a summation involving the original and restored images:

 Square root of MSE is called root-mean-square-error.


Signal-to-noise ratio in the spatial domain
 Considers the restored image to be “signal” and the difference between this image and the
original to be noise, we can define a signal-to-noise ratio in the spatial domain as

 The closer f and ̂ are, the larger this ratio will be.

EXAMPLE: Comparison of inverse and Wiener filtering.

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 51


Digital Image Processing Notes 17EC72/15EC72

FIGURE 5.28 Comparison of inverse and Wiener filtering. (a) Result of full inverse filtering of Fig. 5.25(b).
Radially limited inverse filter result. (c) Wiener filter result.

 Figure 5.28 illustrates the advantage of Wiener filtering over direct inverse filtering.
 Figure 5.28(a) is the full inverse-filtered result from Fig. 5.27(a).
 Fig. 5.28(b) is the radially limited inverse filter result of Fig, 5.27(c). These images are
duplicated here for convenience in making comparisons.
 Figure 5.28(c) shows the result obtained using Eq. (3) with the degradation function
H(u,v)=
The value of K was chosen interactively to yield the best visual results.
 The advantage of Wiener filtering over the direct inverse approach is evident in this example.
By comparing Figs. 5.25(a) and 5.28(c), we see that the Wiener filter yielded a result very
close in appearance to the original image.

5.9 Constrained Least Squares Filtering


 Knowing something about the degradation function H is common to all methods discussed in
this chapter.
 Implementation of Wiener filter requires Power spectra of the undegraded image & noise to
be known. Constrained Least Squares Filter requires knowledge of only the mean and
variance of the noise. These parameters usually can be calculated from a given degraded
image, so this is an important advantage.
 Wiener filter is based on minimizing a statistical criterion and, it is optimal in an average
sense. Constrained Least Squares Filter yields an optimal result for each image to which it is
applied.

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 52


Digital Image Processing Notes 17EC72/15EC72

 Degradation process is given by

g(x,y)=h(x,y) f(x,y)+η(x,y)………………….(1)
 Using the definition of convolution we can express Eq. (1) in vector-matrix form:
g=Hf+η …………… (2)
Example: If g(x, y) is of size M * N.
 Then we can form the first N elements of the vector g by using the image elements in first
row of g(x, y), the next N elements from the second row, and so on. The resulting vector will
have dimensions MN * 1.
 The dimensions of f and η are formed in the same manner. The matrix H then has
dimensions MN * MN.
 If H is highly sensitive to noise. To improve the noise sensitivity problem is to
use optimality of restoration on a measure of smoothness, such as the second
derivative of an image (Laplacian).
 The objective is to minimize the criterion function, C, defined as
C=∑ ∑ ……………….. (3)

 Subject to the constraint ‖ ̂‖ =‖ ‖ ……………….. (4)

Where
‖ ‖ = Euclidean vector norm,
̂ = estimate of the undergraded image.

= Laplacian operator is defined in eq.

 Frequency domain solution to this optimization problem is given by the expression

̂ [| ]G(u,v) ………….(5)
| | |
Where
γ = parameter that must be adjusted so that the constraint in Eq. (4) is satisfied,
P(u, v)=Fourier transform of the function p(x,y), which is a 3*3 Laplacian mask.

P(x,y)=[ ]………………….(6)

 If γ = zero, Eq. (5) reduces to inverse filtering.

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 53


Digital Image Processing Notes 17EC72/15EC72

 Iterative algorithm for constrained least square filter(A procedure for computing by
iteration is as follows):
Step1:
 Define a “residual” vector r as
r=g-H ̂……………..(7)
̂ (u, v) is a function of γ, then r also is a function of this parameter.

=‖ ‖ ………….. (8)

It can be shown that is a monotonically increasing function of γ.


Step2:
Adjust γ so that
‖ ‖ ‖ ‖ a (9)
Where a is an accuracy factor.
In view of eq.(7),if ‖ ‖ ‖ ‖ ,the constraints in eq.(4) will be strictly satisfied.
Step3:
Because is monotonic, finding the desired value of γ is not difficult. one approach is to
1. Specify an initial value of γ
2. Compute ‖ ‖
3. Stop if eq.(9) is satisfied else return to step2 after increasing γ if ‖ ‖ ‖ ‖ a or
decreasing γ if ‖ ‖ ‖ ‖ [Link] the new value of γ in eq.(5) to recomputed the optimum
estimate ̂

 In order to use this algorithm, we need the quantities‖ ‖ ‖ ‖ . To compute ‖ ‖ , we


note from Eq. (7) that
̂
From which we obtain r(x,y) by computing the inverse transform of R(u,v). Then

‖ ‖ ∑∑

 Computation of ‖ ‖ leads to an interesting result.

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 54


Digital Image Processing Notes 17EC72/15EC72

 First, consider the variance of the noise over the entire image, which we estimate by the
sample-average method, is given below.

∑ ∑

Where ∑ ∑

Is the sample mean.


 With reference to the form of Eq. (11), we note that the double summation in Eq. (12) is
equal to ‖ ‖ . This gives us the expression
‖ ‖ [ ]

 This is a most useful result. It tells us that we can implement an optimum restoration
algorithm by having knowledge of only the mean and variance of the noise. These quantities
are not difficult to estimate, assuming that the noise and image intensity values are not
correlated. This is a basic assumption of all the methods discussed in this chapter.
 In general, automatically determined restoration filters yield lesser results to manual
adjustment of filter parameters. This is particularly true of the constrained least squares filter,
which is completely specified by a single, scalar parameter.

EXAMPLE: Comparison of Wiener and constrained least squares filtering.

FIGURE 5.30 Results of constrained least squares filtering. Compare (a), (b), and (c) with the Wiener
filtering results in Figs. 5.29(c), (f), and (i), respectively.

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 55


Digital Image Processing Notes 17EC72/15EC72

 Figure 5.30 shows the result of processing Figs. 5.29(a), (d), and (g) with constrained least
squares filters, in which the values of γ were selected manually to yield the best visual
results. This is the same procedure we used to generate the Wiener filtered results in Fig.
5.29(c), (f), and (i).
 By comparing the constrained least squares and Wiener results, it is noted that the former
yielded slightly better results for the high and medium noise cases, with both filters
generating equal results for the low-noise case.
 It is not unexpected that the constrained least squares filter would outperform the Wiener
filter when selecting the parameters manually for better visual results.
 The parameter γ in Eq. (5) is a scalar, while the value of K in Eq. ̂
| |
[ | |
]G(u,v) is an approximation to the ratio of two unknown frequency domain

functions; this ratio not often is constant.


 Thus, it stands to reason that a result based on manually selecting γ would be a more accurate
estimate of the undegraded image.
EXAMPLE: Iterative estimation of the optimum constrained least squares filter.

FIGURE 5.31:(a)Iteratively determined constrained least squares restoration of Fig. 5.16(b), using correct noise
parameters. (b)Result obtained with wrong noise parameters.

 Figure 5.31(a) shows the result obtained by using the algorithm just described to estimate the
optimum filter for restoring Fig. 5.25(b).
 The initial value used for γ was 10-5, the correction factor for adjusting γ was 10-6, and the
value for a was 0.25. The noise parameters specified were the same used to generate Fig.

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 56


Digital Image Processing Notes 17EC72/15EC72

5.25(a): a noise variance of 10-5, and zero mean. The restored result is almost as good as Fig.
5.28(c), which was obtained by Wiener filtering with K manually specified for best visual
results.
 Figure 5.31(b) shows what can happen if the wrong estimate of noise parameters are used. In
this case, the noise variance specified was 10-2 and the mean was left at a value of 0. The
result in this case is considerably more blurred.

Recommended Questions:
1. Explain the model of image degradation/restoration. List all noise probability density
functions and explain any three with necessary equations and graph.
2. Explain inverse filtering and weiner filtering in image processing.
3. Define the process of image restoration. Explain the order statistics filter for restoring images
in the presence of noise.
4. Explain the following methods to estimate the degradation function, used in image restoration:
i) Estimation by image observation;ii)Estimation by experiment
iii)Mathematic modeling.
5. Write short notes on:
i)Noise models ii)Wiener filtering iii)inverse filtering
6. with the relevant p.d.f plots. Explain: i) Gaussian noise, ii) Impulse noise.
7. What are the applications of the second order derivative in image processing?
[Link] in brief the inverse filtering approach and its limitation in image restoration.
[Link] is order-statistics filter?Explain any [Link] their relative merits and demerits.
[Link] the help of a block diagram,explain the imge degradation and restoration model and
mention the reasons for degradation.
[Link] the minimum mean square error (Wiener) filtering that incorporates both degradation
function and the statistical characteristics of noise into the restoration process.
[Link] the following order statistics filter for image restoration: i)Median filter ii)max and
min filter iii)Adaptive local noise reduction filter.
13. Bring out the use of geometric transformation for image restoration?
14. Explain the importance of image restoration process in image processing. Explain any four
important noise probability density functions.

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 57


Digital Image Processing Notes 17EC72/15EC72

15. Discuss the importance of adaptive filter in image restoration system. Highlight the working
of adaptive median filters.
16. Explain the following order-statistics filters, indicating their uses.
i) Median Filter ii) max filter iii) min filter
17. Explain the notch reject filters. How can we obtain the notch filter that pass rather than
suppressing the frequency in the notch area?
18. Explain in brief, the properties of a Linear, position Invariant Operator.

Dept. of ECE,RLJIT Prepared by : [Link] Chandra G Page 58

You might also like