Lecture02-Part II
Lecture02-Part II
DS617
Image Processing
Lecture 2 – Part II
Intensity Transformation Methods
They take the form of: s = T(r)
Where s refers to the enhanced output image pixel value and r refers
to the original input image pixel value.
Because T depends only on the intensity (gray-level) value at a pixel
and not explicitly on its spatial coordinates (x,y) and T is referred to
as a intensity (gray-level) transformation function.
They are divided into two types:
Well-Defined Mathematical Function Based
Arbitrary User-Defined (Piecewise Linear) Function Based
r
Well-Defined Mathematical Function Based Transformation
There are many different kinds of them where the most common:
Linear
Negative
Identity
Logarithmic
Log
Inverse Log (Exponential)
Power-Law
nth root (Same as Log)
nth power (Same as Inverse Log)
Image Negative
The negative of an image with gray levels in range [0,L-1] is obtained
by the following negative transformation expression:
s=L–1–r
Reversing the intensity levels of an image.
Original Negative
Image s = Intsmax - r Image
Image Negative Example
Logarithmic (Log) Transformation
• The simplified form of logarithmic transformation is:
s = c x log(1 + r)
Where c > 0 is a constant that scales the output s by increasing its
brightness over the image quantization range (0-255) and r ≥ 0.
s = r 0.3
became visible (more brighter)
Power-Law Transformation Example (3)
• An aerial photo of a
runway is shown
s = r 5.0
• As gamma increased,
as more detail became
lost (more darker)
Arbitrary User-Defined (Piecewise Linear) Transformation
Rather than using a well-defined mathematical function we can use
arbitrary user-defined transformation (piecewise linear function).
By setting (r1,s1) = (rmin,0) and (r2,s2) = (rmax,L-1) where rmin and rmax
are the minimum and maximum gray-levels in the image, this
transform stretches gray-levels linearly to the full range [0,L-1].
Piecewise Linear Transform: Gray-Level Slicing Example
Highlights a specific range of gray-levels for certain feature enhancing
by thresholding or brightening the desired range of gray levels.
Bit-Plane Slicing
Highlights the contributions made to total image appearance by
specific bits for analyzing the relative importance played by each bit
in order to determine the adequacy of number of bits needed to
quantize each pixel for image compression.
Consider the pixels that are bounded within the yellow line. The
binary formats for those values are (8-bit representation):
Bit-Plane Slicing Example (2)
The binary format for the pixel value 167 is 10100111 and similarly,
for 144 it is 10010000
Plane 1 (left) contains the lowest order bit of all the pixels in the
image, and plane 8 (right) contains the highest order bit of all the
pixels in the same image.
Bit-Plane Slicing Example (3)
Bit-Plane Slicing Example (4)
The nth plane in the pixels are multiplied by the constant 2n-1, i.e., for
10100111, multiply the 8 bit plane with 128 and 7 bit plane with 64.
(1x128)+(0x64)+(1x0)+(0x0)+(0x0)+(1x0)+(1x0)+(1x0)=128.
4
x 10
4
3.5
2.5
1.5
0.5
29
Spatial Pixel Distribution: Histogram (4)
7000
6000
5000
4000
3000
2000
1000
30
Spatial Pixel Distribution: Histogram Example
We see a histogram plot with two distinctive peaks: a high peak in the
lower range of pixel values (dark pixels) corresponds to the
background and a lower peak in the higher range of pixel values
(bright pixels) corresponds to the foreground objects (coins).
Histogram Stretching Based Contrast Enhancement
In order to perform histogram stretching (normalization) based
contrast enhancement, first we must know the new lower and
upper pixel value limits over which the image is to be stretched
(normalized), denoted c and d respectively.
Compute the histogram of the input image and select c and d such
that 5% of image pixels will be less than c and 5% greater than d).
Based on these four values (a, b, c and d), the image pixel dynamic
range is linearly stretched according to the following formula:
𝐼𝑖𝑛𝑝𝑢𝑡 𝑖,𝑗 −𝑎
𝐼𝑜𝑢𝑡𝑝𝑢𝑡 𝑖, 𝑗 = 𝑑−𝑐 +c
𝑏−𝑎
Histogram Stretching Based Contrast Enhancement (2)
• Pixel values less than a are all converted to c, and pixel values greater
than b are all converted to d.
Histogram Stretching Based Contrast Enhancement (3)
The stretching from the old [a,b] range to the new [c,d] range is not
necessarily linear, but it can also be nonlinear using gamma option
where gamma (γ) ≠ 1.
This function has the effect of stretching the grey levels 5-9 to grey
levels 2-14 according to the following equation:
Where i is the input grey level and j is the output grey level.
Input grey level i: 5 6 7 8 9
Output grey level j: 2 5 8 11 14
Grey levels outside this range are either left alone (as in this case) or
transformed piecewise linearly according to the linear functions at
the both ends of the graph shown in the next slide.
Histogram Stretching Example (3)
Histogram Stretching Example (4)
Since the gray levels are all clustered together in the center of the
histogram, the image is poorly contrasted, as indeed it.
Given a poorly contrasted image, we would like to enhance its
contrast, by spreading out its histogram.
Histogram Stretching Example (5)
Lookup Table (LUT) Based Contrast Enhancement
A lookup table (LUT) is a table that contains a set of all possible (full
range) input values arranged in increasing order R = { r0=0, r1=1,r2=2,
…, rk=k, …, rL-1=L-1}, and a corresponding set of output (mapped,
reassigned) values S = {s0, s1, s2, …, sk, …, sL-1} into which the input
values are correspondingly mapped.
This means, for example, that a pixel with value 4 will be replaced
with 2; a pixel with value 253 will be replaced with value 126.
Lookup Table (LUT) Based Contrast Enhancement (3)
LUT mapping graph looks like:
Lookup Table (LUT) Based Contrast Enhancement (3)
As an example, suppose we wish to apply an LUT to implement the
contrast stretching graph shown below.
Lookup Table (LUT) Based Contrast Enhancement (4)
The three equations of three lines are:
x ϵ [0,96]
x ϵ [97,160]
x ϵ [161,255]
x ϵ [97,160]
x ϵ [161,255]
Histogram Equalization Based Contrast Enhancement
The trouble with the histogram-stretching and look-up table methods of
contrast enhancement is that they requires user input.
Suppose also that the total number of pixels in the image is n so that
n0 + n1 + n2 +…+ nL-1 = n
Therefore AHE is more suitable for improving the local contrast and
enhancing the definitions of edges in each region of an image.
Adaptive Histogram Equalization (AHE) (2)
After Applying the global
histogram equalization to the
original image on the top, it is
true that the background
contrast has improved in the
equalized image on the bottom.
The above image shows the result of applying AHE to the top original
image in the previous slide.
1. The image is broken down into relatively equally sized small adjacent
blocks called “tiles” or local NxM (i.e., 8x8) neighborhood regions.
Given the gray-levels r and z of the input and the target (reference)
images with their corresponding probability density functions (pdfs)
are pr(r) and pz(z).
Histogram Matching Example (3)
The actual histogram of the output new image does not exactly but
only approximately matches with the specified reference histogram
because of dealing with discrete histograms.
Histogram Matching Example (4)
Histogram Equalization Vs Histogram Matching Example
The End
Questions?