Chapter 3 Part 1
Chapter 3 Part 1
Chapter 3
03 Spatial filtering
Identity Tansformation: each value of the input image is directly mapped to each
other value of output image.
• Identity transformation/transition is shown by a straight line.
output
⚬ That results is the same in input
image and output image.
⚬ And hence is called identity
transformation.
Input
Negative Transformation
So each value is subtracted by 255 and the result image has been shown
above.
So what happens is that, the lighter pixels become dark and the darker
picture becomes light.
It is useful when for enhancing white details embedded in dark regions of the
image.
Negative Transformation cont...
Conversely, if γ > 1, the transformation brightens the image and enhances the
contrast in the darker regions.
Different display devices / monitors have their own gamma correction, that’s why
they display their image at different intensity.
Power Law (Gamma) Transformations
• Variation in the value of γ varies the
enhancement of the images.
Rather than using a well defined mathematical function we can use arbitrary
user-defined transforms
This is called contrast stretching, which means that the bright pixels in the
image will become brighter and the dark pixels will become darker, this means :
higher contrast image.
Piecewise-Linear Transformation
Contrast stretching
Notice that the intensity transformation function T, made the pixels with dark
intensities darker and the bright ones even more brighter, this is called contrast
stretching
Piecewise-Linear Transformation
Contrast stretching
Notice that the intensity transformation function T, made the pixels with dark
intensities darker and the bright ones even more brighter, this is called contrast
stretching
Piecewise-Linear Transformation
Thresholding
Is a limited case of contrast stretching, it produces a two-level (binary) image.
Assume that
• a: rmin,
• b:rmax,
• k : intensity
Contrast stretching:
• (r1,s1)=(rmin,0) , (r2,s2)=(rmax,L-1)
Thresholding:
• (r1,s1)=(k,0) , (r2,s2)=(k,L-1)
Thresholding
Piecewise-Linear Transformation
Thresholding
g(x,y) = T[f(x,y)] Or s= Example: suppose m= 150 (called threshold),
T(r) if r (or pixel intensity in image f) is above this threshold
it becomes 1 in s (or pixel intensity in image g),
otherwise it becomes zero.
• One approach is to display a high value for all gray levels in the range of
interest and a low value for all other gray levels.
• The second approach, based on the transformation brightens the desired
range of gray levels but preserves gray levels unchanged.
Piecewise-Linear Transformation
Gray-level Slicing
Approach 1 Approach 2
Display in one value(e.g white) all the Brightens or darkens the desired
values in the range of interest , and in range of intensities but leaves all
another (e.g black) all other other intensity levels in the image
intensities unchanged
Piecewise-Linear Transformation
Bitplane Slicing
Pixels are digital numbers, each one composed of bits. Instead of highlighting
gray-level range, we could highlight the contribution made by each bit.
• In image processing, a histogram shows the number of pixels for each intensity
value in a given image.
• A histogram is a statistical representation of an image.
• It doesn’t show any information about where the pixels are located in the image.
• Therefore, two different images can have equivalent histograms.
3
of
39
Image Histogram
4
of
39
Histogram Equalization
• Histogram equalization (also known as
histogram flattening).
• The goal is to improve contrast in images that
might be either blurry or have a background and
foreground that are either both bright or both dark.
• Histogram equalization helps sharpen an image.
5
of
39
Histogram Equalization
6
of How Histogram Equalization Works
39
– Note: The sum of all the components in the normalized histogram is equal to 1.
• Step 3: Calculate the transformation T to map the old intensity values to new
intensity values.
– Let K represent the total number of possible intensity values (e.g. 256).
• Step 4: Given the new mappings of intensity values, we can use a lookup table to transform
each pixel in the input image to a new intensity.
7
of Example of Histogram Equalization
39
The two yellow columns above are our lookup table and we
use these two columns to generate the output image.
9
of
39
Solution cont..
10
of
39
Histogram Matching
• Step 2: Obtain the cumulative distribution function CDF for both the input image and the
specified image (same method as in histogram equalization).
• Step 3: Calculate the transformation T to map the old intensity values to new intensity
values for both the
input image and specified image (same method as in histogram equalization).
• Step 4: Use the transformed intensity values for both the input image and
specified image to map the intensity values of the input image to new values
12
of Example of Histogram Matching
39
• Using the two yellow columns above to map the old intensity values for the pixels to new intensity
values, we get the following histogram after equalization:
14
of
39
Solution cont..
• Now, transform intensity values for both the input image and specified image to map the intensity
values of the input image to new values.
• To do that, all we need are the FLOOR((K – 1) * CDF) values for both the original and the specified
image.
For example, when the gray level is 4, the original image is 2. 2 in the specified image corresponds
to a gray
level of 1. Therefore, we map 4 to 1.
Part I End
Question?