2. Content
• Image enhancement
• Spatial domain enhancement
– Point operations, Spatial operations
– Digital Negative
– Contrast Stretching
– Thresholding
– Gray level slicing
– Bit plane slicing
– Dynamic range compression
– Histogram modeling
– Adaptive Histogram Equalization
• Frequency domain enhancement
– Fourier Transforms / Spectral (Frequency) Analysis
• Color Image
– Color Image Enhancement
3. Image Enhancement
• Image enhancement is improving the perception of information in images
for human viewers.
• Also, providing better input for the further image processing techniques.
• It accentuates or sharpens image features such as edges, boundaries, or
contrast to make a graphic display more helpful for display and analysis.
• The enhancement doesn't increase the inherent information content of the
data, but it increases the dynamic range of the chosen features that can be
detected easily.
Image enhancement methods:
1. Spatial domain enhancement
– operate on pixels directly
1. Point operations 2. Spatial operations (Based on Filtering)
2. Frequency domain enhancement
– operate on the Fourier transform of an image
4. Spatial Domain Enhancement
• Spatial domain techniques are performed to the image plane itself.
• Its working with pixel values or raw data of an image.
• The operation is g(x, y) = T[f(x, y)], g is the modified output image, f is
the input original image and T [ . ] is an transformation operation on f
defined over some neighborhood of (x, y).
• Based on the operations on the image pixels, it is divided into 3
categories:
1. Point processing
2. Neighborhood processing
3. Histogram based approach.
• The 2D convolution is performed
in Spatial domain:
g(x, y)= f(x, y) * h(x, y)
• Figure shows the image size
256 x 256 pixels from (0,0) to (255, 255)
(255, 255)
(0, 0)
5. 1. Point Processing (Operations) / Greyscale transformation
x
• The new grey level (color) value in a spatial location (m, n) in the
resulting image depends only on the grey level (color) in the same
spatial location (m, n) in the original image/
m m
n n
U[M×N] V[M×N]
Point-wise operation
(grey scale transformation)
f(∙) => v=f(u)
u(m, n) v(m, n) = f(u(m, n))
∀m = 0, 1, .. M-1
∀n = 0, 1, .. N-1
6. Point Processing (Operations) / Greyscale transformation
• It works on single pixel at a time i.e. T is 1 x 1 operator.
• Transfer function is S = T(r)
• S – processed point image
• r – point to be processed
Examples of point processing are:
• Digital Negative
• Contrast Stretching
• Thresholding
• Gray level slicing
• Bit plane slicing
• Dynamic range compression
7. Point Processing (Operations) / Greyscale transformation
• Point operations are zero-memory operations where a given gray
level r[0, L-1] is mapped to another gray level s[0, L-1]
according to a transformation. L = 256
)
(x
f
y =
L
L
x
y
8. Digital Negative
• Negative image is obtained by reverse (inverse) scaling of the gray levels
of the transformation,
v = L- u and umax = 255
• Useful in the display of medical images (X-ray).
• L is total number of gray levels i.e. 255
• But, Generally L range is (0 -255).
• So, v = (L -1) - u i.e. v = (256-1) – u.
L
u
0
L
v
Input intensity
O/p
Gray
level
9. Contrast Stretching
• Contrast stretching increases the dynamic range of the gray levels in the image.
• Low contrast images occur due to poor or non-uniform lightning conditions,
small dynamic range of imaging sensors.
+
−
+
−
=
L
u
b
v
b
u
b
u
a
v
a
u
a
u
u
v
b
a
)
(
)
(
0
L u
0 a b
va
vb
200
,
30
,
1
,
2
,
2
.
0
,
150
,
50 =
=
=
=
=
=
= b
a y
y
b
a
• For dark region stretch α >1, a=L/3 i.e. slope < 1
• For mid region stretch β>1 ,b=2/3L
• For bright region stretch γ>1 i.e. slope > 1
Dotted line – Identity transformation
Solid line – Contrast Stretching
10. Clipping and Thresholding
• Clipping is a special case of contrast stretching, where α= γ=0
• Useful for noise reduction when the input signal is known and the range is [a, b]
i.e. valley between the peaks of the histogram.
• It is used for binary or other images that have bimodal distribution of gray levels.
• Thresholding is extreme contrast stretching where a = b = t and the output comes
as binary. F
f(u)
0
nu
L
,
,
,
0 u a
a u b
b u L
=
V
U
a b
V
U
Clipping Thresholding
u1 = u2
v1 =0, v2 = L -1
11. Intensity level Slicing
• Permit segmentation of certain gray level regions from the rest of the image.
=
otherwise
b
u
a
L
v
,
0
,
=
otherwise
u
b
u
a
L
v
,
,
• Transformation highlights
range [A, B] of gray levels and
reduces all others to a constant
level.
• Transformation highlights
range [A, B], but preserves all
other level.
12. Bit (extraction) level Slicing
• This transformation is useful in determining the number of visually significant
bits in an Image.
• Suppose each pixel is represented by 8 bits it is desired to extract the nth most
significant bit and display it .
• Higher-order bits contain the majority of the visually significant data
13. Range Compression (Log Transformation)
• Sometime, dynamic range of image exceeds the capability of display device. So it
need to compressed.
• Log operator is an excellent compression function.
• Dynamic range compression is achieved using log operator.
• c – normalization constant and u – input intensity
)
1
(
log10 u
c
v +
=
L
u
0
v
L
14. 2. Local neighborhood operations
• Operation performs on local neighborhoods of input pixels.
• Image is convolved with Finite Impulse Response (FIR) filter (Spatial mask)
Local neighborhood methods:
• Min – Set the pixel value to the minimum in the neighborhood pixel
• Max – Set the pixel value to the maximum in the neighborhood pixel
• Median – Set the pixel value to the midpoint of the neighborhood pixels.
• Mean - Set the pixel value to the mean of the neighborhood pixels.
15. 3. Histogram modeling
• Image Histogram is a graphical representation of the
lightness/color distribution in a digital image. It plots the number
of pixels for each value.
• Histogram of a digital gray image range [0, L-1] is a discrete
function
h(rk) = nk
– rk is the kth gray level (value) pixel
– nk is the number of pixels in the image having gray level rk.
0 50 100 150 200
0
500
1000
1500
2000
2500
3000
16. Histogram modeling
• Normalize a histogram by dividing each of its values by the total number
of pixels in the image n.
Normalized histogram p(rk) = nk / n, for k = 0, 1, …, L -1.
• nk is number of pixels of the gray value rk
• p(rk) estimation of the probability of occurrence of gray level rk.
• The sum of all components of a normalized histogram is equal to 1.
Why Histogram modeling is need?
• Histograms are the basis for numerous spatial domain processing
techniques.
• Histogram manipulation can be used effectively for image enhancement.
• Histograms can be used to provide useful image statistics.
• Information derived from histograms are quite useful in other image
processing applications, such as image compression and segmentation.
17. Why Histogram modeling is need?
0 50 100 150 200 250
0
0.5
1
1.5
2
2.5
3
3.5
4
x 10
4
Histogram information reveals that image is under-exposed
18. Why Histogram modeling is need?
Histogram information reveals that image is over-exposed
0 50 100 150 200 250
0
1000
2000
3000
4000
5000
6000
7000
19. 3. Histogram Equalization – Adjust the image pixel values
• Find a map f(x) such that the histogram of the modified (equalized) image is
flat (uniform).
• Cumulative Probability Function (cdf) of a random variable approximates a
uniform distribution
=
=
x
t
t
h
x
s
0
)
(
)
(
h(t) is the histogram (pdf)
=
=
x
t
t
h
L
y
0
)
(
Uniform
Quantization
=
=
L
t
t
h
0
1
)
(
Note:
L
1
=
=
x
t
t
h
s
0
)
(
x
L
y
0
cumulative probability function
25. 3.1. Adaptive Histogram Equalization
• Instead of doing histogram equalization using the whole image, compute
the distribution for a moving window around the given pixel.
• Computes several histograms, each corresponding to a distinct section of
the image, and uses them to redistribute the lightness values of the image.
• It improves the local contrast and enhancing the definitions of edges in
each region of an image.
26. Frequency Domain Enhancement
• The image f(x,y) is transferred into frequency domain i.e. Compute the Fourier
Transform (Discrete Fourier Transform) of the image.
• Enhancement operations (brightness, contrast) performed on Fourier Transform
of image, then find Inverse Fourier Transform for the enhanced image.
• G(u, v) = F(u, v) H(u, v) - Frequency domain representation
• When applying transformation function on input image pixels modifies the pixel
values in the output image.
H(u, v)
F(u, v) H(u, v) F(u, v)
27. Fourier Transforms / Spectral (Frequency) Analysis
• Fourier Transform decomposes an image into its sine and cosine components.
• The output of the transformation represents the image in the Fourier or frequency
domain, while the input image is the spatial domain equivalent.
• In the Fourier domain image, each point represents a particular frequency contained
in the spatial domain image.
• For digital images, Discrete Fourier Transform (DFT) is sufficient to use spatial
domain image. i.e. the image in the spatial and Fourier domain are of the same size.
• FT produces a complex number valued output image which can be displayed with
two images, either real and imaginary part or with magnitude and phase.
• In image processing, the magnitude of the FT contains most of the information of the
geometric structure of the spatial domain image.
• However, if want to re-transform the Fourier image into the correct spatial domain
after some processing in the frequency domain, must preserve both magnitude and
phase of the Fourier image.
• The Fourier domain image has a much greater range than the image in the spatial
domain. For good accuracy, its values are calculated and stored in float values.
• DFT takes O(n2) operations, but Fast Fourier Transform (FFT) takes O(n log2n)
operations
28. Fourier Transforms properties
• Superposition: The FT of a sum of signals is the sum of their Fourier transforms. Thus,
the Fourier transform is a linear operator.
• Shift: The FT of a shifted signal is the transform of the original signal multiplied by a
linear phase shift (complex sinusoid).
• Reversal: The FT of a reversed signal is the complex conjugate of the signal’s transform.
• Convolution: The FT of a pair of convolved signals is the product of their transforms.
• Correlation: The FT of a correlation is the product of the first transform times the
complex conjugate of the second one.
• Multiplication: The FT of the product of two signals is the convolution of their
transforms.
• Differentiation: The FT of the derivative of a signal is that signal’s transform multiplied
by the frequency. In other words, differentiation linearly emphasizes (magnifies) higher
frequencies.
• Domain scaling: The FT of a stretched signal is the equivalently compressed (and scaled)
version of the original transform and vice versa.
• Real images: The FT of a real-valued signal is symmetric around the origin. This fact can
be used to save space and to double the speed of image FFTs by packing alternating
scanlines into the real and imaginary parts of the signal being transformed.
• Parseval’s Theorem: The energy (sum of squared values) of a signal is the same as the
energy of its Fourier transform.
29. Frequency Domain Enhancement
• Finite curves of image can be expressed as the integral of sines/cosines multiplied
by a weighing function.
Steps of filtering in the frequency domain
1. Calculate the DFT of the image f(u, v)
2. Generate a frequency domain filter H
– H(u, v) and F(u, v) should have the same size
» H(u, v) should NOT be centered. Centered H(u, v) is for displaying
purpose only.
» If H(u, v) is centered, F(u, v) needs to be centered too and some post-
processing is required.
» H(u, v) is located at top-left corner
3. Multiply F(u, v) with filter function H (u, v) (element by element).
G(u, v) = H(u, v) F(u, v)
4. Compute the inverse of DFT result G(u, v) .
5. Take the real part of the IDFT
v))
(G(u,
age
filteredim
=
30. Construct Frequency Domain from Spatial Domain filter
Calculate the DFT of the image f(u, v)
- Given image f and spatial filter 9 x 9
1 1 1 1 1 1 1 1
1
1 1 1 1 1 1 1 1
1
1 1 1 1 1 1 1 1
1
1 1 1 1 1 1 1 1
1
1 1 1 1 1 1 1 1
1
1 1 1 1 1 1 1 1
1
1 1 1 1 1 1 1 1
1
1 1 1 1 1 1 1 1
1
1 1 1 1 1 1 1 1
1
81
1
image f Spatial filter h
9 x 9
DFT of image
31. Construct Frequency Domain from Spatial Domain filter
– H(u, v) and F(u, v) should have the same size
» If H(u, v) is centered, F(u, v) needs to be centered too and expand it.
» H(u, v) is located at top-left corner
300
300
9
9
300
9
9
300
DFT of filter
DFT of filter
frequency domain representation
32. Construct Frequency Domain from Spatial Domain filter
Multiply DFT of F(u, v) with DFT of expanded H (u, v) (element by element)
G(u, v) = H(u, v) F(u, v)
not centered
F
not centered H not centered
F∙H
Centered F Centered F∙H
Centered H
34. Direct Construction of Frequency Domain Filters
• Ideal LowPass Filters (ILPF)
– Cut off all high-frequency components of the Fourier transform that are
at a distance greater than a specified distance D0 (cut off frequency)
from the origin of the (centered) transform
– The transfer function (frequency domain filter) is defined by
– D(u,v) is the distance from point (u, v) to the origin (center) of the
frequency domain filter.
– Usually, the image to be filtered is even-sized, but, in this case, the
center of the filter is (M/2,N/2).
– Then the distance D(u,v) can be obtained by
)
,
(
if
0
)
,
(
if
1
)
,
(
0
0
=
D
v
u
D
D
v
u
D
v
u
H
]
)
2
/
(
)
2
/
[(
)
,
( 2
/
1
2
2
N
v
M
u
v
u
D −
+
−
=
35. • Determine the cutoff frequency D0
– Compute circles that enclose specified amounts of total image power PT.
−
=
=
−
=
=
=
1
0
1
0
2
|
)
,
(
|
M
u
u
N
v
v
T v
u
F
P
T
D
v
u
D
P
v
u
F /
)
|
)
,
(
|
(
0
)
,
(
2
ILPF transfer function plot
Filter displayed as a image
Filter radial cross section
36. • As the filter radius increases, very less
power is removed/filtered out, but
more details are preserved.
• Ringing effect is clear in most cases
except for the last one.
• Ringing effect is the consequence of
applying ideal lowpass filters
Image 500 x 500 Fourier spectrum
Circles radii 5, 15, 30, 80, 230
37. Color Image
• Color is a reflection of wavelengths back to the eyes.
• The visible spectrum shows the wavelengths of each of the component
color.
• Color Scheme is the combination of colors
1. Achromatic color - have lightness but no dominant hue or
saturation.
Ex. white, grey and black
2. Monochromatic - comprised of variations of one color.
3. Chromatic color scheme - Any color in which one particular
wavelength or hue predominates.
Ex. blue and green
Achromatic
No color
Monochromatic
Single Color
Chromatic
Having color
38. Color Image properties
Color Appearance Parameters
• Hue: dominant color corresponding to a dominant wavelength of mixture
light wave
• Saturation / Chroma / Colorfulness: Relative purity or amount of
white light mixed with a hue (inversely proportional to amount of white
light added)
• Brightness / lightness: Intensity of the pixel
• Opacity / Transparency: Indicates the element is fully transparent or
not.
39. Color Image Enhancement
• Improves the color balance or contrast of the color image
Enhancement of color image:
• The input color coordinates of each pixel are independently transformed
into another set of color coordinates.
• Apply enhancement algorithm for individual monochrome images.
• Since each image plane Tk (m, n),k=1,2,3 is enhanced independently,
care has to be taken so that the enhanced coordinates T’k are within the
color gamut (range) of R-G-B system.