Chapter 3 - Image Enhancement
Chapter 3 - Image Enhancement
2
Chapter 3:
IMAGE ENHANCEMENT
IN THE SPATIAL DOMAIN
4
Chapter 3
3.1 BACKGROUND
5
3.1. BACKGROUND
6
3.1. BACKGROUND
For any location (x, y), output image g(x, y) is equal to the
result of applying T to the neighborhood of (x, y) in f.
8
3.1. BACKGROUND
s T (r )
Where s and r denote, respectively, the intensity of g and f at
any point (x, y).
9
3.1. BACKGROUND
EXAMPLE
10
3.1. BACKGROUND
EXAMPLE
11
Chapter 3
12
3.2. SOME BASIC INTENSITY
TRANSFORMATION FUNCTIONS
16
3.2. SOME BASIC INTENSITY
TRANSFORMATION FUNCTIONS
3.2.3. POWER-LAW (GAMMA) TRANSFORMATIONS
17
3.2. SOME BASIC INTENSITY
TRANSFORMATION FUNCTIONS
3.2.3. POWER-LAW (GAMMA) TRANSFORMATIONS
Plots of the
gamma equation
for various values
of γ (c = 1 in all
cases). Each
curve was scaled
independently so
that all curves
would fit in the
same graph.
18
3.2. SOME BASIC INTENSITY
TRANSFORMATION FUNCTIONS
3.2.3. POWER-LAW (GAMMA) TRANSFORMATIONS
(a)Intensity ramp
image.
(b) Image
as viewed on a
simulated
monitor with a
gamma of 2.5.
(c) Gamma-
corrected image.
(d) Corrected
image as viewed
on the same
monitor.
19
3.2. SOME BASIC INTENSITY
TRANSFORMATION FUNCTIONS
3.2.3. POWER-LAW (GAMMA) TRANSFORMATIONS
20
3.2. SOME BASIC INTENSITY
TRANSFORMATION FUNCTIONS
3.2.3 POWER-LAW (GAMMA) TRANSFORMATIONS
21
3.2. SOME BASIC INTENSITY
TRANSFORMATION FUNCTIONS
3.2.4. PIECEWISE LINEAR TRANSFORMATION FUNCTIONS
1. Contrast Stretching
22
3.2. SOME BASIC INTENSITY
TRANSFORMATION FUNCTIONS
1. Contrast Stretching
23
cho a =giá trị nhỏ thứ nhì,
b=giá trị lớn nhất thứ 2,
=0.5, β=5, =1
24
3.2. SOME BASIC INTENSITY
TRANSFORMATION FUNCTIONS
3.2.4. PIECEWISE LINEAR TRANSFORMATION FUNCTIONS
2. Intensity-Level Slicing
Intensity-level slicing to highlight a specific range of
intensities in an image.
Its applications include enhancing features in satellite
imagery, such as masses of water, and enhancing flaws
in X-ray images.
It can be implemented in several ways, but most are
variations of two basic themes. One approach is to
display in one value (say, white) all the values in the
range of interest and in another (say, black) all other
intensities.
25
3.2. SOME BASIC INTENSITY
TRANSFORMATION FUNCTIONS
2. Intensity-Level Slicing
26
3.2. SOME BASIC INTENSITY
TRANSFORMATION FUNCTIONS
2. Intensity-Level Slicing
27
3.2. SOME BASIC INTENSITY
TRANSFORMATION FUNCTIONS
3.2.4. PIECEWISE LINEAR TRANSFORMATION FUNCTIONS
3. Bit-plane slicing
Bit-plane slicing:
It can highlight the contribution made to total image
appearance by specific bits.
Each pixel in an image represented by 8 bits.
Image is composed of eight 1-bit planes, ranging
from bit-plane 0 for the least significant bit to bit
plane 7 for the most significant bit.
28
Chapter 3
3.3 HISTOGRAM
PROCESSING
29
3.3. HISTOGRAM PROCESSING
3.3.1. HISTOGRAM
Let rk, for k = 0, 1, 2,…, L-1 denote the intensities of an
L-level digital image, f(x, y). The unnormalized
histogram of f is defined as
h(rk ) nk (k 1, 2,..., L 1)
Where nk is the number of pixel in f with intensity rk. and the
subdivisions of the intensity scale are called histogram bins.
The normalized histogram (histograms or image
histograms) of f is defined as
h(rk ) nk
p (rk )
MN MN
Where M, N are the number of image rows and columns,
respectively.
30
3.3. HISTOGRAM PROCESSING
Histogram
31
3.3. HISTOGRAM PROCESSING
Histogram
32
3.3. HISTOGRAM PROCESSING
3.3.2. HISTOGRAM EQUALIZATION
Histogram equalization:
To improve the contrast of an image
To transform an image in such a way that the transformed image
has a nearly uniform distribution of pixel values
Transformation:
Assume r has been normalized to the interval [0,1], with r = 0
representing black and r = 1 representing white
s T (r ) 0 r 1
The transformation function satisfies the following conditions:
T(r) is single-valued and monotonically increasing in the interval
0 T (r ) 1 for 0 r 1
33
3.3. HISTOGRAM PROCESSING
3.3.2. HISTOGRAM EQUALIZATION
34
3.3. HISTOGRAM PROCESSING
3.3.2. HISTOGRAM EQUALIZATION
dr dT (r ) d r p (r )
dr 0
p ( w) dw
ds dr
r r
dr 1
p s ( s ) pr ( r ) pr ( r ) 1 0 s 1
ds pr ( r )
36
3.3. HISTOGRAM PROCESSING
3.3.2. HISTOGRAM EQUALIZATION
For discrete values:
The probability of occurrence of gray level rk in an image is
nk
pr (r ) k 0,1, 2,..., L 1
MN
MN : the total number of pixels in the image
nk : the number of pixels that have gray level rk
L : the total number of possible gray levels in the image
The transformation function is
k k nj
sk T (rk ) pr ( rj ) k 0,1,2,..., L 1
j 0 j 0 n
38
3.3. HISTOGRAM PROCESSING
3.3.2. HISTOGRAM EQUALIZATION
39
3.3. HISTOGRAM PROCESSING
3.3.2. HISTOGRAM EQUALIZATION
40
3.3. HISTOGRAM PROCESSING
3.3.3. HISTOGRAM MATCHING (SPECIFICATION)
41
3.3. HISTOGRAM PROCESSING
3.3.4. LOCAL HISTOGRAM PROCESSING
The histogram processing methods discussed above are
global, in the sense that pixels are modified by a
transformation function based on the gray-level content of
an entire image.
However, there are cases in which it is necessary to
enhance details over small areas in an image.
42
Chapter 3
43
3.4. IMAGE ENHANCEMENT USING SPATIAL
OPERATIONS
3.4.1. FUNDAMENTALS OF SPATIAL FILTERING
46
3.4. IMAGE ENHANCEMENT USING SPATIAL
OPERATIONS
3. SPATIAL CONVOLUTION
47
3.4. IMAGE ENHANCEMENT USING SPATIAL
OPERATIONS
Mask 3x3
48
3.4. IMAGE ENHANCEMENT USING SPATIAL
OPERATIONS
49
3.4. IMAGE ENHANCEMENT USING SPATIAL
OPERATIONS
51
3.4. IMAGE ENHANCEMENT USING SPATIAL
OPERATIONS
3. EXAMPLES OF SPATIAL CORRELATION AND CONVOLUTION
52
3.4. IMAGE ENHANCEMENT USING SPATIAL
OPERATIONS
3. EXAMPLES OF SPATIAL CORRELATION AND CONVOLUTION
53
3.4. IMAGE ENHANCEMENT USING SPATIAL
OPERATIONS
3.4.2. SMOOTHING (LOWPASS) SPATIAL FILTERS (IMAGE AVERAGING)
55
3.4. IMAGE ENHANCEMENT USING SPATIAL
OPERATIONS
1. AVERAGE FILTER KENELS (BOX FILTER KENELS)
The simplest, separable lowpass filter kernel is the box kernel,
whose coefficients have the same value.
An m x n box filter is an m x n array of 1’s, with a normalizing
constant in front, whose value is 1 divided by the sum of the
values of the coefficients.
This normalization is applied to all lowpass kernels, has two
purposes:
First, the average value of an area of constant intensity
would equal that intensity in the filtered image.
Second, normalizing the kernel in this way prevents
introducing a bias during filtering; that is, the sum of the
pixels in the original and filtered images will be the same.
56
3.4. IMAGE ENHANCEMENT USING SPATIAL
OPERATIONS
1. AVERAGE FILTER KENELS (BOX FILTER KENELS)
57
3.4. IMAGE ENHANCEMENT USING SPATIAL
OPERATIONS
1. AVERAGE FILTER KENELS (BOX FILTER KENELS)
59
3.4. IMAGE ENHANCEMENT USING SPATIAL
OPERATIONS
1. AVERAGE FILTER KENELS (BOX FILTER KENELS)
More effective smoothing filters can be generated by
allowing different pixels in the neighborhood different
weights in the averaging function.
60
3.4. IMAGE ENHANCEMENT USING SPATIAL
OPERATIONS
2. GAUSSIAN FILTER KENELS.
Gaussian filter is a linear filter, which based on a
Gaussian function: s 2 t 2
w( s, t ) G ( s, t ) Ke 2 2
62
3.4. IMAGE ENHANCEMENT USING SPATIAL
OPERATIONS
Comparison of Gaussian and box filter smoothing characteristics.
63
3.4. IMAGE ENHANCEMENT USING SPATIAL
OPERATIONS
3. ORDER-STATISTIC (NONLINEAR) FILTERS
Order-statistic filters are nonlinear spatial filters whose
response is based on ordering (ranking) the pixels contained in
the region encompassed by the filter.
65
3.4. IMAGE ENHANCEMENT USING SPATIAL
OPERATIONS
MEDIAN FILTERS
x x
x 77
71
3.4. IMAGE ENHANCEMENT USING SPATIAL
OPERATIONS
2 f
In the y-direction 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 )
73
3.4. IMAGE ENHANCEMENT USING SPATIAL
OPERATIONS
74
3.4. IMAGE ENHANCEMENT USING SPATIAL
OPERATIONS
75
3.4. IMAGE ENHANCEMENT USING SPATIAL
OPERATIONS
The result of a Laplacian filtering is not an enhanced image.
Subtract the Laplacian result from the original image to
generate our final sharpened enhanced image
f ( x, y ) 2 f if the center coefficient of the Laplacian mask is negative.
g ( x, y )
f ( x , y ) 2
f if the center coefficient of the Laplacian mask is positive.
76
3.4. IMAGE ENHANCEMENT USING SPATIAL
OPERATIONS
77
3.4. IMAGE ENHANCEMENT USING SPATIAL
OPERATIONS
This gives us a new filter which does the whole job for us in
one step
78
3.4. IMAGE ENHANCEMENT USING SPATIAL
OPERATIONS
79