You are on page 1of 64

CS-419:

Applied Image
Processing
Dr. Muhammad Hanif
Histogram
Histogram
Histogram
Histogram
Histogram
Interpreting Histograms
Histogram
Image Brightness
Histogram
• Detecting bad exposer using histogram:
Image Contrast
Contrast and Histogram
Contrast Calculation
Contrast Calculation
High Dynamic Range Images
Histogram and Dynamic Range
HDR Imaging
Histogram and Dynamic Range
Histogram Basics
Histogram h( rk )  nk
th
rk is the k intensity value
nk is the number of pixels in the image with intensity rk

nk
Normalized histogram p(rk ) 
MN
nk : the number of pixels in the image of
size M  N with intensity rk
Point Operation and Histogram
Color image Histogram
Color image Histogram
Point Operation
Homogenous point Operation
Point Operation Pseudocode
Non-Homogenous point operation
Clamping
Inverting Image
Image Negative
Thresholding
Thresholding
Thresholding and Histogram
Basic Grey level Transforms
Logarithmic Transform
Power Law Transform
Power Law transform
Intensity Windowing
Intensity Windowing
Contrast Adjustment
• Automatic contrast adjustment
Contrast Adjustment
• Auto adjustment example
Modified Contrast adjustment
Cumulative Density Function
Histogram Equalization
Histogram equalization is a technique for adjusting image intensities to enhance contrast.
Histogram Equalization
• Unlike contrast stretching, histogram modeling operators may
employ non-linear and non-monotonic transfer functions to map
between pixel intensity values in the input and output images.
• Histogram equalization employs a monotonic, non-linear mapping
which re-assigns the intensity values of pixels in the input image such
that the output image contains a uniform distribution of intensities
(i.e. a flat histogram).
• This technique is used in image comparison processes (because it is
effective in detail enhancement) and in the correction of non-linear
effects introduced by, say, a digitizer or display system.
Histogram Equalization
Histogram Equalization
• Here, the goal is to obtain a uniform histogram for the output image.
• r represents the gray levels of image to be enhanced.
• It is normalized in the range [0,1]
– r = 0 represents black
– r = 1 represents white
• s = T(r) is transformation that produces
• a level s for every pixel r in the original image
Histogram Equalization
• T should satisfies the following conditions
– T(r) is single valued and monotonically increasing
where r is in the range [0,1]
– T(r) also varies in the range [0,1]
1.The first requirement is to ensure that T is invertible,
and monotonicity ensures the order of increasing
intensities (one to one)
2.The second requirement is to ensure that resulting gray
levels are in the same range as input levels (onto)
• The inverse transformation from s back to r is
denoted by r = T-1(s)
Histogram Equalization
Histogram Equalization
The intensity levels in an image may be viewed as
random variables in the interval [0, L-1].
Let pr ( r ) and ps ( s ) denote the probability density
function (PDF) of random variables r and s.

T (r ) is continuous and differentiable.

ps ( s)ds  pr (r )dr
Histogram Equalization
• In discrete case r takes discrete values
• rk , k=0,1…L-1 and
probability of occurrence of a gray level rk in an image is
approximated by:
Histogram Equalization
• Mathematically, the discrete form of the transformation function for histogram
equalization is given by


Where
• – nj is the number of times the jth gray level appears in the image
– L is the number of gray levels
– P r(rj) is the probability of the j th gray level and
– N is the total number of pixels in the image
• it spreads the histogram to span a larger range.
Histogram Equalization
• Suppose that a 3-bit image (L=8) of size 64 × 64 pixels (MN = 4096) has the
intensity distribution shown in following table.

• Get the histogram equalization transformation function and give the ps(sk)
for each sk.
Histogram Equalization

0
s0  T (r0 )  7 pr (rj )  7  0.19  1.33 1
j 0
1
s1  T (r1 )  7 pr (rj )  7  (0.19  0.25)  3.08 3
j 0
s2  4.55  5 s3  5.67  6
s4  6.23  6 s5  6.65  7
s6  6.86  7 s7  7.00  7
Histogram Equalization
Equalization Transformation Function
Transformation Equalization
Equalization Example
Equalization Example
Equalization Example
Histogram Matching
Adjusting to a Histogram
References

You might also like