Lecture 8
Lecture 8
Lecture 8
The histogram of an image is a plot of the Gray _levels values versus the number of
pixels at that value.
A histogram appears as a graph with "brightness" on the horizontal axis from 0 to 255
(for an 8-bit) intensity scale) and "number of pixels "on the vertical axis. The
histogram gives us a convenient –easy -to -read representation of the concentration of
pixels versus brightness of an image.
Example:
Image (left) has 256 distinct gray levels (8 bits)
Histogram (right) shows frequency (how many times) each gray level occurs
1|Marwa R.
Where rk is the Kth intensity level in the interval [0 , L-0] and nk is the number of pixels
in the image whose intensity level is rK
The value of L is 255 for images of class unit8 , 65535 for images of class unit16 , and
1.0 for images of class double.
Different images can have same histogram , 3 images below have same histogram
2|Marwa R.
So, a histogram for a grayscale image with intensity values in range
Feature of histogram
1. Histograms help detect image acquisition issues
2. Problems with image can be identified on histogram
• Over and under exposure
• Brightness
• Contrast
• Dynamic Range
3. Point operations can be used to alter histogram. E.g.
• Addition
• Multiplication
• Exp and Log
• Intensity Windowing (Contrast Modification)
4. Image enhancements
5. Image statistic
6. Image compression
7. Image segmentation
3|Marwa R.
Four basic image types and their corresponding histograms:
• Dark
• Light
• Low contrast
• High contract
Histograms commonly viewed in plots as
4|Marwa R.
Image Contrast
The contrast of a grayscale image indicates how easily objects in the image can be
distinguished
• High contrast image: many distinct intensity values
• Low contrast: image uses few intensity values
Good Contrast? Widely spread intensity values + large difference between min and
max intensity values
Contrast Equation
Many different equations for contrast exist
Examples:
5|Marwa R.
Histograms and Dynamic Range
6|Marwa R.
Histogram Equalization
Where (w) is a variable of integration. the right side of this equation is called the
cumulative distribution function (CDF) of random variable (r). for discrete Gray level
values, we deal with probabilities (histogram values) and summations instead of
probity density function and integrals. thus , the transform will be
7|Marwa R.
8|Marwa R.
9|Marwa R.
10 | M a r w a R .
Example :
suppose that a 3-bit image (L=8) of size 64 x 64 pixels has the Gray level (intensity)
distribution shown in the table below
Perform histogram equalization on this image , and draw its normalized histogram,
transformation function , and the histogram of the equalized image
Solution:
11 | M a r w a R .
Then we find the transformation function
12 | M a r w a R .
We round the values of s to the nearest integer
These are the values of the equalized histogram. Note that there are only five Gray
levels.
13 | M a r w a R .
The next figure shows the results of performing histogram equalization on dark , light,
low-contrast, and high-contrast Gray images
left column original images. centre column corresponding histogram equalized images.
right column histograms of the images in the centre column
14 | M a r w a R .