Download - Enhancement A
-
7/27/2019 Enhancement A
1/66
Image Enhancement in the
Raul Queiroz Feitosa
Gilson A. O. P. Costa
-
7/27/2019 Enhancement A
2/66
Enhancement in the S atial
DomainContents
Introduction
Background
Histogram Processing
oca n ancement
Spatial Filters Smoothing Filters
Sharpening Filters
9/4/2013 Enhancement in the Spatial Domain 2
-
7/27/2019 Enhancement A
3/66
Introduction
Two Groups of Enhancement Techniques:
In the Spatial DomainBased on the direct manipulation of the pixels in an image.
In the Fre uenc Domain
Based on modifying the Fourier Transform of an image.
g a
imagedigital
image
Acquis ition Enhancement SegmentationFeature
extractionRecognition
Post-
processing
9/4/2013 Enhancement in the Spatial Domain 3
-
7/27/2019 Enhancement A
4/66
Back round
Notation:
(x,y) =T[f(x,y) ]
where: y, ,
g(x,y) is the output image, and (x,y)
a neighborhood of (x,y).
x
9/4/2013 Enhancement in the Spatial Domain 4
-
7/27/2019 Enhancement A
5/66
Back round
Two groups of approaches:
Point Processing: when the neighborhood is of size
11, it becomes agray level(orintensity ormapping)transformation function of the form:
s =T(r)
where rands denote the gray level atf(x,y) andg(x,y)at an oint x, .
Mask-Based: uses small arra s called mask whosecoefficients determine the nature of the process.
9/4/2013 Enhancement in the Spatial Domain 5
-
7/27/2019 Enhancement A
6/66
Point Processin
Image Negatives
l-s
raylev
e
T(r)
Output
-
9/4/2013 Enhancement in the Spatial Domain 6
-
7/27/2019 Enhancement A
7/66
Point Processin
Contrast Stretching
(r2,s2)
l-s
T(r)raylev
e
Output
1, 1
-
9/4/2013 Enhancement in the Spatial Domain 7
-
7/27/2019 Enhancement A
8/66
Point Processin
Power Law Transformation (Gamma Correction)
Correo Gama
where
l-s
=0.04
=0.1
=0.2
raylev
e=0.4
=0.67
=1
Output =1.5
=2.5
=5.0
-
=10
=25
9/4/2013 Enhancement in the Spatial Domain 8
-
7/27/2019 Enhancement A
9/66
Point Processin
Power Law Transformation (Gamma Correction)
=0.04 Correo Gama
where
=0.1
=0.2
=0.4l-s
=0.04
=0.1
=0.2
=0.67
=1raylev
e=0.4
=0.67
=1=1.5
=2.5
=5.0Output =1.5
=2.5
=5.0
=10
=25
-
=10
=25
9/4/2013 Enhancement in the Spatial Domain 9
-
7/27/2019 Enhancement A
10/66
Point Processin
Brightness Adjustment
10tosubjected, = sbrs
l-s
raylev
e
Output
9/4/2013 Enhancement in the Spatial Domain 10
npu gray eve - r
-
7/27/2019 Enhancement A
11/66
Histo ram Processin
Definition
The histo ram of a di ital ima e with ra levelsin the range [0,L-1] is a discrete function
where:
rkis the kth gray level,
nkis the number of pixels having gray level rk
9/4/2013 Enhancement in the Spatial Domain 11
-
7/27/2019 Enhancement A
12/66
Histo ram Processin
Example: dark image
9/4/2013 Enhancement in the Spatial Domain 12
-
7/27/2019 Enhancement A
13/66
Histo ram Processin
Example: bright image
9/4/2013 Enhancement in the Spatial Domain 13
-
7/27/2019 Enhancement A
14/66
Histo ram Processin
Example: image with low contrast
9/4/2013 Enhancement in the Spatial Domain 14
-
7/27/2019 Enhancement A
15/66
Histo ram Processin
Example: image with high contrast
9/4/2013 Enhancement in the Spatial Domain 15
-
7/27/2019 Enhancement A
16/66
Histo ram Processin
When the pixel counts are normalized and pixel
intensity (gray value) is considered a random variable,histogram is analogous to a PDF
w ere
rk
is the kth gray level,
nk s t e num er o p xe s av ng gray eve rk, an
n is the number of pixels in the image.
9/4/2013 Enhancement in the Spatial Domain 16
-
7/27/2019 Enhancement A
17/66
Histo ram Processin
Problem formulation: design a functions =T(r) that
has uniformly distributed gray levels.
9/4/2013 Enhancement in the Spatial Domain 17
-
7/27/2019 Enhancement A
18/66
Histo ram Processin
Letpr(r) andp
s(s) be the histogram respectively of the
Assume that rands represent the continuous gray levels
, .
Search for the transformation function T(r) satisfying
a) T(r) is a single-valued and monotonically increasing in [0,1]
b) 0 T(r) 1 for 0 r1c) the inverse function T-1(s) must also meet the above conditions
9/4/2013 Enhancement in the Spatial Domain 18
-
7/27/2019 Enhancement A
19/66
Histo ram Processin
From basic probability theory, ifpr(r) and T(r) are
ons er ng t e umu at ve str ut on as t e
transformation function:
9/4/2013 Enhancement in the Spatial Domain 19
-
7/27/2019 Enhancement A
20/66
Histo ram Processin
From basic probability theory, ifpr(r) and T(r) are
ca ng up t e trans ormat on unct on to t e actua gray
levels we have:
9/4/2013 Enhancement in the Spatial Domain 20
-
7/27/2019 Enhancement A
21/66
Histo ram Processin
9/4/2013 Enhancement in the Spatial Domain 21
-
7/27/2019 Enhancement A
22/66
Histo ram Processin
In the continuous case
In the discrete case
fork= 0,1,,L-1 where n is the total number of pixels
9/4/2013 Enhancement in the Spatial Domain 22
-
7/27/2019 Enhancement A
23/66
Histo ram Processin
rk nk p(rk) =nk/n
r0 = 0 790 0.191 .
r2 = 2 850 0.21
r3 = 3 656 0.16
r4 = 4 329 0.08
r5 = 5 245 0.06
r6 = 6 122 0.03
r7 = 7 81 0.02
= , n= x =
9/4/2013 Enhancement in the Spatial Domain 23
-
7/27/2019 Enhancement A
24/66
Histo ram Processin
s0 = 1.33 1 s4 = 6.23 6
s1 = 3.08 3 s5 = 6.65 7s2 = . s6 = . s3 = 5.67 6 s7 = 7.00 7
9/4/2013 Enhancement in the Spatial Domain 24
-
7/27/2019 Enhancement A
25/66
Histo ram Processin
A histogram is and approximation of a PDF and no new
histograms are rare.
equalization results in uniform histogram.
dynamic range.
.
9/4/2013 Enhancement in the Spatial Domain 25
-
7/27/2019 Enhancement A
26/66
Histo ram Processin
r
Equalization
9/4/2013 Enhancement in the Spatial Domain 26
-
7/27/2019 Enhancement A
27/66
Histo ram Processin
Problem formulation: design a transformation function
=
output image has a specified histogram.
9/4/2013 Enhancement in the Spatial Domain 27
-
7/27/2019 Enhancement A
28/66
Histo ram Processin
Letpr(r) andps(s) be the histogram of the input image and the
.
s
referenceinput
H(r)
s
G-1(z)
r un orm
pr
(r) ps(s)
s = T(r) = G-1[H(r)]
9/4/2013 Enhancement in the Spatial Domain 28
-
7/27/2019 Enhancement A
29/66
Histo ram Processin
Histogram Matching
image 1999
mage w e
histogram of image 2001
mage
9/4/2013 Enhancement in the Spatial Domain 29
-
7/27/2019 Enhancement A
30/66
Local Enhancement
The parameters of most functions presented so far are
computed based on the whole image. To enhance details in small image areas (example):
1. Select a neighborhood, whose center moves from pixel to pixel
over e mage.
2. At each position find the transformation function based on the
.
3. Apply the function to the pixel at the center of the neighborhood.
4. Move the center to the next ixel and re eat ste s 2 and 3 till allimage is covered.
9/4/2013 Enhancement in the Spatial Domain 30
-
7/27/2019 Enhancement A
31/66
Local Enhancement
Example: local histogram equalization
Original Image After Global Equalization After Local Equalization
9/4/2013 Enhancement in the Spatial Domain 31
-
7/27/2019 Enhancement A
32/66
Re ion of Interest Processin
(ROI) Logical matrices called masks can be used to define regions
in an image (roi) where an operator is to be applied. Example: blurring uninteresting regions
input image mask (roi) output image
9/4/2013 Enhancement in the Spatial Domain 32
-
7/27/2019 Enhancement A
33/66
Local Enhancement
Global statistics: the nth moment about the mean
where( ) ( ) ( )ii
n
in rpmrr
=
=0
( )
=
=0i
ii rprm
9/4/2013 Enhancement in the Spatial Domain 33
-
7/27/2019 Enhancement A
34/66
Local Enhancement
Local statistics: let (x,y) be the pixel coordinates and Sxy a
nei hborhood with a iven size around x .
average gray level around Sxy= ttS rprm
contrast around S y= tStS rpmr22
( ) xySts,
xySts ),(
9/4/2013 Enhancement in the Spatial Domain 34
-
7/27/2019 Enhancement A
35/66
Local Enhancement
Example: enhance SEM image (tungsten filament
Enhance only dark areas
,
but not constant/uniform areas
9/4/2013 Enhancement in the Spatial Domain 35
-
7/27/2019 Enhancement A
36/66
Local Enhancement
Example: enhance SEM image (tungsten filament
Enhance only dark areas:
GS Mkm xy 0
MG is the global mean
xySm is the local mean
k0 is positive, less than one
Sxy is 3x3
9/4/2013 Enhancement in the Spatial Domain 36
-
7/27/2019 Enhancement A
37/66
Local Enhancement
Example: enhance SEM image (tungsten filament
Enhance low contrast areas:
GS Dkxy 2
xyS
DG is the global standard dev
is the local standard dev
k2 is positive, less than one
Sxy is 3x3
9/4/2013 Enhancement in the Spatial Domain 37
-
7/27/2019 Enhancement A
38/66
Local Enhancement
Example: enhance SEM image (tungsten filament
Enhance non uniform areas:
xySGDk 1
xyS
DG is the global standard dev
is the local standard dev
k1 is positive, less than k2Sxy is 3x3
9/4/2013 Enhancement in the Spatial Domain 38
-
7/27/2019 Enhancement A
39/66
Local Enhancement
Example: enhance SEM image (tungsten filament
Enhance only dark areas
,
but not constant/uniform areas
9/4/2013 Enhancement in the Spatial Domain 39
-
7/27/2019 Enhancement A
40/66
Local Enhancement
Example: enhance SEM image (tungsten filament
Enhance only dark areas
,
but not constant/uniform areas
E=4;k0=0.4;k1=0.02;k2=0.4}
9/4/2013 Enhancement in the Spatial Domain 40
-
7/27/2019 Enhancement A
41/66
-
7/27/2019 Enhancement A
42/66
Smoothin Filters
Aplications:
Removal of small details prior to large object extraction.
Noise reduction. Side Effect
It blurs the image.
moo ng mas s
All elements are non-negative, and
sum u to 1.
Masks 1 11
1 111/9
1 17
7 7541/881 11 1 17
9/4/2013 Enhancement in the Spatial Domain 42
-
7/27/2019 Enhancement A
43/66
Smoothin Filters
Examples of applying an averaging filter:
original 33 55
9/4/2013 Enhancement in the Spatial Domain 43
-
7/27/2019 Enhancement A
44/66
Smoothin Filters
Order Statistic Filters
are non-linear s atial filters whose res onse isbased on ordering (ranking) the pixels contained
,
then replacing the value of the center pixel with.
9/4/2013 Enhancement in the Spatial Domain 44
S hi Fil
-
7/27/2019 Enhancement A
45/66
Smoothin Filters
Order Statistic Filters:
Median Filterreplaces the value of a pixel by the median of the gray
levels in its nei hborhood
A median of a set of values is such that half of thevalues in the set is lower than and hal o the values
in the set is greater than or equal to .
Percentile Filterreplaces the value of a pixel by n-th percentile of the
ra levels in its nei hborhood.
9/4/2013 Enhancement in the Spatial Domain 45
S hi Fil
-
7/27/2019 Enhancement A
46/66
Smoothin Filters
Original image Image with salt-and-pepper noise
9/4/2013 Enhancement in the Spatial Domain 46
Ad i Fil
-
7/27/2019 Enhancement A
47/66
Ada tive Filter
The out ut x of a ada tive filter de ends on
the statistical characteristics of the input image
xycentered at (x,y).
variance of the noise (?)
[ ]Lmyxfyxfyxg = ),(),(),( 22
variance in Sxy mean in S
9/4/2013 Enhancement in the Spatial Domain 47
Ad i Fil
-
7/27/2019 Enhancement A
48/66
Ada tive Filter
is zero: no noise, nothing should change2
is high relative to : no change, probably an edge
is similar to : reduce noise b avera in2
2
2
2
L
is less than : must avoid/treat negative output
L
2
2
L
variance of the noise (?)
[ ]Lmyxfyxfyxg = ),(),(),( 22
variance in Sxy mean in S
9/4/2013 Enhancement in the Spatial Domain 48
Ad ti Filt
-
7/27/2019 Enhancement A
49/66
Ada tive Filter
Exam le
image corrupted by
noise of zero mean
and variance 1000
noise reduction filter
mean filter
9/4/2013 Enhancement in the Spatial Domain 49
Sh i Filt
-
7/27/2019 Enhancement A
50/66
Shar enin Filters
A lications Highlight of fine details.
acquisition method.
Side Effect
Emphasizes the noise.
9/4/2013 Enhancement in the Spatial Domain 50
Sh r nin Filt r
-
7/27/2019 Enhancement A
51/66
Shar enin Filters
Accomplished by spatial differentiation:
Approximation for the 1 derivative
( ) ( ) ( )( ) ( )xfxf
x
xfxxf
x
xf+
+=
1lim
( ) ( ) ( )[ ] ( ) ( )[ ]2 + xxfxfxfxxfxf
( ) ( ) ( )121
22
++
xfxfxf
xx ox
9/4/2013 Enhancement in the Spatial Domain 51
Shar enin Filters
-
7/27/2019 Enhancement A
52/66
Shar enin Filters
9/4/2013 Enhancement in the Spatial Domain 52
Ed e Detection
-
7/27/2019 Enhancement A
53/66
Ed e Detection-1 0 1
-1 0 1
-1 0 1 3
4
2
1
0
4
pixel values of
horizontal line
Prewitt mask
2
1
0
3
first derivative-1
-2
-3
-4
2
1
3
4
-1
-2
-3
0 second derivative
9/4/2013 Image Segmentation 53
-4
Shar enin Filters
-
7/27/2019 Enhancement A
54/66
Shar enin Filters
From the previous slide we may conclude:
1. First-order derivatives generally produce thickeredges in the image,
2. Second-order derivatives have a stron er res onse at
the fine details,3. First-order derivatives enerall have a stron er
response to a gray-level step, and
4. Second-order derivatives have a double-res onse atstep changes in gray level.
9/4/2013 Enhancement in the Spatial Domain 54
Shar enin Filters
-
7/27/2019 Enhancement A
55/66
Shar enin Filters
Laplacian Filter22
2 ff 22 yx
( ) ( ) ( )yxfyxfyxfxf
,1,2,12
2
++
( ) ( ) ( )1,,21,2
2
++
yxfyxfyxf
y
f
we o ta n
( )[ ( ) ( ) ( ) ( ) ]yxfyxfyxfyxfyxff ,41,1,,1,12 +++++=
9/4/2013 Enhancement in the Spatial Domain 55
Shar enin Filters
-
7/27/2019 Enhancement A
56/66
Shar enin Filters
Laplacian Filter: example of masks
1 -4 1 4 -20 41 -8 1
9/4/2013 Enhancement in the Spatial Domain 56
Shar enin Filters
-
7/27/2019 Enhancement A
57/66
Shar enin Filters
Laplacian based filter : an example
if center coefficient 0( ) ( )
+=
yxfCyxfyxfs
,,,,,
2
)(xf
e s arpen ng e ect n -
)(2 xf
)()( 2 xfxf s aper
transition
9/4/2013 Enhancement in the Spatial Domain 57
Shar enin Filters
-
7/27/2019 Enhancement A
58/66
Shar enin Filters
Laplacian based filter: a mask example
0 00 1 00 -C 00
=1 000 00
-4 11
1 00
4C+1 - C- C
- C 00
-C
9/4/2013 Enhancement in the Spatial Domain 58
Shar enin Filters
-
7/27/2019 Enhancement A
59/66
Shar enin Filters
Imagem Original C=4C=2
C=10C=6 C=8
9/4/2013 Enhancement in the Spatial Domain 59
Shar enin Filters
-
7/27/2019 Enhancement A
60/66
Shar enin Filters
Unsharp masking
Subtracts a blurred version of an image from the imageitself
( ) ( ) ( )yxfyxfyxfum ,,, =
Example of a mask output of a smoothing filter
0 00
--
-1/9 -1/9-1/91 11
=
0 00 -1/9 -1/9-1/9
-
1 11
9/4/2013 Enhancement in the Spatial Domain 60
Shar enin Filters
-
7/27/2019 Enhancement A
61/66
Shar enin Filters
Filter High-Boost
It is a generalization of unsharp masking, given by
( ) ( ) ( ) 1for,,, = AyxfyxAfyxfhb
output of a sharpening filter
,,, = shb
If we elect to use the Laplacian filter for sharpening
if center coefficient 0( )
( ) ( )
+=
yxfyxAf
yxyxyxfhb
,,
,,,
2
9/4/2013 Enhancement in the Spatial Domain 61
Shar enin Filters
-
7/27/2019 Enhancement A
62/66
Shar enin Filters
Filter High-Boost: example
or g na
imagelaplacian
high-boost
with A=1
high-boost
with A=1.7
9/4/2013 Enhancement in the Spatial Domain 62
Shar enin Filters
-
7/27/2019 Enhancement A
63/66
e e s
The Gradient
= xf
y
2/122
==
ff
x
9/4/2013 Enhancement in the Spatial Domain 63
-
7/27/2019 Enhancement A
64/66
Shar enin Filters
-
7/27/2019 Enhancement A
65/66
Gradient: example
original image |Gy| (sobel)|Gx| (sobel)
9/4/2013 Enhancement in the Spatial Domain 65
Next To ic
-
7/27/2019 Enhancement A
66/66
Ima e Enhancement
9/4/2013 Enhancement in the Spatial Domain 66