Вы находитесь на странице: 1из 5

A study of changes in image contrast with various

algorithms

Catalin Ionescu, Cristian Fosalau and Daniel Petrisor


Faculty of Electrical Engineering
Technical University of Iasi
Iasi, Romania
catalin.ionescu@tuiasi.ro

Abstract—The contrast enhancement is an important part of the are included in the indirect category. A linear contrast
image enhancement process. The visual details become more modification technique can be adopted to improve the image
visible in an image with a high level of contrast. There are more details. The contrast transformation is made on piecewise.
techniques to improve a contrast image. In this paper we analyze Another technique is the non-linear contrast modification that
the contrast modification by three main methods: the histogram takes into account different mathematic functions like power,
equalization method, local histogram equalization (LHE) method logarithm and some filters [3]. One of the most well-known
and contrast limited adaptive histogram equalization (CLAHE) methods to change the contrast of an image is the histogram
method. The degree of contrast enhancement is measured using equalization. It can be divided in: global histogram equalization
the root-mean-square (RMS) parameter.
and local histogram equalization [4]. To the second method, a
Keywords - image processing; image enhancement; image
condition with which a user can control the intensity of the
contrast enhancement; contrast measurement. contrast can be added. This procedure is named CLAHE
(Contrast Limited Adaptive Histogram Equalization) [5]. The
I. INTRODUCTION histogram of an image has a statistical meaning which
represents the density probability of pixel values in an image. It
In order to improve a digital image, it is necessary to
can be graphically represented. The X axis symbolizes the
change the pixel values. Image enhancement is a subjective
maximum value that a pixel could have and the Y axis
term that depends on what interests us from a digital image. It
represents the number of pixels of an image with the same
can be considered as a process that makes the information of an
values. The histogram equalization is a common method to
image more determinable and perceptible by a human observer
modify the contrast. The data processing is made based on the
and also a good input for other methods of image processing.
image histogram information. The method attempts to uniform
In this way any image can be improved for a specific
the histogram and the color levels are better distributed on the
application. Any digital image processing finally results in the
whole image. Using the histogram equalization applied on a
deterioration of the initial image information. The most used
grey image results in a global improvement of the contrast and
methods to improve an image can be classified in two domains:
brightness normalization. This does not work well when we
spatial domain and frequency domain. The frequency domain
want to increase the contrast on low regions. By analyzing the
methods use the Fourier Transform to transfer the data from the
global histogram equalization, LHE and CLAHE, we want to
space domain into the frequency domain where these are
observe the changes of the image contrast and brightness,
processed. The Inverse Fourier Transform is used to bring the
focusing on the small patches such as the eye region on a
modified data back to the space domain. The time domain
human face. The image contrast will be assessed using the
methods work directly with the pixel values to enhance the
root-mean-square (RMS) parameter[6].
image. Many of these methods are used to perform changes on
the contrast and brightness of an image and others are used to II. TOTAL HISTOGRAM EQUALIZATION, LHE AND
eliminate the image noises. CLAHE ALGORITHMS
The contrast is one of the most used parameter to improve a A. Total histogram equalization algorithm
digital image. It can be defined as the brightness differences in
an image that make a good perceptual quality of the image Our study focuses on the grey image. The flowchart of this
details [1]. The changes of contrast can make a particular algorithm is shown in Fig. 1.
region to be more visible and more detailed in order to provide
the information of an image, in part or in whole. The methods
that modify the image contrast can be divided into two
dominant categories: direct and indirect methods [2]. The direct
methods improve the image contrast based on the contrast
measurement. The second ones try to improve the image
contrast without knowing its value. The most common methods
TOTAL HISTOGRAM
EQUALIZATION
B. Local histogram equalizatioon algorithm
Frequency of pixels calculation To improve the contrast of o small patches, we can use a
variant of the histogram equualization named LHE (Local
Probability of pixel frequency andd
Histogram Equalization). Its floowchart is shown below:
normalization calculation
LOCAL HISTOGRAM
H
EQUAL
LIZATION
Cumulative normalized histogram
m
calculation
Border im
mage creation
Cumulative distribution function
calculation
Templatte creation

Figure 1. The total histogram equalizationn algorithm


