Professional Documents
Culture Documents
Robotics and Computer Vision: Intensity Transformations
Robotics and Computer Vision: Intensity Transformations
Robotics and Computer Vision: Intensity Transformations
Intensity Transformations
Log Transformations
Contrast Stretching
Intensity-level Slicing
Bit-plane Slicing
Histogram Processing
Histogram Equalization
2
Why Transform images?
Image has noise in it
Image is low contrast
Want to find things in an image
Want to emphasize things in an image
Want to remove things in an image
Want to de-emphasize things in an image
3
Spatial Processing
The term spatial domain refers to the image plane itself, and
image processing methods in this category are based on direct
manipulation to the image pixels.
There are two principle categories of spatial processing:
Intensity Transformation (Point Processing)
4
General Spatial Processing
Spatial Processing Algorithms can be reduced to the form:
𝒈 𝒙, 𝒚 = 𝑻 [𝒇 𝒙, 𝒚 ] Origin x
y Image f (x, y)
5
Intensity Transformation
The simplest spatial domain operations occur when the
neighbourhood is simply the pixel itself.
Here, 𝐠 depends only on the value of 𝐟 at (𝐱, 𝐲). In this case 𝐓 is
referred to as a point processing operation (or intensity
transformation function).
Point processing operations take the form:
𝑠 = 𝑇(𝑟)
Where 𝐬 and 𝐫 are variables denoting, respectively, the
intensity of 𝐠 and 𝐟 at any point (𝐱, 𝐲).
𝐓 is a transformation that maps pixel value 𝐫 into pixel value 𝐬.
6
Intensity Transformation
There are three basic types of transformations used frequently for
image enhancement:
Linear (identity and
negative transformations)
Logarithmic (log and
inverse-log transformations)
Power-law (𝑛𝑡ℎ power and
𝑛𝑡ℎ root transformations)
7
Image Negatives
The negative of an image with intensity levels in the range [0,L-1]
can be described by:
𝑠 = 𝐿 −1− 𝑟
8
Log Transformations
General form: 𝑠 = 𝑐 log(1 + 𝑟)
Where c is a constant and r ≥ 0.
9
Log Transformations
A plot (image) of the Fourier Spectrum usually has a fairly large
dynamic range.
10
Power-Law (Gamma) Transformations
Basic form: 𝑠 = 𝑐𝑟 𝛾
Where c and γ are positive constants.
11
Gamma Correction
Many devices used for image capture, display and printing
respond according to a power law.
Example:
CRT devices have an intensity-to-voltage response that is a power
function (exponents typically range from 1.8-2.5)
Gamma correction in this case could be achieved by applying the
transformation: s = r1/2.5 = r 0.4 .
12
Gamma Correction Example
13
Power-Law transformation (MRI Example)
The Figure shows magnetic resonance image (MRI) of an upper
thoracic human spine with a fracture dislocation and spinal cord
impingement.
14
Power-Law transformation (MRI Example)
s = r 0.6
1
Transformed Intensities
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
0 0.2 0.4 0.6 0.8 1
Old Intensities
15
Power-Law transformation (MRI Example)
s = r 0.4
1
0.9
Transformed Intensities
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
0 0.2 0.4 0.6 0.8 1
Original Intensities
16
Power-Law transformation (MRI Example)
s = r 0.3
1
0.9
Transformed Intensities
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
0 0.2 0.4 0.6 0.8 1
Original Intensities
17
Power-Law transformation (MRI Example)
as gamma decreased from 0.6 to 0.4,
more detail became visible.
Further decrease of gamma to 0.3
enhanced a little more detail in
the background, but began to reduce
original 𝜸=0.6
contrast to the point where the image
started to have a very slight
“washed-out” appearance, especially
in the background.
The best enhancement in terms
of contrast and discernible detail
𝜸=0.4 𝜸=0.3
was obtained with 𝛾=0.4.
18
Power-Law transformation (Aerial Example)
The Aerial image has washed-out appearance, so a compression of
intensity levels is desirable.
19
Power-Law transformation (Aerial Example)
Suitable results were obtained 𝜸=3.0
20
Piecewise-Linear Transformation Functions
We use user-defined transforms, defined by a set of lines “pieced”
together….piecewise linear.
Example functions:
Contrast stretching
Intensity-level slicing
Bit-plane slicing
21
Contrast stretching
Contrast stretching
expands the range of
intensity levels in an image
so it spans a given (full)
intensity range.
when r1 = r2 , s1 = 0 and
s2 = L − 1, this yields
a thresholding function.
22
Intensity-level slicing
Intensity-level slicing used to highlight a specific range of
intensities in an image that might be of interest.
23
Intensity-level slicing Example
24
Bit-plane slicing
Pixels are digital values composed of bits. For example, a pixel in a
256-level gray-scale image is comprised of 8 bits.
25
Bit-plane slicing
26
Bit-plane slicing Example
[00000001] [00000010]
27
Bit-plane slicing Example
Bit-plane slicing is useful in
Determining the number of bits necessary to quantize an image
Image compression
The figure shows Images reconstructed using (a) bit planes 8 and
7; (b) bit planes 8, 7 and 6; and (c) bit planes 8, 7, 6, and 5.
original
28
Histogram Processing
The histogram of a digital image, f, (with intensities [0, 𝐿 − 1]) is
a discrete function: ℎ(𝑟𝑘 ) = 𝑛𝑘
Where 𝐫𝐤 is the k th intensity value and 𝐧𝐤 is the number of pixels
in 𝐟 with intensity 𝐫𝐤 .
29
Histogram Processing
Histogram manipulation can be used for
Image enhancements
Image statistics
Image compression
Image segmentation
30
Histogram Examples
Four basic image types and their
corresponding histograms
Dark
Light
Low contrast
High contrast
31
Histogram Equalization
we want to be able to learn how to go from a non-uniform
distribution to a uniform distribution.
32
Histogram Equalization
In order to achieve that, what we needs to find a transform that
takes basically the pixel values of the original image and
transforms them to pixel values of a different image.
33
Histogram Equalization
Intensity levels in an image may be viewed as random variables in
the interval [0, 𝐿 − 1].
34
Histogram Equalization
For discrete values, we deal with probabilities (histogram values),
instead of probability density functions and integrals.
35
Histogram Equalization Example
Suppose we have Intensity distribution and histogram values for a
3-bit, 64x64 digital image.
36
Histogram Equalization Example
The values of histogram equalization transformation function are
obtained using the equation:
So:
𝑠0 = 1.33 𝑠1 = 3.08
𝑠2 = 4.55 𝑠3 = 5.67
𝑠4 = 6.23 𝑠5 = 6.65
𝑠6 = 6.86 𝑠7 = 7.00
37
Histogram Equalization Example
At this point, the s values still have fractions because they were
generated by summing probabilities values, so we round them to
the nearest integer:
𝑠0 = 1.33 1 𝑠1 = 3.08 3
𝑠2 = 4.55 5 𝑠3 = 5.67 6
𝑠4 = 6.23 6 𝑠5 = 6.65 7
𝑠6 = 6.86 7 𝑠7 = 7.00 7
38
Histogram Equalization Example
39
Contrast enhancement using Histogram Equalization
Transformation functions
40