Image Contrast Enhancement Using Histogram Modification Technique

DOI : 10.17577/IJERTV1IS7236

Download Full-Text PDF Cite this Publication

Text Only Version

Image Contrast Enhancement Using Histogram Modification Technique

Shekhar R. Suralkar 1, Atul H. Karode 2, Manali S. Rathi 3

1 Asso. Prof. (E&TC Dept.), SSBTs COET, Jalgaon, India

2 Asst. Prof. (E&TC Dept.), SSBTs COET, Jalgaon, India

3 Student, M.E. E&TC (Digital Electronics), SSBTs COET, Jalgaon, India

Abstract Image contrast enhancement plays a vital role in digital image processing especially in biomedical applications and secures digital image transmission. The objective of any image enhancement technique is to improve the characteristics or quality of an image, such that the resulting image is better than the original image. To improve the image contrast, numerous enhancement techniques have been proposed. One of the conventional methods adopted is the Histogram Equalization (HE) technique. Histogram Equalization (HE) has proved to be a simple and effective image contrast enhancement technique. However, it tends to change the mean brightness of the image to the middle level of the gray-level range, which is not desirable in many applications. Thus, HE has limitations since preserving the input brightness of the image is required to avoid the generation of non-existing artifacts in the output image. To surmount this drawback, Bi-HE methods for brightness preserving and contrast enhancement have been proposed. Although these methods preserve the input brightness on the output image with a significant contrast enhancement, they may produce images which do not look as natural as the original images. In order to overcome this drawback, this work proposes a low-complexity histogram modification algorithm for contrast enhancement and thereby introducing specifically designed terms, the level of contrast enhancement can be adjusted and thus noise robustness, white/black stretching and mean brightness preservation may easily be incorporated into the optimization.

Keywords Contrast Enhancement, Histogram Equalization, Histogram Modification

1. Introduction

Contrast enhancement is one of the most important issues of image processing and applications. It is believed that it is a fundamental step in Image Segmentation [1]. Contrast enhancement plays a crucial role in image processing applications, such as digital photography, medical image analysis, remote sensing, LCD display processing, and scientific visualization. There are several reasons for an image/video to have poor contrast: the poor quality of the used imaging device, lack of expertise of the operator, and the adverse external conditions at the time of acquisition. These effects result in under-utilization of the offered dynamic range. As a result, such images and videos may not reveal all the details in the captured scene, and may have a washed-out and unnatural look. Contrast enhancement targets to eliminate these problems, thereby to obtain a more visually-pleasing or informative image or both. Typical viewers describe the enhanced images as if a curtain of fog has been removed from the picture.

Image enhancement techniques can be broadly categorized into two groups: direct methods and indirect methods. Direct methods define a contrast measure and try to improve it. Indirect methods, on the other hand, improve the contrast through exploiting the under-utilized regions of the dynamic range without defining a specific contrast term. Most methods in the literature fall into the second group. Indirect methods can further be divided into several subgroups: i) techniques that decompose an image into high and low frequency signals for manipulation, e.g., homomorphic filtering, ii) histogram modification techniques, and iii) transform-based techniques. Out of these three subgroups, the techniques based on histogram of the image received the most attention due to its straightforward and intuitive implementation qualities.

The most common way to improve the contrast of an image is to modify its pixel value distribution, or histogram. Contrast enhancement techniques in the second subgroup modify the image through some pixel mapping such that the histogram of the processed image is more spread than that of the original image. Techniques in this subgroup either enhance the contrast globally or locally. If a single mapping derived from the image is used then it is a global method; if the neighborhood of each pixel is used to obtain a local mapping function then it is a local method. Using a single global mapping cannot (specifically) enhance the local contrast.

One of the most popular GCE techniques is histogram equalization (HE). HE is widely used for contrast enhancement in a variety of applications due to its simple function and effectiveness. However, it tends to change the brightness of an image and hence, not suitable for consumer electronic products, where preserving the original brightness is essential to avoid annoying artifacts. In addition, HE method tends to introduce unneccessary visual deterioration including saturation effect. Preserving the input brightness of an image and keeping PSNR in the desired range are required to avoid the generation of non-existing artifacts in the output image.

