Upload
claire-franklin
View
250
Download
1
Tags:
Embed Size (px)
Citation preview
Digital Image Processing
Chapter 3: Intensity Transformations and Spatial Filtering
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
)],([),( yxfTyxg ),( yxf ),( yxg
),( yx
Neighborhood about a point
Gray-level transformation function
where r is the gray level of and s is the gray level of at any point
)(rTs ),( yxf
),( yxg),( yx
Contrast enhancement For example, a thresholding function
Masks (filters, kernels, templates, windows) A small 2-D array in which the values of
the mask coefficients determine the nature of the process
Some Basic Gray Level Transformations
Image negatives
Enhance white or gray details
rLs 1
Log transformations
Compress the dynamic range of images with large variations in pixel values
)1log( rcs
From the range 0- to the range 0 to 6.2
6105.1
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
crs )( rcs
1
1
Monitor, 5.2
Piecewise-linear transformation functions The form of piecewise functions can be
arbitrarily complex
Contrast stretching
Gray-level slicing
Bit-plane slicing
Histogram Processing
Histogram
where is the kth gray level and is the number of pixels in the image having gray level
Normalized histogram
kk nrh )(
kr kn
kr
nnrp kk /)(
Histogram equalization10 ),( rrTs
10 ),(1 ssTr
Probability density functions (PDF)
ds
drrpsp rs )()(
r
r dwwpLrTs0
)()1()(
)()1()()1()(
0rpLdwwp
dr
dL
dr
rdT
dr
dsr
r
r
1
1)(
L
sps
1,...,2,1,0 ,)1()()1()(00
Lkn
nLrpLrTs
k
j
jk
jjrkk
Histogram matching (specification)
r
r dwwpLrTs0
)()1()(
z
z sdttpLzG0
)()1()(
)]([)( 11 rTGsGz
)(zpz is the desired PDF
1,...,2,1,0 ,)1()()1()(00
Lkn
nLrpLrTs
k
j
jk
jjrkk
1,...,2,1,0 ,)()1()(0
LkszpLzGv k
k
iizkk
1,...,2,1,0 )],([1 LkrTGz kk
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
)(zpz
kskr
kz kskr ks
ks kz
Local enhancement Histogram using a local neighborhood,
for example 7*7 neighborhood
Histogram using a local 3*3 neighborhood
Use of histogram statistics for image enhancement denotes a discrete random
variable denotes the normalized histogram
component corresponding to the ith value of
Mean
)( irp
r
r
1
0
)(L
iii rprm
The nth moment
The second moment
1
0
)()()(L
ii
nin rpmrr
1
0
22 )()()(
L
iii rpmrr
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
is the gray level at coordinates (s,t) in the neighborhood
is the neighborhood normalized histogram component
mean:
local variance
tsr ,
)( ,tsrp
xy
xySts
tstsS rprm),(
,, )(
xy
xyxySts
tsStsS rpmr),(
,2
,2 )(][
are specified parameters is the global mean is the global standard deviation Mapping
210 ,,, kkkEGMGD
otherwise),(
and
if),(
),(21
0
yxf
DkDk
MkmyxfE
yxgGSG
GS
xy
xy
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(
yxfw
yxfw
yxfw
yxfw
yxfwR
Image size: Mask size:
and and
NM nm
a
as
b
bt
tysxftswyxg ),(),(),(
2/)1( ma 2/)1( nb1,...,2,1,0 Mx 1,...,2,1,0 Ny
Spatial Correlation and Convolution
9
1
992211
...
iii zw
zwzwzwR
Vector Representation of Linear Filtering
Smoothing Spatial Filters
Smoothing Linear Filters Noise reduction Smoothing of false contours Reduction of irrelevant detail
9
19
1
iizR
a
as
b
bt
a
as
b
bt
tsw
tysxftswyxg
),(
),(),(),(
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
Sharpening Spatial Filters
Foundation The first-order derivative
The second-order derivative
)()1( xfxfx
f
)(2)1()1(2
2
xfxfxfx
f
Use of second derivatives for enhancement-The Laplacian Development of the method
),(2),1(),1(2
2
yxfyxfyxfx
f
2
2
2
22
y
f
x
ff
),(2)1,()1,(2
2
yxfyxfyxfy
f
),(4)]1,(
)1,(),1(),1([2
yxfyxf
yxfyxfyxff
positive is
mask Laplacian theof
tcoefficiencenter theif
),(),(
negative is
mask Laplacian theof
t coefficiencenter theif
),(),(
),(
2
2
yxfyxf
yxfyxf
yxg
Simplifications
)]1,(
)1,(),1(),1([),(5
),(4)]1,(
)1,(),1(),1([),(),(
yxf
yxfyxfyxfyxf
yxfyxf
yxfyxfyxfyxfyxg
Unsharp masking and highboost filtering Unsharp masking
Substract a blurred version of an image from the image itself
: The image, : The blurred image
),(),(),( yxfyxfyxgmask
),( yxf ),( yxf
),(*),(),( yxgkyxfyxg mask 1, k
High-boost filtering
),(*),(),( yxgkyxfyxg mask 1, k
Using first-order derivatives for (nonlinear) image sharpening—The gradient
y
fx
f
G
G
y
xf
The magnitude is rotation invariant (isotropic)
2
122
21
22
)(mag
y
f
x
f
GGf yxf
yx GGf
Computing using cross differences, Roberts cross-gradient operators
)( 59 zzGx )( 68 zzGy and
21
268
259 )()( zzzzf
6859 zzzzf
Sobel operators A weight value of 2 is to achieve some
smoothing by giving more importance to the center point
)2()2(
)2()2(
741963
321987
zzzzzz
zzzzzzf
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