Keywords

1 Introduction

In the process of digital photography, the lack of environment light makes the image dark, and loses image details and contrast. There are many kinds of image enhancement algorithms, which are mainly divided into spatial domain and frequency domain [16]. To solve the quality defects of low-contrast images, Zhang and Cui [7], Wu and Wang [8] used piecewise linear function to process the grayscale images. Although it can improve the image contrast in certain extent, some adjacent gray values may be combined into the same gray value and lead to the fault phenomenon in the process of histogram segmentation. Wang et al. [9] proposed the method of histogram equalization to enhance the image contrast globally, but the effect is not obvious, and the background of the image and noises inhibits the details of the image. Huang and Jiang [10] proposed an enhancement method of low-contrast images based on wavelet transform, which might create unnecessary noise and affect the image sharpness and limit the enhancement effect of image contrast. Di et al. [11] proposed the enhancement algorithm combined with histogram compaction equalization (abbreviated as HCE), which used the threshold selection method to improve the contrast of grayscale images based on local maximum values, but the image details and sharpness were not enhanced substantially. The paper studies the image enhancement algorithm of histogram compaction equalization based on the adaptive thresholds (abbreviated as ATHCE in the following text) in the spatial domain for the low-contrast chromatic image through selecting the reasonable equalization threshold of R, G, and B channel of the image to improve the contrast and the sharpness of color images, and the performance of the algorithm is verified by a low-contrast image.

2 Principle of ATHCE Algorithm

