Image Enhancement
(Histogram Processing)
Syed Ali Zamin
The histogram of an image shows us the distribution of grey levels in the image
Massively useful in image processing, especially in segmentation
Image Histograms
Grey Levels
Frequencies
A selection of images and
their histograms
Notice the relationships
between the images and
their histograms
Note that the high contrast
image has the most
evenly spaced histogram
Histogram Examples (cont…)
We can fix images that have poor contrast by applying a pretty simple
contrast specification
The interesting part is how do we decide on this transformation
function?
Contrast Stretching
Histogram Stretching
Our aim is to have High Contrast Images
We stretch the Histogram of Images
This is done by the formula:
For an 8bpp image:
Example of Histogram Stretching –8bpp image
1276060
200127200
12760127
4
3
2
060127 200255
Example of Histogram Stretching –8bpp image
1220 0
255122255
1220122
4
3
2
0 122 255
Stretching Histogram of an Image
Problems in Histdogram Stretching
There is no effect of Histogram Stretching on images when:
There are pixels of intensity 0 and intensity 255 in an image.
Extreme Case:
Low Contrast Image
One pixel Intensity = 0
One pixel Intensity = 255
Some Examples of Contrast Stretching
Some Examples of Contrast Stretching
Some Examples of Contrast Stretching
Histogram Equalisation
Spreading out the frequencies in an image (or equalising
the image) is a simple way to improve dark or washed out
images
The formula for histogram
equalisation is given where
r
k
:input intensity
s
k
:processed intensity
k: the intensity range
(e.g 0.0 –1.0)
n
j
:the frequency of intensity j
n:the sum of all frequenciess
k=T(r
k) =∑
j=1
k
p
r(r
j) =∑
j=1
k
n
j
n
Steps of Histogram Equalization
Calculate PMF
Calculate CDF
Multiply CDF by gray level resolution –1 (levels –1)
Map New gray level values to number of pixels
Equalization Transformation Function
Equalization Examples
1
The functions used to equalise the images in the previous example
Equalization Transformation Functions
Equalization Examples
2
The functions used to equalise the images in the previous example
Equalization Transformation Functions
Equalization Examples (cont…)
3
4
Equalization Examples (cont…)
3
4
The functions used to equalise the images in the previous examples
Equalization Transformation Functions
Another Example
Histogram Equalization Examples
Histogram Equalization Examples
Histogram Equalization Examples
Histogram Equalization can be Worse
Histogram Equalization can be Worse
We have looked at:
Different kinds of image enhancement
Histograms
Histogram equalisation
Next time we will start to look at point processing and some
neighbourhoodoperations
Summary