1 Introduction

Histogram equalization (HE) is widely used due to its simplicity and effectiveness in providing contrast enhancement. In fact, HE-based methods have been used in the field of consumer electronics, medical image processing, image matching and searching, speech recognition, and texture synthesis [1]. Basically, HE transforms the resultant image according to the probability distribution function of the test image. It stretches and flattens the dynamic range of the image. As a result, the overall contrast of the processed image is improved [1]. However, sometimes it can degenerate the quality of the resultant image by introducing the washed-out appearance and by producing unnecessary visual degradation. This is especially true for low-contrast images, (i.e., images with few bins in the histogram contain most of the weight of the input image histogram) where washed-out appearance will occur after applying HE. Furthermore, HE is also known for shifting the mean brightness of the enhanced image, in which the mean brightness of the input image is significantly altered from that of the resultant image. Due to this significant change in mean brightness, unnecessary visual deterioration is unavoidable.

In order to solve the aforementioned problem, many HE-based methods have been proposed. Chen and Ramli [2] introduce minimum mean brightness error bi-histogram (MMBEBHE). The objective of this method is to provide maximum brightness preservation in the enhanced image. MMBEBHE firstly separates the input image histogram into two sub-histograms using a separating point. Then, it independently applies HE to the two sub-histograms. The separating point is determined by the minimum brightness difference between the input image and the resultant image. However, the MMBEBHE suffers from slow runtime as a result of its highly complex implementation. For example, given an 8-bit image, the MMBEBHE process requires 256 repetitions (i.e., one time per gray level) before the separating point is found. Moreover, the minimal mean shift in the output does not always guarantee the visual quality of the enhanced image.

Another attempt in addressing the problems faced by the HE is known as the recursively separated and weighted histogram equalization (RSWHE) [3], which is introduced to improve the contrast while preserving brightness of the enhanced image. RSWHE consists of three modules. It first performs the histogram segmentation module that recursively separates an image histogram into two or more sub-histograms. The separating point can be either mean or median of the histogram. Then, it proceeds with the histogram weighting module, which modifies the sub-histograms by using a weighting process based on a normalized power law function. Lastly, HE module is applied. In this module, HE is applied to all sub-histograms separately. As claimed in [3], the RSWHE is considered as the leading state-of-the-art method in brightness-preserving image enhancement. However, the RSWHE tends to introduce unnatural enhancement to the processed image under some circumstances. Additionally, the user-defined selection of recursion level prevents the RSWHE to yield optimal enhancement performance.

Next, the weighted clustering histogram equalization (WCHE) [4] is introduced to preserve image brightness, improve contrast, and enhance visualization without producing any undesired artifacts through over-enhancement. The WCHE starts with cluster assigning, and then cluster merging based on three criteria (i.e., cluster weight, weight ratio, and width of two neighboring clusters). Lastly, it performs the cluster transformation function before an improved resultant image is produced. Generally, the WCHE yields satisfactory enhancement results, but the WCHE tends to lose pertinent image details because a cluster with large groups of bins may equalize to a narrow dynamic range [4].

Later on, the bi-histogram equalization with plateau limit (BHEPL) [5] is introduced as one of the options for the system that requires a short processing time image enhancement. The BHEPL first separates the input histogram into two sub-histograms by using the mean of the input histogram. Then, a clipping process is applied by clipping each sub-histogram using the mean of the corresponding occupied intensity in the sub-histogram. Finally, HE is applied to each sub-histogram separately.

Then, the bi-histogram equalization with median plateau limit (BHEPL-D) [6] is introduced to avoid producing unwanted artifacts. The BHEPL-D is similar to the BHEPL, but unlike the BHEPL, the BHEPL-D clips each sub-histogram using the median of the corresponding occupied intensity in the sub-histogram.

Another approach, namely the dynamic quadrants histogram equalization plateau limit (DQHEPL) [6] is also introduced to avoid producing unwanted artifacts. The DQPLBHE first performs the histogram segmentation that recursively separates the input histogram into four sub-histograms. The separating point used is the median of the input histogram. Then, a clipping process is applied by clipping each sub-histogram using the mean of the corresponding occupied intensity in the sub-histogram. After that a gray level allocation is applied but maintaining the separating point at the first recursion level. Finally, HE is applied to each sub-histogram separately.

