Documente Academic
Documente Profesional
Documente Cultură
Processing
by
Dr. S. D. Ruikar
Associate Professor,
Department of Electronics Engineering
Walchand College of Engineering,
Sangli
MODULE 2: Image
Enhancement and Restoration
Syllabus
Spatial Domain: Gray level transformation,
Histogram processing , Arithmetic / Logic
operations, Spatial filtering, smoothing filters,
sharpening filters
Frequency Domain: Fourier transforms,
smoothing frequency domain filters, sharpening
filters, Homographic filtering
Image degradation model, Noise modeling,
Mean filter, Order statistics filter, Inverse filter,
Weiner filter, Blind image restoration
IMAGE QUALITY AND NEED FOR
IMAGE ENHANCEMENT
Enhancement Vs restoration
Spatial Domain vs. Transform Domain
Spatial domain
image plane itself, directly process the intensity values of
the image plane
Transform domain
process the transform coefficients, not directly process
the intensity values of the image plane
Spatial Domain Process
g ( x, y ) T [ f ( x, y )])
f ( x, y ) : input image
g ( x, y ) : output image
T : an operator on f defined over
a neighborhood of point ( x, y )
Spatial Domain Process
Spatial Domain Process
Intensity transformation function
s T (r )
Some Basic Intensity Transformation
Functions
Image Negatives
Image negatives
s L 1 r
Example: Image Negatives
Small
lesion
Log Transformations
Log Transformations
s c log(1 r )
Example: Log Transformations
Power-Law (Gamma) Transformations
s cr
Example: Gamma Transformations
Example: Gamma Transformations
Cathode ray tube
(CRT) devices have an
intensity-to-voltage
response that is a
power function, with
exponents varying
from approximately
1.8 to 2.5
sr 1/ 2.5
Example: Gamma Transformations
18
Example: Gamma Transformations
19
Piecewise-Linear Transformations
Contrast Stretching
Expands the range of intensity levels in an image so that it spans
the full intensity range of the recording medium or display device.
Intensity-level Slicing
Highlighting a specific range of intensities in an image often is of
interest.
Highlight the major
blood vessels and
study the shape of the
flow of the contrast
medium (to detect
blockages, etc.)
Histogram Equalization
Histogram Matching
Histogram h(rk ) nk
rk is the k th intensity value
nk is the number of pixels in the image with intensity rk
nk
Normalized histogram p(rk )
MN
nk : the number of pixels in the image of
size M N with intensity rk
Histogram Equalization
The intensity levels in an image may be viewed as
random variables in the interval [0, L-1].
Let pr (r ) and ps ( s) denote the probability density
function (PDF) of random variables r and s.
Histogram Equalization
s T (r ) 0 r L 1
s T (r ) 0 r L 1
ps (s)ds pr (r )dr
Example
2r
, for 0 r L-1
pr (r ) ( L 1) 2
0,
otherwise
0
s0 T (r0 ) 7 pr (rj ) 7 0.19 1.33 1
j 0
1
s1 T (r1 ) 7 pr (rj ) 7 (0.19 0.25) 3.08 3
j 0
s2 4.55 5 s3 5.67 6
s4 6.23 6 s5 6.65 7
s6 6.86 7 s7 7.00 7
Example: Histogram Equalization
Question
Is histogram equalization always good?
No
Histogram Matching
Histogram matching (histogram specification)
generate a processed image that has a specified histogram
Let pr (r ) and pz ( z ) denote the continous probability
density functions of the variables r and z. pz ( z ) is the
specified probability density function.
Let s be the random variable with the probability
r
s T ( r ) ( L 1) pr ( w) dw
0
1
z G ( s) G 1
T (r)
Histogram Matching: Procedure
Obtain pr(r) from the input image and then obtain the values of s
r
s ( L 1) pr (w)dw
0
Use the specified PDF and obtain the transformation function G(z)
z
G( z ) ( L 1) pz (t )dt s
0
Mapping from s to z
z G 1 (s)
Example: Histogram Matching
Example: Histogram Matching
Example: Histogram Matching
Local Histogram Processing
Variance L 1 M 1 N 1
u2 (r ) (ri
1
m) p(ri ) f ( x, y) m
2 2 2
i 0
MN x 0 y 0
Using Histogram Statistics for Image
Enhancement
Local variance
L 1
2
sxy (ri msxy ) psxy (ri )
2
i 0
Using Histogram Statistics for Image
Enhancement: Example
a b
g ( x, y ) w(s, t ) f ( x s, y t )
s a t b
Spatial Filtering
Spatial Correlation
a b
w( x, y ) f ( x, y ) w(s, t ) f ( x s, y t )
s a t b
Spatial Convolution
a b
w( x, y ) f ( x, y ) w(s, t ) f ( x s, y t )
s a t b
Smoothing Spatial Filters
w(s, t ) f ( x s, y t )
g ( x, y ) s a t b
a b
w(s, t )
s a t b
where m 2a 1, n 2b 1.
Two Smoothing Averaging Filter Masks
Example: Gross Representation of Objects
Order-statistic (Nonlinear) Filters
Nonlinear
Foundation
Laplacian Operator
f
f ( x 1) f ( x)
x
2 f
f ( x 1) f ( x 1) 2 f ( x)
x 2
Sharpening Spatial Filters: Laplace Operator
2
f 2
f
f 2 2
2
x y
2 f
f ( x 1, y ) f ( x 1, y ) 2 f ( x, y )
x 2
2 f
f ( x, y 1) f ( x, y 1) 2 f ( x, y )
y 2
2 f f ( x 1, y ) f ( x 1, y ) f ( x, y 1) f ( x, y 1)
- 4 f ( x, y )
Sharpening Spatial Filters: Laplace Operator
Sharpening Spatial Filters: Laplace Operator
g ( x, y ) f ( x, y ) c 2 f ( x, y )
where,
f ( x, y ) is input image,
g ( x, y ) is sharpenend images,
c -1 if 2 f ( x, y ) corresponding to Fig. 3.37(a) or (b)
and c 1 if either of the other two filters is used.
Unsharp Masking and Highboost Filtering
Unsharp masking
Sharpen images consists of subtracting an unsharp (smoothed)
version of an image from the original image
e.g., printing and publishing industry
Steps
1. Blur the original image
M ( x, y ) | g x | | g y |
z1 z2 z3
M ( x, y) | z8 z5 | | z6 z5 |
z4 z5 z6
z7 z8 z9
Image Sharpening based on First-Order Derivatives
Sobel Operators
M ( x, y) | ( z7 2 z8 z9 ) ( z1 2 z2 z3 ) |
z1 z2 z3 | ( z3 2 z6 z9 ) ( z1 2 z4 z7 ) |
z4 z5 z6
z7 z8 z9
Image Sharpening based on First-Order Derivatives
Example
Example:
Combining
Spatial
Enhancement
Methods
Goal:
Enhance the
image by
sharpening it
and by bringing
out more of the
skeletal detail
Example:
Combining
Spatial
Enhancement
Methods
Goal:
Enhance the
image by
sharpening it
and by bringing
out more of the
skeletal detail
Example
Spatial Filtering Techniques
Image Smoothing Filter
Variable Weights
Gaussian Filters
Directional Smoothing
Conservative smoothing
Sharpening Filters
High-Boost Filter
Frequency Domain Filtering
Image Smoothing Frequency
Domain 1D.
2D Case
Butterworth Filter
Band-Pass filter
Homomorphic Filtering
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
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
Image Degradation model
Modeling Process
Image Degradations
An Image Degradation Model
Two types of degradation
Additive noise
Spatial domain restoration (denoising) techniques are preferred
Image blur
Frequency domain methods are preferred
We model the degradation process by a degradation function h(x,y),
an additive noise term, (x,y), as g(x,y)=h(x,y)*f(x,y)+ (x,y)
f(x,y) is the (input) image free from any degradation
g(x,y) is the degraded image
* is the convolution operator
The goal is to obtain an estimate of f(x,y) according to the knowledge
about the degradation function h and the additive noise
In frequency domain: G(u,v)=H(u,v)F(u,v)+N(u,v)
Three cases are considered in this Chapter
g(x,y)=f(x,y)+ (x,y)
g(x,y)=h(x,y)*f(x,y)
g(x,y)=h(x,y)*f(x,y)+ (x,y)
A Model of the Image
Degradation/Restoration Process
Noise Model
We first consider the degradation due to noise only
h is an impulse for now ( H is a constant)
White noise
Autocorrelation function is an impulse function multiplied by a
constant
N 1 M 1
a( x, y ) ( s, t ) ( s x, t y ) N 0 ( x, y )
t 0 s 0
It means there is no correlation between any two pixels in the noise
image
There is no way to predict the next noise value
The spectrum of the autocorrelation function is a constant (white)
Gaussian Noise
Noise (image) can be classified according the
distribution of the values of pixels (of the noise image) or
its (normalized) histogram
Gaussian noise is characterized by two parameters,
(mean) and 2 (variance), by
1 ( z ) 2 / 2 2
p( z ) e
2
70% values of z fall in the range [(-),(+)]
95% values of z fall in the range [(-2),(+2)]
Gaussian Noise
Noise Modeling
Other Noise Models
Rayleigh noise
2
( z a )e ( z a ) / b for z a
2
p( z ) b
0 for z a
The mean and variance of this
density are given by
b( 4 )
a b / 4 and 2
4
a and b can be obtained through
mean and variance
Other Noise Models
Erlang (Gamma) noise
a b z b 1 az
e for z 0
p( z ) (b 1)!
0 for z 0
The mean and variance of this
density are given by
b
b / a and 2
a2
a and b can be obtained
through mean and variance
Other Noise Models
Exponential noise
ae az for z 0
p( z )
0 for z 0
The mean and variance
of this density are given
by 1
1 / a and
2
a2
Special case pf Erlang
PDF with b=1
Other Noise Models
Uniform noise
1
if a z b
p( z ) b a
0 otherwise
The mean and variance
of this density are given
by
(b a ) 2
(a b) / 2 and 2
12
Other Noise Models
Impulse (salt-and-pepper)
noise Pa for z a
p( z ) P for z b
b
0 otherwise
If either Pa or Pb is zero,
the impulse noise is called
unipolar
a and b usually are
extreme values because
impulse corruption is
usually large compared
with the strength of the
image signal
It is the only type of noise
that can be distinguished
from others visually
A Sample Image
Effect of Adding Noise to Sample Image
Effect of Adding Noise to Sample Image
Periodic Noise
Arises typically from electrical
or electromechanical
interference during image
acquisition
It can be observed by visual
inspection both in the spatial
domain and frequency
domain
The only spatially dependent
noise will be considered
Periodic Noise
Estimation of Noise Parameters
Periodic noise
Parameters can be estimated by inspection of the
spectrum
Noise PDFs
From sensor specifications
If imaging sensors are available, capture a set of
images of plain environments
If only noisy images are available, parameters of
the PDF involved can be estimated from small
patches of constant regions of the noisy images
Blur
Estimation of Noise Parameters
0 2 1 ( z ( xi , yi ) ) 2 12 1 i i
( z ( x , y )
) 2
N S ( x , y )S
i i
NS ( xi , yi )S
2 1
2 i i
(
N S 1 ( x , y )S
z ( x , y )
) 2
i i
Restoration in the presence of
Noise
Order Statistic Filter
Inverse Filter
Degraded
Inverse Filtering Image
Filtering with H
cut off outside a
radius of 40
Full inverse
Filtering
Filtering with H
cut off outside a
radius of 85
Wiener Filter
Xn(u,v) = W(u,v).Y(u,v)
= E {(f f)2 }
Obtained from [1]
H * (u, v)
G (u, v)
H (u, v) S (u, v) / S f (u, v)
2
1 H (u, v)
2
G (u, v)
H (u, v) H (u, v) S (u, v) / S f (u, v)
2
Constant Unknown
1 H ( u , v )
2
F (u, v) G(u, v)
H (u, v) H (u, v) K
2
Reduce
d noise
variance