Image Enhancement
Image Enhancement
Image Enhancement
To process an image so that the result is
more suitable than the original image for a
specific application.
Image Enhancement
s = T (r)
image
Brightening the levels above m in the
original image
Logarithmic Functions:
Log Transformation
Inverse-log Transformation
Power-Law Functions:
nth power transformation
s=L–1–r
Histogram Equalization
Histogram Specification
Local Processing
Global Processing
Grayscale Histogram
• Count intensities
• Normalize
• What determines Histogram?
– Contrast, aperture, lighting levels, scene,
Histogram Processing
• The Histogram of a digital image with gray levels
in therange [0,L-1] is a discrete function
P(rk ) = nk /n
Where rk is the kth gray level,
nk is the number of pixels in the image
n is the total number of pixels in the image
k= 0,1,2,…… , L-1
• Simply P(rk ) gives an estimation of the probability
of
occurrence of gray-level rk.
(a)
(b)
(c) (d)
Fig (a) shows the gray levels are concentrated towards the dark end of the gray
scale
(b) shows overall dark characteristics just opposite of fig (a)
(c ) shows a narrow shape and little dynamic also appeared as murky gray
(d) shows a histogram with significant spread, corresponding to an image with
high contrast.
Histogram Equalization
The idea is to spread out the histogram so that it
makes full use of the dynamic range of the image.
1
pout ( s ) pin (r ) 1r T 1 ( s ) 1, 0 s 1
pin (r ) r T 1 ( s )
· The output probability density function is uniform,
regardless of the input.
nk
pin (rk ) 0 rk 1 0 k L 1
n
L: Total number of gray levels
k
s k T (rk ) pin (r j ) 0 k L 1
j 0
Example:
NB: The gray values in output are also (0, 1/7, 2/7, …, 1).
# Fraction
pixels of #
pixels
# pixels
Gray values
· Goal
Derive a point operation, H(r), that maps the input image into
an output image that has the user-specified histogram.
z=H(r) = G-1(v=s=T(r))
z
V G ( z ) pout ( w)dw , 0 z 1 (**)
0
· From the gray values n we can obtain the gray values z by
using the inverse transformation, z = G-1(v)
k
s k T (rk ) pin (r j ) 0 k L 1
j 0
k
vk G ( z k ) pout ( z j ) sk 0 k L 1
j 0
k
s k T (rk ) pin (r j ) 0 k L 1
j 0
k
vk G ( z k ) pout ( z j ) sk 0 k L 1
j 0
-1 -1
(3)
= ® =
z G (v=s) z G [T (r)]
Example:
#
pixels
Gray
value
· It is desired to transform this image into a new image, using a
transformation Z=H(r)= G-1[T(r)], with histogram as specified
below:
# pixels
Gray values
· The transformation T(r) was obtained earlier (reproduced
below):
G-1(0) = ?
G-1(1/7) = 3/7
G-1(2/7) = 4/7
G-1(3/7) = ?
G-1(4/7) = ?
G-1(5/7) = 5/7
G-1(6/7) = 6/7
G-1(1) = 1
· Combining the two transformation T and G-1 , compute
z=H(r)= G-1[v=s=T(r)]
· Applying the transformation H to the original image yields an
image with histogram as below:
· Again, the actual histogram of the output image does not exactly
but only approximately matches with the specified histogram. This is
because we are dealing with discrete histograms.
Original image and its histogram