Various methods have been proposed for limiting the level of enhancement, most of which are obtained through modifications on HE. For example, Mean preserving Bi- Histogram Equalization (BBHE) was proposed to overcome the brightness preservation problems. BBHE seperates the input image/video histogram into two parts based on input mean before equalizing them independently [2]. Later, Equal Area Dualistic Sub-Image Histogram Equalization (DSIHE) was proposed to separate the histogram by entropy value [8]. Again, an extension of BBHE which was referred to as Minimum Mean Brightness Error Bi-Histogram Equalization

(MMBEBHE) was proposed to provide maximal brightness

preservation [3]. Although they are visually more pleasing than HE, these techniques cannot adjust the level of enhancement and are not robust to noise, which may become a problem when the histogram has spikes. Also, it should be noted that preserving the brightness does not imply preservation of naturalness.

One recent method proposed by Wang and Ward [4] suggests modifying the image histogram by weighting and thresholding before histogram equalization. The weighting and thresholding is performed by clamping the original histogram at an upper threshold Pu and at a lower threshold Pl

, and transforming all the values between the upper and lower thresholds using a normalized power law function with index

to obtain an image with a histogram that is as close as

possible to a uniform distribution to fully exploit the dynamic range. A histogram, h[n], can be regarded as an un- normalized discrete probability mass function of the pixel intensities. The normalized histogram p[n] of an image gives the approximate probability density function (PDF) of its pixel intensities. Then, the approximate cumulative distribution function (CDF), c[n], is obtained from p[n]. The mapping function is a scaled version of this CDF. HE uses the image histogram to obtain the mapping function; whereas, other histogram-based methods obtain the mapping function via the modified histogram. The mapping function in the discrete form is given as

B n

r > 0. There are also unconventional approaches to the

T[n] (2

1) p[ j] 0.5


histogram based contrast enhancement problem. Gray-level grouping (GLG) [11] is such an algorithm that groups histogram bins and then redistributes these groups iteratively. Although GLG can adjust the level of enhancement and is robustto histogram spikes, it is mainly designed for still images. Since gray-level grouping makes hard decisions on grouping histogram bins, and redistributing the bins depends on the grouping, mean brightness intensity in an image sequence can abruptly change in the same scene. This causes flickering, which is one of the most annoying problems in video enhancement. Although a fast version of the algorithm is available, GLGs computational complexity is high for most applications. Contrast enhancement techniques in the first and third subgroups often use multiscale analysis to


where B is the number of bits used to represent the pixel values, and n [0, 2B – 1]. Although the histogram of the processed image will be as uniform as possible, it may not be exactly uniform because of the discrete nature of the pixel intensities [6].

It is also possible to enhance the contrast without using the histogram. Black stretching and white stretching are simple but effective techniques used in consumer-grade TV sets. Black stretching makes dark pixels darker, while white stretching makes bright pixels brighter. This produces more natural looking black and white regions; hence, it enhances the contrast of the image. Linear black and white stretching can be achieved by the mapping

decompose the image into different bands and enhance desired global and local frequencies. These techniques are computationally complex but enable global and local contrast enhancement at the same time by enhancing the appropriate

n sb ,

T[n] n g[n],


w (n w) s

n b

b n w

, w n



The aforementioned contrast enhancement techniques perform well on some images but they can create problems when a sequence of images is enhanced, or when the histogram has spikes, or when a natural looking enhanced image is strictly required. In addition, computational complexity and controllability become an important issue when the goal is to design a contrast enhancement algorithm for consumer products. In order to achieve all these requirements, this work presents a histogram modification based method which aims to better preserve the image quality, preserves better contrast and enriches the image details. In summary, our goal in this paper is to obtain a visually pleasing enhancement method that has low- computational complexity and can be easily implemented on FPGAs or ASICs and works well with both video and still images.