Template movinng over the whole
Let us consider a digital grey image witth NxM size. The im
mage
frequency of a pixel p(n) can be computed ass (1):
M N
Frequency of piixels calculation
fp n p n (1)
i 0 j 0 Probability of pixxel frequency and
normalizationn calculation
M and N are the number of columns andd rows and p(n) is
the value of a pixel. The values of the pixels will
w be normalized Cumulative norm
malized histogram
to [0,1]and the probability of the pixel frequuency describes the calcuulation
result of the division between the frequency of a pixel and the
number of all image pixels. This is described in (2).
Figure 4. The local equalization algorithm
P f ⁄MxN (2)
For the smallest value of a pixel, the cumuulative normalized An image of MxN size cann be defined as a matrix by MxN
histogram (CNH) is equal with the frequeency of the pixel dimension. Each element in thee matrix represents the pixels of
occurrence in the image. For other pixel valuues, the cumulative the image. We create a templatte that is a new square matrix by
normalized histogram is calculated as the sum of all CNH TxT dimension described in (55),where M an N are the number
values of the pixels which are smaller thann the target pixel's of columns and rows from thee initial image and is the pixel
value. The frequency of this pixel is added tot the result of the value fromk location.
sum. Equation (3) describes the mathematical model of the
cumulative normalized histogram. M T / N T / T

Patch T, T p (5)
(3) T / T /
CNH f CNH
VP For the processing of everyy pixel we must create a border
on the initial image. For a tem mplate by TxT size, the border
whereVP represents the smallest pixeel value from the must be of (T-1+T)x(T-1+T) dimension,
d because we want to
image. The cumulative distribution function (CDF) of the change all image pixels. The TxT T matrix will be moved over
NH of this pixel to
target pixel is calculated by dividing the CN the entire initial matrix and thee middle pixel value of the patch
the number of all pixels and the result is multiplied by the is changed. For each templatte the occurrence frequency of
number of bins (NB ) (4). pixels is calculated by meanns of (1) where M=N=T. The
CDF CHN ⁄MxN NB (4) probability of pixel frequency anda normalization are calculated
In Fig. 3 we can see that the contrastt of the Fig. 2 is with (2), where the number off template elements is given by
increased and some image areas are more visible. the square of T. The cumuulative distribution function is
calculated for the pixel values that are less or equal to the
middle pixel value of the tem mplate. Because the target pixel
value can be less than other pixel values, for these is not
necessary to calculate their CDF.C The initial pixel will be
changed with the value of its CD DF described in (4).
In the Fig. 5 and Fig. 6 we
w can see a very well contrast
improvement of the Fig. 2. Thiis image enhancement parameter
is changed when the size of the template is modified.

Figure 2. The initial image Figure 3. Thhe global HE


algorithm applied on Fig.1
M and N are the number of columns and rows,P is the
pixel value from index and P is the pixel values average of an
image. All pixel values are normmalized to [0,1]. This method of
contrast measuring does not depend
d on the spatial frequency
features or the spatial distributtion of the differences between
pixel values. As a result, we can
c measure the contrast of two
different images. We define thee image brightness as an average
of all pixel value normalized to (0,100). A dark image will
have 0 percent luminosity andd a white image will have 100
Figure 6. Thee LHE algorithm percent luminosity (8).
Figure 5. The LHE algorithm with
5x5 template dimension. with 21x21 tem
mplate dimension. M N
100
BR P (8)
M N 255
C. Contrast limited adaptive histogram equaalization
algorithm
It is a variant of the local histogram eqqualization method III. EXPERIMENTAL RESULTS AND DISCUSSION
where a new condition is introduced that is, the clipping level. For every tested image, we calculate the RMS contrast and
The LHE has good results and very manyy increases of the the brightness. We apply foor an initial image, the three
image contrast but the noise is increased tooo. This noise can algorithms: histogram equalizaation, LHE and CLAHE. For the
disturb an analyzer in processing the releevant information. last two, we changed the size of
o the patch and the value of the
There has been established that the effectt of noise can be clip limit.
limited. When the histogram equalization meethod is applied on
the small area of an image, its mapping function of pixel
intensities will be proportional with the cum mulative histogram.
The slope of the mapping function caan be considered
proportional with the contrast. When limiting the slope
intensity, the contrast will be changed ass well. The input
intensity of the mapping function is propportional with the
number of pixels of the same value at the giiven intensity. The
decrease of the slope intensity makes decreasse the height of the
histogram as well. If a histogram bin has a value greater than
the value established for the clip limit, all piixels that compose
the bin will be clipped and allocated to otherss bins.

Figure 9. Initial image with Figure 10. Global HE with


