04 - Image Enhancement in The Spatial Domain
04 - Image Enhancement in The Spatial Domain
Spatial Domain
Lecturer: Hossam Abdelmunim
Email : [email protected]
2
2 domains
• Spatial Domain : (image plane)
– Techniques are based on direct manipulation of pixels in
an image
• Frequency Domain :
– Techniques are based on modifying the Fourier transform
of an image
• There are some enhancement techniques based on
various combinations of methods from these two
categories.
3
Good images
• For human visual
– The visual evaluation of image quality is a highly subjective
process.
– It is hard to standardize the definition of a good image.
• For machine perception
– The evaluation task is easier.
– A good image is one which gives the best machine
recognition results.
• A certain amount of trial and error usually is required
before a particular image enhancement approach is
selected.
4
Spatial Domain
• 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)
5
Mask/Filter
• Neighborhood of a point (x,y) can
be defined by using a
square/rectangular (common
(x,y)
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
6
Point Processing
• Neighborhood = 1x1 pixel
• g depends on only the value of f at (x,y)
• T = gray level (or intensity or mapping)
transformation function
s = T(r)
• Where
– r = gray level of f(x,y)
– s = gray level of g(x,y)
7
Contrast Stretching
• Produce higher contrast
than the original by
– darkening the levels
below m in the original
image
– Brightening the levels
above m in the original
image
8
Thresholding
• Produce a two-level
(binary) image
9
Mask Processing or Filter
• Neighborhood is bigger than 1x1 pixel
• Use a function of the values of f in a predefined
neighborhood of (x,y) to determine the value of g at
(x,y)
• The value of the mask coefficients determine the
nature of the process
• Used in techniques
– Image Sharpening
– Image Smoothing
10
3 basic gray-level transformation
functions
• Linear function
Negative
nth root
– Negative and identity
Output gray level, s
transformations
Log
nth power • Logarithm function
– Log and inverse-log
transformation
• Power-law function
Identity Inverse Log
– nth power and nth root
transformations
Input gray level, r
11
Identity function
• Output intensities are
Negative
identical to input
nth root
intensities.
Output gray level, s
Log
nth power
• Is included in the graph
only for completeness.
• Negative transformation :
Log
nth power s = L – 1 –r
• Reversing the intensity levels of
an image.
• Suitable for enhancing white or
Identity Inverse Log
gray detail embedded in dark
regions of an image, especially
when the black area dominant in
Input gray level, r size.
13
Example of Negative Image
14
Log Transformations
s = c log (1+r)
Negative
• c is a constant
nth root and r 0
Output gray level, s
Log
• Log curve maps a narrow
nth power range of low gray-level values
in the input image into a
wider range of output levels.
• Used to expand the values of
dark pixels in an image while
Inverse Log
Identity
compressing the higher-level
values.
Input gray level, r
15
Log Transformations
• It compresses the dynamic range of images with
large variations in pixel values
• Example of image with dynamic range: Fourier
spectrum image
• It can have intensity range from 0 to 106 or higher.
• We can’t see the significant degree of detail as it will
be lost in the display.
16
Example of Logarithm Image
18
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
19
Power-Law Transformations
20
Effect of decreasing gamma
• When the is reduced too much, the image
begins to reduce contrast to the point where
the image started to have very slight “wash-
out” look, especially in the background
21
Power Law Transformations (cont…)
•An aerial photo
of a runway is
shown s = r 3.0
•This time
power law
s=
s = r 4.0
transforms are r 5.0
used to darken
the image
22
Piecewise-Linear Transformation
Functions
• Advantage:
– The form of piecewise functions can be arbitrarily
complex
• Disadvantage:
– Their specification requires considerably more
user input
23
Contrast Stretching
• increase the dynamic range of the
gray levels in the image
• (b) a low-contrast image : result from
poor illumination, lack of dynamic
range in the imaging sensor, or even
wrong setting of a lens aperture of
image acquisition
• (c) result of contrast stretching: (r1,s1)
= (rmin,0) and (r2,s2) = (rmax,L-1)
• (d) result of thresholding
24
Gray Level Slicing
•Highlights a specific range of grey levels
– Similar to thresholding
– Other levels can be
suppressed or maintained
– Useful for highlighting features
in an image
25
Bit-plane slicing
• Highlighting the contribution
Bit-plane 7
made to total image
One 8-bit byte
(most significant) appearance by specific bits
• Suppose each pixel is
represented by 8 bits
• Higher-order bits contain the
majority of the visually
significant data
Bit-plane 0
(least significant)
• Useful for analyzing the relative
importance played by each bit
of the image
26
Bit Plane Slicing
•Often by isolating particular bits of the pixel
values in an image we can highlight interesting
aspects of that image
– Higher-order bits usually contain most of the
significant visual information
– Lower-order bits contain
subtle details
Bit Plane Slicing (cont…)
Bit Plane Slicing: Another Example
Least/Most Significance?