Section II introduces the details about the contrast

where b is the maximum gray-level to be stretched to black and w is the minimum gray-level to be stretched to white, g[n] is any function mapping the intensities in between, and sb, sw are black and white stretching factors both of which are less than one.

3. Histogram Equalization Technique

The main objective of histogram equalization [5], [9] is to obtain a uniform histogram for the output image [15]. The procedure to perform histogram equalization techniques is as follows:

  1. Find the running sum of the histogram values.

  2. Normalize the running sum values by dividing by the total number of pixels.

  3. Multiply the normalized values by maximum gray level and round off to the nearest integer value.

  4. Map the gray level values using a one to one mapping.

enhancement and mapping functions. Section III describes

the conventional histogram equalization technique. Section

IV gives the details of the proposed method. In Section V, experimental results and measures are provided. Finally, Section VI contains concluding remarks.

For a given digital image G (i,j) with M pixels and a gray

level of [0,L-1].The probability density function (PDF) is given by

2. Contrast Stretching Mapping Function


) un



kn 0,1,K,K, L 1


Histogram-based contrast enhancement techniques utilize the image histogram to obtain a single-indexed mapping T[n] to modify the pixel values. In HE and other histogram-based

where un is the number of times level k appears in an image.

The running sum or cumulative density function (CDF) of histogram values is obtained by


methods, mapping function is obtained from the histogram or

the modified histogram, respectively [5]. HE finds a mapping

C(kn ) P(m)


for kn 0,1,K,K, L 1


Using the running sum, histogr am equalization plots an

with its neighbors (denoted by C ). That is,

V~ol. 1 Issue 7, September – 2012

h[i] p[i | C] ,

input level kn into an output level kn .


p[i | C] denotes the probability of a pixel having gray-

kn (L 1) C(kn )


level i given the event C. Performing histogram equalization

The output level can be increment by


on h rather than h will enhance the contrast but not the

kn (L 1) P(kn )


noise, since the former will only utilize the dynamic range for

The above equation indicates that distance between kn and kn 1 has direct relation with PDF of the input image at the gray level kn . In the Histogram Equalization, the pixel

pixels that have some level of contrast with their neighbors.

Noting that the histogram modification methods presented in the previous section also aim to increase contrast but not the noise visibility, they must modify the histogram in such a

values are uniformly distributed with gray level values across

way that the modified histogram resembles

p[i | C]


their range. HE over enhances the background of the image


p[i] . However, one can simply obtain

p[i | C] by

and often produces the improbable effects in the image.

An example of histogram equalization is shown in fig. 1. The original image and the equalized image and their corresponding histograms are shown. It can be clearly seen that the equalization results in the uniform spreading of the bins in the original histogram and though enhanced, the equalized image may or may not be as natural looking as the original image.

Figure 1. Example of HE : The original image and its histogram, and the equalized versions.

counting only those pixels that have contrast, rather than solving complex optimization problems, which in essence corresponds to dealing with histogram spikes resulting from smooth area (noncontrast) pixels after computing the histogram in the conventional way.

To obtain the histogram, the local variation of each pixel can be used to decide if a pixel has sufficient contrast with its neighbors. One efficient way of achieving this for hardware simplicity is to use a horizontal variation measure by taking advantage of the row-wise pixel processing architecture, which is available in common video processing hardware platforms. A horizontal one-lagged difference operation is a high-pass filter, which will also measure noise. On the other hand, a horizontal two-lagged difference operation is a band- pass filter which will attenuate high-frequency noise signals. Histogram is created using pixels with a two-lagged difference that has a magnitude larger than a given threshold (steps 5, 6, 7). The number of pixels included in the histogram is also counted for proper normalization.

4.2. Adjusting the Level of Enhancement