Low-contrast images have the characteristic of sparse distribution in grayscale and many gray levels do not exist in the images. In order to make the sparse distribution of the grayscale histogram of R, G, and B channels of the low-contrast chromatic images compact, the histogram compaction equalization based on the adaptive thresholds (ATHCE) algorithm was proposed on basis of HCE [11] method. ATHCE algorithm removes the gray levels from the histogram of R, G, and B channels whose pixel number is zero, and chooses the threshold value between the gray value of the details and the background to inhibit the image background and noises and improve the image contrast and sharpness, and highlight the image details. The process of the algorithm is as follows.

  1. (1)

    Extracting the color data from R, G, and B channel of the low-contrast chromatic image.

  2. (2)

    Calculating the grayscale histogram of R, G, and B channel, S K (i), i = 0–255; K = 1, 2, 3 represent the R, G, and B channel separately.

  3. (3)

    Compacting the grayscale histogram of R, G, and B channel and store the results as \(S_{K}^{*} (j)\), then:

    $$S_{K}^{*} (j) = S_{K} (i),S_{K} (i) \ne 0$$
    (34.1)

    Here i = 0–255, K = 1, 2, 3, j = 0–n, n is the gray level whose pixel number is nonzero in the grayscale histogram of each channel.

  4. (4)

    Calculating the average thresholds AVE(K) of the histogram of the compacted R, G, and B channel. Find the local maxima \(S_{K}^{*} \left( m \right)\) and the local minima \(S_{K}^{*} (n)\) of \(S_{K}^{*} (j)\), m = 0–M, n = 0–N, M and N are the number of local maxima and local minima, and then average the mean values of all local maxima and the mean values of all local minima for each channel, see formula 34.2, the result is treated as the threshold AVE(K).

    $${\text{AVE}}(K) = (\frac{1}{M}\sum\limits_{m = 0}^{M} {S_{K}^{*} (m)} { + }\frac{1}{N}\sum\limits_{n = 0}^{N} {S_{K}^{*} (n)} )/2$$
    (34.2)
  5. (5)

    Compare the grayscale histogram value \(S_{K}^{*} (j)\) and the average threshold AVE(K), and get the improved histogram \(T_{K}^{'} (i)\)(see formula 34.3), i = 0–255; K = 1, 2, 3.

    $$T_{{K^{{\prime }} }} (i) = \left\{ {\begin{array}{*{20}l} {S_{K}^{*} (i)} \hfill & {S_{K}^{*} (i) \le {\text{AVE}}(K)} \hfill \\ {{\text{AVE}}(K)} \hfill & {S_{K}^{*} (i) > {\text{AVE}}(K)} \hfill \\ \end{array} } \right.$$
    (34.3)
  6. (6)

    Equalize the histogram of R, G, and B channel according to the improved histogram \(T_{K}^{'} (i)\) and then merge the three channels into a color image which is the new copy with enhanced contrast of the original low-contrast chromatic image.

3 Application and Results Analysis

  1. (1)

    Experiment and the results

In order to verify the performance of ATHCE algorithm proposed in the paper, a low-contrast color image with 256 × 256 pixels (seen in Fig. 34.1a) was used and processed by ATHCE algorithm in the experiment. Meanwhile, the image was also processed by the traditional histogram equalization method and the enhancement method based on wavelet transform proposed by Huang and Jiang [10].

Fig. 34.1
figure 1

Tested image and its enhanced effects

The enhancement effects of the three methods are shown in Fig. 34.1. Figure 34.1b–d separately represents the result of the traditional histogram equalization method, the enhancement method based on wavelet transform, and the enhancement method with ATHCE algorithm.

  1. (2)

    Subjective evaluation and analysis

As shown in Fig. 34.1a, the grayscale of most pixels in the original image are concentrated in the middle tone, the image looks flat with low contrast. Figure 34.1b shows that the contrast and details of the image have a certain degree of improvement through the traditional histogram equalization method, but some of the image tonal levels are lost. Figure 34.1c shows that the tonal level of the image was well preserved after applying the enhancement method based on wavelet transform, but the image contrast was not improved obviously. While, the image details, sharpness, and brightness contrast were improved greatly with the enhanced method of ATHCE, the “Sun Life” signed on the top of the building are more prominent, seen in Fig. 34.1b. Furthermore, the image processed by ATHCE algorithm is the closest to the original image judging from the color performance.

Figure 34.2 shows the R, G, and B channel information of the images in Fig. 34.1. Compare the R, G, and B channel information in Fig. 34.2b–d, the image processed by ATHCE algorithm has better grayscale distribution than the other two images. The average thresholds of R, G, and B channel of the original color image calculated by ATHCE algorithm are 269, 267, and 247, which can keep the image details well enough and inhibit the influence of the background and noises. As shown in Fig. 34.2d, the image processed by ATHCE algorithm well preserves the proportion relationship between the R, G, and B channel and the gradation of each channel in the original image and extends the tonal distribution of the original image well, which bring about the significant contrast improvement.

Fig. 34.2
figure 2

Histograms of the tested images. a Histogram of image in Fig. 34.1a. b Histogram of image in Fig. 34.1b. c Histogram of image in Fig. 34.1c. d Histogram of image in Fig. 34.1d

  1. (3)

    Objective evaluation and analysis

Here, the image quality evaluation index of root mean square error (RMSE), the sharpness index (SI), information entropy (IE) and peak signal-to-noise ratio (PSNR) are used [12]. Information entropy indicates how much information the image contains. If the number of the image grayscale is i, the probability of the grayscale of no. i is p i , then the gray information entropy of the image is:

$$e(i) = - p_{i} \log p_{i}$$
(34.4)

The information entropy of the whole image is:

$$E = \sum\limits_{i = 0}^{i} {e(i) = } - \sum\limits_{i = 0}^{i} {p_{i} \log p_{i} }$$
(34.5)

When the probability of each gray level of the image is equal, the E value reaches the maximum, which means the image contains the maximum amount of information.

Sharpness index is often used for comparing the improvement effect of image quality before and after the enhancement. To the image with M * N pixels, its sharpness index is defined as:

$$L = 1 - \frac{1}{MN}\sum\limits_{x = 0}^{M - 1} {\sum\limits_{y = 0}^{N - 1} {\hbox{min} [p(x,y),1 - p(x,y)]} }$$
(34.6)

Here, \(p\left( {x,y} \right) = \sin [\pi /2(1 - f(x,y)/f_{ \hbox{max} } )]\), f max is the largest gray value in the image. According to the definition of formula (34.5) of the sharpness index, if the image has large grayscale range, the image will have good sharpness and high sharpness index, otherwise the image sharpness index will be low.

Table 34.1 contains the objective quality evaluation results of the low-contrast chromatic images processed by the traditional histogram equalization method, the enhancement method based on wavelet transform, and ATHCE algorithm proposed in the paper.

Table 34.1 Objective quality evaluation results of the images with different enhanced methods

It can be seen from Table 34.1 that the color image processed by ATCHE algorithm has the smallest mean square error, the biggest information entropy, peak signal-to-noise ratio and sharpness index than the images enhanced through the other two methods.

The information entropy and sharpness index of the original image are 6.8728 and 0.7610. It can be seen from Table 34.1 that the information entropy of color image enhanced by ATCHE algorithm is the closest to the information entropy of the original image among the three methods, which means the image enhanced by this method has the least information loss. Meanwhile, the images enhanced by the traditional histogram equalization method and ATCHE algorithm have higher sharpness index than the original image, but the sharpness index of image enhanced by the enhancement method based on wavelet transform is smaller than that of the original image, which means the sharpness of the image enhanced by the enhancement method based on wavelet transform is reduced, while the sharpness of the image enhanced by the other two enhancement methods are improved. Those objective evaluation results are consistent well with the subjective evaluation results. Thus, the image enhanced by ATCHE algorithm retains more information of the original low-contrast chromatic image, and the brightness contrast, details and sharpness of the original image are well improved.

4 Conclusions

The traditional histogram equalization method cannot effectively enlarge the tonal range of R, G, and B channel of the low-contrast chromatic image to the largest possible extent, and may result in the loss of image information because too many grayscales are merged. Although the enhancement method based on wavelet transform remains the gradation of R, G, and B channel of the low-contrast chromatic image, the low-dimension diagonal high-frequency component of wavelet decomposition of the image is compressed which will affect the image sharpness. The ATHCE algorithm proposed in the paper can effectively improve the contrast and sharpness of low-contrast chromatic image with the best adaptive average threshold of R, G and B channel. The experiment results show that the ATHCE algorithm can highlight the image details greatly while preserving the color appearance of the original image well.