In [7], the weighting mean separated sub-histogram equalization (WMSHE) is another method introduced to solve the problem faced by HE, and it aims to achieve complete contrast enhancement for the small-scale detail. WMSHE begins with histogram segmentation by using weighted-mean value, and it then uses a piecewise transformation function to all sub-histograms to accentuate on the enhancement of fine details in the image. However, the effort to bring out fine image details leads to the generation of noise artifacts, largely due to the enhancement noise components in the input image.

More recently, the simple histogram modification scheme (SHMS) is proposed in [8] to solve the washed-out appearance and patchiness effect due to application of HE. SHMS modifies the image histogram before performing HE on the modified histogram. Modification is done by replacing the first nonzero bin to zero-th bin, and then replacing the last nonzero bin with the minimum bin between the last two nonzero bins. This modification is intended to solve the washed-out appearance and patchiness effect. According to [8], SHMS can be used for both single and multiple thresholding cases. The main advantage is that the SHMS can solve the washed-out appearance and patchiness effect if it applies HE. However, for the case of multiple thresholds, it limits brightness to certain extent. As a result, higher degree of brightness preservation is required to avoid generating annoying artifacts in the enhanced images.

Although the mentioned methods can often improve the contrast of the input images, but they do not handle well the common problems in HE, namely generation of washed-out appearance, intensity saturation, and visual degradation due to the enhancement of the noise. Therefore, in this paper, an efficient algorithm in mean brightness preservation and contrast enhancement that prevent intensity saturation is presented. The proposed method is significantly good in preserving the mean brightness and improving the contrast of images. In addition, it is fast and has simple implementation, in which it does not require any time-consuming training or tuning of parameters. These advantages are in-line with the requirements of many modern consumer electronic products, namely digital camera, camcorder, camera phone, etc.

The rest of this paper is organized as follow. In Sect. 2, the proposed method is explained in detail. In Sect. 3, simulation results using 190 natural images are used to demonstrate the effectiveness of the proposed method as compare to other existing methods. Finally, Sect. 4 concludes this paper.

2 The novel histogram equalization method

In this section, a detailed description of the proposed method will be discussed. Generally, the proposed method can be divided into three stages: histogram segmentation, histogram modification, and histogram transformation. For a given input image stored as an 8-bit integer, its histogram will be segmented into two sub-histograms. The histogram segmentation process is essential because it preserves the original brightness of the input image to a certain extend even after HE is applied. Then, the sub-histograms will be modified using quantization. Quantization is done by selectively clipping the bins in the sub-histogram to one of the plateau limit. The amount of enhancement to be performed on the input image depends on the contents of the image itself. This argument is valid as different regions in a well-exposed captured image have different contrast and local brightness. At bright regions, there should not be much enhancement as it will lead to intensity saturation problem, while at dark regions, it should be enhanced to bring out the image details. The overall brightness should be preserved in order to maintain the natural appearance of the enhanced image. Therefore, the amount of enhancement at each quantized segments will be determined by the plateau limits, and the application of HE (i.e., histogram transformation) stretches the histogram but maintaining the shape of the original histogram. As a result, fine image details can be brought out while the brightness is preserved, and thus, results in a visually pleasant contrasted image. The remainder of this section will be spent on discussing the three stages in greater depth.

2.1 Histogram segmentation

Let consider Fig. 1 which illustrates the hypothetical histogram of an image commonly found in digital photography.

Fig. 1
figure 1

Histogram of an arbitrary input image

The histogram segmentation stage starts by finding the separating point (SP) (i.e., the mean intensity of the histogram), which can be defined as

$$\begin{aligned} \text{ SP }=\frac{\sum _{k=0}^{L-1} {l_k \times n_k }}{N} \end{aligned}$$
(1)

where \(l_{k}\) is the kth gray level and \(n_{k}\) is the number of pixels of gray level \(k, N\) is the total number of pixels in the test image, and \(L\) is the maximum range of the gray level in an image, which is 256 for an 8-bit image. Next, by using the SP value found using (1), the histogram of the test image is separated into two sub-histograms: low sub-histogram, \(\text{ HIS }_{L}\), and high sub-histogram, \(\text{ HIS }_{H}. \, \text{ HIS }_{L}\) consists of pixels that range from minimum gray level \(l_\mathrm{MIN}\) to SP, while \(\text{ HIS }_{H}\) consists of pixels that range from SP +1 to maximum gray level \(l_\mathrm{MAX}\). The whole histogram segmentation process is graphically summarized and illustrated in Fig. 2. After the sub-histograms are obtained, they will be modified in the histogram modification stage.

Fig. 2
figure 2

Histogram segmentation process

2.2 Histogram modification