RMSc= 0.189 RMS c = 0.288
=43.53 % = 50.33 %
1000
1000 pixel number
pixel number
900
900
800
800
700
700
600
600
Figure 7. The CLAHE algorithm Figure 8. Thee CLAHE algorithm 500
500
with 5x5 template size and clip limit with 5x5 tem mplate size and clip 400
400
of 5. limit of 50.
300 300

200 200
D. Contrast and brightness measurement 100
100
To assess the degree of the contrast of an
a image, we used 0
0
the RMS contrast parameter given by (6). pixel value
0 50 100 150
pixel value
200 250
0 50 100 150 200 250

M N Figure 11. Histogram of the Fig.9 Figure 12. Histogram of the Fig.10
1
RMSC P P (6)
M N

M N
1
P P (7)
M N
Figure 13. LHE with Figure 14. LH
HE with Figure 17. CLAHE with Figure 18. CLAHE with
RMSc= 0.261 RMSc= 0.2388 RMSc = 0.236, = 48.30%, RMSc= 0.257, = 50.51%,
= 50.87 %, Patch = 5x5 = 51.92%, Patch = 21x21 Patch = 5x5, Clip limit = 3 Patch = 5x5,Clip limit = 11
1000 1000 1200 900
pixel number pixel number
n pixel number pixel number
900 900 800
800 800 1000
700
700 700
800 600
600 600
500
500 500 600
400
400 400
300 300 400 300

200 200 200


200
100 100 100
0 0 0 0
pixel value pixel value pixel value pixel value
0 50 100 150 200 250 0 500 100 150 200 250 0 50 100 150 200 250 0 50 100 150 200 250

Figure 15. Histogram of the fig.13 Figure 16. Hiistogram of the fig.14 Figure 19. Histogram of the fig.17 Figure 20. Histogram of the fig.18

In Fig. 9, the initial image is presented, on which we


