You are on page 1of 79

Unit 3

Image Restoration and Segmentation


PART 1

Dr.S.Deepa
Mrs.N.Arunpriya
Mrs.B.Sathyabhama
Panimalar Engineering College
Contents
3.1 • Introduction

3.2 • Image Degradation/Restoration Model

3.3 • Linear Position Invariant Degradations

3.4 • Noise Models

3.5 • Image Restoration Filters

3.6 • Inverse Filter

3.7 • Wiener Filter


Restoration
• The principle goal of restoration technique is to improve quality of
image in some predefined sense.
• An image may be corrupted by so many degradations which starts
from the stage of image acquisition itself.
Goal • Images can be degraded by noise, blur and distortion (or)
artifacts.

• Image Restoration is defined as the process of


reconstruction (or) recovering an image which is in
Definition the degraded (or) distorted state.

• Restoration attempts to recover an image that has been


degraded by using apriori knowledge of the
What it degradation phenomenon.
does
Image Enhancement vs. Image Restoration
Image Enhancement Image Restoration

Image enhancement is a subjective Image Restoration is an objective


process process
It is a heuristic procedure designed to Restoration techniques are oriented
manipulate an image in order to towards modeling the degradation
please the viewer. and applying the inverse process in
order to recover the original image.
Modeling of degradation process Modeling of degradation is a must.
is not required.
Apriori knowledge of the degradation Apriori knowledge of the degradation
is not required. function is required to model the
degradation function.
Ex: Contrast stretching Ex: Removal of motion blur
Causes of Image Degradation

1. Improper opening and closing of the shutter

2. Atmospheric turbulence

3. Misfocus of lens

4. Relative motion between camera and object


which causes motion blur
Restoration Techniques
The restoration techniques are oriented towards modeling the
degradation and applying the inverse process in order to recover
the original image.
Restoration
Techniques

Frequency
Algebraic
Domain
Approach
Approach

Whereas the
Frequency domain algebraic approach
techniques are of involves manipulation
relatively less of large systems of
computational simultaneous
complexity equations.
Image Degradation/ Restoration Model