After two sub-histograms are segmented, the plateau limits PLs of both sub-histograms are computed. In should be noted that unlike the BHEPL, BHEPL-D, and DQHEPL which use only one plateau limit in each sub-histogram, the proposed method uses three plateau limits. Therefore, there are a total of 6 PLs used in the proposed method, in which three PLs are used in each sub-histogram.

Basically, the PL can be calculated by using a general equation given by:

$$\begin{aligned} \text{ PL }=X\times \text{ Pk } \end{aligned}$$
(2)

where \(X\) is the coefficient with value between 0 and 1, and Pk is the peak bin of the input histogram. In general, the PLs can be obtained by manually setting or by fixing to certain percentage of the Pk. However, these approaches are not user friendly. Therefore, in this work, an automated selection of the PLs is introduced, which suggests that the PLs should be selected based on the local information obtained from the input histogram. Basically, the proposed method uses the local information obtained to automatically compute the \(X\) value. One of the ways of extracting information obtained from the input histogram is by using the gray level ratio, GR, in each sub-histogram. It should be noted that the GR is a value between 0 and 1. The GR is used in proposed method as it could reflect the percentage of how much enhancement process should be applied. Lower percentage of enhancement process will be applied to bin with low GR, while for the other bins, the enhancement rate should be increased and vice versa. The calculation of GR will be explained next. By using the GR as the coefficient, the PLs can be calculated as follows

$$\begin{aligned}&\text{ PL }_{L1} = \text{ GR }_{L1} \times \text{ Pk }_L \end{aligned}$$
(3)
$$\begin{aligned}&\text{ PL }_{L2} = \text{ GR }_{L2} \times \text{ Pk }_L \end{aligned}$$
(4)
$$\begin{aligned}&\text{ PL }_{L3} = \text{ GR }_{L3} \times \text{ Pk }_L \end{aligned}$$
(5)
$$\begin{aligned}&\text{ PL }_{H1} = \text{ GR }_{H1} \times \text{ Pk }_H \end{aligned}$$
(6)
$$\begin{aligned}&\text{ PL }_{H2} = \text{ GR }_{H2} \times \text{ Pk }_H \end{aligned}$$
(7)
$$\begin{aligned}&\text{ PL }_{H3} = \text{ GR }_{H3} \times \text{ Pk }_H \end{aligned}$$
(8)

where \(\text{ Pk }_{L}\) is the peak bin of lower sub-histogram and \(\text{ Pk }_{H}\) is the peak bin of higher sub-histogram. All the gray level ratios, GRs, are defined as:

$$\begin{aligned}&\text{ GR }_{L1} = \text{ GR }_{L2} - D_L \end{aligned}$$
(9)
$$\begin{aligned}&\text{ GR }_{L2} = \frac{\text{ SP }-\text{ SP }_L }{\text{ SP }-l_\mathrm{MIN}} \end{aligned}$$
(10)
$$\begin{aligned}&\text{ GR }_{L3} = \text{ GR }_{L2} + D_L \end{aligned}$$
(11)
$$\begin{aligned}&\text{ GR }_{H1} = \text{ GR }_{H2} - D_H \end{aligned}$$
(12)
$$\begin{aligned}&\text{ GR }_{H2} = \frac{l_\mathrm{MAX} - \text{ SP }_H }{l_\mathrm{MAX} - \text{ SP }} \end{aligned}$$
(13)
$$\begin{aligned}&\text{ GR }_{H3} = \text{ GR }_{H2} + D_H \end{aligned}$$
(14)

where \(\text{ SP }_{L}\) and \(\text{ SP }_{H}\) are the separating points, i.e., means of the lower and higher sub-histograms, respectively, \(D_{L}\) and \(D_{H}\) are the gray level ratio differences of the lower and higher sub-histograms, respectively.

\(\text{ SP }_{L}\) and \(\text{ SP }_{\text{ H }}\) can be computed as

$$\begin{aligned}&\text{ SP }_L =\frac{\sum _{k=l_\mathrm{MIN} }^{\text{ SP }} {l_k \times n_k } }{N_L } \end{aligned}$$
(15)
$$\begin{aligned}&\text{ SP }_H =\frac{\sum _{k=\text{ SP }+1}^{l_\mathrm{MAX} } {l_k \times n_k } }{N_H } \end{aligned}$$
(16)

where \(N_{L}\) and \(N_{H}\) are the total number of pixels in the lower and higher sub-histograms, respectively. As for the gray level ratio differences \(D_{L}\) and \(D_{H}\), both term are calculated using

