SlideShare a Scribd company logo
CSC447: Digital Image
Processing
Chapter 5: Image Restoration
Prof. Dr. Mostafa Gadal-Haqq M. Mostafa
Computer Science Department
College of Computer & Information Sciences
AIN SHAMS UNIVERSITY
Contents
In this lecture we will look at image restoration
techniques used for noise removal
 What is image restoration?
 Noise and images
 Noise models
 Noise removal using spatial domain filtering
 Periodic noise
 Noise removal using frequency domain
filtering
CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 2
What is Image Restoration?
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
CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 3
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
CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 4
Noise Model
We can consider a noisy image to be modelled
as follows:
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 model of the noise in an
image, this will help us to figure out how to
restore the image.
),(),(),( yxyxfyxg 
CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 5
Noise Models
Gaussian Rayleigh
Erlang Exponential
Uniform
Impulse
There are many different
models for the image
noise term η(x, y):
 Gaussian
 Most common model
 Rayleigh
 Erlang
 Exponential
 Uniform
 Impulse
 Salt and pepper noise
CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 6
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
Image Histogram
CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 7
Noise Example (cont…)
Gaussian Rayleigh Erlang
CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 8
Noise Example (cont…)
Exponential Uniform Impulse
CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 9
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:
This is implemented as the
simple smoothing filter
Blurs the image to remove
noise


xySts
tsg
mn
yxf
),(
),(
1
),(ˆ
1/9
1/9
1/9
1/9
1/9
1/9
1/9
1/9
1/9
CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 10
Other Means
There are different kinds of mean filters all of
which exhibit slightly different behaviour:
 Geometric Mean
 Harmonic Mean
 Contra-harmonic Mean
CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 11
Other Means (cont…)
There are other variants on the mean which can
give different performance
Geometric Mean:
 Achieves similar smoothing to the arithmetic
mean, but tends to lose less image detail
mn
Sts xy
tsgyxf
1
),(
),(),(ˆ








 
CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 12
Other Means (cont…)
Harmonic Mean:
 Works well for salt noise, but fails for pepper
noise.
 Also does well for other kinds of noise such
as Gaussian noise


xySts tsg
mn
yxf
),( ),(
1
),(ˆ
CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 13
Other Means (cont…)
Contra-harmonic Mean:
 Q is the order of the filter and adjusting its
value changes the filter’s behaviour
 Positive values of Q eliminate pepper noise
 Negative values of Q eliminate salt noise






xy
xy
Sts
Q
Sts
Q
tsg
tsg
yxf
),(
),(
1
),(
),(
),(ˆ
CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 14
Noise Removal Examples
Original
Image
Image
Corrupted
By Gaussian
Noise
After A 3*3
Geometric
Mean Filter
After A 3*3
Arithmetic
Mean Filter
CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 15
Noise Removal Examples
(cont…)
Image
Corrupted
By Pepper
Noise
Result of
Filtering Above
With 3*3
Contraharmonic
Q=1.5
CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 16
Noise Removal Examples
(cont…)
Image
Corrupted
By Salt
Noise
Result of
Filtering Above
With 3*3
Contraharmonic
Q=-1.5
CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 17
Contra-harmonic Filter
Choosing the wrong value for Q when using the
contra-harmonic filter can have drastic results
CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 18
Order Statistics Filters
Spatial filters that are based on ordering the
pixel values that make up the neighbourhood
operated on by the filter
Useful spatial filters include
 Median filter
 Max and Min filter
 Midpoint filter
 Alpha trimmed mean filter
CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 19
Median Filter
Median Filter:
 Excellent at noise removal, without the
smoothing effects that can occur with other
smoothing filters
 Particularly good when salt and pepper noise
is present
)},({),(ˆ
),(
tsgmedianyxf
xySts 

CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 20
Max and Min Filter
Max Filter:
Min Filter:
Max filter is good for pepper noise and Min is
good for salt noise
)},({max),(ˆ
),(
tsgyxf
xySts 

)},({min),(ˆ
),(
tsgyxf
xySts 

CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 21
Midpoint Filter
Midpoint Filter:
Good for random Gaussian and uniform noise



 

)},({min)},({max
2
1
),(ˆ
),(),(
tsgtsgyxf
xyxy StsSts
CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 22
Alpha-Trimmed Mean Filter
Alpha-Trimmed Mean Filter:
 We can delete the d/2 lowest and d/2 highest
grey levels
 So gr(s, t) represents the remaining mn – d
pixels


xySts
r tsg
dmn
yxf
),(
),(
1
),(ˆ
CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 23
Noise Removal Examples
Image
Corrupted
By Salt And
Pepper Noise
Result of 1
Pass With A
3*3 Median
Filter
Result of 2
Passes With
A 3*3 Median
Filter
Result of 3
Passes With
A 3*3 Median
Filter
CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 24
Noise Removal Examples
(cont…)
Image
Corrupted
By Pepper
Noise
Image
Corrupted
By Salt
Noise
Result Of
Filtering
Above
With A 3*3
Min Filter
Result Of
Filtering
Above
With A 3*3
Max Filter
CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 25
Noise Removal Examples
(cont…)
Image
Corrupted
By Uniform
Noise
Image Further
Corrupted
By Salt and
Pepper Noise
Filtered By
5*5 Arithmetic
Mean Filter
Filtered By
5*5 Median
Filter
Filtered By
5*5 Geometric
Mean Filter
Filtered By
5*5 Alpha-Trimmed
Mean Filter
CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 26
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
CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 27
Band Reject Filters
 Removing periodic noise form an image involves
removing a particular range of frequencies from
that image
 An ideal band reject filter is given as follows:












2
),(1
2
),(
2
0
2
),(1
),(
0
00
0
W
DvuDif
W
DvuD
W
Dif
W
DvuDif
vuH
CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 28
Band Reject Filters (cont…)
The ideal band reject filter is shown below,
along with Butterworth and Gaussian versions
of the filter
Ideal Band
Reject Filter
Butterworth
Band Reject
Filter (of order 1)
Gaussian
Band Reject
Filter
CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 29
Band Reject Filter Example
Image corrupted by
sinusoidal noise
Fourier spectrum of
corrupted image
Butterworth band
reject filter
Filtered image
CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 30
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 characteristics of the image
inside the filter region
 We will take a look at the adaptive median
filter
CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 31
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 element in the adaptive median filter
is that the filter size changes depending on
the characteristics of the image
CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 32
Adaptive Median Filtering (cont…)
Remember that filtering looks at each original pixel
image in turn and generates a new filtered pixel
First examine the following notation:
 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
CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 33
Adaptive Median Filtering (cont…)
Level A: A1 = zmed – zmin
A2 = zmed – zmax
If A1 > 0 and A2 < 0, Go to level B
Else increase the window size
If window size ≤ Smax repeat level A
Else output zmed
Level B: B1 = zxy – zmin
B2 = zxy – zmax
If B1 > 0 and B2 < 0, output zxy
Else output zmed
CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 34
Adaptive Median Filtering (cont…)
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
CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 35
Adaptive Filtering Example
Image corrupted by salt
and pepper noise with
probabilities
Pa = Pb=0.25
Result of filtering with
a 7 * 7 median filter
Result of adaptive
median filtering with
i = 7
CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 36
Summary
 In this lecture we studied image restoration for
noise removal
 Restoration is slightly more objective than
enhancement
 Spatial domain techniques are particularly useful
for removing random noise
 Frequency domain techniques are particularly
useful for removing periodic noise
 Behaviour of adaptive filters changes depending
on the characteristics of the image inside the filter
region
CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 37
HW 4
 Solve problems 5.1 to 5.12.
CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 38

More Related Content

PPTX
Color Image Processing
PPT
Spatial filtering
PPTX
Fundamental steps in image processing
PDF
Image Restoration (Digital Image Processing)
PPTX
Image compression .
PPTX
Chapter 9 morphological image processing
POTX
Presentation of Lossy compression
PPTX
Psuedo color
Color Image Processing
Spatial filtering
Fundamental steps in image processing
Image Restoration (Digital Image Processing)
Image compression .
Chapter 9 morphological image processing
Presentation of Lossy compression
Psuedo color

What's hot (20)

PPTX
Chapter 8 image compression
PDF
Digital Image Processing - Image Compression
PPTX
Texture,pattern and pattern classes
PDF
Noise Models
PPT
ImageProcessing10-Segmentation(Thresholding) (1).ppt
PPTX
Fundamentals and image compression models
PPT
Image trnsformations
PPTX
digital image processing
PPSX
Color Image Processing: Basics
PPTX
Image Restoration And Reconstruction
PPTX
Log Transformation in Image Processing with Example
PPTX
Lecture 1 for Digital Image Processing (2nd Edition)
PPT
Image enhancement
PPSX
Edge Detection and Segmentation
PDF
Image processing, Noise, Noise Removal filters
PPT
08 frequency domain filtering DIP
PPT
Image degradation and noise by Md.Naseem Ashraf
PPTX
Spatial Filters (Digital Image Processing)
PPTX
Histogram Processing
Chapter 8 image compression
Digital Image Processing - Image Compression
Texture,pattern and pattern classes
Noise Models
ImageProcessing10-Segmentation(Thresholding) (1).ppt
Fundamentals and image compression models
Image trnsformations
digital image processing
Color Image Processing: Basics
Image Restoration And Reconstruction
Log Transformation in Image Processing with Example
Lecture 1 for Digital Image Processing (2nd Edition)
Image enhancement
Edge Detection and Segmentation
Image processing, Noise, Noise Removal filters
08 frequency domain filtering DIP
Image degradation and noise by Md.Naseem Ashraf
Spatial Filters (Digital Image Processing)
Histogram Processing
Ad

Similar to Digital Image Processing: Image Restoration (20)

PPTX
M03 - Imagerestoration digital image processing ppt
PPT
Chapter 5
PPSX
Noise models presented by Nisha Menon K
PPTX
Digital Image restoration
PPTX
Noise filtering
PPTX
Image Restoration ppt unit III for III years.pptx
PPTX
Unit3 dip
PPTX
Smoothing in Digital Image Processing
PPTX
Module 31
PPT
Image denoising
PDF
noiseestimationfiltering-221217050348-c5d1a246.pdf
PPTX
Noise Estimation & Filtering_.pptx
PDF
filters for noise in image processing
PPT
PPTX
Image denoising
PDF
D122733
PPTX
A Presentation on various techniques used in Image Filtering
PDF
restoration_recon_chap5_GW.pdf
PPTX
Image Restoration and Reconstruction in Digital Image Processing
PPTX
Digital image processing
M03 - Imagerestoration digital image processing ppt
Chapter 5
Noise models presented by Nisha Menon K
Digital Image restoration
Noise filtering
Image Restoration ppt unit III for III years.pptx
Unit3 dip
Smoothing in Digital Image Processing
Module 31
Image denoising
noiseestimationfiltering-221217050348-c5d1a246.pdf
Noise Estimation & Filtering_.pptx
filters for noise in image processing
Image denoising
D122733
A Presentation on various techniques used in Image Filtering
restoration_recon_chap5_GW.pdf
Image Restoration and Reconstruction in Digital Image Processing
Digital image processing
Ad

More from Mostafa G. M. Mostafa (20)

PDF
Csc446: Pattern Recognition
PDF
CSC446: Pattern Recognition (LN8)
PDF
CSC446: Pattern Recognition (LN7)
PDF
CSC446: Pattern Recognition (LN6)
PDF
CSC446: Pattern Recognition (LN5)
PDF
CSC446: Pattern Recognition (LN4)
PDF
CSC446: Pattern Recognition (LN3)
PDF
Csc446: Pattren Recognition (LN2)
PDF
Csc446: Pattren Recognition
PDF
Csc446: Pattren Recognition (LN1)
PDF
Digital Image Processing: Image Segmentation
PDF
Digital Image Processing: Image Enhancement in the Spatial Domain
PDF
Digital Image Processing: Image Enhancement in the Frequency Domain
PDF
Digital Image Processing: Digital Image Fundamentals
PDF
Digital Image Processing: An Introduction
PDF
Neural Networks: Introducton
PDF
Neural Networks: Least Mean Square (LSM) Algorithm
PDF
Neural Networks: Support Vector machines
PDF
Neural Networks: Rosenblatt's Perceptron
PDF
Neural Networks: Model Building Through Linear Regression
Csc446: Pattern Recognition
CSC446: Pattern Recognition (LN8)
CSC446: Pattern Recognition (LN7)
CSC446: Pattern Recognition (LN6)
CSC446: Pattern Recognition (LN5)
CSC446: Pattern Recognition (LN4)
CSC446: Pattern Recognition (LN3)
Csc446: Pattren Recognition (LN2)
Csc446: Pattren Recognition
Csc446: Pattren Recognition (LN1)
Digital Image Processing: Image Segmentation
Digital Image Processing: Image Enhancement in the Spatial Domain
Digital Image Processing: Image Enhancement in the Frequency Domain
Digital Image Processing: Digital Image Fundamentals
Digital Image Processing: An Introduction
Neural Networks: Introducton
Neural Networks: Least Mean Square (LSM) Algorithm
Neural Networks: Support Vector machines
Neural Networks: Rosenblatt's Perceptron
Neural Networks: Model Building Through Linear Regression

Recently uploaded (20)

PDF
Sports Quiz easy sports quiz sports quiz
PDF
Insiders guide to clinical Medicine.pdf
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PPTX
Pharma ospi slides which help in ospi learning
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPTX
Lesson notes of climatology university.
PPTX
GDM (1) (1).pptx small presentation for students
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PPTX
master seminar digital applications in india
PPTX
Cell Structure & Organelles in detailed.
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
Sports Quiz easy sports quiz sports quiz
Insiders guide to clinical Medicine.pdf
102 student loan defaulters named and shamed – Is someone you know on the list?
Pharma ospi slides which help in ospi learning
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Lesson notes of climatology university.
GDM (1) (1).pptx small presentation for students
Anesthesia in Laparoscopic Surgery in India
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Abdominal Access Techniques with Prof. Dr. R K Mishra
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
2.FourierTransform-ShortQuestionswithAnswers.pdf
master seminar digital applications in india
Cell Structure & Organelles in detailed.
STATICS OF THE RIGID BODIES Hibbelers.pdf
FourierSeries-QuestionsWithAnswers(Part-A).pdf
Final Presentation General Medicine 03-08-2024.pptx
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Renaissance Architecture: A Journey from Faith to Humanism

Digital Image Processing: Image Restoration

  • 1. CSC447: Digital Image Processing Chapter 5: Image Restoration Prof. Dr. Mostafa Gadal-Haqq M. Mostafa Computer Science Department College of Computer & Information Sciences AIN SHAMS UNIVERSITY
  • 2. Contents In this lecture we will look at image restoration techniques used for noise removal  What is image restoration?  Noise and images  Noise models  Noise removal using spatial domain filtering  Periodic noise  Noise removal using frequency domain filtering CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 2
  • 3. What is Image Restoration? 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 CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 3
  • 4. 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 CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 4
  • 5. Noise Model We can consider a noisy image to be modelled as follows: 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 model of the noise in an image, this will help us to figure out how to restore the image. ),(),(),( yxyxfyxg  CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 5
  • 6. Noise Models Gaussian Rayleigh Erlang Exponential Uniform Impulse There are many different models for the image noise term η(x, y):  Gaussian  Most common model  Rayleigh  Erlang  Exponential  Uniform  Impulse  Salt and pepper noise CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 6
  • 7. 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 Image Histogram CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 7
  • 8. Noise Example (cont…) Gaussian Rayleigh Erlang CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 8
  • 9. Noise Example (cont…) Exponential Uniform Impulse CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 9
  • 10. 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: This is implemented as the simple smoothing filter Blurs the image to remove noise   xySts tsg mn yxf ),( ),( 1 ),(ˆ 1/9 1/9 1/9 1/9 1/9 1/9 1/9 1/9 1/9 CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 10
  • 11. Other Means There are different kinds of mean filters all of which exhibit slightly different behaviour:  Geometric Mean  Harmonic Mean  Contra-harmonic Mean CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 11
  • 12. Other Means (cont…) There are other variants on the mean which can give different performance Geometric Mean:  Achieves similar smoothing to the arithmetic mean, but tends to lose less image detail mn Sts xy tsgyxf 1 ),( ),(),(ˆ           CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 12
  • 13. Other Means (cont…) Harmonic Mean:  Works well for salt noise, but fails for pepper noise.  Also does well for other kinds of noise such as Gaussian noise   xySts tsg mn yxf ),( ),( 1 ),(ˆ CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 13
  • 14. Other Means (cont…) Contra-harmonic Mean:  Q is the order of the filter and adjusting its value changes the filter’s behaviour  Positive values of Q eliminate pepper noise  Negative values of Q eliminate salt noise       xy xy Sts Q Sts Q tsg tsg yxf ),( ),( 1 ),( ),( ),(ˆ CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 14
  • 15. Noise Removal Examples Original Image Image Corrupted By Gaussian Noise After A 3*3 Geometric Mean Filter After A 3*3 Arithmetic Mean Filter CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 15
  • 16. Noise Removal Examples (cont…) Image Corrupted By Pepper Noise Result of Filtering Above With 3*3 Contraharmonic Q=1.5 CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 16
  • 17. Noise Removal Examples (cont…) Image Corrupted By Salt Noise Result of Filtering Above With 3*3 Contraharmonic Q=-1.5 CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 17
  • 18. Contra-harmonic Filter Choosing the wrong value for Q when using the contra-harmonic filter can have drastic results CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 18
  • 19. Order Statistics Filters Spatial filters that are based on ordering the pixel values that make up the neighbourhood operated on by the filter Useful spatial filters include  Median filter  Max and Min filter  Midpoint filter  Alpha trimmed mean filter CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 19
  • 20. Median Filter Median Filter:  Excellent at noise removal, without the smoothing effects that can occur with other smoothing filters  Particularly good when salt and pepper noise is present )},({),(ˆ ),( tsgmedianyxf xySts   CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 20
  • 21. Max and Min Filter Max Filter: Min Filter: Max filter is good for pepper noise and Min is good for salt noise )},({max),(ˆ ),( tsgyxf xySts   )},({min),(ˆ ),( tsgyxf xySts   CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 21
  • 22. Midpoint Filter Midpoint Filter: Good for random Gaussian and uniform noise       )},({min)},({max 2 1 ),(ˆ ),(),( tsgtsgyxf xyxy StsSts CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 22
  • 23. Alpha-Trimmed Mean Filter Alpha-Trimmed Mean Filter:  We can delete the d/2 lowest and d/2 highest grey levels  So gr(s, t) represents the remaining mn – d pixels   xySts r tsg dmn yxf ),( ),( 1 ),(ˆ CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 23
  • 24. Noise Removal Examples Image Corrupted By Salt And Pepper Noise Result of 1 Pass With A 3*3 Median Filter Result of 2 Passes With A 3*3 Median Filter Result of 3 Passes With A 3*3 Median Filter CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 24
  • 25. Noise Removal Examples (cont…) Image Corrupted By Pepper Noise Image Corrupted By Salt Noise Result Of Filtering Above With A 3*3 Min Filter Result Of Filtering Above With A 3*3 Max Filter CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 25
  • 26. Noise Removal Examples (cont…) Image Corrupted By Uniform Noise Image Further Corrupted By Salt and Pepper Noise Filtered By 5*5 Arithmetic Mean Filter Filtered By 5*5 Median Filter Filtered By 5*5 Geometric Mean Filter Filtered By 5*5 Alpha-Trimmed Mean Filter CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 26
  • 27. 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 CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 27
  • 28. Band Reject Filters  Removing periodic noise form an image involves removing a particular range of frequencies from that image  An ideal band reject filter is given as follows:             2 ),(1 2 ),( 2 0 2 ),(1 ),( 0 00 0 W DvuDif W DvuD W Dif W DvuDif vuH CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 28
  • 29. Band Reject Filters (cont…) The ideal band reject filter is shown below, along with Butterworth and Gaussian versions of the filter Ideal Band Reject Filter Butterworth Band Reject Filter (of order 1) Gaussian Band Reject Filter CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 29
  • 30. Band Reject Filter Example Image corrupted by sinusoidal noise Fourier spectrum of corrupted image Butterworth band reject filter Filtered image CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 30
  • 31. 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 characteristics of the image inside the filter region  We will take a look at the adaptive median filter CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 31
  • 32. 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 element in the adaptive median filter is that the filter size changes depending on the characteristics of the image CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 32
  • 33. Adaptive Median Filtering (cont…) Remember that filtering looks at each original pixel image in turn and generates a new filtered pixel First examine the following notation:  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 CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 33
  • 34. Adaptive Median Filtering (cont…) Level A: A1 = zmed – zmin A2 = zmed – zmax If A1 > 0 and A2 < 0, Go to level B Else increase the window size If window size ≤ Smax repeat level A Else output zmed Level B: B1 = zxy – zmin B2 = zxy – zmax If B1 > 0 and B2 < 0, output zxy Else output zmed CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 34
  • 35. Adaptive Median Filtering (cont…) 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 CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 35
  • 36. Adaptive Filtering Example Image corrupted by salt and pepper noise with probabilities Pa = Pb=0.25 Result of filtering with a 7 * 7 median filter Result of adaptive median filtering with i = 7 CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 36
  • 37. Summary  In this lecture we studied image restoration for noise removal  Restoration is slightly more objective than enhancement  Spatial domain techniques are particularly useful for removing random noise  Frequency domain techniques are particularly useful for removing periodic noise  Behaviour of adaptive filters changes depending on the characteristics of the image inside the filter region CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 37
  • 38. HW 4  Solve problems 5.1 to 5.12. CS447: Introduction to Digital Image Processing Prof. Dr. Mostafa GadalHaqq. 38