Image enhancement techniques can be divided into two categories: spatial domain and frequency domain methods. Spatial domain methods directly manipulate pixel values, while frequency domain methods modify the image's Fourier transform. Common spatial techniques include gray-level transformations like negatives, logarithms, and power laws. Piecewise-linear transformations include contrast stretching, gray-level slicing, and bit-plane slicing. Histogram equalization improves contrast by producing a uniform histogram. Smoothing filters reduce noise by averaging pixel neighborhoods. Arithmetic operations on images include addition, subtraction, and logical operations like AND and OR.
Recombinant DNA technology (Immunological screening)
Image Enhancement in the Spatial Domain.pdf
1. Image Enhancement in the Spatial Domain
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.
Image enhancement approaches fall into two
broad categories:
- Spatial domain methods
- Frequency domain methods
The term spatial domain refers to the image
plane itself, and approaches in this category are
based on direct manipulation of pixel in an image.
2. Image Enhancement in the Spatial Domain
Frequency domain processing techniques are
based on modifying the Fourier transformation of
an image.
3. Background
• A mathematical representation of spatial
domain enhancement:
where f(x, y): the input image
g(x, y): the processed image
T: an operator on f, defined over some neighborhood of
(x, y)
In addition, T can operate on a set of input images, such as
performing the pixel-by-pixel sum of K image for noise
reduction, discussed later
)]
,
(
[
)
,
( y
x
f
T
y
x
g
4. The principal approach in defining a neighborhood about a point
(x, y) is to use a square or rectangular subimage area centered at
(x, y)
)]
,
(
[
)
,
( y
x
f
T
y
x
g
The operator T is applied at each location (x, y) to produce
The output g, at that location.
5. Background
Where, r and s are variables denoting the gray-level of f(x, y)
and g(x, y) at any point (x, y)
7. Image Enhancement in the Spatial Domain
Some Basic Gray Level Transformation
As an introduction to gray level transformations,
consider the following figure, which shows three
types of functions used for image enhancement:
Linear ( negative and identity transformations)
Logarithmic (log and inverse-log
transformations)
Power-law (nth root transformations)
9. Image Enhancement in the Spatial Domain
Image Negatives
Reversing the intensity levels of an image in
this manner produces the equivalent of a
photographic negative.
An example is shown in the following figure.
11. Image Enhancement in the Spatial Domain
Image Negatives
The original image is a digital mammogram
showing a small lesion.
In spite of the fact that the visual content is the
same in both images, note how much easier it is to
analyze the breast tissue in this particular case.
Lab Problem: You are given an image make it a negative image.
Save the output image in BMP file.
12. Image Enhancement in the Spatial Domain
Log Transformations
The shape of the log curve shows that this
transformation maps a narrow range of low gray-
level values in the input image into a wider range
of output levels.
The opposite is true of higher values of input
levels.
We would use a transformation of this type to
expand the values of dark pixels in an image while
compressing the higher-level values.
The opposite is true of the inverse log
transformation.
17. Image Enhancement in the Spatial Domain
Power-Law Transformation
As in the case of the log transformation, 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.
18. Image Enhancement in the Spatial Domain
Power-Law Transformation
A variety of devices used for capture, printing,
and display respond according to a power law.
By convention, the exponent in the power-law
equation is referred to as gamma.
The process used to correct this power-law
response phenomena is called gamma correction.
19. Image Enhancement in the Spatial Domain
Power-Law Transformation
For example, CRT devices have an intensity-to-
voltage response that is a power function, with
exponents varying from approximately 1.8 to 2.5.
with reference to the curve for γ = 2.5 in figure,
we see that such display systems would tend to
produce images that are darker than intended.
21. Image Enhancement in the Spatial Domain
Power-Law Transformation
In addition to gamma correction, power law
transformations are useful for general purpose
contrast manipulation.
The following figure shows a magnetic
resonance (MR) image of an upper thoracic human
spine with a fracture dislocation and spinal
impingement.
23. Image Enhancement in the Spatial Domain
Power-Law Transformation
An aerial image is a projected image which is
"floating in air", and cannot be viewed normally. It
can only be seen from one position in space.
25. Lab Problem: You are given an image
perform power-law transformation. Save
the output image in BMP file.
26. Image Enhancement in the Spatial Domain
Piecewise-Linear Transformation Functions
Contrast Stretching
One of the simplest piecewise linear functions
is a contrast-stretching transformation.
The idea behind contrast stretching is to
increase the dynamic range of the gray levels in
the image being processed.
The following figure shows a typical
transformation used for contrast stretching.
28. Image Enhancement in the Spatial Domain
Piecewise-Linear Transformation Functions
Contrast Stretching
29. Image Enhancement in the Spatial Domain
Piecewise-Linear Transformation Functions
Contrast Stretching
30. Image Enhancement in the Spatial Domain
Piecewise-Linear Transformation Functions
Contrast Stretching
31. Image Enhancement in the Spatial Domain
Piecewise-Linear Transformation Functions
Contrast Stretching
32. Image Enhancement in the Spatial Domain
Piecewise-Linear Transformation Functions
Gray-level slicing
Highlighting a specific range of gray levels in
an image often is desired.
Applications include enhancing features such as
masses of water in satellite imagery and enhancing
flaws in X-ray images.
The following figure shows-
34. Image Enhancement in the Spatial Domain
Piecewise-Linear Transformation Functions
Bit-plane slicing
Instead of highlighting gray-level ranges,
highlighting the contribution made to total image
appearance by specific bits might be desired.
35. Piecewise-Linear Transformation Functions
Case 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.
36. Image Enhancement in the Spatial Domain
Piecewise-Linear Transformation Functions
Bit-plane slicing
In terms of 8-bit bytes, plane 0 contains all the
lowest order bits in the bytes comprising the pixels
in the image and plane 7 contains all the higher-
order bits.
The higher-order bits (especially the top four)
contain the majority of the visually significant
data. The other bit planes contribute to more subtle
details.
The figure 3.14 shows the various bit planes for
the image shown in figure 3.13.
41. Image Enhancement in the Spatial Domain
Histogram Processing
Histogram processing in image enhancement,
shown in figure 3.15.
Four basic gray level characteristics: dark, light,
low contrast, and high contrast.
The right side of the figure shows the
histograms corresponding to these images.
45. 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
– The transformation function satisfies the following conditions:
1
0
)
(
r
r
T
s
48. Histogram Equalization
• Histogram equalization is based on a transformation of the
probability density function of a random variable.
• Let pr(r) and ps(s) denote the probability density function of
random variable r and s, respectively.
• If pr(r) and T(r) are known and , then
the probability density function ps(s) of the transformed
variable s can be obtained
ds
dr
r
p
s
p r
s )
(
)
(
49. Histogram Equalization
• Define a transformation function where w is a dummy variable
of integration and the right side of this equation is the
cumulative distribution function of random variable r.
r
r dw
w
p
r
T
s
0
)
(
)
(
50. Histogram Equalization
• Given transformation function T(r),
ps(s) now is a uniform probability density function.
• T(r) depends on pr(r), but the resulting ps(s) always is uniform.
1
0
1
)
(
1
)
(
)
(
)
(
s
r
p
r
p
ds
dr
r
p
s
p
r
r
r
s
r
r dw
w
p
r
T
0
)
(
)
(
51. Histogram Equalization
• In discrete version:
– The probability of occurrence of gray level rk in an image is
n : 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
1
,...,
2
,
1
,
0
)
(
L
k
n
n
r
p k
r
52. Histogram Equalization
– The discrete version the transformation function is
– Thus, an output image is obtained by mapping each pixel with level rk
in the input image into a corresponding pixel with level sk.
– The transformation given in the above equation is called histogram
equalization or histogram linearization.
1
,...,
2
,
1
,
0
)
(
)
(
0 0
L
k
n
n
r
p
r
T
s
k
j
k
j
j
j
r
k
k
57. Enhancement Using Arithmetic/Logic Operations
• Two images of the same size can be combined using
operations of addition, subtraction, multiplication, division,
logical AND, OR, XOR and NOT. Such operations are done on
pairs of their corresponding pixels.
• Often only one of the images is a real picture while the other
is a machine generated mask. The mask often is a binary
image consisting only of pixel values 0 and 1.
• Example: Figure 3.27
58. Enhancement Using Arithmetic/Logic Operations
The AND and OR operations are used for masking; that is, for
selecting subimages in an image, as illustrated in following
figure.
In the AND and OR image masks, light represents a binary 1
and dark represents a binary 0.
62. Lab Problem: Perform subtraction of two given images.
Show the histogram equalized image.
Lab Problem: Add any two given images. Show and write the
result into a file in BMP format.
63. Image Averaging
• When taking pictures in reduced lighting (i.e., low
illumination), image noise becomes apparent.
• A noisy image g(x,y) can be defined by
where f (x, y): an original image
: the addition of noise
• One simple way to reduce this granular noise is to
take several identical pictures and average them, thus
smoothing out the randomness.
)
,
(
)
,
(
)
,
( y
x
y
x
f
y
x
g
)
,
( y
x
69. Basics of Spatial Filtering
Some neighborhood operations work with the values of
the image pixels in the neighborhood and the
corresponding values of a subimage that has the same
dimensions as the neighborhood.
The subimage is called a filter, mask, kernel, template,
or window.
We are interested in filtering operations that are
performed directly on the pixels of an image.
The mechanics of spatial filtering are illustrated in the
following figure-
72. Basics of Spatial Filtering
The process consists simply of moving the filter mask
from point to point in an image.
At each point (x,y), the response of the filter at that
point is calculated using a predefined relationship.
For linear spatial filtering the response is given by a sum
of products of the filter coefficients and the
corresponding image pixels in the area spanned by the
filter mask.
77. Basics of Spatial Filtering
What happens when the center of the filter approaches
the border of the image?
78. Smoothing Spatial Filters
Smoothing filters are used for blurring and for noise
reduction.
Blurring is used in preprocessing steps, such as removal of
small details from an image prior to object extraction.
Smoothing Linear Filters
The output of a smoothing, linear spatial filter is simply the
average of the pixels contained in the neighborhood of the
filter mask.
These filters sometimes are called averaging filter.
79. Smoothing Spatial Filters
Smoothing Linear Filters
The idea behind smoothing filters is straightforward. By
replacing the value of every pixel in an image by the average
of the gray levels in the neighborhood defined by the filter
mask, this process results in an image with reduced “sharp”
transitions in gray levels.
80. Smoothing Spatial Filters
• Smoothing linear filters
– Averaging filters (Lowpass filters in Chapter 4))
• Box filter ( all coefficients are equal)
• Weighted average filter
Box filter Weighted average
81. Smoothing Spatial Filters
• The general implementation for filtering an MXN image with
a weighted averaging filter of size mxn is given by
where a=(m-1)/2 and b=(n-1)/2
a
a
s
b
b
t
a
a
s
b
b
t
t
s
w
t
y
s
x
f
t
s
w
y
x
g
)
,
(
)
,
(
)
,
(
)
,
(
83. Lab Problem: You are given an image. Make it smooth using
smoothing filter (filter size may be varied).
84. Sharpening Spatial Filters
• Sharpening filters are based on computing spatial
derivatives of an image.
• The first-order derivative of a one-dimensional
function f(x) is
• The second-order derivative of a one-dimensional
function f(x) is
)
(
)
1
( x
f
x
f
x
f
)
(
2
)
1
(
)
1
(
2
2
x
f
x
f
x
f
x
f
**Home Work