CSC566-chapter 4
CSC566-chapter 4
Nursuriati
Jamil
TOPICS
1. Histogram processing
2. Gray level transformations
3. Logical and arithmetic operations
4. Image smoothing
5. Image sharpening
HISTOGRAM PROCESSING Dr. Nursuriati
Jamil
LEARNING OUTCOME
Image
histogram
10/10/2017 6
IMAGE TYPE AND HISTOGRAM
10/10/2017 7
HOW IS IT CONSTRUCTED?
The histogram of a digital image with gray levels from 0 to L-1 is a
discrete function h(rk)=nk, where
rk is the kth gray level
nk is the # pixels in the image with that gray level
n is the total number of pixels in the image
k = 0, 1, 2, …, L-1
0 0 3 3 7 5
1 3 3 5 5 4
7 7 6 5 4 3
3 1 2 2 2 2
2 5 6 7 1 1
0 1 2 3 4 5 6 7
Gray level
ANSWER THIS!
Do these images have the same histogram?
I I min
J 255
I max I min
Graylevel 0 1 2 3 4 5 6 7
Histogram 5 9 9 12 5 8 7 9
Histogram
HISTOGRAM EQUALIZATION –STEP 2
Normalize the histogram.
Graylevel 0 1 2 3 4 5 6 7
Histogram 5 9 9 12 5 8 7 9
Histogram
Graylevel 0 1 2 3 4 5 6 7
Histogram 5 9 9 12 5 8 7 9
Normalized 0.08 0.14 0.14 0.19 0.08 0.13 0.11 0.14
Normalized histogram
HISTOGRAM EQUALIZATION –STEP 3
Built cumulative histogram.
Graylevel 0 1 2 3 4 5 6 7
Histogram 5 9 9 12 5 8 7 9
Normalized 0.08 0.14 0.14 0.19 0.08 0.13 0.11 0.14
Cumulative 0.08 0.22 0.36 0.55 0.63 0.76 0.87 1.0
Cumulative histogram
HISTOGRAM EQUALIZATION –STEP 4
Calculate new gray levels
Graylevel 0 1 2 3 4 5 6 7
Histogram 5 9 9 12 5 8 7 9
Normalized 0.08 0.14 0.14 0.19 0.08 0.13 0.11 0.14
Cumulative 0.08 0.22 0.36 0.55 0.63 0.76 0.87 1.0
New Gray level T(rk) * 20 56 92 140 161 194 222 255
255
Equalized image
GRAY LEVEL
TRANSFORMATIONS
LEARNING OUTCOME
10/10/2017 23
IMAGE NEGATIVE DEMO
Brain tissue
highlighted
Before After
LOG TRANSFORMATIONS
s = c log(1+ f(x,y)), c: constant
Compresses the dynamic range of images with large
variations in pixel values so that the image can be display.
Pixel
1 + log(1348.3) = 8.20 intensities are
compressed
LOG TRANSFORMATIONS DEMO Pixel
intensities are
compressed
Before After
GRAY LEVEL SLICING
Highlight tumour
More about this in
THRESHOLDING image segmentation
chapter
OR
AND
NOT
IMAGE ADDITION
Both input
images must be
= the same size
and type.
10/10/2017 35
IMAGE MULTIPLICATION
X 4 =
10/10/2017 36
IMAGE SUBTRACTION
Both input
images must be
= the same size
and type.
10/10/2017 37
IMAGE DIVISION
Both input
= images must be
the same size
and type.
IMAGE FILTERING
LEARNING OUTCOME
Linear filter
works by using
neighbourhood
transformation
HOW DO LINEAR FILTER WORKS?
m1 m2 m3
Given a mask, m m4 m5 m6
m7 m8 m9
f(1,1) … … … … … f(1,n)
f(m,0) … … … … … f(m,n)
HOW DO LINEAR FILTER WORKS?
Step 1. Position the mask, m centred at the current pixel to
be filtered, f(x,y).
f(1,1) … … … … … f(1,n)
f(m,0) … … … … … f(m,n)
HOW DO LINEAR FILTER WORKS?
Step 2. Form all products of the mask coefficients
with the corresponding neighbourhood pixels.
+ =
- = =
Step 2. Add the mask with the original image for the sharpened result
+ =
Original Mask Sharpened