It is possible to adjust the level of histogram equalization to achieve natural looking enhanced images. The modified histogram is a weighted average of the input histogram and the uniform histogram , as given in (7).

  1. Proposed Method

    ~ hi u


    h hi u


    In this paper, we are implementing the contrast

    1 1


    enhancement method proposed in [6]. Here in this section, a low-complexity histogram modification algorithm is

    The contribution of th input histogram in the modified histogram is

    presented which deals with histogram spikes, performs B&W

    * 1/(1 )


    stretching, and adjusts the level of enhancement adaptively so

    that the dynamic range is better utilized while handling the noise visibility and the natural look requirements.

    1. Histogram Computation

      To deal with histogram spikes in a simple way, instead of smoothing or weighting the input histogram, one can change the way a histogram is computed. Histogram spikes are created because of a large number of pixels that have the same gray-level and these pixels almost always come from smooth areas in the input image when they create artifacts/noise in the enhanced image. Hence, histogram computation can be modified so as to take pixels that have some level of contrast with their neighbors into account, which will solve the histogram spike problem at the very beginning. It is also possible to relate this practical approach with optimization based solutions as follows: For a successful contrast enhancement, the histogram should be modified in

      The level of histogram equalization should be adjusted depending on the input images contrast. Low contrast images have narrow histograms and with histogram equalization, contouring and noise can be created. Therefore, k is computed to measure the input contrast using the aggregated outputs of horizontal two-lagged difference operation (step 4). Afterwards, k is multiplied by a user- controlled parameter g, then gk is normalized to the range [0, 1] (step 11) to get k*. It is a good practice to limit the maximum contribution of a histogram, since this will help with the worst-case artifacts created due to histogram equalization. By choosing the maximum value that gk can take on as a power of two, the normalization step can be done using a bit-shift operation rather than a costly division. To ensure that hi and u have the same normalization, u is obtained using the number of pixels that are included in the histogram (step 12). umin is used to ensure that very low bin

      regions of the histogram will not result in very low slope in

      such a way that the modified histogram,


      h , represents the

      the mapping function; it will increase the slope in these

      conditional probability of a pixel, given that it has a contrast

      regions, resulting in increased-utilization of dynamic range.

      B&W stretching is performed using (9) (step 17) and maximum intensity values in each block, and averaging



      h ((1 )I I


      (hi u)



      where IB is a diagonal matrix, IB (i, i) = 1 for i {[0, b] v [w, 255]} and the remaining diagonal elements are zero.

      The MSE value is given by

      1 i1 j1


      Parameters b, w and can be adapted with the image content. b and w is usually derived from the histogram as the



      m0 n0

      x m, n y i, j


      minimum and maximum intensities. For noise robustness, b should be chosen as the minimum gray-level that is bigger than some predefined number of pixels intensities, w can be chosen similarly. It is a good practice to impose limits on b and w. The stretching parameter should also be adapted with image content. For dark images white stretching can be favored, while for bright images black stretching can be favoured. may also depend on the input images contrast.

      Proposed Histogram Modification Algorithm [6]

      Step 1 : Read input image, B&W stretch parameters b, w, and

      1/(1 ) , level of enhancement value g

      Step 2 : Calculate the histogram using pixels with a two – lagged difference that has a magnitude larger than a given threshold

      Step 3 : Aggregate the two-lagged operation as

      Step 4 : Count the number of pixels included in the histogram for proper normalization

      where the size of an image is i x j. The original and restored

      images are x(m, n) and y(i, j).

      The PSNR is the ratio between the maximum possible power of a signal and the power of corrupted noise.

      PSNR = 20 x log10 (255/sqrt(MSE)) (12)

      1. (b)

      Step 5 : Calculate g, which are the control parameters

      Step 6 : Perform the normalization using a bit-shift operation

      Step 7 : Calculate umin which will increase the slope in the mapping function, resulting in increased utilization of dynamic range

      Step 8 : Obtain u using umin and the number of pixels that are included in the histogram

      u mincount / 256,umin

      Step 9 : Perform contrast stretching

  2. Experimental Results and Discussions

    In order to test the proposed method, experiments are performed on various images regardless of the image size. The input image can be of any size. Observation of all these images show that the proposed method outperform well compared to the histogram equalization. However, it is usually desired to have some quantitative measures in addition to subjective assessment i.e. visual interpretation.

    Therefore, to evaluate the image enhancement and restoration performance, the quantitative measures such as Absolute Mean Brightness Error (AMBE), the Discrete Entropy (H), Measure of Enhancement (EME), Mean Squared Error (MSE) and Peak Signal to Noise Ratio (PSNR) are used as the criterion.

    AMBE is defined as the absolute difference between input and output mean values.

    AMBEn = IE(X) – En(Y)I (10)

    The discrete entropy H is used to measure the content of an image, where a higher value indicates an image with richer details.

    The measure of enhancement (EME) approximates an average contrast in the image by dividing image into non- overlapping blocks, finding a measure based on minimum

    1. (d)

      Figure 2. Results for image Lady with Hat. (a) Original Image, (b) Enhanced image obtained using HE, (c) Enhanced image obtained using the proposed algorithm, (d) Mappings for enhanced images : blue line indicates HE mapping, red dotted line indicates the proposed method and the dotted line indicates no change mapping.

      The performance of the proposed method is compared with the conventional histogram equalization technique. The proposed algorithm has been successfully tested on a variety of test images. Only, a few of the results are shown in this paper.

      Fig. 2, 3, 4, 5, 6 shows the original image and their corresponding contrast enhanced image using HE and proposed method.

      The proposed algorithm is compared with the conventional histogram equalization. In the histogram equalization, the pixels are spreading uniformly. Usually Histogram Equalized resultant images have unnatural look that means HE over enhances the images. The proposed method reduces the effect caused by the histogram equalization. When the contrast of an image is enhanced, as an upshot the noise induced in the image will be high and the image looks unnatural. Thus, the proposed technique can be effectively used to improve the contrast of the images and filter out the noises in the image and preserves the edges.

      1. (b)

    (c) (d)

    Figure 3. Results for image Living Room. (a) Original Image, (b) Enhanced image obtained using HE, (c) Enhanced image obtained using the proposed algorithm, (d) Mappings for enhanced images : blue line indicates HE mapping, red dotted line indicates the proposed method and the dotted line indicates no change mapping.

    (a) (b) (c) (d)

    Figure 4. Results for image Lena. (a) Original Image, (b) Enhanced image obtained using HE, (c) Enhanced image obtained using the proposed algorithm, (d) Mappings for enhanced images : blue line indicates HE mapping, red dotted line indicates the proposed method and the dotted line indicates no change mapping.

    Vol. 1 Issue 7, September – 2012

    (a) (b)

    (c) (d)

    Figure 5. Results for image Halloween. (a) Original Image, (b) Enhanced image obtained using HE, (c) Enhanced image obtained usng the proposed algorithm, (d) Mappings for enhanced images : blue line indicates HE mapping, red dotted line indicates the proposed method and the dotted line indicates no change mapping.

    (a) (b)

    (c) (d)

    Figure 6. Results for image Lady. (a) Original Image, (b) Enhanced image obtained using HE, (c) Enhanced image obtained using the proposed algorithm, (d) Mappings for enhanced images : blue line indicates HE mapping, red dotted line indicates the proposed method and the dotted line indicates no change mapping.

    Table 1. Quantitative Measurement Results

    Vol. 1 Issue 7, September – 2012



















    Lady with Hat













    Living Room







































    New York


























    Computed quantitative measures AMBE, H, EME, MSE and PSNR listed in Table I supplement the visual assessment. Comparison of AMBE values shows that the proposed method outperforms the HE method in all the images, which indicates better preservation of mean brightness in the image. Comparison of H values show that the proposed method again outperform HE. Normally, one would expect HE to give higher discrete entropy value as HE results in more uniform histogram distribution. However, HE results in bin

    grouping and this decreases the value.

    Comparison of EME values show that HE outperforms the proposed method; HE gives higher EME values than the proposed method. Since EME measures a form of contrast, it is no surprise that HE gives the highest value even though it does not produce the most visually pleasing image.

    Also, from PSNR and MSE values, we can conclude that these values are better than the HE method, indicating less noise in the enhanced image.

  3. Conclusion

In this paper, we propose a novel approach of image enhancement technique using histogram modification algorithm. The proposed framework employs carefully designed penalty terms to adjust the various aspects of contrast enhancement. Hence, the contrast of the image/video can be improved without introducing visual artifacts that decrease the visual quality of an image and cause it to have an unnatural look. To obtain a real-time implementable algorithm, the proposed method avoids complex calculations and memory-bandwidth consuming operations. The experimental results show the effectiveness of the algorithm in comparison to conventional contrast enhancement algorithms. Obtained images are visually pleasing, artifact free, and natural looking. The proposed method is applicable to a wide variety of images and video sequences. It also offers a level of controllability and adaptivity through which different levels of contrast enhancement, from histogram equalization to no contrast enhancement, can be achieved.


  1. H. D Cheng, Huijuan Xu, A Novel Fuzzy Logic Approach to Contrast Enhancement, Pattern Recognit., Vol. 33, No. 5, Pages 809819, May 2000.

  2. Hojat Yeganeh, Ali Ziaei, Amirhossein Rezaie, A Novel Approach for Contrast Enhancement based on Histogram Equalization, Proceedings of Int. Conf. on Computer and Communication Engineering, 2008.

  3. David Menotti, Laurent Najman, Jacques Facon, and Arnaldo de A. Araújo. Multi-Histogram Equalization Methods for Contrast Enhancement and Brightness Preserving, IEEE Transactions on Consumer Electronics, Vol. 53, No. 3, pages 1186-1194, August 2007.

  4. Q. Wang and R. K. Ward, Fast image/video contrast enhancement based on weighted thresholded histogram equalization, IEEE Trans. Consum. Electron., Vol. 53, No. 2, Pages 757764, May 2007.

  5. R. C. Gonzalez and R. E.Woods, Digital Image Processing, 2nd ed. Englewood Cliffs, NJ: Prentice-Hall, 2002.

  6. Tarik Arici, Salih Dikbas, and Yucel Altunbasak, A Histogram Modification Framework and Its Application for Image Contrast Enhancement, IEEE Transactions On Image Processing, Vol. 18, No. 9, pages 1921-1935, September 2009

  7. William K. Pratt, Digital Image Processing, 4th ed., Wiley Publication, 2007

  8. G. de Haan, in Video Processing for Multimedia Systems, Eindhoven,

    The Netherlands, 2000

  9. Manpreet Kaur, Jasdeep Kaur, Jappreet Kaur, Survey of Contrat Enhancement Techniques based on Histogram Equalization, International Journal of Advanced Computer Science and Applications, Vol. No. 2, Issue No. 7, Pages 137-141, 2011.

  10. A. Polesel, G. Ramponi, and V. Mathews, Image enhancement via adaptive unsharp masking, IEEE Trans. Image Process., vol. 9, no. 3, pp. 505510, Mar. 2000

  11. Z. Y. Chen, B. R. Abidi, D. L. Page, and M. A. Abidi, Gray-level grouping (GLG): An automatic method for optimized image contrast enhancementPart I: The basic method, IEEE Trans. Image Process., vol. 15, no. 8, pp. 22902302, Aug. 2006.

  12. J. A. Stark, Adaptive image contrast enhancement usign generalizations of histogram equalization, IEEE Trans. Image Process., vol. 9, no. 5, pp. 889896, May 2000.

  13. Vinay Kumar, Himani Bansal, Performance Evaluation of Contrast Enhancement Techniques for Digital Images. International Journal of Consumer Sciences and Technologies, Vol. 2, Issue 1, March 2011

  14. Anil K. Jain, Fundamentals of Digital Image Processing, PHI Publication, 2005

  15. Hyunsup Yoon, Youngjoon Han, and Hernsoo Hahn, Image Contrast Enhancement based Sub-histogram Equalization Technique without Over-equalization Noise. World Academy of Science, Engineering and Technology, 2009.

Leave a Reply