$$\begin{aligned}&D_L =\left\{ {{\begin{array}{l@{\quad }ll} \frac{1-\text{ GR }_{L2} }{2} &{} \text{ if } &{} \text{ GR }_{L2} >0.5\\ \frac{\text{ GR }_{L2} }{2} &{} \text{ if } &{} \text{ GR }_{L2} \le 0.5 \\ \end{array}}} \right. \end{aligned}$$
(17)
$$\begin{aligned}&D_H =\left\{ {{\begin{array}{l@{\quad }ll} \frac{1-\text{ GR }_{H2}}{2} &{} \text{ if } &{} \text{ GR }_{H2} >0.5 \\ \frac{\text{ GR }_{H2}}{2} &{} \text{ if } &{} \text{ GR }_{H2} \le 0.5 \\ \end{array}}} \right. \end{aligned}$$
(18)

In Fig. 3, the calculated plateau limits for each sub-histogram is shown. After the PLs values are obtained, the histogram modification can be applied. For reasons to become apparent in a short while, the nonzero bins in the sub-histogram that are lower and equal to the first plateau limit (\(\text{ PL }_{L1}\) and \(\text{ PL }_{H1}\)) are clipped to the first plateau limit. Next, the bins that are located between the first and the second plateau limits will be clipped to the second plateau limit. Then, the bins that are situated between the second and the third plateau limits will be clipped to the second plateau limit. Lastly, for the bins that are greater than the third plateau limit, they will be clipped to the third plateau limit. By doing this, the proposed method can improve the appearance and visual of an image at the bins region below or equal to \(\text{ PL }_{2}\) by increasing the enhancement rate. On the other hand, the proposed method decreases the enhancement rate of the bins region greater than the \(\text{ PL }_{2}\) to avoid intensity saturation problem. Mathematically, for the lower sub-histogram (\(l_\mathrm{MIN}\le k \le {\text{ SP }}\)), the clipping process can be presented as:

$$\begin{aligned} \text{ HIS }_{L}(k)=\left\{ {{\begin{array}{lll} \text{ PL }_{L1}, \quad \text{ if } \quad \text{ HIS }_{L} (k) \le \text{ PL }_{L1} \\ \text{ PL }_{L2}, \quad \text{ if } \quad \text{ PL }_{L1} < \text{ HIS }_{L} (k) \le \text{ PL }_{L3} \\ \text{ PL }_{L3}, \quad \text{ if } \quad \text{ HIS }_{L} (k)> \text{ PL }_{L3} \\ \end{array}}} \right. \end{aligned}$$
(19)

While for the higher sub-histogram (\(\text{ SP } + 1 \le k \le l_\mathrm{MAX}\)), the clipping process is given as:

$$\begin{aligned} \text{ HIS }_H (k)\!=\!\left\{ {{\begin{array}{lll} \text{ PL }_{H1}, \quad \text{ if } \quad \text{ HIS }_H (k)\le \text{ PL }_{H1} \\ \text{ PL }_{H2}, \quad \text{ if } \quad \text{ PL }_{H1} < \text{ HIS }_H(k)\!\le \! \text{ PL }_{H3} \\ \text{ PL }_{H3}, \quad \text{ if } \quad \text{ HIS }_H(k) > \text{ PL }_{H3} \\ \end{array} }} \right. \end{aligned}$$
(20)

The quantized histogram is shown in Fig. 4. Note that the clipping process locally limits the amount of enhancement. Such strategy circumvents the intensity saturation problems. Once the quantized segments in the sub-histograms are obtained, the processing will proceed to the histogram transformation stage.

Fig. 3
figure 3

Histogram with three plateau limits set

Fig. 4
figure 4

The quantized histogram

2.3 Histogram transformation

Histogram transformation is the final stage in the proposed method. It is done by applying the conventional HE into each modified sub-histogram. However, the probability density function, PDF, and cumulative density function, CDF, of each modified sub-histogram are needed. PDF and CDF have to be computed first. The PDF and CDF are defined as

For \(l_\mathrm{MIN} \le k \le \text{ SP }\),

$$\begin{aligned} \text{ PDF }_L(k)&= \frac{n_k }{N_L} \end{aligned}$$
(21)
$$\begin{aligned} \text{ CDF }_L (k)&= \sum _{i=l_\mathrm{MIN} }^{\text{ SP }} {\text{ PDF }_L(i)} \end{aligned}$$
(22)

For \(\text{ SP }+1 \le k \le l_\mathrm{MAX}\),

$$\begin{aligned} \text{ PDF }_H (k)&= \frac{n_k }{N_H} \end{aligned}$$
(23)
$$\begin{aligned} \text{ CDF }_H (k)&= \sum _{i=\text{ SP }+1}^{l_\mathrm{MAX} } {\text{ PDF }_H(i)} \end{aligned}$$
(24)

where \(\text{ PDF }_{L}\) and \(\text{ CDF }_{L}\) are the respective probability density function and cumulative density function of lower sub-histogram, and \(\text{ PDF }_{H}\) and \(\text{ CDF }_{H}\) are the probability density function and cumulative density function of higher sub-histogram, respectively. Note that the \(n_{k}, N_{L}, \text{ PDF }_{L}, \text{ CDF }_{L}, N_{H}, \text{ PDF }_{H}\) and \(\text{ CDF }_{H}\) are obtained from the modified histogram. Finally, the enhanced image is obtained with a final round of HE that can be described by:

$$\begin{aligned} T(k)= \left\{ {{\begin{array}{lll} \text{ SP }\times \text{ CDF }_L(k) \quad \text{ for } \, l_\mathrm{MIN} \le k\le \text{ SP } \\ \text{ SP }+1+(255-\text{ SP }-1)\times \text{ CDF }_H (k) \\ \quad \text{ for } \, \text{ SP }<k\le l_\mathrm{MAX} \\ \end{array} }} \right. \end{aligned}$$
(25)

2.4 Real image demonstration

In order to further demonstrate the proposed method, a real image is used in the explanation. Fig. 5 illustrates the ‘Hill’ image and its corresponding histogram.

Fig. 5
figure 5

‘Hill’ image (a) and its corresponding histogram (b)

The proposed method starts with the histogram segmentation stage. The histogram segmentation stage begins by finding the SP. The SP value is computed by using Eq. (1), and it is equal to 125. The input histogram is separated into two sub-histograms based on the SP value found. The segmented histogram is as shown in Fig. 6. After the sub-histograms are obtained, they will be modified in the histogram modification stage.

Fig. 6
figure 6

Segmented histogram \(\text{ HIS }_L\) (a) and \(\text{ HIS }_H\) (b) of ‘Hill’ image

After two sub-histograms are segmented, the PLs of both sub-histograms are computed. Before computing the PLs, several values of local information (i.e., \(\text{ SP }_{L}\) (Eq. (15)), \(\text{ SP }_{H}\) (Eq. (16)), \(l_\mathrm{MIN}, l_\mathrm{MAX}\), \(\text{ Pk }_{L}\), and \(\text{ Pk }_{H})\) need to be determined. Based on the local information of the ‘Hill’ image, the values of \(\text{ SP }_{L}, \text{ SP }_{H}, l_\mathrm{MIN}, l_\mathrm{MAX}, \text{ Pk }_{L}\), and \(\text{ Pk }_{H}\) are obtained automatically to be 103, 148, 55, 226, 3,543, and 3,724, respectively. Then, \(\text{ GR }_{L2}\) and \(\text{ GR }_{H2}\) are calculated by using Eqs. (10), (13), respectively.

$$\begin{aligned} \text{ GR }_{L2}&= \frac{\text{ SP }-\text{ SP }_L }{\text{ SP }-l_\mathrm{MIN} }=\frac{125-103}{125-55}=0.3143\\ \text{ GR }_{H2}&= \frac{l_\mathrm{MAX} - \text{ SP }_H }{l_\mathrm{MAX} - \text{ SP }}=\frac{226-148}{226-125}=0.7723 \end{aligned}$$

After that \(D_{L}\) and \(D_{H}\) are computed by using Eqs. (17) and (18), respectively.

$$\begin{aligned}&D_L =\left( {{\begin{array}{lll} \frac{1-\text{ GR }_{L2}}{2} \quad \text{ if } \text{ GR }_{L2} > 0.5 \\ \frac{\text{ GR }_{L2}}{2} \quad \text{ if } \text{ GR }_{L2} \le 0.5 \\ \end{array} }} \right. =\frac{0.3143}{2}=0.1571 \\&D_H =\left\{ {{\begin{array}{lll} \frac{1\!-\!\text{ GR }_{H2}}{2} \quad \text{ if } \text{ GR }_{H2} >0.5 \\ \frac{\text{ GR }_{H2}}{2} \quad \text{ if } \text{ GR }_{H2} \le 0.5 \\ \end{array}}} \right. =\frac{1-0.7723}{2}\!=\!0.1139 \end{aligned}$$

Next, \(\text{ GR }_{L1}, \text{ GR }_{L3}, \text{ GR }_{L1}\), and \(\text{ GR }_{H3}\) are calculated by using Eqs. (9), (11), (12) and (14), respectively.

$$\begin{aligned}&\text{ GR }_{L1} = \text{ GR }_{L2} - D_L = 0.3143 - 0.1571 = 0.1572 \\&\text{ GR }_{L3} = \text{ GR }_{L2} + D_L = 0.3143 + 0.1571 = 0.4714 \\&\text{ GR }_{H1} = \text{ GR }_{H2} - D_H = 0.7723 - 0.1139 = 0.6584 \\&\text{ GR }_{H3} = \text{ GR }_{H2} + D_H = 0.7723 + 0.1139 = 0.8862 \end{aligned}$$

Finally, the PLs are computed according to Eqs. (3) until (8).

$$\begin{aligned}&\text{ PL }_{L1} = \text{ GR }_{L1} \times \text{ Pk }_L =0.1572\times 3{,}543=557 \\&\text{ PL }_{L2} = \text{ GR }_{L2} \times \text{ Pk }_L =0.3143\times 3{,}543=1{,}114 \\&\text{ PL }_{L3} = \text{ GR }_{L3} \times \text{ Pk }_L =0.4714\times 3{,}543=1{,}670 \\&\text{ PL }_{H1} = \text{ GR }_{H1} \times \text{ Pk }_H =0.6584\times 3{,}724=2{,}452 \\&\text{ PL }_{H2} = \text{ GR }_{H2} \times \text{ Pk }_H =0.7723\times 3{,}724=2{,}876 \\&\text{ PL }_{H3} = \text{ GR }_{H3} \times \text{ Pk }_H =0.8862\times 3{,}724=3{,}300 \end{aligned}$$

After the PLs’ values are obtained, each sub-histogram is modified by a clipping process as described in Eqs. (19) and (20), respectively. The quantized histogram is as shown in Fig. 7. Once the quantized histograms are obtained, the proposed method will proceed to the histogram transformation stage.

Fig. 7
figure 7

Quantized histogram \(\text{ HIS }_L\) (a) and \(\text{ HIS }_H\) (b) of ‘Hill’ image

Histogram transformation stage is done by applying HE into each modified sub-histogram. The PDF and CDF need to be calculated (i.e., as described in Eqs. (21)–(24)) before applying HE. The enhanced image is obtained by applying HE as described in Eq. (25). The enhanced image and its corresponding histogram are shown in Fig. 8.

Fig. 8
figure 8

Enhanced ‘Hill’ image (a) of the proposed method and its corresponding histogram (b)

3 Results and discussion

In order to demonstrate the feasibility of the proposed method, few of the state-of-the-art methods previously mentioned in Sect. 1 are implemented for comparison purposes. The 190 natural images are used as the input images to the implemented filters, and their outputs are compared based on two criteria, namely qualitative and quantitative analyses. For simulation purposes, the resolution of the images range from 467\(\times \)413 to 2,352\(\times \)1,568.

In this section, simulation will utilize 190 natural images that can be further divided into two categories: standard images and real images obtained from personal digital camera. The standard images selected are obtained from multiple internet sources that are commonly used for evaluating contrast enhancement method, with their dimensions ranging from 467\(\times \)413 to 1,024\(\times \)1,024. Most of the standard images selected are obtained from [9] and [10]. On the other hand, 118 real images captured using personal digital camera are used in simulation to demonstrate the enhancement strength of the proposed method when used in real-world application. All the real images are 2,352\(\times \)1,568 in dimension. It is worth noting that these 190 images used are 8-bit images.

For comparison, the HE [1], MMBEBHE [2], RSWHE [3], WCHE [4], BHEPL [5], BHEPL-D [6], DQHEPL [6], WMSHE [7], and SHMS [8] are implemented, and their output images are compared to the proposed method. Because some of these methods require the user to select their parameters, a set of values have been selected. For example, the RSWHE is implemented with 4 sub-histograms (recursion level is two) and the separating points used are the mean intensity in the histogram and/or sub-histograms. The SHMS is implemented based on the brightness preserving bi-histogram equalization (BPBHE) method in [8]. As for the WMSHE, the recursion level is set equal to 6.

Meanwhile, the image analysis and comparison can be divided into two types, namely qualitative and quantitative analysis. The objective of qualitative analysis is to provide visual inspection on whether the enhanced images are visually acceptable to human perception, and whether they have natural appearance upon enhancement, while the quantitative analysis numerically measures the brightness, contrast, entropy, and runtime of the implemented methods.

The quantitative analyses used in this work are the average absolute mean brightness error (AAMBE) [4], average contrast (AC) [11], average entropy (AE) [12], and average processing time (AT). The AAMBE analysis is applied to measure the ability of brightness preservation of the processed images. The smaller value of the AAMBE indicates better mean preservation. The AAMBE is given as

$$\begin{aligned} \text{ AAMBE }=\frac{1}{M}\left| {E(Y)-E(X)} \right| \end{aligned}$$
(26)

where \(M\) is the total number of input images, which is 72 for standard image and 118 for real image. \(E(X)\) and \(E(Y)\) are the average intensity values of the input image and the enhanced image, respectively. On the other hand, the AC is used to measure the contrast enhancement of the resultant images. Therefore, the AC value of the well-contrasted image should be higher than the AC value of the test image. The AC is given as:

$$\begin{aligned} \text{ AC }=\frac{1}{M}\sqrt{\sum _{k=0}^{L-1} {(l_k -E(Y))^{2}\times \text{ PDF }(l_k )} } \end{aligned}$$
(27)

where PDF is the probability density function of the resultant image.

The AE is defined as the measurement of information that can be brought out from the enhanced images. As a result, the AE value of the enhanced image should be as close as possible to that of the original image in order to preserve image details. In addition, the closer AE value of ground truth and processed images would indicate that the shape of the enhanced image histogram is maintained. Meanwhile, intensity saturation problem can be circumventing by maintaining the shape of the input image. Thus, AE is also used to measure the capability of intensity saturation prevention. The AE is defined as

$$\begin{aligned} \text{ AE }=-\frac{1}{M}\sum _{k=0}^{L-1} {\text{ PDF }(l_k )\times \log _2 (} \text{ PDF }(l_k )) \end{aligned}$$
(28)

Finally, AT is used to calculate the processing time. In general, the complexity of a method tends to be revealed in its runtime, as a high complexity method would most likely consume longer processing time. Here, the AT is computed in megapixels per second (\(M/s\)) and it is given as

$$\begin{aligned} \text{ AT }=\frac{1}{M}\sum _{k=1}^M {\text{ TPM }_k } \end{aligned}$$
(29)

where \(\text{ TPM }_{k}\) is the processing time per megapixels of image \(k\), and it can be defined as

$$\begin{aligned} \text{ TPM }_\mathrm{k} =\frac{T_k }{N_k }\times 10^{6} \quad \text{ for } \, 1\le k\le M \end{aligned}$$
(30)

where \(T_{k}\) is the runtime of image \(k\), and \(N_{k}\) is total number of pixels of image \(k\).

In this study, the coding of all the implemented methods is written in Matlab 2010b and is run by a personal computer with Pentium dual CPU 4300 1.80 GHz and 1.49 gigabytes of RAM.

3.1 Standard image simulation result

For qualitative analysis, two standard images are used to demonstrate the capability of the proposed method. One of the visual results using standard test images named ‘Hill’ is shown in Fig. 9. From visual inspection, Fig. 9 shows that all the images become more contrasty; however, only few maintain the natural appearance composure. The enhanced images using the HE, MMBEBHE, BHEPL, BHEPL-D, DQHEPL, and SHMS in Fig. 9b, c, f, g, h, and j, respectively, suffer from saturation problem. This phenomena is clearly demonstrated by the over-brighten ground at the corresponding highlighted area as shown in Fig. 10. On the other hand, the enhanced images in Fig. 9d, e, and i for the RSWHE, WCHE, and WMSHE, respectively, produce unnatural contrast enhancement. The WCHE has darken its resultant image as shown in Fig. 9e for the whole ‘Hill’ image and Fig. 10e for the highlighted area of the ‘Hill’ image. For the RSWHE and WMSHE, both methods produce unnatural look of resultant images as could clearly be observed at the tree of the highlighted area shown in Fig. 10d and i, respectively. Conversely, the proposed method in Fig. 9k yields the best visual result without the above-mentioned problems and with good contrast enhancement that preserves the brightness of the input image. Next, for the second standard image called ‘House’ as shown in Fig. 11 similar finding are obtained. There is contrast improvement in all the images; however, only the proposed method in Fig. 11k escapes from the intensity saturation problem in highlighted area (i.e., in Fig. 12k), especially at the ground and the roof. The saturation problem could clearly be seen at both areas in Fig. 12 for other methods.

Fig. 9
figure 9

Simulation results for the ‘Hill’ image (resolution \(512\times 512\))

Fig. 10
figure 10

Simulation results for the highlighted area of ‘Hill’ image

Fig. 11
figure 11

Simulation results for the ‘House’ image (resolution \(512\times 512\))

Fig. 12
figure 12

Simulation results for the highlighted area of ‘House’ image

For the quantitative analysis, the average AAMBE, AC, AE, and AT results presented in Table 1 show that the HE produces the highest average AAMBE. This is not surprising because the HE is not designed for brightness preservation purpose. The MMBEBHE that yields the lowest AAMBE is mainly attributed to its mechanism that produces maximum brightness preservation but does not guarantee the visual quality of the enhanced image. Conversely, the proposed method has the fourth lowest average AAMBE value in this comparison, but its better visual quality as shown in Figs. 9,  11 favors the proposed method as a competitive advantage.

Table 1 Quantitative analyses for the average of the 72 standard images

As for the average AC, the results in Table 1 show that all methods produce higher AC value than the input images’ AC value. Thus, all the methods successfully improve the contrast of the test images. In AE analysis, among the implemented methods, the RSWHE produces the highest average AE. Again, the proposed method comes third in terms of the average AE value, which shows its ability to prevent the intensity saturation problem.

In terms of computational complexity that is gauged by the runtime consumed, Table 1 shows that the HE has the fastest runtime, and this is not surprising because its mechanism is straightforward and does not require modification on the histogram. However, the proposed method remains competitive as it records a relatively fast average runtime. Overall, simulation results clearly demonstrate the good performance of the proposed method. It has excellent brightness preservation, good ability in intensity saturation prevention, yield superior detail preservation, and it is relatively fast in its processing.

3.2 Real image simulation result

To demonstrate the feasibility and usefulness of the proposed method in real-world application, it is used to enhance real images captured using personal digital camera. These images are captured under normal lighting conditions. From visual inspection, it can be clearly seen that for the image called ‘Box,’ the HE, MMBEBHE, RSWHE, BHEPL, BHEPL-D, DQHEPL, WMSHE, and SHMS methods in Fig. 13b–j, respectively, produce resultant images with intensity saturation problem, especially at the body of the bottle as shown in the corresponding highlighted area in Fig. 14. Meanwhile, as shown in Fig. 13e, the WCHE method fails to improve the contrast of the ‘Box’ image. However, the proposed method has successfully produced a more natural appearance and artifact-free enhanced image as shown in Figs. 13k and  14k. In addition, for the second real image called ‘Mop,’ in Fig. 15, Fig. 15k yields the best visual result with natural appearance composure; while others either suffer from intensity saturation problem or unnatural contrast enhancement which could be clearly observed in the highlighted area as shown in Fig. 16. To conclude, the proposed method outperforms the rest of the methods in comparison, both in terms of its natural appearance and artifact-free enhanced image.

Fig. 13
figure 13

Simulation results for the ‘Box’ image (resolution 2,352\(\times \)1,568)

Fig. 14
figure 14

Simulation results for the highlighted area of ‘Box’ image

Fig. 15
figure 15

Simulation results for the ‘Mop’ image (resolution 2,352\(\times \)1,568)

Fig. 16
figure 16

Simulation results for the highlighted area of ‘Mop’ image

Table 2 reports the average results for AAMBE, AC, AE, and AT. The results show that the proposed method has the fourth lowest average AAMBE, which explains the good mean brightness preservation. In addition, the average AC results show that all the methods improve the contrast of the input images, which is numerically indicated by the greater average AC values as compare to that of the input image. Although the RSWHE has the highest average AE, it has only a slight difference (i.e., 0.0107 in difference) with the proposed method which has the third highest AE value. However, the promising visual results coupled with relatively good and/or comparable quantitative analyses indicate the good performance of the proposed method and accentuate the good performance of the proposed method as compare to some well-known methods in literature.

Table 2 Quantitative analyses for the average of the 118 real images

4 Conclusions

In conclusion, a novel HE-based method is presented. The performance of the proposed method is compared to some well-known HE-based methods in literature. Simulation results using both standard test images and real natural images show that the proposed method has good performance in brightness preservation and image contrast enhancement, which leads to better visual quality. The proposed method has the advantages of being simple, and it does not require any tuning of parameters, which further underline its importance toward image-based application in consumer electronic products.