applied the three algorithms. In Fig. 10, thee HE algorithm is
used to increase the global contrast of Fig. 9. In Fig. 13, the
result of the LHE algorithm applied to Figg. 9 is shown. We
used a 5x5 pixel size for the template. We can see that some
image areas become more visible and more contrasted, but the
general image perception is worse than in Fig.F 10. In Fig. 14,
for LHE algorithm a 21x21 pixel size is used u for the patch.
Overall, the image perception is worse thann in Fig. 13, but if
we are interested, for example, by the inforrmation about eye
region, this is a very good image change. Inn Figs. 17, 18, 21
and 22 the CLAHE algorithm is used with w different size
templates and values of clip limit parameter. Modifying the
Figure 21. CLAHE with Figure 22. CLAHE with
clip limit parameter, we can change the conntrast enhancement RMSc = 0.197, = 53.85%, RMSc = 0.217, = 54.85%,
whereas the noise image is limited. When thhe clip limit value Patch = 21x21, Clip limit = 3 Patch = 21x21, Clip limit = 11
increases the image noise increases too. Thiis can be observed 1400
pixel number 900
pixel number
making a comparison between Fig. 17 and Fiig. 18 that have the 1200 800
same value of the patch and different values of the clip limit. 700
1000
The same can be observed by comparing Fig. 21 and Fig. 22.In 600
some cases, if we are interested by a pooorly lit detail, the 800 500
CLAHE algorithm with a higher value of the patch will be 600 400
required to be used. If we are focused on thee whole image, the 300
clip limit will be a significant parameterr. Decreasing this 400
200
parameter, the small details will not be visibble, but the image 200 100
contrast will be greater than the initial im mage contrast. The
0 0
brightness value is changed, too. For exampple, in Fig. 22 the pixel value pixel value
0 50 100 150 200 250 0 50 100 150 200 250
brightness value is greater than in the Fig. 21,
2 since there are
more pixels with high value that are necessaryy to emphasize the Figure 23. Histogram of the fig.21 Figure 24. Histogram of the fig.22
small dark areas of the image. If the clip limiit and the RMS are
increased very much, the brightness value will increase too, The results written in the taable I resume the RMS and the
leading to a very low RMS value. brightness values of Fig. 9, the RMS and the brightness
values of the Total Histogram Equalization algorithm applied modify the contrast using some parameters, like the template
on the Fig. 9 and the RMS and brightness values of the LHE size and the value of clip limit. The CLAHE algorithm brings
algorithm applied on the same figure. For the LHE algorithm, improvements with respect to the other two because it can
we set several patch dimensions. better control the image contrast and noise by controlling the
patch value. The LHE and the CLAHE algorithms are very
In the below table we can see that the RMS of the initial useful for small areas information.
image and the brightness values are improved with the Total
Histogram Equalization algorithm. Overall, the image is REFFERENCES
clearer and the transition between the white regions and the [1] A. Saleem, A. Beghdadiand B. Boashash, “Image fusion-based contrast
black regions is steeper. The LHE's RMS results decrease and enhancement, ”EURASIP Journal on Image and Video Processing2012,
2012:10.
the brightness values increase proportional with the size of
[2] S.C. Huang , C.H. Yehlosing, “Image contrast enhancement for
patch. The main benefit of this algorithm is proved when we preserving mean brightness without losing image features, ”Engineering
are interested by a certain region of an image. Such a region Applications of Artificial Intelligence 26,2013, pp. 1487–1492.
could be the eye's area of a human face that is poorly lit. LHE [3] Aca D. Micić, Biljana R. Đorđević, Vlastimir D. Nikolić, Miodrag M.
algorithm highlights the subtle information of a small area. Stojiljković, “Non-linear image contrast enhancement for determining
dimensions of objects in the presence of industrial evaporation,
TABLE I. RMS AND BRIGHTNESS VALUES FOR AN INITIAL IMAGE, ”Mechanical Engineering Vol. 8, No 1, 2010, pp. 39 - 46.
TOTAL HISTOGRAM EQUALIZATION, LHE WITH DIFFERENT SIZE OF THE [4] J.B. Zimmerman, S.B. Cousins, K. M. Hartzell, M.E. Frisse, and
PATCH M.G. Kahn, “A psychophysical comparison of two methods for
RMS Initial Image = 0.189 adaptive histogram equalization, ”Journal of Digital Imaging, Vol. 2,
Brightness Initial image = 43.53 % No 2 (May), 1989,pp 82-91.
RMS Total Histogram Equalization = 0.288 [5] J. B. Zimmerman, J. B. and S. M. Pizer “Evaluation of the effectiveness
Brightness Total Histogram Equalization = 50.33 % of adaptive histogram equalization”, Proc. 25th Fall Symposia -
Imaging, November 17-22, 1985, Soc. of Photographic Scientists and
LHE -
3x3 5x5 7x7 9x9 11x11 13x13 15x15 17x17 19x19 21x21 Engineers, 1985, pp. 189-190.
patch
[6] B. Seok Min, D. Kyun Lim, S. Jong Kim and J. Heung Lee “A Novel
RMS 0.265 0.261 0.254 0.248 0.243 0.243 0.240 0.240 0.239 0.238 Method of Determining Parameters of CLAHE Based on Image Entropy
”International Journal of Software Engineering and Its Applications,
Brightness Vol.7, No.5,2013, pp.113-120.
51.10 50.87 50.92 51.14 51.23 51.36 51.64 51.73 51.82 51.92
(%) [7] E. Peli “Contrast in complex images” J. Opt. Soc. Am. A/Vol. 7, No.
Table II shows the RMS and brightness values of the 10/October 1990.
CLAHE algorithm with 3x3 patch size and different values of
the clip limit. For a 3x3 patch size, the maximum value of the
clip limit is 9, that is given by the maximum number of pixels
that can have the same value.
TABLE II. RMS AND BRIGHTNESS VALUES FOR AN INITIAL IMAGE,
TOTAL HISTOGRAM EQUALIZATION, CLAHE WITH THE SIZE OF PATCH BY
3X3 AND DIFFERENT VALUES FOR THE CLIP LIMIT

RMS Initial Image = 0.189


Brightness Initial image = 43.53 %
RMS Total Histogram Equalization = 0.288
Brightness Total Histogram Equalization = 50.33 %
CLHE -
3x3
patch
CLHE -
1 2 3 4 5 6 7 8 9
clip limit
RMS 0.225 0.243 0.248 0.252 0.255 0.258 0.260 0.262 0.265

Brightness
45.98 46.59 46.82 47.61 48.53 49.33 49.95 50.49 50.80
(%)

In the above table, the values of the RMS parameter show


that the user can control the contrast of an image by using the
CLAHE algorithm with a certain patch value.
IV. CONCLUSION
In this paper, we investigated the possibility if increasing an
image contrast using three of the most common methods: the
Global Histogram Equalization method, the LHE method and
the CLAHE method in order to highlight their benefits and
drawbacks with respect to one another. For the last two, we can

Вам также может понравиться