0% found this document useful (0 votes)
44 views14 pages

Lecture 8

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 14

Image Histogram

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

Many cameras display real time histograms of scene


Helps avoid taking over‐exposed pictures
Also easier to detect types of processing previously applied to image

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.

E.g. K = 16, 10 pixels have intensity value = 2


Histograms: only statistical information
No indication of location of pixels

Different images can have same histogram , 3 images below have same histogram

Half of pixels are gray, half are white


• Same histogram = same statisics
• Distribution of intensities could be different

2|Marwa R.
So, a histogram for a grayscale image with intensity values in range

would contain exactly K entries


E.g. 8‐bit grayscale image, K = 28 = 256
Each histogram entry is defined as:
h(i) = number of pixels with intensity I for all 0 < i < K.
E.g.: h(255) = number of pixels with intensity = 255
Formal definition

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

Histograms and Contrast

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

Dynamic Range: Number of distinct pixels in image


high dynamic rang means very bright and very dark parts in a single image (many
different values)

6|Marwa R.
Histogram Equalization

Histogram equalization is an automatic enhancement technique which produces an


output (enhanced) image that has a near uniformly distributed histogram.
For continuous function , the intensity (Gray level) in an image may be viewed as a
random variable with its probability density function (PDF). the PDF at a Gray level
(r) represents the expected proportion (likelihood) of occurrence of Gray level (r) in
the image. a transformation function has the form

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

This transformation is called histogram equalization or histogram linearization

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:

We compute the normalized histogram

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.

Thus, the histogram of the equalized image can be drawn as follows:

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 .

You might also like