f(x,y) • Original Image As shown in figure, the degradation function `H'


together with the additive noise η(x,y) operate on
g(x,y) • Degraded Image the input image to produce the degraded image
g(x,y)
H • Degradation

f^(x,y) • Restored Image Given g(x,y), the objective of restoration is to


obtain an estimate f^(x,y) of the original image
η(x,y) • Additive Noise using some knowledge about the degradation
function H and additive noise
Image Degradation/ Restoration
Model (Contd…)
Spatial Domain
If H is a linear, position invariant process, then the degraded image in the
spatial domain is given by,

g ( x, y )  f ( x, y )  h ( x, y )   ( x, y ) (1)

Where h(x, y) is the spatial representation of the degradation function H

Frequency Domain

G(U, V ) = H(U, V )F(U, V ) + N(U, V ) (2)

Where the terms in capital letters are the Fourier Transforms of the
corresponding terms in Eq(1)

Eq(1) and (2) are the basis for all restoration models.
Linear Position Invariant Degradations
Linear Position Invariant Degradations (Contd…)

Additivity Property

Homogeneity Property
Linear Position Invariant Degradations (Contd…)
Linear Position Invariant Degradations (Contd…)

h(x,y,α,β) is called the impulse response of H


Linear Position Invariant Degradations (Contd…)
Linear Position Invariant Degradations
Linear Position Invariant Degradations
Linear Position Invariant Degradations
Summary
• The preceding discussion indicates that a linear, spatially
invariant degradation system with additive noise can be
modelled in the spatial domain as the convolution of the image,
followed by the addition of noise.
• Based on the convolution theorem, the same process can be
expressed in the frequency domain as the product of the
transform of the image and degradation, followed by the
addition of the transform of the noise.
• Because degradations are modelled as being the result of
convolution, and restoration filters apply the reverse of
convolution process, the filters used in the restoration process
often are called deconvolution filters.
Noise Models
The principal sources of noise in digital image arise
– during image acquisition and / or transmission.
• During Image Acquisition
– in acquiring images with a CCD camera, light levels and
sensor temperature are major factors affecting the
amount of noise in the resulting image.
– Quality of Sensing Elements used
• During Image Transmission
– due to interference in the channel used for
transmission,
– Example : an image transmitted using a wireless
network might be corrupted as a result of lightning or
other atmospheric disturbances.
Spatial and Frequency Properties of
Noise
White noise:
The Fourier spectrum of noise is constant.
This terminology is a carryover from the physical
properties of white light, which contains nearly all
frequencies in the visible spectrum in equal
properties.

We assume in this chapter: Noise is independent of


spatial coordinates.
Noise Probability Density Functions
Noise cannot be predicted but can be approximately described
in statistical way using the probability density function (PDF).
The statistical properties of the gray level of spatial noise can
be considered random variables characterized by a PDF.
1 • Gaussian Noise

2 • Rayleigh Noise
Commonly
3 • Erlang Noise
Used PDF
4 • Exponential Noise

5 • Uniform Noise

6 • Impulse Noise
Gaussian Noise
Are used frequently in practice
The PDF of a Gaussian random variable,
Z, is given by:
1  ( z   ) 2 / 2 2
p( z )  e
2
Rayleigh Noise
The PDF of Rayleigh noise:
 2 2
( z  a )e ( z a ) / b for z  a
p( z)   b
 0 for z  a
Erlang Noise (Gamma Noise)
The PDF of Erlang noise :
 b b 1  ( z  a ) 2 / b
a z e for z  a
p ( z )   (b  1)!
0 for z  a

Exponential Noise
The PDF of Exponential Noise is given by

 az
p ( z )  ae
Uniform Noise
 1
 for a  z  b
p( z)   b - a
 0 otherwise
Salt and Pepper Noise
Image Restoration Filters

Types of Image Restoration Filters


 Spatial Restoration Filters
 Frequency Domain Restoration Filters

When noise is the only degradation ---- then Spatial


Domain Filters are used

Commonly used spatial Filters for image restoration


are
• Mean Filters
• Order statistics Filters
• Adaptive Filters.
Mean Filters
Types:
• Arithmetic Mean Filters
• Geometric Mean Filters
• Harmonic Filters
• Contra Harmonic Filters
Arithmetic Mean Filter
 Simplest of the mean filters

 Sxy Rectangular subimage window of size m x n

 Centred at point (x,y)


 Computes the average value of the corrupted image
g(x,y)

 Restored Image f^(x,y) is


Geometric mean filter
 Geometric Mean Filter performs better than Arithmetic Mean
Filter
 Tends to lose less image details
 The restored image using Geometric Mean Filter is given by
Harmonic mean filter

• The restored image using Harmonic Mean Filter is given by

 It works well for salt noise


 Suitable to remove Gaussian Noise

Disadvantage:
 Fails to remove pepper Noise
Contra Harmonic mean filter
The restored image using Harmonic Mean Filter is
given by

Q  is the order of the filter

 Best suited for eliminating the effects of salt and pepper noise

 For positive values of Q  eliminates PEPPER noise

 For Negative values of Q  eliminates SALT noise


Order Statistics Filters
• Non linear smoothing spatial filters
• Response of the filter is based on ordering
(Ranking the value of the pixels
• Ranking result determines the response of the
filter
Types
 MEDIAN FILTER
 MAX & MIN FILTERS
 MIDPOINT FILTERS
 ALPHA TRIMMED MEAN FILTER
MEDIAN FILTER
• Best known order statistic filter
• Replaces the value of pixel by the median of the
intensity values in the neighborhood of that pixel
• Median Filter is given by

• Provide Excellent Noise reduction Capabilities


• Considerably less blurring than linear filters
• Effective in removing both bipolar and unipolar
Impulse Noise
Max & Min filters
• Max filter is the 100th percentile filter and is given by,

 Used for finding brightest points in the Image


 Effective in removing pepper Noise

• Min filter is the 0th percentile filter and is given by,

 Used for finding darkest points in the Image


 Effective in removing salt Noise
Midpoint filter

• Computes the midpoint between the maximum


and minimum values in the area encompassed
by the filter
• Midpoint filter is given by

• It combines both order statistics and averaging


• Works best for randomly distributed noise like
Gaussian or Uniform Noise
Alpha trimmed mean filter
• Delete d/2 lowerst and d/2 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 are
called Alpha Trimmed Mean Filter and is given by,

 If d=0, this filter reduces to Arithmetic Mean filter


 If d=mn-1, this filter becomes Median Filter
 Useful to remove multiple types of noise such as
combination of salt and pepper and Gaussian Noise.
Adaptive filters
• Adaptive Filters are filters whose behavior
changes based on statistical characteristic of
the image inside the filter region.
• Improved filtering is achieved by improved
complexity

Two important adaptive Filters


• Adaptive Local Noise Reduction Filters
• Adaptive Median Filter
Adaptive local noise reduction filter

• Adapts to some statistical measures on a local


neighborhood, usually mean and variance:
– g(x,y)  the noisy image gray-level value.

– noise variance in the image.

– local mean in neighborhood.

–  local variance in neighborhood.

 could be estimated from an uniform area in


the given image.
Adaptive local noise reduction filter (Contd…)

• If noise variance is zero  Indicates no noise  return the


observed image.
• If local variance is high compared to the noise variance 
presence of edge or a sharp feature return a value close to
observed grey-value.
• If two variances are equal presence of noise return the
arithmetic mean
Adaptive local noise reduction filter
(contd…)
• Filter equation:

• How to handle , what does it mean?

• When , let in the filter equation.

ADVANTAGES
 Achieves better results
 Image filtered with adaptive filters are sharper
Adaptive Median Filtering
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 thickenning of object
boundaries).
Adaptive Median Filtering (cont…)
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
Adaptive Median Filtering (cont…)
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
Adaptive Median Filtering (cont…)
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.
Adaptive Median Filtering (cont…)
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 .
Adaptive Filtering Example

Image corrupted by salt Result of filtering with a Result of adaptive


and pepper noise with 7x7 median filter median filtering with
probabilities Pa = Pb=0.25 Smax = 7

AMF preserves sharpness and details.


Periodic Noise
 Typically arises due to
electrical or electromagnetic
interference.
 Gives rise to regular noise
patterns in an image.
 Frequency domain techniques
are most effective at removing
periodic noise.
Frequency Domain Filters

 Commonly used Frequency Domain Filters


 Band Reject Filters
 Band Pass Filters

 Notch Filters

 Optimum Notch Filters


Band Reject Filters

Removing periodic noise from an image involves


removing a particular range of frequencies from that
image.
Band reject filters can be used for this purpose
Types:
Ideal BRF
Butterworth BRF
Gaussian BRF
Band Reject Filters (Contd…)

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

D(u,v) distance from the origin of the centered freq. rectangle


W width of the band
D0Radial center of the band.
Band Reject Filters (Contd…)

 Butterworth band Reject filter of order n

1
H (u , v )  2n
 D (u , v )W 
1  2 2
 D (u , v )  D0 
 Gaussian band Reject filter

2
1  D 2 ( u , v )  D02 
  
2  D ( u ,v )W 
H (u , v )  1  e
Band Reject Filters (cont…)

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 (of order 1) Filter
Band Reject Filter Example

Image corrupted by Fourier spectrum of


sinusoidal noise corrupted image

Butterworth band Filtered image


reject filter
Periodic Noise Reduction
(Frequency Domain Filtering)

 Band-Pass Filters
 Opposite operation of a band-reject fiter

H bp  1  H br (u , v)
Notch Filters

Notch Filters Reject Frequencies in predefined


neighborhoods about a center frequency

Types
 Ideal Notch Filter

 Butterworth Notch Filter

 Gaussian Notch Filter


Notch Filters (Contd…)

Ideal notch reject filter

0 if D1 (u, v)  D 0 or D 2 (u, v)  D 0
H (u , v )  
1 otherwise
Where,

D1 (u , v )  (u  M / 2  u0 )  (v  N / 2  v0 )
2
 2 1/ 2

D (u , v )  (u  M / 2  u )
2 0
2
 (v  N / 2  v ) 
0
2 1/ 2
Notch Filters (Contd…)

 Butterworth notch reject filter of order n

1
H (u , v )  n
 D 2

1  0

 D1 (u , v ) D2 (u , v ) 

• Gaussian notch reject filter


1  D ( u , v ) D2 ( u , v ) 
  1 2 
2  D0 
H (u , v )  1  e
Notch Filters (Contd…)

 Notch Filters
 Rejects (or passes) frequencies in predefined neighborhoods
about a center frequency

Ideal
Must appear in
symmetric pairs about
the origin.

Butterworth

Gaussian
Notch Pass Filter

 Notch pass filter

H np (u , v)  1  H nr (u , v)

 When Uo =Vo= 0, notch pass filters become low


pass filters
Optimum Notch Filtering
Optimum Notch Filtering
Optimum Notch Filtering
Optimum Notch Filtering
Restoration Filters

When Images are degraded due to Degradation Function


H, Restoration Filters are used to Recover the Original
Image.

Restoration Filters are used to estimate the original image


‘f’ from the degraded image ‘g’ using some knowledge of
the degradation Function ‘H’

Types
 Inverse Filters

 Wiener Filters (Minimum Mean Square Error Filter)


Inverse Filtering
Inverse filtering
Inverse filtering
5/6
Degradation function  k ( u  M / 2) 2  ( v  N / 2)2 
H (u, v)  e  

Curtain of noise
Cutting off values of the ratio outside a radius of 40, 70,85.
Wiener filtering
Wiener filtering

H (u , v) is the degradation function


Wiener filtering

White noinse
Wiener filtering

You might also like