Digital Image Processing 07 Image Restoration Noise Removal
Digital Image Processing 07 Image Restoration Noise Removal
John See
Faculty of Information Technology
Multimedia University
Some portions of content adapted CYPee's notes, MMU. Most figures from Gonzalez/Woods 1
Lecture Outline
● Degradation & Restoration Process Models
● Noise Models
● Restoration in the presence of noise only (spatial
filtering)
● Restoration of Periodic Noise
● Restoration in the presence of degradation & noise
(frequency domain filtering)
2
Some Announcements
● Reminder: Assignment 1 is due this Friday.
3
Image Restoration
● Image Restoration – To improve the appearance of an image
by application of a restoration process that uses a
mathematical model for image degradation
● Types of degradation:
– Blurring caused by motion or atmospheric disturbance
– Geometric distortion caused by imperfect lenses
– Superimposed interference pattern caused by mechanical systems
– Noise from electronic sources
4
How are these images restored?
5
Image Restoration: The Idea
Example
degraded
images Develop Develop
degradation inverse degradation
model process
Knowledge of
image creation
process
Apply Output
Input
inverse degradation image
image
process fˆ ( x, y )
g(x,y)
6
Degradation/Restoration Process Model
8
Noise Models
● Noise – Any undesired information that contaminates
an image
● Variety of sources:
– Digital image acquisition process, e.g. For CCD (charged
coupled device) camera, electronics signal fluctuations in
detector, caused by thermal energy and light levels
– During image transmission, e.g. Wireless network, may be
corrupted by lightning or other atmospheric disturbance
9
Noise Models
● Assumptions of Noise models in this course:
– Noise is independent of spatial coordinates (except for
spatially periodic noise)
– Noise is uncorrelated w.r.t the image (pixel values)
●
Spatial Noise Descriptor – concern of the statistical behavior
of the intensity values in the noise component of the model
– Characterized by probability density function (PDF)
10
Noise Models
● Typical image noise models that can be modeled:
– Gaussian
– Rayleigh
– Erlang (Gamma)
– Exponential
– Uniform
– Impulse (salt-and-pepper)
11
Noise Models - PDFs
● Gaussian Noise
1 − ( z − µ ) 2 / 2σ 2
p( z ) = e
2πσ 2
where
z: gray scale
µ = mean (average)
σ = standard deviation
12
Noise Models - PDFs
● Rayleigh Noise
2
( z − a ) exp(−( z − a ) / b for z ≥ a
2
p( z ) = b
0 for z < a
where
mean = a + πb/ 4
b(4 − π )
variance = 4
13
Noise Models - PDFs
● Uniform Noise
1
for a ≤ z ≤ b
p ( z ) = (b − a )
0
elsewhere
where
mean = (a + b) / 2
variance = (b − a ) 2 /12
14
Noise Models - PDFs
● Uniform Noise
Pa for z = a (pepper)
p( z ) = Pb for z = b (salt)
0 otherwise
where
b>a
15
Example: Noise Models
16
Example: Noise Models
17
Restoration in Presence of Noise Only –
Spatial Filtering
● Consider an image degraded with only additive noise.
The degradation model is further simplified as
g ( x , y ) = f ( x, y ) + n ( x , y )
in frequency domain
18
Noise Removal with Spatial Filters
● Spatial filters can effectively remove various types of
noise in digital images
● Typically operate on small neighborhoods, from 3x3
to 11x11.
● Some can be implemented as convolution masks
19
Mean Filters
● Arithmetic Mean Filter
– Computes the average value of the corrupted image g(x,y)
in area defined by Sxy. Sxy represents the set of
coordinates in a rectangular subimage window of size
mxn, centred at point (x,y)
1
fˆ ( x, y ) = ∑
mn ( s , t )∈S xy
g ( s, t )
20
Mean Filters
● Geometric Mean Filter
– The image restored using a geometric mean filter:
1
mn
fˆ ( x, y ) = ∏ g ( s, t )
( s , t )∈Sxy
– For random noise: lose less detail than Arithmetic Mean
● Harmonic Mean Filter
– The image restored using a harmonic mean filter:
mn
fˆ ( x, y ) =
1
∑
( s , t )∈S xy g ( s, t )
– For salt noise
21
Mean Filters
● Contraharmonic Mean Filter
– The image restored with a contraharmonic mean filter:
∑
( s , t )∈S xy
g ( s, t )Q +1
fˆ ( x, y ) =
∑
( s , t )∈S xy
g ( s , t )Q
23
Example: Mean Filters (Cont'd)
24
Example: Mean Filters (Cont'd)
25
Order-Statistics Filters
● Order Filter – based on a specific type of image statistics
called order statistics, sometimes known as Order-Statistics
Filter
● Order Statistics: Arranges all the pixels in sequential order
(smallest to largest), based on gray-level value
● The selection of the value to be replaced in the center pixel,
is determined by the statistical function used (min, max,
median, etc.)
26
Max & Min Filters
● Minimum Filter – select the smallest value within an ordered
window of pixel values, denoted as
fˆ ( x, y ) = min {g ( s, t )}
( s , t )∈S xy
27
Median Filters
● Median Filter – select the middle pixel value within an
ordered window of pixel values, denoted as
fˆ ( x, y ) = median{g ( s, t )}
( s ,t )∈S xy
28
Example: Median Filter
29
Example: Min & Max Filters
30
Midpoint Filter
● Midpoint Filter – select the average of the maximum and
minimum pixel values within the window, denoted as
ˆf ( x, y ) = 1 max {g ( s, t )} + min {g ( s, t )}
2 ( s , t )∈S xy ( s , t )∈S xy
● Useful for Gaussian and uniform noise
31
Alpha-trimmed Mean Filter
● Alpha-trimmed Mean Filter – select the average of the values
within the window, but with some of the endpoint-ranked
values excluded
● Suppose we delete d/2 lowest and d/2 highest gray level
values of g(s,t) in the neighborhood Sxy. Let gr(s,t) represent
the remaining mn-d pixels, the remaining pixels are
averaged: 1
fˆ ( x, y ) =
mn − d
∑
( s , t )∈S XY
g r ( s, t )
33
Adaptive Filters
● Filters that consider behavior changes based on statistical
characteristics of the image inside the filter region.
● Capable of superior performance, but causes increase in filter
complexity
● Textbook Extra Reading:
– Adaptive, local noise reduction filter
– Adaptive median filter
34
Adaptive Filters
● Filters that consider behavior changes based on statistical
characteristics of the image inside the filter region.
● Capable of superior performance, but causes increase in filter
complexity
● Textbook Extra Reading:
– Adaptive, local noise reduction filter
– Adaptive median filter
35
Periodic Noise
● Periodic Noise can be effectively filtered using frequency
domain techniques
● Periodic Noise: Concentrated bursts of energy in the Fourier
transform, at locations corresponding to the frequencies of
the periodic interference
● Approach: Use selective filters to isolate noise – Bandreject,
Bandpass, Notch filters
36
Bandreject Filters
38
Notch Filters
● Notch Filter – Rejects or passes frequencies in predefined
neighborhoods about a center frequency
● Due to symmetry of the Fourier Transform, notch filters must
appear in symmetric pairs about the origin in order to obtain
meaningful results
● Available as Notch Pass and Notch Reject (one a complement
of the other)
● Useful for removing periodic noise (horizontal, vertical,
diagonal periodic lines in images) which are concentrated on
one small spot in the frequency spectrum
39
Example: Notch (Reject) Filters
40
Example: Notch Filter
41
Restoration Process Model
Degraded image
g(x,y)
G(u,v)
Frequency
Degradation function Fourier H(u,v) Domain
h(x, y) Transform Filter
R(u,v)
N(u,v)
Noise model
n(x, y)
Inverse
Restored Image
fˆ ( x, y ) Fourier
Transform
42
Restoration Process
● Mathematical model:
G(u,v) = H(u,v)F(u,v) + N(u,v)
where:
G(u,v) = Fourier transform of degraded image
H(u,v) = Fourier transform of degradation function
F(u,v) = Fourier transform of original image
N(u,v) = Fourier transform of additive noise function
● To obtain the restored image:
fˆ ( x, y ) = ℑ−1 [ Fˆ (u, v)] = F −1 [ R(u, v)G (u, v)]
where:
fˆ ( x, y )
= the restored image, an approximation of
ℑ−1[] = the inverse Fourier transform
R(u,v) = the restoration (frequency domain) filter
43
Degradation Function?
● Question: How do we estimate the degradation
function?
– Image Observation
– Experimentation
– Mathematical Modeling
44
Inverse Filtering
● Uses the same model, with assumption of no noise.
Fourier transform of degraded image:
G (u , v) = H (u , v) F (u , v) + 0
● Fourier transform of the original image will be:
G (u , v) 1
F (u , v) = = G (u , v)
H (u, v) H (u , v)
G (u , v) H (u , v) F (u , v) N (u , v) N (u , v)
Fˆ (u , v) = = + = F (u , v) +
H (u , v) H (u , v) H (u , v) H (u , v)
46
Inverse Filtering: Some Problems
● If any points in H(u,v) are zero – division by zero
● Solution: Do not take zero-points of H(u,v) into account
● In presence of noise:
G (u, v) H (u , v) F (u, v) N (u, v) N (u, v)
Fˆ (u, v) = = + = F (u, v) +
H (u, v) H (u, v) H (u, v) H (u , v)
● As the value of H(u,v) becomes very small, the second term
becomes very large, and it overshadows the F(u,v)
● Limit the restoration to a specific radius about the origin in
the spectrum – the restoration cutoff frequency
47
Example: Inverse Filter
original image
48
Wiener Filter
● Also known as minimum mean-square error (MMSE) filter
● Attempt to model the error in the restored image through
the use of statistical characteristics of noise
● The average error is mathematically minimized, resulting in
the equation for Wiener filter:
2
H * (u , v) 1 H (u , v)
Rw (u , v) = =
H (u , v) + Snl ( u ,v ) H (u , v) H (u , v) + Snl (u ,v )
2 S ( u ,v ) 2 S (u ,v )
49
Example: Wiener Filter
Image blurred with
an 11 x 11 gaussian
convolution mask
50
Example: Motion Blur + Additive Noise
51
Other Frequency-Domain Restoration
Filters
● Constrained Least-Squares Filter
● Geometric Mean Filter – the most general form for frequency
domain restoration filters
52
Recommended Readings
rd
● Digital Image Processing (3 Edition), Gonzalez &
Woods,
● Chapter 4: Image Restoration
● 5.1 – 5.4, 5.6 – 5.10 (Week 7)
● Chapter 9: Morphological Image Processing
● 9.1 – 9.4 (Week 8)
53