Chapter 4 Image Restoration
Introduction
Image Restoration is the operation of taking a corrupt/noisy image and estimating the clean,
original image. Corruption may come in many forms such as motion blur, noise and camera mis-
focus. Image restoration is performed by reversing the process that blurred the image and such is
performed by imaging a point source and use the point source image, which is called the Point
Spread Function (PSF) to restore the image information lost to the blurring process.
Image restoration attempts to restore images that have been degraded
– Identify the degradation process and attempt to reverse it
– Similar to image enhancement, but more objective
Goal of Restoration : Improve an image in some predefined sense. i.e.
g(x,y)=h(x,y)*f(x,y)+η(x,y)
G(u,v)=H(u,v)F(u,v)+N(u,v)
Noise and Images
The sources of noise in digital images arise during image acquisition (digitization) and
transmission
– Imaging sensors can be affected by ambient conditions
– Interference can be added
to an image during transmission
Noise models
• Source of noise
– Image acquisition (digitization)
– Image transmission
• Spatial properties of noise
– Statistical behavior of the gray-level values of pixels
– Noise parameters, correlation with the image
• Frequency properties of noise
– Fourier spectrum
– Ex. white noise (a constant Fourier spectrum)
• We can consider a noisy image to be modelled as follows:
g ( x, y) f ( x, y) ( x, y )
• where f(x, y) is the original image pixel, η(x, y) is the noise term and g(x, y) is the
resulting noisy pixel
• If we can estimate the noise model we can figure out how to restore the image
There are many different models for the image
noise term η(x, y):
– Gaussian
• Most common model
– Rayleigh
– Erlang (Gamma)
– Exponential
– Uniform
– Impulse
• Salt and pepper noise
1
p( z ) e ( z ) / 2
2 2
a) Gaussian Noise
2
2
( z a )e ( z a ) / b for z a
2
b) p( z ) b Rayleigh Noise
0 for z a
a b z b 1 z
e for z 0
c) p ( z ) (b 1)! Gamma Noise
0 for z 0
ae az for z 0
d) p( z ) Exponential Noise
0 for z 0
1
for a z b
e) p ( z ) b a Uniform Noise
0 otherwise
Pa for z a
f ) p ( z ) Pb for z b Salt Pepper Noise
0
otherwise
Gaussian noise
• Math. tractability in spatial and frequency domain
• Electronic circuit noise and sensor noise caused by poor illumination and transmission.
• Probability Density Function (PDF) equal to normal distribution.
• Here, z is gray level.
1
p( z ) e ( z ) / 2
2 2
2
Mean Variance
Note: p( z )dz 1
70% in [(), ()]
95% in [(), ()]
Uniform noise
• Less practical, used for random number generator
Impulse (salt-and-pepper) noise
• Quick transients, such as faulty switching during imaging
Impulse (salt-and-pepper) noise PDF
Noise Example
The test pattern to the right is ideal for demonstrating the addition of noise
The following slides will show the result of adding noise based on various models to this image
This test pattern is well-suited for illustrating the noise models, because it is composed of simple,
constant areas that span the grey scale from black to white in only three increments. This
facilitates visual analysis of the characteristics of the various noise components added to the
image.
Filtering to Remove Noise
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 ) g ( s, t )
mn ( s ,t )S xy
1 1 1
/9 /9 /9
1 1 1
/9 /9 /9
1 1 1
/9 /9 /9
This is implemented as the simple smoothing filter.It blurs the image
There are different kinds of mean filters all of which exhibit slightly different behaviour:
– Geometric Mean
– Harmonic Mean
– Contraharmonic Mean
Geometric Mean:
– Achieves similar smoothing to the arithmetic mean, but tends to lose less image detail.
1
mn
fˆ ( x, y ) g ( s, t )
( s ,t )S xy
Harmonic Mean:
mn
fˆ ( x, y )
1
( s ,t )S xy g ( s, t )
Works well for salt noise, but fails for pepper noise.
Also does well for other kinds of noise such as Gaussian noise
Contraharmonic Mean:
g ( s, t )
( s ,t )S xy
Q 1
fˆ ( x, y )
g ( s, t )
( s ,t )S xy
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
Order Statistics Filters
Spatial filters based on ordering the pixel values that make up the neighbourhood defined by the
filter support.
Useful spatial filters include
– Median filter
– Max and min filter
– Midpoint filter
– Alpha trimmed mean filter
Median Filter
fˆ ( x, y) median{g ( s, t )}
( s ,t )S xy
Excellent at noise removal, without the smoothing effects that can occur with other smoothing
filters . Particularly good when salt and pepper noise is present.
Max and Min Filter
Max Filter:
fˆ ( x, y) max {g ( s, t )}
( s ,t )S xy
Min Filter:
fˆ ( x, y) min {g ( s, t )}
( s ,t )S xy
Max filter is good for pepper noise and Min filter is good for salt noise.
Midpoint Filter:
fˆ ( x, y ) max {g ( s, t )} min {g ( s, t )}
1
2 ( s ,t )S xy ( s ,t )S xy
Good for random Gaussian and uniform noise.
Alpha-Trimmed Mean Filter:
1
fˆ ( x, y )
mn d
g ( s, t )
( s ,t )S xy
r
We can delete the d/2 lowest and d/2 highest grey levels.So gr(s, t) represents the remaining mn –
d pixels.
• Where d ranges from 0 to mn – 1.
• When d=0, it reduces to mean filter
• When d=mn – 1, it 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 combination of salt-and-pepper and Gaussian noise.
Adaptive Filters
The filters discussed so far are applied to an entire image without any regard for how image
characteristics vary from one point to another. The behaviour of adaptive filters changes
depending on the statistical characteristics of the image inside the filter region. Improved
filtering power but increasing complexity . We will take a look at the adaptive median filter.
The median filter performs relatively well on impulse noise as long as the spatial density of the
impulse noise is not large. The adaptive median filter can handle much more spatially dense
impulse noise, and also performs some smoothing for non-impulse noise.
The key to understanding the algorithm is to remember that the adaptive median filter has three
purposes:
– Remove impulse noise
– Provide smoothing of other noise
– Reduce distortion (excessive thinning or thickening of object boundaries).
In the adaptive median filter, the filter size changes depending on the characteristics of the
image.
Notation:
– Sxy = the support of the filter centerd at (x, y)
– zmin = minimum grey level in Sxy
– zmax = maximum grey level in Sxy
– zmed = median of grey levels in Sxy
– zxy = grey level at coordinates (x, y)
– Smax =maximum allowed size of Sxy
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
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 A determines if the output of the median filter zmed is an impulse or not (black or white).
If it is not an impulse, we go to stage B.If it is an impulse the window size is increased until it
reaches Smax or zmed is not an impulse.Note that there is no guarantee that zmed will not be an
impulse. The smaller the the density of the noise is, and, the larger the support Smax, we expect
not to have an impulse.
Stage B: B1 = zxy – zmin
B2 = zxy – zmax
If B1 > 0 and B2 < 0, output zxy
Else output zmed
Stage B determines if the pixel value at (x, y), that is zxy, is an impulse or not (black or white).
If it is not an impulse, the algorithm outputs the unchanged pixel value zxy .
If it is an impulse the algorithm outputs the median zmed .
Fig (a) Image corrupted by salt and pepper noise with probabilities Pa = Pb=0.25
Fig (b) Result of filtering with a 7x7 median filter
Fig (c) Result of adaptive median filtering with
Smax = 7
AMF preserves sharpness and details, e.g. the connector fingers.
Periodic Noise
Typically arises due to 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.
Band Reject Filters
Removing periodic noise form an image involves removing a particular range of frequencies
from that image.
Band reject filters can be used for this purpose
An ideal band reject filter is given as follows:
W
1 if D(u , v) D0 2
W W
H (u , v) 0 if D0 D (u , v) D0
2 2
1 if D(u , v) D0 W
2
The ideal band reject filter is shown below, along with Butterworth and Gaussian versions of the
filter.
Ideal Band Butterworth Gaussian
Reject Filter Band Reject Band Reject Filter
Filter (of order 1)
Fig (a) Image corrupted by sinusoidal noise
Fig (b) Fourier spectrum of corrupted image
Fig (c) Butterworth band reject filter
Fig (d) Filtered image
4.3 Periodic Noise Reduction by Frequency domain Filters
LPF & HPF Image Enhancement
1) BandReject Filters
if Du , v D0
1-1) Ideal : W
1 2
H u , v 0 Du, v D0
W W
if D0
2 2
if Du , v D0
1 W
2
D(u,v): distance from the origin of the centered frequency rectangle
W: bandwidth
D0: radial center
1-2) Butterworth of order n :
H u , v
1
Du , v W
2n
1 2 2
D u , v D0
1-3) Gaussian :
2
1 D 2 u ,v D0
2
2 D u ,v W
H u, v 1 e
2) Bandpass Filters Hbp(u,v)=1-Hbr(u,v)
It helps isolate the noise pattern.
0 if D1 u , v D0 or D2 u , v D0
3) Notch Filters H u , v
3-1) Ideal : 1 otherwise
1
2
2 2
D1 u , v u
M N
u0 v v0
2 2
1
2
2 2
D1 u , v u
M N
u0 v v0
2 2
The center of the frequency rectangle has been shifted to the point (M/2,N/2)
H u , v
1
3-2) Butterworth of order n n
D0
2
1
D1 u , v D2 u, v
3-3) Gaussian
1 D u ,v D2 u ,v
1
H u, v 1 e
2 D0 2