0% found this document useful (0 votes)
11 views55 pages

1-Image Imagerestoration-S

image Imegerestoration

Uploaded by

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

1-Image Imagerestoration-S

image Imegerestoration

Uploaded by

Noman Haider
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 55

Digital Image

Processing
Image Restoration:
Noise Removal

Dr. Abida Sharif


Material Reference

Images and Material


From
Rafael C. Gonzalez and Richard E. Wood,
Digital Image Processing,
2nd Edition.& Internet Resources 2
Contents
 Recap
 Image restoration techniques used for noise
removal
 What is image restoration?
 Image enhancement vs image restoration
 Noise and images
 Noise models
 Noise removal using spatial domain filtering
 Order Statistics Filters

3
Recap
Image enhancement
 Smoothing filters
 Sharpening filters

4
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

5
Image enhancement vs image restoration
(Cont.)
 Restoration involves modeling of degradation
and applying the inverse process in order to
recover the original image.
 Although the restore image is not the original
image, its approximation of actual image.

6
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

7
Noise Model
 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 model the noise in an
image is based on this will help us to figure
out how to restore the image

8
Noise Corruption Example

Original Image x Noisy Image x

Image f (x, y) Image f (x, y)


y y
9
Noise Models
 There are many
different models for the Gaussi Rayleig
h
image noise term η(x, an
y):
 Gaussian
 Most common Erlan Exponenti
g al
model
 Rayleigh
 Erlang Impul
Unifor
 Exponential m se

 Uniform
 Impulse 10

 Salt and pepper


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

Histogram to go here

11
Noise Example (cont…)

Gaussian Rayleigh Erlang

12
Noise Example (cont…)

Exponential Uniform Impulse

13
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
1 as follows:1/ 1
/ 1
/9
ˆ f ( x, y )   g ( s, t )
mn ( s ,t )S xy
9 9

/9
1
/9
1
/9
1

 g(s,t): degraded image /9


1
/9
1
/9
1
 Sxy: set the coordinates in a rectangular
 sub image window of size m*n
 An arithmetic mean filter removes short tailed
noise such as uniform and Gaussian type noise
from the image at the cost of blurring the 14

image.
Noise Removal Example
Original Image x Filtered Image x
154 152 157 155 156 152 151

150 149 151 150 152 153 158

151 204 152 142 100 57 160

148 150 051 149 153 159 063


149 151 152 155 181 164 167

150 154 057 060 063 067 170

051 155 159 162 165 069 072 Image f (x, y)


y Image f (x, y) y

15
Other Means
 There are different kinds of mean filters all
of which exhibit slightly different behavior:
 Geometric Mean
 Harmonic Mean
 Contra harmonic Mean

16
Other Means (cont…)
 There are other variants on the mean which
can give different performance
 Geometric Mean: 1
  mn
fˆ ( x, y )   g ( s, t )
 ( s ,t )S xy 
 Achieves similar smoothing to the arithmetic
mean, but tends to lose less image detail.
 This usually results in similar as the arithmetic
mean filter,
 With possibly less loss of image detail.
17
Noise Removal Example
Original Image x Filtered Image x
54 52 57 55 56 52 51

50 49 51 50 52 53 58

51 204 5 16 22 57 60

48 50 6 3 18 59 63
49 51 12 3 15 64 67

148 154 157 160 163 167 170

151 155 159 162 165 169 172


Image f (x, y)
y Image f (x, y) y
5 16 2
2 Gives the result of:
6 3 1 (5*16*22*6*3*18*12*3*15)^(1/9)
8 = 8.77 18

12 3 1
Mean Filters (cont…)
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.

19
Noise Corruption Example
Original Image x Filtered Image x
154 152 157 155 156 152 151

150 149 151 150 152 153 158

151 204 152 142 100 57 160

148 150 051 149 153 159 063


149 151 152 155 181 164 167

150 154 057 060 063 067 170

051 155 159 162 165 069 072


Image f (x, y)
y Image f (x, y) y

20
Mean Filters (cont…)
Contraharmonic Mean:
 g ( s, t ) Q 1

ˆf ( x, y )  ( s ,t )S xy
 g ( s, t )
( s ,t )S xy
Q

 Q is the order of the filter and adjusting its


value changes the filter’s behaviour.
 This yields the arithmetic mean filter for Q=0
and the harmonic mean filter for Q=-1.
 Positive values of Q eliminate pepper noise,
Negative values of Q eliminate salt noise
21
Noise Corruption Example
x Filtered Image x
Original Image
154 152 157 155 156 152 151

150 149 151 150 152 153 158

151 204 152 142 100 57 160

148 150 051 149 153 159 063


149 151 152 155 181 164 167

150 154 057 060 063 067 170

051 155 159 162 165 069 072


Image f (x, y)
y Image f (x, y) y

22
Noise Removal Examples

Original Image
Image Corrupted
By Gaussian

Noise
After A 3*3 After A 3*3
Arithmetic Geometric
Mean Filter Mean Filter

23
Noise Removal Examples (cont…)

Image
Corrupted
By Pepper
Noise

Result of
Filtering Above
With 3*3
Contraharmonic
Q=1.5
24
Noise Removal Examples (cont…)

Image
Corrupted
By Salt
Noise

Result of
Filtering Above
With 3*3
Contraharmonic
Q=-1.5

25
Contraharmonic Filter: Here Be Dragons
 Choosing the wrong value for Q when using
the contraharmonic filter can have drastic
results

26
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

27
Median 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.
 Median filters are particularly suited for
