2. Background
Spatial domain process
where is the input image,
is the processed image, and T is an
operator on f, defined over some
neighborhood of
)]
,
(
[
)
,
( y
x
f
T
y
x
g
)
,
( y
x
f )
,
( y
x
g
)
,
( y
x
4. Gray-level transformation function
where r is the gray level of and
s is the gray level of at any
point
)
(r
T
s
)
,
( y
x
f
)
,
( y
x
g
)
,
( y
x
9. Log transformations
Compress the dynamic range of images
with large variations in pixel values
)
1
log( r
c
s
10. From the range 0- to the range
0 to 6.2
6
10
5
.
1
11. Power-law transformations
or
maps a narrow range of dark
input values into a wider range of
output values, while maps a
narrow range of bright input values into
a wider range of output values
: gamma, gamma correction
cr
s
)
(
r
c
s
1
1
25. Histogram Processing
Histogram
where is the kth gray level and is
the number of pixels in the image
having gray level
Normalized histogram
k
k n
r
h
)
(
k
r k
n
k
r
n
n
r
p k
k /
)
(
29. Probability density functions (PDF)
ds
dr
r
p
s
p r
s )
(
)
(
r
r dw
w
p
L
r
T
s
0
)
(
)
1
(
)
(
)
(
)
1
(
)
(
)
1
(
)
(
0
r
p
L
dw
w
p
dr
d
L
dr
r
dT
dr
ds
r
r
r
1
1
)
(
L
s
ps
37. Histogram matching (specification)
r
r dw
w
p
L
r
T
s
0
)
(
)
1
(
)
(
z
z s
dt
t
p
L
z
G
0
)
(
)
1
(
)
(
)]
(
[
)
( 1
1
r
T
G
s
G
z
)
(z
pz
is the desired PDF
40. Histogram matching
Obtain the histogram of the given
image, T(r)
Precompute a mapped level for each
level
Obtain the transformation function G
from the given
Precompute for each value of
Map to its corresponding level ;
then map level into the final level
)
(z
pz
k
s
k
r
k
z k
s
k
r k
s
k
s k
z
41.
42.
43.
44.
45.
46.
47.
48. Local enhancement
Histogram using a local neighborhood,
for example 7*7 neighborhood
50. Use of histogram statistics for
image enhancement
denotes a discrete random variable
denotes the normalized
histogram component corresponding to
the ith value of
Mean
)
( i
r
p
r
r
1
0
)
(
L
i
i
i r
p
r
m
51. The nth moment
The second moment
1
0
)
(
)
(
)
(
L
i
i
n
i
n r
p
m
r
r
1
0
2
2 )
(
)
(
)
(
L
i
i
i r
p
m
r
r
52. Global enhancement: The global mean
and variance are measured over an
entire image
Local enhancement: The local mean
and variance are used as the basis for
making changes
53. is the gray level at coordinates
(s,t) in the neighborhood
is the neighborhood normalized
histogram component
mean:
local variance
t
s
r ,
)
( ,t
s
r
p
xy
xy
S
t
s
t
s
t
s
S r
p
r
m
)
,
(
,
, )
(
xy
xy
xy
S
t
s
t
s
S
t
s
S r
p
m
r
)
,
(
,
2
,
2
)
(
]
[
54. are specified parameters
is the global mean
is the global standard deviation
Mapping
2
1
0 ,
,
, k
k
k
E
G
M
G
D
otherwise
)
,
(
and
if
)
,
(
)
,
( 2
1
0
y
x
f
D
k
D
k
M
k
m
y
x
f
E
y
x
g G
S
G
G
S
xy
xy
55.
56.
57.
58. Fundamentals of Spatial Filtering
The Mechanics of Spatial Filtering
)
1
,
1
(
)
1
,
1
(
)
,
1
(
)
0
,
1
(
)
,
(
)
0
,
0
(
)
,
1
(
)
0
,
1
(
)
1
,
1
(
)
1
,
1
(
y
x
f
w
y
x
f
w
y
x
f
w
y
x
f
w
y
x
f
w
R
59. Image size:
Mask size:
and
and
N
M
n
m
a
a
s
b
b
t
t
y
s
x
f
t
s
w
y
x
g )
,
(
)
,
(
)
,
(
2
/
)
1
(
m
a 2
/
)
1
(
n
b
1
,...,
2
,
1
,
0
M
x 1
,...,
2
,
1
,
0
N
y
70. Order-statistic filters
median filter: Replace the value of a
pixel by the median of the gray levels
in the neighborhood of that pixel
Noise-reduction
71.
72. Sharpening Spatial Filters
Foundation
The first-order derivative
The second-order derivative
)
(
)
1
( x
f
x
f
x
f
)
(
2
)
1
(
)
1
(
2
2
x
f
x
f
x
f
x
f
73.
74.
75. Use of second derivatives for
enhancement-The Laplacian
Development of the method
)
,
(
2
)
,
1
(
)
,
1
(
2
2
y
x
f
y
x
f
y
x
f
x
f
2
2
2
2
2
y
f
x
f
f
)
,
(
2
)
1
,
(
)
1
,
(
2
2
y
x
f
y
x
f
y
x
f
y
f
81. Unsharp masking and highboost
filtering
Unsharp masking
Substract a blurred version of an image
from the image itself
: The image, : The
blurred image
)
,
(
)
,
(
)
,
( y
x
f
y
x
f
y
x
gmask
)
,
( y
x
f )
,
( y
x
f
)
,
(
*
)
,
(
)
,
( y
x
g
k
y
x
f
y
x
g mask
1
,
k
85. Using first-order derivatives for
(nonlinear) image sharpening—The
gradient
y
f
x
f
G
G
y
x
f
86. The magnitude is rotation invariant
(isotropic)
2
1
2
2
2
1
2
2
)
(
mag
y
f
x
f
G
G
f y
x
f
y
x G
G
f
87. Computing using cross differences,
Roberts cross-gradient operators
)
( 5
9 z
z
Gx
)
( 6
8 z
z
Gy
and
2
1
2
6
8
2
5
9 )
(
)
( z
z
z
z
f
6
8
5
9 z
z
z
z
f
88. Sobel operators
A weight value of 2 is to achieve some
smoothing by giving more importance to
the center point
)
2
(
)
2
(
)
2
(
)
2
(
7
4
1
9
6
3
3
2
1
9
8
7
z
z
z
z
z
z
z
z
z
z
z
z
f
89.
90.
91. Combining Spatial Enhancement
Methods
An example
Laplacian to highlight fine detail
Gradient to enhance prominent edges
Smoothed version of the gradient
image used to mask the Laplacian
image
Increase the dynamic range of the gray
levels by using a gray-level
transformation