4 - Image Enhancement in Spatial Domain II
4 - Image Enhancement in Spatial Domain II
Domain-II
2
of
30
Image Histograms
The histogram of an image shows us the
distribution of grey levels in the image
Massively useful in image processing,
especially in segmentation
Frequencies
Grey Levels
3
of
30
Image Histograms
• The histogram of a digital image, f, (with intensities [0,L-1])
is a discrete function
h(rk) = nk
• Where rk is the kth intensity value and nk is the number of
pixels in f with intensity rk
• Normalizing the histogram is common practice – Divide the
components by the total number of pixels in the image –
Assuming an MxN image, this yields
p(rk) = nk/MN for k=0,1,2,....,L-1 – p(rk) is, basically, an estimate
of the probability of occurrence of intensity level rk in an image
Σ p(rk) = 1
4
of
30
Uses for Histogram Processing
• Image enhancements
• Image statistics
• Image compression
• Image segmentation
• Simple to calculate in software
• Economic hardware implementations
– Popular tool in real-time image processing
• A plot of this function for all values of k provides a global
description of the appearance of the image (gives useful information
for contrast enhancement)
• Histograms commonly viewed in plots as
h(rk) = nk versus rk
p(rk) = nk /MN versus rk
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
5
of
30
Histogram Examples
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
6
of
30
Histogram Examples (cont…)
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
7
of
30
Histogram Examples (cont…)
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
8
of
30
Histogram Examples (cont…)
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
9
of
30
Histogram Examples (cont…)
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
of
30
10
Histogram Examples (cont…)
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
of
11
30
Histogram Examples (cont…)
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
of
30
12
Histogram Examples (cont…)
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
of
30
13
Histogram Examples (cont…)
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
of
30
14
Histogram Examples (cont…)
15
of
30
Histogram Examples (cont…)
A selection of images and
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
their histograms
Notice the relationships
between the images and
their histograms
Note that the high contrast
image has the most
evenly spaced histogram
16
of
30
Contrast Stretching
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?
17
of
30
Histogram Equalisation
• Histogram equalization is a process for increasing the
contrast in an image by spreading the histogram out to be
approximately uniformly distributed
• The gray levels of an image that has been subjected to
histogram equalization are spread out and always reach
white
– The increase of dynamic range produces an increase in
contrast
• For images with low contrast, histogram equalization has
the adverse effect of increasing visual graininess
18
of
30
Histogram Equalisation
• The intensity transformation function we are constructing
is of the form
s=T(r) 0 ≤ r ≤ L−1
of
30
23
Equalisation Transformation Function
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
of
30
24
1
Equalisation Examples
25
of
30
Equalisation Transformation Functions
of
30
26
2
Equalisation Examples
27
of
30
Equalisation Transformation Functions
of
30
28
4
3
Equalisation Examples (cont…)
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
of
30
29
4
3
Equalisation Examples (cont…)
30
of
30
Equalisation Transformation Functions