Image Processing Reference
In-Depth Information
400
n_hist
bright
200
0
0
50
100
150
200
250
Bright
The histogram now occupies the whole available range, as required.
Histogram equalisation
is a
nonlinear
histogram-stretching process. The equalised
histogram is a
resampled
cumulative histogram
. We first work out the histogram of the
picture, then we work out the cumulative histogram. Finally, we resample the cumulative
histogram, giving a look-up table to
map
original intensity levels to the equalised ones.
The main difference between equalisation and normalisation is that in
normalisation
all
grey levels have the same 'weight': the process stretches the histogram to occupy the
available range. In
equalisation
,
the histogram is resampled or manipulated, again to cover
the available range. Since the histogram is manipulated, brightness values do not have the
same weight.
equalise(pic):= range
←
Define output range
255
number
←
Number of points
rows(pic)·cols(pic)
for bright
∈
0..255
pixels_at_level
bright
←
Initialise histogram
0
for x
∈
0..cols(pic)-1
for y
∈
0..rows(pic)-1
pixels_at_level
pic
y,x
Determine histogram
pixes_at_level
+1
pic
y,x
sum
←
0
for level
∈
0..255
sum
←
sum+pixels_at_level
level
Form cumulative histogram
range
number
hist
floor
sum
level
Make look-up table
+0.00001
for x 0..cols(pic)-1
for y 0..rows(pic)-1
newpic
Map input to output
hist
y,x
pic
y,x
newpic