Spatial Domain Methods

Chapter 3
Image Enhancement
Image Enhancement
The principal objective of enhancement is to process an
image so that the result is more suitable than the original
image for a specific application
The specific application may determine approaches or
techniques for image enhancement
Image enhancement approaches fall into two broad categories
Spatial domain methods
Frequency domain methods
Spatial Domain Methods
• Procedures that operate
directly on pixels.
g(x,y) = T[f(x,y)]
where
– f(x,y) is the input image
– g(x,y) is the processed image
– T is an operator on f defined
over some neighborhood of
(x,y)
Spatial Domain Methods
(x,y)
•
• Neighborhood of a point (x,y) can
be defined by using a
square/rectangular (common
used) or circular subimage area
centered at (x,y)
• The center of the subimage is
moved from pixel to pixel starting
at the top of the corner
Spatial Domain Methods
The smallest possible neighborhood is of size 1x1
s=T(r) ;gray-level transformation
s,r : gray level
Gray Level Transformations
Image Negatives
Image in the range [0, L-1]
It is useful in displaying medical images
Image Negatives
Log Transformations
s = c log(1+r) c : constant, r >= 0
We use a transformation of this type to expand the values of dark
pixels while compressing the higher-level values
The opposite is true of the inverse log transformation
Power-Law Transformations
s = cr
• c and  are positive constants
• Power-law curves with
fractional values of  map a
narrow range of dark input
values into a wider range of
output values, with the
opposite being true for
higher values of input levels.
• c =  = 1  Identity function
Power-Law Transformations
Cathode ray tub (CRT)
devices have intensity-tovoltage response that is a
power function
Exp. varies approximately
1.8 to 2.5.
2.5 tends to produce
darker images (from the
graph)
Power-Law Transformations
Power-Law Transformations
Power-Law Transformations
Piecewise-Linear Transformation
Functions
• Advantage:
– The form of piecewise
functions can be arbitrarily
complex
• Disadvantage:
– Their specification requires
considerably more user input
Contrast-stretching
• If r1=s1 and r2=s2, linear
function produces no changes in
gray levels.
• If r1=r2, s1=0 and s2=L-1,
thresholding
•creates a binary image
•Intermediate values of (r1, s1)and
(r2, s2)
various degrees of spread in the
gray levels of the output image,
thus affecting its contrast.
Contrast-stretching
• increase the dynamic
range of the gray levels in
the image
• (b) a low-contrast image
• (c) result of contrast
stretching: (r1,s1) =
(rmin,0) and (r2,s2) =
(rmax,L-1)
• (d) result of thresholding
Intensity-Level Slicing
• Highlighting a specific range of gray levels in an image
– Display a high value of all gray levels in the range of interest and a
low value for all other gray levels
• (a) transformation highlights range [A,B] of gray level and reduces all
others to a constant level
• (b) transformation highlights range [A,B] but preserves all other levels
Intensity-Level Slicing
Bit-Plane Slicing
Highlighting the contribution made to total image appearance
by specific bits
Bit-Plane Slicing
Bit-Plane Slicing
Decomposing an image into its planes is useful for analyzing the
relative importance of each bit.
Determine the number of bits adequate to quantize the image
Reconstructing of an image is done by multiplying the pixels in
nth plane by the constant 2n-1.
Histogram Processing
• Histogram of a digital image with gray levels in the range [0,L-1] is a
discrete function
• h(rk) = nk
• Where
– rk : the kth gray level
– nk : the number of pixels in the image having gray level rk
– h(rk) : histogram of a digital image with gray levels rk
- p(rk) = nk/MN , k=0, 1, …, L-1
- p(rk) is an estimate of the probability of occurrence of gray
level k
Histogram Processing
Histogram Processing
Histogram Equalization
Consider a transformation such as s= T(r), 0 ≤ r ≤ L-1
Assume T(r) satisfies the following conditions
(a) T(r) is a monotonically increasing in the interval 0 ≤ r ≤ L-1;
(b) 0 ≤ T(r) ≤ 1 for 0 ≤ r ≤ L-1
Monotonically preserves the increasing order from black to white in the image
Condition b guarantees that the output gray level will be in the same range as
input.
Single valued is required to guarantee the inverse transformation will exist
r =T-1(s)
0≤ s ≤L-1
To achieve this, T(r) is a strictly monotonically increasing function in the
interval 0 ≤r ≤L-1
Histogram Equalization
Histogram Equalization
• Let
– pr(r) denote the PDF of random variable r
– ps (s) denote the PDF of random variable s
• If pr(r) and T(r) are known and T-1(s) satisfies
condition (a) then ps(s) can be obtained using a
formula :
dr
ps(s)  pr(r)
ds

A transformation function is :
Histogram Equalization
Histogram Equalization
Histogram Equalization
• The probability of occurrence of gray level in
an image is approximated by
nk
pr (rk ) 
MN
where k  0, 1, ..., L-1
• The discrete version of transformation
k
sk  T (rk )  ( L  1) pr (rj )
j 0
=
Histogram Equalization
A 3-bit image 0f size 64×64 pixels (MN =4096) has
the intensity distribution shown in the table.
Histogram Equalization
Histogram Equalization
Histogram Equalization