You are on page 1of 16

Transfer Functions and Histogram Equalization

Khushbu Kochar, Anunay Sinha

Abstract

When we say image enhancement what do we


mean by it? Enhancement is a very abstract
term, not well defined at all.It could mean
increasing the brightness of an image or the
number of colour levels of an image, increasing
the contrast or the sharpness. It could also mean
feature enhancement, noise removal, red eye
reduction, removing patches and so on.
We have divided this paper into different
sections.Section 1 gives a basic introduction
about transfer functions and contrast
stretching.Section 2 talks about the project that Figure 1: Transfer Function to Increase
we have designed on .NET platform to apply Brightness
different transfer functions on images and see
which image gives us the best results for which The above transfer function depicts that the
transfer function.Section 3 talks about histogram value of each level has been increased by a
equalisation which is a generic method and will constant value k, thereby increasing the overall
gives good results not only for particular input brightness of the image.
images but any kind of input image unlike when
we apply transfer functions.

1. Introduction

1.1Transfer functions

Figure 2: Transfer Function to Decrease


Brightness
The above transfer function depicts that the
value of each level has been decreased by a
constant value l, thereby decreasing the overall In the above transfer function the levels ranging
brightness of the image. from 0-250 are getting mapped to 0-50 on the y
axis and 250-255 are getting mapped to 50-
Therefore from the above discussion it it clear 255,that is a large no of colour levels are getting
that O(img)|x,y = f(I(img))|x,y . compressed to a small dark region,and a small
range of colours is getting stretched to a very
1.2 Contrast Stretching large range.The output image would have colour
levels increasing in steps of 5 from 0-50 and
Now let us talk about another transfer function then the rest of the region would become white
which demonstrates contrast stretching.Contrast and all the gradient would be lost.
Stretching means maximising the difference
between the brightest and the darkest. 1.3 Characteristics of an ideal contrast
stretcher

(i) It should monotonically increase (i.e it should


never decrease)
(ii) It should utilize all the grey shades (in case
of grey scale images), that is the o/p should not
leave any grey shades unused.

2. Project Designed

We have designed an interactive interface where


a used can design his own transfer function just
by clicking on points. This transfer function can
be applied to any of the browsed images and
output can be visualised.The images can be both
Figure 3: Transfer function which shows grey scale and coloured, for coloured the transfer
contrast stretching. Function has to be applied separately to red, blue
and green channels.

2.1 Visualizing Results


CASE #1

Transfer function 1

Sno. INPUT IMAGE OUTPUT IMAGE

1.
2

4.
5.

Conclusion :Transfer function 1 gives best reults for image 1,2 and 3,this might be possible because
these input images have less no of pixels in the range of 0-50.

Case # 2

Transfer function 2
Sno. INPUT IMAGE OUTPUT IMAGE
1.

2.

3.
4.

5.

Conclusion: Transfer function 2 gives best results for image 5 because image 5 possibly has more
information in the range of 0-50
Case #3

Transfer function 3

SNo INPUT IMAGE OUTPUT IMAGE


1.
2.

3.

4.
5.

Conclusion: This transfer function does not give good results for any of the input images because all the
input images have a bright region which is where the information is getting lost.

Case # 4

Transfer function 4
SNo INPUT IMAGE OUTPUT IMAGE
1.

2.

3.
4.

5.

Conclusion: In transfer function 4 image 2 and image 4 give best results because they probably have
most information in the range of 0-200.

As we can see from above that each transfer function does not give good results for all the images.
Therefore we move to a technique called histogram equalization.

3. Histogram Equalisation

3.1 What is histogram equalization?


Histogram equalization is a method in image
processing of contrast adjustment using
the image's histogram. This method usually
increases the global contrast of many images,
especially when the usable data of the image is
represented by close contrast values. Through
this adjustment, the intensities can be better Figure 4
distributed on the histogram. This allows for
areas of lower local contrast to gain a higher
contrast. Histogram equalization accomplishes
this by effectively spreading out the most
frequent intensity values
2.2 Example of histogram equalisation The cumulative distribution function (cdf) is
shown below. Again, pixel values that do not
The following is the same 8x8 sub image as used contribute to an increase in the cdf are excluded
in JPEG. The 8-bit grayscale image shown has for brevity.
the following values:

The general histogram equalization formula is:


The histogram for this image is shown in the
following table. Pixel values that have a zero
count are excluded for the sake of brevity.

For example, the cdf of 78 is 46. (The value of


78 is used in the bottom row of the 7th column.)
The normalized value becomes

Once this is done then the values of the


equalized image are directly taken from the
normalized cdf to yield the equalized values:
3.2 Visualization of results

SNo. INPUT IMAGE OUTPUT IMAGE


1.

2.

2.
3.

4.

5.

Conclusion: Histrogram Equalisation gives good results for all kinds of input images.

You might also like