impulsive noise. They often result in much
less loss of sharp edges in the original
image. 28
Median Filter Example
Input Image Values using 3x3
Mask
124.126.127.120.1
50.125.115.119.12
3
After sorting
115.119.120.123.1
24.125.126.127.15
0

Median Value: 124


 As can be seen, the central pixel value of 150 is not
appropriate of the surrounding pixels and is replaced with the
median value: 124
29
Noise Corruption Example
Original Image x Filtered Image x
154 152 157 155 156 152 151

150 149 151 150 152 153 158

151 204 152 142 100 57 160

148 150 051 149 153 159 063


149 151 152 155 181 164 167

150 154 057 060 063 067 170

051 155 159 162 165 069 072


Image f (x, y)
y Image f (x, y) y

30
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 is
used to find the bright spots in an image.
 Min is good for salt noise and is used to
find the dark spots in an image.
 Usually, the max and min filters are used in
conjunction. 31
Noise Corruption Example
Original Image x Filtered Image x
154 152 157 155 156 152 151

150 149 151 150 152 153 158

151 204 152 142 100 57 160

148 150 051 149 153 159 063


149 151 152 155 181 164 167

150 154 057 060 063 067 170

051 155 159 162 165 069 072


Image f (x, y)
Image f (x, y) y
y

32
Midpoint Filter

Midpoint Filter:

ˆf ( x, y )  1  max {g ( s, t )}  min {g ( s, t )}


2  ( s ,t )S xy ( s ,t )S xy 

 Good for random Gaussian and uniform


noise.
 It combines order statistic with averaging.

33
Noise Corruption Example
Original Image x Filtered Image x
154 152 157 155 156 152 151

150 149 151 150 152 153 158

151 204 152 142 100 57 160

148 150 051 149 153 159 063


149 151 152 155 181 164 167

150 154 057 060 063 067 170

051 155 159 162 165 069 072


Image f (x, y)
y
y Image f (x, y)

34
Alpha-Trimmed Mean Filter
Alpha-Trimmed Mean Filter:
1
fˆ ( x, y )   g ( s, t ) r
mn  d ( s ,t )S xy

 We can delete the d/2 lowest and d/2 highest


grey levels
 So gr(s, t) represents the remaining mn – d
pixels.
 When d=0, we get the regular arithmetic
mean filter, whereas when d = (ab -1) / 2,we
get the median filter.
35
Alpha-Trimmed Mean Filter (Cont.)
 Place a window over elements;
 Pick up elements;
 Order elements;
 Discard elements at the beginning and at the
end of the got ordered set;
 Take an average— sum up the remaining
elements and divide the sum by their number.

This filter also combines order statistic with


averaging.

36
Noise Corruption Example
Original Image x
Filtered Image x
154 152 157 155 156 152 151

150 149 151 150 152 153 158

151 204 152 142 100 57 160

148 150 051 149 153 159 063


149 151 152 155 181 164 167

150 154 057 060 063 067 170

051 155 159 162 165 069 072


Image f (x, y)
y Image f (x, y) y

37
Noise Removal Examples

Image Result of 1
Corrupted Pass With A
By Salt And 3*3 Median
Pepper Noise Filter

Result of 2 Result of 3
Passes With Passes With
A 3*3 Median A 3*3 Median
Filter Filter

38
Noise Removal Examples (cont…)

Image Image
Corrupted Corrupted
By Pepper By Salt
Noise Noise

Result Of Result Of
Filtering Filtering
Above Above
With A 3*3 With A 3*3
Max Filter Min Filter

39
Noise Removal Examples (cont…)
Image Image Further
Corrupted Corrupted
By Uniform By Salt and
Noise Pepper Noise

Filtered By Filtered By
5*5 Arithmetic 5*5 Geometric
Mean Filter Mean Filter

Filtered By Filtered By
5*5 Median 5*5 Alpha-Trimmed
Filter Mean Filter

40
Codes Description
 Description: The blurring effect can be
controlled by “a” and ‘b’ components of the
model.
 Then random noise is added in the image
via Matlab programming.
 Many methods can restore the noisy and
motion blurred image; particularly in this
lecture, we follows the Inverse filtering,
Wiener filtering, Lucy-Richardson, Blind
DeConvolution, and Regularized Method
for the purpose of image restoration.
41
Codes

a. Inverse filter, Wiener filter & Lucy-


Richardson filters based restoration.
b. Blind DeConvolution based Restoration
c. Lucky Richardson Method
d. Regularized Method

42
Inverse filter, Wiener filter &
Lucy-Richardson filters based
restoration

43
Inverse filter, Wiener filter &
Lucy-Richardson filters based
restoration (Cont.)

44
Inverse filter, Wiener filter &
Lucy-Richardson filters based
restoration (Cont.)

45
Blind DeConvolution based Restoration

46
Blind DeConvolution based Restoration
(Cont.)

47
Lucky Richardson Method

48
Lucky Richardson Method (Cont.)

49
Regularized Method

50
Regularized Method (Cont.)

51
Task

 Based on the previous simulation codes,


implement these codes for more images
from different domains and analyze
which method performed good for which
domain.
 Input image
 Add noise and other blur factors
 Perform restoration techniques and
obtained a resultant images.

52
Summary
 Image restoration techniques used for noise
removal
 What is image restoration?
 Image enhancement vs image restoration
 Noise and images
 Noise models
 Noise removal using spatial domain filtering
 Order Statistics Filters

53
Next Lecture
 Histograms

54
THANK YOU

55

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy