0% found this document useful (0 votes)
19 views6 pages

Histogram

very

Uploaded by

dhruvdascbi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views6 pages

Histogram

very

Uploaded by

dhruvdascbi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

23-09-2024

Image Enhancement: Histogram Processing Image Enhancement: Histogram Processing


❑Histogram: ❑Histogram Equalization:
✓The histogram of an image shows the frequency distribution of grey levels in the image ✓Equalization is a process that attempts to spread out the gray levels in an image so that
✓ The histogram of an image is a plot of the number of occurrences of gray levels in the image against they are evenly distributed across their range.
the gray-level values.
✓ The histogram provides a convenient summary of the intensities (i.e. gray levels) in an image, but it
✓Histogram equalization reassigns the brightness values of pixels based on the image
is unable to convey any information regarding spatial relationships between pixels. histogram.
✓ The histogram does not uniquely specify an image. This is because it does not have information ✓Histogram equalization is a technique where the histogram of the resultant image is as flat
about the position (location) of the pixels with a certain gray level. It only has information about as possible.
how many pixels have a certain gray level.
✓Histogram equalization provides more visually pleasing results across a wider range of
✓ The histogram provides more insight about image contrast and brightness.
images.
✓ The histogram of a dark image will be clustered towards the lower gray level.
✓ The histogram of a bright image will be clustered towards higher gray level. ❑Histogram Matching
✓ For a low-contrast image, the histogram will not be spread equally, that is, the histogram will be ❑Local Histogram Processing
narrow.
❑Using Histogram Statistics for Image Enhancement
✓ For a high-contrast image, the histogram will have an equal spread in the gray level.
✓ Image brightness may be improved by modifying the histogram of the image.

What is Contrast Enhancement Histogram vs. Image Contrast


✓ Different images can have same histogram i.e.
same statistics

Half of pixels are gray, half are white


Distribution of the pixel intensities
could be different

Original image with low contrast Enhanced Image

✓ Low contrast: image values concentrated near a narrow range (mostly dark, or mostly bright, or mostly
medium values)
✓ Contrast enhancement: change the image value change the image value distribution to cover a wide
range
✓ Contrast of an image can be revealed by its histogram ✓ Can we reconstruct image from histogram? No!

Drill Problem
Very Different Images May Have Same Histogram ❑ Can two different images have the same histogram? Justify your answer.

❑ Yes, there is a possibility that two different images can have the same histogram. Here, we
have taken an original image (humming bird), and then the image is flipped in the left/right
direction. The histograms of the original image and the flipped image are taken. Since the
values of the pixels are not affected by a ‘flipping’ operation, the histogram of the original
image is the same as the histogram of the flipped image. From Fig., it is clear that even though
the original and flipped images are different, their histograms remain the same. From this
illustration, it is obvious that two different images can have the same histogram.

Histogram reflects the pixel intensity


distribution, not the spatial distribution

1
23-09-2024

Drill Problem Drill Problem


❑Two images have the same histogram. Which of the following properties must they have in ❑The two images shown below are quite different, but their histograms are
common? (i) Same total power(sum of squares of pixel values) (ii) Same entropy (sum of I ln I identical. Both images have size 8 × 8, with black and white pixels. Suppose that
over all pixel values) (iii) Same interpixel covariance function i.e. same degree of pixel to pixel both images are blurred with a 3×3 smoothing mask. Would the resultant
correlation). histograms still be the same? Draw approximately the two histograms and explain
❑Identical histograms imply that both images have the same average gray level. your answer. [Note: the dark lines that appear around the two images are used to
✓ The total power and entropy must be the same when two images have the same histogram,
signify the boundaries of the images but are not part of them.]
because the total power and entropy depend only on the pixel values and not on the order
they are arranged in the image.
✓ The interpixel covariance function is not necessarily the same when two images have the
same histogram.
✓ Histogram equalization is a one-to-one mapping; hence, the entropy should not change.
However due to rounding-off effects, many gray levels may get mapped to the same level.
In such cases, the entropy actually reduces.
✓ Two images having identical histograms need not have identical Fourier transforms. This is
so because the histogram does not contain any positional information about the image while ❑Different images can have same histogram i.e. same statistics.
the Fourier transform uses positional information. ✓Half of pixels are gray, half are white
✓Distribution of intensities could be different
❑It is straightforward to see that the two histograms are different
where 𝐻(𝐼) is the histogram, and 𝐼 is the gray level.

Drill Problem Examples of Histograms


❑If all the pixels in an image are shuffled, will there be any change in the histogram? Justify your
answer.

❑If all the pixels in an image are shuffled, there will not be any change in the histogram of the
image. A histogram gives only the frequency of occurrence of the gray level. Consider two
images, 1 and 2, as given below:
❑Image 2 is obtained by shuffling the rows of Image 1. Their corresponding histograms are
shown below:

❑From the two histograms, it is clear that even if all the pixels in an image are shuffled, there
will not be any change in the histogram of the image.

What is Contrast Enhancement Drill Problem


✓ An image of low contrast has a
✓ Images of high contrast
histogram that is concentrated around
are more interesting and
a small range of intensities.
pleasant for the human
eye.

Original image with Enhanced image


low contrast

Histograms showing (i) low dynamic range and low contrast, (ii) maximum dynamic
range and high contrast and (iii) maximum dynamic range and even higher
contrast.

Original girl image with Enhancement image with


low contrast histogram equalization

2
23-09-2024

Drill Problem (1) Drill Problem (2)


❑Dark image equalization: The histogram components are localized to low intensity values. ❑Bright image equalization: The histogram components are localized to high intensity values

Drill Problem (3) Drill Problem (4)


❑Low contrast image equalization: The histogram components are localized in a ❑High contrast image equalization: the high
narrow region of the intensity values contrast image has the most evenly spaced
histogram

❑The histogram components are distributed overall the intensity range.


❑The distribution is almost uniform, with few peaks.
❑If the distribution is uniform, the image tends to have a high dynamic range and
the details are more easily perceived.
❑This is the effect pursued by the histogram based transformations.

Histogram Normalized Histogram (i.e. PDF)


❑Histogram of a digital image with gray levels in the range [0,L-1] is defined as the discrete ❑Normalized histograms: can be obtained by dividing all elements of ℎ 𝑟𝑘 by the total
function: number of pixels in the image:
ℎ 𝑟𝑘 = 𝑛𝑘 , 𝑟𝑘 ∈ [0, 1, … . . , 𝐿 − 1]
❑where
ℎ 𝑟𝑘 𝑛𝑘 𝑛𝑘
𝑃 𝑟𝑘 = = = , 𝑘 = [0, 1, … . . , 𝐿 − 1]
✓𝒓𝒌 is the kth
intensity (gray) level in the interval [0, L-1] 𝑛 𝑛 𝑀×𝑁
✓𝒏𝒌 is the number of pixels in the image with gray level 𝒓𝒌 OR whose intensity level is 𝒓𝒌
✓ where M and N are the number of rows and columns of the image.
✓n is the total number of pixels in the image. ✓ 𝑃 𝑟𝑘 → gives an estimate of the probability of occurrence of a gray level 𝑟𝑘 .
✓ The sum of all components of a normalized histogram is equal to 1
✓ The normalized histogram is a probability density function (pdf).
✓ All the values of a normalized histogram are less than or equal to 1.
✓ From the pdf, build the cumulative distribution function (cdf)

3
23-09-2024

Histogram Equalization: Spreading out the frequencies in an image Drill Problem


❑Histogram Equalization (i.e. CDF running sum) : is a method which increases the dynamic
range of the gray-level in a low-contrast image to cover full range of gray-levels. It is an ❑For the given image. Write a procedure for histogram equalization.
enhancement technique which is related to the PDF of the gray levels of the input image, would
give an output image of uniformly distributed gray levels.
❑The goal of histogram equalization is to spread out the contrast of a given image evenly throughout
the entire available dynamic range. Histogram equalization adjust image intensities to enhance
contrast.
❑In histogram equalization technique, it is the PDF that is being manipulated.
❑PDF can be approximated using the probability based on the histogram as follows:
Total pixels with intenstity 𝑟𝑘
𝑃𝐷𝐹(𝑥) = 𝑃 𝑟𝑘 =
Total pixels in Image 𝑥
❑From PDF we can calculate Cumulative Distribution Function (CDF)
𝐿−1 ✓ Histogram equalization
𝐶𝐷𝐹(𝑥) = ෍ 𝑃 𝑟𝑘 tries to match the pdf of
the result image to the
𝑘=0 uniform pdf

Drill Problem Drill Problem


✓ The above procedure gives us a new mapping. We apply this new mapping of intensities to
pixel values to the original image to get a new image.

The new image has a histogram with a


wider spread i.e. Range of 5 versus a
range of 3 on the original image’s
histogram.
Total 25

Drill Problem
❑Perform histogram equalization on the following image.

Total 9

The modified
image has a better
histogram spread.

4
23-09-2024

Drill Problem
❑What would be the impact of the removal of the last bit in the histogram for the
following image?

Modified image
has a range of 6,
while original has
Total 9 a range of 4.

❑Histogram comparison: Below is a comparison of the two histograms i.e. original Drill Problem
and modified images. We notice the following differences in the histograms ❑The histograms of two images are illustrated below. Sketch a transformation
function for each image that will make the image have a better contrast. Use the
axis provided below to sketch your transformation functions.

❑The transformation used for histogram equalization is

✓ The range of the histogram has decreased. Original range was 7, while the
modified histogram has a range of 4.
✓ Lower range means that fewer bits are sufficient to represent the image. In this
case, the modified image can be represented with only 2 bits.

Drill Problem Histogram Specification (Histogram Matching)


❑Consider the following 4x4 matrix of a 3-bit image, find histogram equalization ❑Consider the following 4x4 matrix of a 3-bit image and the desired histogram:
of this image.

❑Find the Histogram Matching of this image.

✓ 1 and 2 for the given image.


✓ 3 and 4 for the desired histogram

5
23-09-2024

You might also like