1 Introduction

An image normally consists of two components: illumination and reflectance [6]. Illumination may also be referred to as lighting, which excites the visual sensation of humans [1]. A poor illumination condition during the image acquisition process produces a non-uniformly illuminated image [18]. This situation occurs commonly at night [20] in microscopic images [7] and in complex industrial environments [40]. A monochrome object in a non-uniformly illuminated image might exhibit varying intensity levels because of light transition. Differences in intensity levels cause difficulties during image processing, especially in segmentation, because this process is based on either the discontinuity or the similarity principle. Regions that differ in properties, such as intensity, color, texture, or other image statistics, are extracted based on the discontinuity principle. Meanwhile, the pixels of images are grouped based on the similarity principle according to common properties to extract the coherent regions [34]. However, the intensity of the object varies because of the non-uniform illumination, thereby causing difficulties in the pixel intensity-based segmentation process. Thus, enhancing non-uniformly illuminated images is necessary to produce uniformly illuminated and high-contrast resultant images, which benefit the segmentation process.

Numerous approaches have been proposed to solve the non-uniform illumination problem in images. Generally, these techniques can be categorized according to the concept used during the enhancement process, such as histogram modification [13,15,15, 22, 27, 30, 42], fuzzy theory [9, 23, 29], retinex [11, 12, 20, 28], and others [5, 10, 17, 25, 35, 38, 43]. Adaptive histogram equalization (AHE) is one of the histogram modification-based contrast enhancement methods. Most AHE-based methods can solve the non-uniform illumination issue, where the bright and dark regions are darkened and brightened, respectively [32]. As a result, images with highly uniform and homogeneous illumination could be produced. However, conventional AHE suffers from two main drawbacks: (1) it is time-consuming because of the massive calculation required by the HE algorithm and (2) unnatural appearance might occur in some resultant images because of the amplification of unwanted noise [27]. Several new versions of the AHE method have been proposed to address its weaknesses. Contrast-limited HE (CLAHE) [27], partial overlapped sub-block HE (POSHE) [14], cascaded multistep binomial filtering HE (CMBFHE) [15], overlapped sub-blocks and local histogram projection (NOSHP) [3], and fast local histogram specification (FLHS) [22] were specifically designed to reduce the noise enhancement and computational time of AHE. The computational cost of AHE has been reduced after several improvements, but the noise amplification and unnatural appearance of the resultant images are yet to be solved.

Histogram-adaptive image segmentation is another type of histogram modification method, which was proposed to enhance low-quality images [30]. Low-quality images are defined to have low contrast, low image detail, unnatural appearance, and non-uniform illumination. Histogram-adaptive image segmentation algorithm widens the dynamic range of segmented low-contrast areas, which results in better contrast and a brighter resultant image. This method has successfully improved the illumination of images and the details of the resultant images are relatively better. Subsequently, human visual system-based multi-HE (HVSMHE) was introduced. Instead of employing the thresholding concept, HVSMHE employs the human vision thresholding concept to detect and distinguish between the dark and bright regions of non-uniformly illuminated images [21, 42]. Each region is enhanced using a different approach for a better output image. HVSMHE provides good illumination enhancement. However, three parameters need to be set to obtain a well-enhanced image, which is unsuitable for automated applications. Gain-controllable clipped HE (GC-CHE) was proposed to reduce the effect of noise amplification while preserving the mean brightness of the image [13]. GC-CHE clips the histogram bin that is higher than the pre-specified threshold to control the noise amplification and the maximum gain of the transformation function. Furthermore, GC-CHE introduces local and global gains to increase the gain in the dark and bright regions for illumination correction. The resultant images of GC-CHE have more uniform illumination and lower noise amplification than the input images. The existence of four control parameters in GC-CHE limits its usage in real-time applications because these parameters require manual tuning. These parameters have to be tuned according to different illumination conditions to produce good-quality resultant images.

In addition to the histogram modification-based technique, fuzzy set theory is also widely applied for contrast enhancement and illumination correction purposes. The fuzzy set theory is based on the principles of uncertainty, ambiguity, and vagueness [26]. Non-uniformly illuminated images have no rigid boundaries between their dark and bright regions. The fuzzy set theory is useful in distinguishing these areas. Fuzzy image processing has three main stages, namely, image fuzzification, modification of membership values, and image defuzzification [29]. Magudeeswaran and Ravichandran [23] proposed to apply the fuzzy set theory in HE, that is, fuzzy logic-based HE (FHE). This algorithm can preserve the image brightness and improve the local contrast of the original image. However, its performance in terms of detail preservation can be improved further because some details are washed out during the process of remapping the intensity level of the image. Hasikin and Isa [4, 9] introduced a new parameter called contrast factor in their proposed technique, that is, the adaptive fuzzy contrast factor enhancement (AFCFE). The contrast factor indicates the difference among the intensity values in the local neighborhood. Then, a threshold, which is used to separate the bright and dark regions is derived based on the contrast factor. The proposed AFCFE method has better results on peak signal-to-noise ratio (PSNR) and entropy than several HE-based contrast enhancement methods. However, the method requires longer processing time and produces resultant images with low contrast levels in several cases.

Retinex is another approach to solve the non-uniform illumination issue. In general, the retinex theory suggests that color is independent of the flux radiant energy but is correlated with the reflectance of the object [8]. Multi-scale retinex (MSR) was proposed to produce a resultant image with good dynamic range compression and color constancy, as well as a good tonal rendition [28]. MSR combines the dynamic range of the small-scale retinex (i.e., which has poor tonal rendition) with the tonal rendition of the large-scale retinex (i.e., which has poor dynamic range compression) to produce a more uniformly illuminated image. Subsequently, several MSR improvements were proposed. For example, multi-scale retinex color restoration (MSRCR) was proposed to solve the gray world assumption, which results in a grayish output image with a certain dominant color [12]. Meanwhile, multi-scale retinex improvement for nighttime image enhancement (MSRNIE) was proposed to enhance nighttime images that have low and non-uniform illuminations [20]. This method replaced the logarithm function in MSR with the sigmoid function to compress the “extreme” pixels rather than clip them to avoid information loss. This method was also proposed to suppress noise and preserve highlighted areas to avoid over brightening them. However, this method has a parameter that needs to be set manually to obtain a well-enhanced image. It is also time-consuming because of the weight factor calculation for noise suppression and highlight preservation.

Wavelet transform-based methods are also important in image enhancement. Wavelet transformation can concentrate most of the signal energies of an image into a small subset of wavelet coefficient, which is usually along the edges of an image [5, 35, 43]. This feature has been exploited in image compression, denoising, and enhancement [5, 35]. Wan et al. [35] proposed a wavelet-based exact pixel ordering algorithm that can simplify histogram specification. This method has low computational cost and low noise amplification but limited contrast improvement. Isar [25] proposed to use the dual-tree complex wavelet transform (DT-CWT) coupled with the bivariate Laplace model for local adaptive contrast improvement. This method applies the bishrink filter in the DT-CWT domain to overcome the noise amplification issue. The resultant image of this method is characterized by low noise and high contrast, but the non-uniform illumination issue is barely improved.

Instead of improving the illumination of general images, Wang et al. [16] proposed an illumination compensation method for face recognition. The method derives an illumination direction map from the input face image. Then, a partial least-square plane fit is applied to the illumination direction map to select the category of the light source. Finally, the illumination of the input image is compensated based on the selected light source category. The illumination map proposed in this method is only suitable for face images. Jiao et al. [10] proposed a method called partially overlapped sub-block logarithmic transformation (POSLT). POSLT uses a sub-block with a certain size to divide the input image into many partially overlapped sub-images and perform logarithmic transformation on each sub-image. A trade-off between image quality and computational complexity exists in POSLT. Applying a large sub-block with a small step size in POSLT produces a natural and good illumination image but requires a high computational cost. Lee et al. [17] proposed a contrast enhancement method using dominant brightness level analysis and adaptive intensity transformation (DBLAAIT). This method produces an image with good contrast, uniform illumination, and natural appearance. The weaknesses of this method are (1) the absence of noise suppression and (2) the time-consuming manual tuning process required by its four parameters.

Subsequently, Wang et al. [38] proposed the naturalness preserved enhancement algorithm (NPEA), which focuses on illumination enhancement and naturalness preservation. This method proposes a bright-pass filter to decompose the illumination and reflectance in the input image. Then, the illumination is processed using bi-log transformation to ensure that spatial variation does not flood the illumination with details while the lightness order is preserved. Finally, the reflectance and processed illumination are synthesized together to obtain the final enhanced image. The study claimed that the proposed technique could enhance the details and maintain the naturalness of non-uniform illumination. However, the processing time is long and it tends to amplify unwanted noises.

In summary, the aforementioned techniques face one or more of the following problems:

  1. 1.

    Manual control parameters are used to fine-tune the algorithm performance, which is a time-consuming procedure [13, 17, 20, 42].

  2. 2.

    In some cases, resultant images with unnatural appearances are produced [12, 14, 15, 22, 27].

  3. 3.

    The techniques tend to amplify unwanted noise [10, 14, 15, 17, 22, 28,29,30, 38].

  4. 4.

    The methods suffer from loss of image details [14, 15, 23, 29, 30].

Thus, this study proposes a new image illumination correction method that does not require parameter adjustment, can minimize loss of image details, reduces the effect of noise amplification, produces better contrast enhancement performance, and can preserve the naturalness of resultant images. Five quantitative evaluations, namely, entropy (E) [37], measure of enhancement (EME) [33], PSNR, contrast improvement analysis (C) [2], and natural image quality evaluator (NIQE) [19], are selected to objectively evaluate the proposed method in comparison with other state-of-the-art methods and measure the quality of images.

2 Proposed method

Figure 1 shows the flowchart of the proposed method. The proposed method is divided into three stages, namely, pre-processing, illumination correction, and post-processing. As discussed in the previous section, the proposed method can reduce the effect of noise amplification and loss of image details. Thus, unwanted noises and image details (i.e., edges and surface textures) are extracted during the pre-processing stage to reduce noise amplification and detail elimination during the illumination correction process. Then, the proposed method determines and distinguishes between the dark and bright regions of the image. The dark and bright regions are brightened and darkened, respectively, during the illumination correction process. Finally, the contrast of the image is enhanced, and the details are added back into the output image in the post-processing stage. The details of each process are presented in the following subsections.

Fig. 1
figure 1

Flowchart of the proposed method

2.1 Pre-processing stage

In general, an image consists of two main components, namely, illumination and reflectance [6, 11]. The mathematical representation of an image f(x,y) is stated in Eq. (1).

$$ f\left(\right)=\left( x, y\right) r\left( x, y\right), $$
(1)

where i(x,y) and r(x,y) are the illumination and reflectance components, respectively [6, 11]. The proposed method assumes that the illumination variation in an image is the low-frequency signal of the image [32]. Thus, illumination estimation can be performed by applying a low-pass filter to the image. In the proposed method, a Gaussian low-pass filter is employed to produce the illumination variation image. The Gaussian low-pass filter is selected because it has good noise-filtering effects (i.e., better performance than the ideal low-pass and moving average filters) [3]. The mathematical representation of the Gaussian low-pass filter is

$$ h\left( q, r\right)=\frac{1}{2{\pi \sigma}^2}{e}^{\frac{-\left(-{q}^2+{r}^2\right)}{2{\sigma}^2}}, $$
(2)

where h(q , r) is the Gaussian low-pass filter, and q and r are the distances from the origin (i.e., center of filter) in the horizontal and vertical axes, respectively. σ is the standard deviation of the Gaussian low-pass filter.

Standard deviation (σ) is one of the important parameters of the Gaussian low-pass filter. The standard deviation value of a Gaussian filter is the radius that contains 68% of the integrated magnitude of the kernel coefficient [32]. The kernel is a 2D convolution operator applied to perform Gaussian filtering. A higher σ indicates a wider integrated magnitude of coefficient spread. Thus, the filtered image becomes more blurry (i.e., more details and noise are removed). Therefore, a high σ would result in less illumination correction and contrast enhancement because some of the illumination information are removed together with noises and image details. This hypothesis is supported by Figs. 2 and 3. Figure 2 shows the relationship among the standard deviation of the Gaussian filter, EME, and C according to the average results of 375 test images (size, 640 × 480) of the Pasadena dataset [33]. This study employed EME and C in the quantitative analysis. EME measures the local contrast, while C measures the overall contrast of the output images. The details of EME and C are discussed in Section 3. Fig. 2 shows that a higher σ would result in a lower C value (i.e., overall contrast). Meanwhile, the EME value (i.e., local contrast) would reach its peak between σ = 1 and σ = 2. The suitable standard deviation value (σ) for the Gaussian filter of 1 (σ = 1) is used to maintain a balance between the local and overall contrasts. Figure 3 shows the resultant images after applying a Gaussian filter with σ = 1 and σ = 5. The magnified region (i.e., dark region) of Fig. 3 is shown in Fig. 4. The overall appearance of Fig. 4(a) is brighter and clearer than the magnified region of Fig. 4(b). As shown in the boxed region, the edges of the grass are more observable in Fig. 4(a) than those in Fig. 4(b). This result shows that the Gaussian filter with σ = 1 has better illumination correction than the Gaussian filter with σ = 5. Based on the results presented in Fig. 2 and Fig. 3, the value of σ is set to 1.

Fig. 2
figure 2

Effect of standard deviation of Gaussian filter on EME and C of output images for 375 test images of the Pasadena dataset

Fig. 3
figure 3

Enhanced image using Gaussian low-pass filter with standard deviation: (a) σ =1 and (b) σ = 5

Fig. 4
figure 4

Magnified dark region of enhanced image using Gaussian low-pass filter with standard deviation: (a) σ = 1 and (b) σ = 5

Another important parameter of the Gaussian low-pass filter is the filter size. The three-sigma rule is applied to decide the filter size because 99.7% of the values lie within three standard deviations of the mean (i.e., mean ± 3σ) [31]. A further increase in the size of the filter would not result in a significant difference. The mean is represented by the center of the filter to apply the three-sigma rule in the Gaussian low-pass filter. Therefore, the filter size should include one pixel for the filter center and the range should be within +3σ to −3σ pixels. The mathematical expression of the filter size is shown in Eq. (3).

$$ n=2\left(3\sigma \right)+1, $$
(3)

where n is the size of the Gaussian low-pass filter.

The reflectance assumption can be obtained by applying this assumption to Eq. 1.

$$ i\left( x, y\right)\approx I\left( x, y\right), $$
(4)
$$ r\left( x, y\right)\approx \frac{f\left( x, y\right)}{I\left( x, y\right)}= R\left( x, y\right), $$
(5)

where I(x,y) is the filtered image using Gaussian filter, and Eq. (5) is the reflectance assumption. R(x,y) is the assumed reflectance, which is not a suitable output image because most its details are removed during the division process. Thus, the R(x,y) obtained is then multiplied by the median of the I(x,y) (i.e., denoted as median (I(x,y))) to act as the threshold for the separation of the dark and bright regions. The median is selected as the multiplier of R(x,y) because it produces the maximum segmentation entropy [36]:

$$ Threshold\left( x, y\right)=\frac{R\left( x, y\right)\times median\left( I\left( x, y\right)\right)}{mean\left( R\left( x, y\right)\right)}, $$
(6)

where median(I(x,y)) is the median of the histogram of I(x,y) and mean(R(x,y)) is the mean of the histogram of R(x,y). Subsequently, the Gaussian filter is applied to the threshold mapping to reduce the noises that exist (i.e., denoted as filtered Threshold(x,y)). Then, the dark and bright regions are determined using Eqs. (6) and (7), respectively.

$$ Dark\left( x, y\right)=\left\{\begin{array}{c}\hfill Threshold\left( x, y\right)- I\left( x, y\right),\kern0.5em if\; Threshold\left( x, y\right)\ge I\left( x, y\right),\hfill \\ {}\hfill \begin{array}{cc}\hfill 0,\hfill & \hfill \kern4.919997em else\hfill \end{array}\hfill \end{array}\right. $$
(7)
$$ Bright\left( x, y\right)=\left\{\begin{array}{c}\hfill I\left( x, y\right)- Threshold\left( x, y\right),\begin{array}{cc}\hfill \hfill & \hfill if\; Threshold\left( x, y\right)\le \hfill \end{array} I\left( x, y\right),\hfill \\ {}\hfill \begin{array}{cc}\hfill 0,\hfill & \hfill \kern4.919997em else\hfill \end{array}\hfill \end{array}\right. $$
(8)

where Dark(x,y) and Bright(x,y) are the dark and bright regions of the image, respectively. Both Dark(x,y) and Bright(x,y) record only the positive results, while the negative results are set to 0.

From the determined dark and bright regions, the dark enhancer DE(x,y) and bright enhancer BE(x,y) are derived. The DE(x,y) and BE(x,y) adjust the levels of illumination correction on the dark and bright areas, respectively.

$$ DE\left( x, y\right)=\frac{Dark\left( x, y\right)}{ \max \left( I\left( x, y\right)\right)}\times median\left( I\left( x, y\right)\right), $$
(9)
$$ BE\left( x, y\right)\frac{Bright\left( x, y\right)}{ \max \left( I\left( x, y\right)\right)}\times median\left( I\left( x, y\right)\right), $$
(10)

where max(I(x,y)) is the maximum intensity value of I(x,y). A 3 × 3 average filter is applied to both DE(x,y) and BE(x,y) to reduce the salt-and-pepper noises in the reflectance assumption.

2.2 Illumination correction

The reflectance assumption is not suitable to represent the output image because of the unnaturalness and loss of image details. Thus, the proposed method performs illumination correction based on the bright and dark enhancers derived according to the following equations:

$$ IC\left( x, y\right)= I\left( x, y\right)\left[1+ DR\times DE\left( x, y\right)- BR\times BE\left( x, y\right)\right], $$
(11)
$$ DR=\left(\frac{meadian\left( I\left( x, y\right)\right)- mean\left( Dark\left( x, y\right)\right)}{mean\left( Dark\left( x, y\right)\right)}\right), $$
(12)
$$ BR=\left(\frac{meadian\left( Bright\left( x, y\right)\right)- \max \left( meadian\left( x, y\right)\right),\left( mean\left( I\left( x, y\right)\right)\right)}{mean\left( Bright\left( x, y\right)\right)}\right), $$
(13)

where IC(x,y) is the illumination-corrected image, DR is the dark ratio, and BR is the bright ratio. Mean(Dark(y,y)) and mean(Bright(x,y)) are the mean values of the histogram of Dark(x,y) and Bright(x,y), respectively.

Both DR and BR act as control parameters to adjust the level of illumination correction on the dark and bright regions, respectively. DR is derived to shift the dark region toward the median of the I(x,y), which could increase the brightness. On the contrary, the illumination correction on the bright area subtracts the estimated illumination of the bright area as shown in Eq. (11). A higher BR value would result in a higher intensity level on the bright areas being subtracted. Therefore, a high BR value would cause low contrast in the bright area and the unnatural appearance of the resultant image. Thus, instead of shifting the bright region toward the median of the image, it is shifted toward the maximum value between the mean and the median of the image. This procedure can minimize the BR value. Therefore, more contrast and naturalness can be preserved in the resultant image. In some extreme dark or bright situations, the derived DR and BR extremely shift the dark and bright regions toward the median, which would result in over enhancement and unnatural illumination transition of the output image. Thus, DRlimit and BRlimit are proposed to avoid the over-enhancement problem. DR is set to DRlimit if it exceeds the DRlimit, while BR is set to BRlimit if it exceeds the BRlimit.

$$ DRlimit=\left(\frac{\mathit{\min}\left( median\left( I\left( x, y\right)\right), mean\left( I\left( x, y\right)\right)\right)}{2\times \max \left( DE\left( x, y\right)\right)}\right), $$
(14)
$$ BRlimit=\left(\frac{\mathit{\max}\left( median\left( I\left( x, y\right)\right), mean\left( I\left( x, y\right)\right)\right)}{2\times \max \left( BE\left( x, y\right)\right)}\right), $$
(15)

where min and max are the minimum and maximum values of the number matrix tested, respectively. DRlimit is derived by limiting the maximum increment of the dark region to less than half of the minimum value between the mean and median of the image. BRlimit is derived by limiting the maximum decrement of the bright region to less than half of the maximum value between the mean and median of the image. This consideration is applied to prevent the average of the dark region from shifting beyond the median intensity of the image and average of the bright region to be shifted under the median intensity of the image. Over-shifting would cause an unsmooth transition from the dark to the bright region, which would lead to an unnatural resultant image.

2.3 Clipped histogram equalization

After the illumination correction, the contrast of IC(x,y) is reduced, which leads to a grayish output image because both dark and bright regions are shifted toward the median of the image. Therefore, the dynamic range of the output image is compressed. Thus, performing contrast enhancement on IC(x,y) is necessary. A modified clipped HE (CHE) is applied to balance between enhancing the contrast and amplifying the noises of the image. CHE is proposed to restrict the slope of the mapping function in HE to avoid over-enhancement [27]. Figure 5 shows the process of CHE and modified CHE, which is applied in the proposed method. In CHE, the number of pixels, which is more than the predefined clipping level (i.e., shaded region in Fig. 2(a)), is removed from the original histogram. Then, the clipped pixels are distributed evenly to all histogram bins, as shown in Fig. 5(b). However, uniform clipped pixel redistribution is not suitable for the proposed method because it does not solve the non-uniform illumination problem. According to the HE idea, the histogram for a good image has a flat or uniform distribution of pixels [34]. The appropriate median of an 8-bit image should be 128 because the median of the histogram is located at its center. The proposed method redistributes the clipped pixels based on the DR and BR ratios as shown in Fig. 5(c). The proposed redistribution can shift the median of the output image closer to 128, which could produce a more uniform distribution and a better image quality.

Fig. 5
figure 5

(a) Clipped histogram, (b) uniform clipped pixel redistribution, and (c) proposed clipped pixel redistribution

Figure 6 shows the relationship between the percentage of clipped pixels, EME [2], and C [19] according to the average results of 375 test images [41]. According to the test results shown in Fig. 6(a), a high percentage of clipped pixels results in better overall contrast but lowers the local contrast. Thus, this study proposes to clip out 50% of the total pixels to maintain the balance in terms of the local and overall contrasts. Figure 7 shows the flowchart of the clipping level identification. First, the histogram of IC(x,y) is sorted from low to high. Then, the percentage of the clipped pixels is determined using Eq. (16) repeatedly with an i increment of 1 until the percentage of the clipped pixels exceeds 50%. The clipping level is the number of pixels in the ith bin of the sorted histogram.

$$ PCP=1-\frac{\sum_j^i Sorted\; histogram(j)+ Sorted\; histogram(i)\times \left(256- i\right)}{total\; number\; of\; pixels}\times 100\%, $$
(16)
Fig. 6
figure 6

Relationship between percentage of clipped pixels, EME, and contrast

Fig. 7
figure 7

Flowchart of clipping level identification

where PCP is the percentage of clipped pixels. Next, a clipped histogram is formed using Eq. (17).

$$ Clipped\; histogram= minimum\left\{ histogram\; of\; IC\left( x, y\right), clippinglevel\right\} $$
(17)

Next, the clipped pixels (CP) are divided into three portions, namely, dark gain (DG), bright gain (BG), and global gain (GG), and added into the clipped histogram.

$$ GG= CP\times 0.5, $$
(18)
$$ DG=\frac{CP\times 0.5\times DR}{DR+ BR}, $$
(19)
$$ BG=\frac{CP\times 0.5\times BR}{DR+ BR}, $$
(20)
$$ Redistributed\; hisogram=\left\{\begin{array}{c}\hfill clipped\; histogram(i)+ GG+ DG, for\; i\le median\hfill \\ {}\hfill clipped\; histogram(i)+ GG+ BG, for\; i\le median\hfill \end{array}\right.. $$
(21)

Next, a transformation function (tf) is derived based on the redistributed histogram using Eq. (22). tf is used to remap the input image into a contrast-enhanced resultant image.

$$ \mathrm{Transformation}\; function, tf= cdf\times 255, $$
(22)
$$ cdf(i)-\frac{\sum_{j=0}^i redistributed\; histogram(j)}{total\; number\; of\; pixels},\begin{array}{cc}\hfill \hfill & \hfill \mathrm{where}\; i=0,1,2,\dots 255\hfill \end{array}, $$
(23)

where cdf is the cumulative density function of the redistributed histogram. Then, the IC(x,y) is remapped using the derived transformation function.

$$ \mathrm{Transformed}\; IC=\left\{ tf\left( IC\left( x, y\right)\right)|\forall \left( x, y\right)\in IC\right\}, $$
(24)

2.4 Detail enhancement

As mentioned in Section 2.1, details of the images are removed throughout the process to reduce the loss of details and noise amplification. Thus, the final stage of the proposed method is adding image details into the transformed IC(x,y). The Gaussian filter is applied to both I(x,y) and Threshold(x,y), where I(x,y) is the illumination assumption while Threshold(x,y) is the reflectance assumption. The removal of both details is important for the resultant image. Thus, detail enhancement is applied using Eq. (25).

$$ Output\; image= Transformed\; IC+{Detail}_{illumination}+{Detail}_{reflectance}, $$
(25)
$$ {Detail}_{illumination}= f\left( x, y\right)- I\left( x, y\right), $$
(26)
$$ {Detail}_{reflectance}= Threshold\left( x, y\right)- filtered\; Threshold\left( x, y\right), $$
(27)

where Detail illumination and Detail reflectance are the details removed in the illumination and reflectance assumptions, respectively.

3 Benchmark and quality metric

Both qualitative and quantitative analyses were conducted to evaluate the proposed method. The data samples used in this study comprised 375 images (size: 480 × 640) of the Pasadena Buildings 2010 packages [41] and 422 images (size: 592 × 896) of Faces 1999 (Front) packages [39], which were obtained from the California Institute of Technology database. These datasets were selected because they contain different types of illumination conditions. Some images in these datasets have bright foreground areas with dark background areas. Some images have the opposite illumination condition, where foreground areas are dark while background areas are bright. In addition, the illumination of images in some cases is not uniform, such that some images could be categorized as underexposed images, while other images are categorized as overexposed images. These different illumination conditions ensure that the evaluation is not biased toward only one type of illumination condition. The proposed method was implemented on Intel i7 2.5GHz using MatLab R2014a and compared with NPEA [38], MSRNIE [20], and GC-CHE [13].

The evaluation focused on contrast, detail preservation, and naturalness of the resultant image. The qualitative analysis was based on the visual evaluation of four different images with different illumination conditions. The conditions were (1) overexposed, (2) underexposed, (3) bright background but dark foreground, and (4) dark background but dark foreground. The analysis was conducted to evaluate the robustness of the performance of the proposed method in different illumination conditions. Four image characteristics, such as amount of image details, level of contrast, uniformity of illumination, and naturalness of images, were considered in the qualitative analysis. For the amount of image detail analysis, the resultant images were magnified for the inspection of image details (e.g., leaves, grass, and surface texture of walls). The resultant image with more observable details demonstrated better detail preservation performance. The contrast level was mainly judged by the distinctive level of the resultant image appearance. For example, the image with a significant intensity level difference between the dark- and bright-colored objects is said to have better contrast.

The uniformity of illumination represents the illumination correction capability of the tested methods. Evaluation was performed by inspecting the brightness differences of the bright and dark regions of the enhanced images. Lower brightness differences correspond to better illumination uniformity. The noise level of the resultant images was judged by the existence of speckles at the uniform intensity level area. Resultant images with more speckles have higher noise level, and therefore a lower image quality. The naturalness of the images was judged by the smoothness of the illumination transition of the resultant images.

Meanwhile, five quantitative evaluations, namely, entropy (E) [33], EME [2], PSNR, C [19], and NIQE [24], were employed to objectively evaluate the proposed method with other state-of-the-art methods.

Entropy was introduced by Shannon [33] to evaluate the amounts of details in images. Images with higher entropy values contain more information. The E of the image is given by

$$ E=-{\sum}_{i=1}^N p(i){log}_2 p(i) $$
(26)

where p(i) is the probability of the gray levels I as obtained in the image histogram.

EME is called the measure of enhancement or measure of improvement proposed by Agaian [2] and is used to determine the average ratio of the maximum to minimum intensities as given by

$$ EME=\frac{1}{k_1{k}_2}{\sum}_{l=1}^{k1}{\sum}_{k=1}^{k2}20\mathit{\log}\frac{I_{\mathit{\max}; k, l}^w}{I_{\mathit{\min}; k, l}^w+ c}, $$
(27)

where the image is broken into k1 × k2 blocks, wk. ,l (i,j). \( {\ I}_{\mathit{\max}; k, l}^w \) is the maximum intensity of each block. \( {I}_{\mathit{\min}; k, l}^w \) is the minimum intensity of each block. k and l are the horizontal and vertical coordinates of each sub-block, respectively, while w is the numbering of the sub-block. c is a small constant equal to 0.0001 to avoid division by 0. EME divides an image into numerous blocks, which is similar to the AHE idea. Therefore, EME is suitable for measuring the local contrast of images. In this paper, all images were divided into 16 × 16 blocks for EME measurement.

In the third measurement, PSNR measured how much the enhanced images have degraded compared to the input image, as shown in Eq. (28).

$$ \mathrm{PSNR}= 20\mathit{\log}\left.\left(\frac{L-1}{\sqrt{MSE}}\right)\right), $$
(28)

where L − 1 is the maximum gray level in the image.

$$ \mathrm{MSE}=\frac{1}{ W H}{\sum}_{i=1}^W{\sum}_{j=1}^H{\left({R}_{i j}-{I}_{i j}\right)}^2, $$
(29)

where R ij is the enhanced image, I ij is the original image, W is width of the image, and H is height of the image.

C calculates the division of gray levels in the contrast improvement analysis. A high value of C indicates a larger dynamic range of gray levels and has better overall contrast. C is computed in decibels as follows:

$$ C=10\;{log}_{10}\left[\frac{1}{WH}{\sum}_{\mathrm{x}=1}^{\mathrm{W}}{\sum}_{\mathrm{y}=1}^{\mathrm{H}}{\mathrm{g}}^2\left(\mathrm{x},\mathrm{y}\right)-{\left|{\sum}_{\mathrm{x}=1}^{\mathrm{W}}{\sum}_{\mathrm{y}=1}^{\mathrm{H}}\mathrm{g}\left(\mathrm{x},\mathrm{y}\right)\right|}^2\right], $$
(30)

where W and H are the width and height of the image, respectively, and g(x,y) is the gray level of the pixel at (x,y).

NIQE was used to measure the quality of the images based on the construction of a “quality aware” collection of statistical features based on a simple and successful space domain natural scene statistics (NSS) model. NIQE assumes that the naturalness of an image is affected by the amount of distortion that exists [24]. The image with a lower NIQE value indicates that less distortion exists in the image. Thus, the image has better quality.

$$ \mathrm{NIQE}=\sqrt{\left({\left({v}_1-{v}_2\right)}^T{\left(\frac{\sum_1+{\sum}_2}{2}\right)}^{-1}\left({v}_1-{v}_2\right)\right)}, $$
(31)

where v 1, v 2 and Σ 1 , Σ 2 are the mean vectors and covariance matrices of the natural MVG model and the multivariate Gaussian model of the distorted image, respectively.

4 Results and discussion

The results of the qualitative analysis of 4 of the 375 tested images, namely, Test Images 1, 2, 3 and 4, are shown in Figs. 8, 11, 13, and 15, respectively. Figures 9 and 10 show the magnified area of Test Image 1, while Figs. 12, 14, and 16 show the magnified areas of Test Images 2, 3, and 4, respectively. As supporting data, the results of the quantitative analyses of these four images are reported in Table 1. The best results in Table 1 are in boldface, and the second best results are underlined. These four tested images have different illumination conditions. Figure 8(a) shows that Test Image 1 is categorized as an underexposed image, where most areas are very dim. Figures 9 and 10 are the magnified images of the boxed area in Fig. 8(a). The resultant image of GC-CHE did not show obvious improvement compared to the original image. The resultant image of MSRNIE was slightly better than that of the GC-CHE because MSRNIE brightened the bottom area of the Test Image 1 as shown in Fig. 8(c). Figure 8(d) shows that NPEA produces the best illumination correction because all of the dark areas in the image were brightened while the bright areas remained unchanged. However, some defects could be observed from the image. As shown in the boxed area of Fig. 9(d), the illumination correction by the NPEA resulted in an unnatural appearance and the amplification of noise in its resultant image. An unnatural appearance can be seen at the unsmooth illumination transition area of the resultant images, where the dark regions were transformed into extremely bright regions. Although the proposed method did not produce an illumination correction that was as good as that of the NPEA, the contrast and brightness of the image details, such as the tree, as shown in Fig. 9(e), and the curtain, as shown in Fig. 10(e), were successfully enhanced. The comparison of Figs. 9(d) and 9(e) shows that the noise amplification of the proposed method was obviously lower than that of the NPEA. The promising qualitative results produced by the proposed method were supported by the quantitative analysis results as presented in Table 1. The resultant image of the proposed method produced the best entropy value and second best EME, PSNR, and C values. These results show that the proposed method can preserve image details and produce decent local and overall contrast enhancements.

Fig. 8
figure 8

Test Image 1: (a) original image, (b) GC-CHE, (c) MSRNIE, (d) NPEA, and (e) proposed method

Fig. 9
figure 9

Magnified Test Image 1 area 1 of (a) original image, (b) GC-CHE, (c) MSRNIE, (d) NPEA, and (e) proposed method

Fig. 10
figure 10

Magnified Test Image 1 area 2 of (a) original image, (b) GC-CHE, (c) MSRNIE, (d) NPEA, and (e) proposed method

Table 1 Results of quantitative analysis

The illumination condition of Test Image 2, as shown in Fig. 11(a), is opposite to that of Test Image 1. Test Image 2 is an overexposed image, where most areas of the image are very bright. Figure 12 shows the magnified image of the boxed area in Fig. 11(a). Figure 11(a) shows that the main problem of an overexposed image is its low contrast. For example, the boxed area in Fig. 11(a) is barely observable because of the strong effect of sunlight. Figure 12 shows that GC-CHE, MSRNIE, and NPEA methods failed to improve the contrast of the low-contrast area. Their resultant images shown in Figs. 12(b), (c), and (d), respectively, have similar contrast with or very slightly better contrast than that in Fig. 12(a), where the image details, such as the stitches on the fence (i.e., boxed area in Fig. 12(a)), are not emphasized. Thus, these methods are not suitable for the illumination correction of overexposed images. Meanwhile, the proposed method successfully enhanced the contrast of the aforementioned area. Figure 12(e) shows that the stitches on the fence can be observed easily. The quantitative analysis results in Table 1 also support the proposed method as the best method by producing the best result in the local contrast and image detail preservation (i.e., the method produced the best EME and entropy values).

Fig. 11
figure 11

Test image 2: (a) original image, (b) GC-CHE, (c) MSRNIE, (d) NPEA, and (e) proposed method

Fig. 12
figure 12

Magnified test image 2: (a) original image, (b) GC-CHE, (c) MSRNIE, (d) NPEA, and (e) proposed method

Test Image 3, as shown in Fig. 13(a), is an example of a non-uniform illuminated image with a bright background area (i.e., for example, the field and sky) but a dark foreground area (i.e., for example, the house and car). The resultant image of the NPEA, as shown in Fig. 13(d), shows the best illumination correction performance compared with other methods. The bright background region is darkened, while the dark foreground region is brightened. As a result, the resultant image is more uniform in illumination. Although GC-CHE, MSRNIE, and the proposed method had small contrast improvements compared with the original image, the proposed method is the best in local contrast improvement among the three methods as shown in Figs. 13(b), (c), and (e). This finding can be clearly observed by comparing the magnified image details shown in Fig. 14. The resultant image of the proposed method, as shown in Fig. 14(e), is clearer and the image details are more observable than that of the GC-CHE and MSRNIE methods, as shown in Figs. 14(b) and (c), respectively. The door in Fig. 14(e) is more observable than those in Figs. 14(b) and (c). Another advantage of the proposed method could be observed by comparing Figs. 14(d) and (e). Although Fig. 14(d) is clearer than Fig. 14(e), higher noise effects could be observed in Fig. 14(d), where speckles exist in the door region. The quantitative analysis, as reported in Table 1, significantly supported these qualitative findings, where the resultant image of the NPEA produced the best C value but the worst PSNR value, which shows that the resultant image is highly affected by unwanted noise. Meanwhile, the resultant image of the proposed method produced the best EME and the second best C. Although the PSNR of the proposed method is not as good as those of the GC-CHE and the MSRNIE, it is far better than that of the NPEA. Therefore, although the proposed method has a slightly lower contrast enhancement performance than that of NPEA, it is more stable in reducing the noise amplification problem for this type of image.

Fig. 13
figure 13

Test Image 3: (a) original image, (b) GC-CHE, (c) MSRNIE, (d) NPEA, and (e) proposed method

Fig. 14
figure 14

Magnified Test Image 3: (a) original image, (b) GC-CHE, (c) MSRNIE, (d) NPEA, and (e) proposed method

Test Image 4, as shown in Fig. 15(a), is an example of an image with a bright background area (i.e., the building) but dark foreground area (i.e., the tree). The results in Fig. 15 show that GC-CHE, MSRNIE, NPEA, and the proposed method produced quite similar enhancements on the bright background (i.e., the building areas). However, a significant difference could be observed at the tree area (the boxed region), as shown in Fig. 15(a). Fig. 16 shows the magnified image of the tree area. Based on both figures, MSRNIE improved the contrast of Test Image 4. However, some details of the image, especially those of the tree (i.e., as shown in Fig. 16), were poorly emphasized by MSRNIE. For example, the tree bark in the rectangle area in Fig. 16(c) is hardly observable. Meanwhile, GC-CHE emphasized the details better than MSRNIE, as shown in Fig. 16(b). However, the overall contrast of its resultant image is not as good as that of MSRNIE, which can be observed in Fig. 15. This finding shows that GC-CHE is probably good for local contrast enhancement but not for global contrast enhancement. The third state-of-the-art method, the NPEA, produced a better resultant image in terms of the visibility of the tree bark. However, the unsmooth transition of light and the amplification of noises, as shown in Fig. 16(d), resulted in an unnatural output image. On the contrary, Fig. 16(e) shows that the proposed method has the ability to produce a resultant image with better contrast, which successfully emphasized the tree bark. In addition, it can also reduce the effect of noise amplification because a smoother transition of light could be observed at the tree bark. Therefore, the proposed method is the best among the tested algorithms for the enhancement of Test Image 4.

Fig. 15
figure 15

Test image 4: (a) original image, (b) GC-CHE, (c) MSRNIE, (d) NPEA, and (e) proposed method

Fig. 16
figure 16

Magnified test image 4: (a) original image, (b) GC-CHE, (c) MSRNIE, (d) NPEA, and (e) proposed method

From the average results of the 375 images tested, the proposed method is ranked the best in terms of the EME, NIQE, and entropy, while GC-CHE and NPEA are ranked the best in terms of the PSNR and C, respectively. MSRNIE is ranked second in all measured aspects (i.e., EME, NIQE, entropy, PSNR, and C). The average EME value of the proposed method is 59.6% higher than the second ranked method (i.e., MSRNIE) and 73.6% higher than the worst ranked method (i.e., NPEA). This finding proves that the proposed method exhibits decent improvement in the local contrast of resultant images compared with other state-of-the-art methods. In the comparison of the averages of the NIQE values, the proposed method is 0.6% and 1.0% higher than the second best (i.e., MSRNIE) and the worst (i.e., GC-CHE) ranked methods, respectively. Therefore, the resultant image of the proposed method has the lowest distortion among the various methods. In terms of the average entropy value, the proposed method is 0.2% and 2.6% higher than the second (i.e., MSRNIE) and the worst (i.e., NPEA) ranked methods, respectively. This finding implies that the proposed method exhibits the best detail preservation among the various methods. The proposed method is ranked third in terms of the PSNR, where the average PSNR value of the proposed method is 15.3% lower than the best ranked method (i.e., GC-CHE) but 24.1% higher than the worst ranked method (i.e., NIQE). Although the noise amplification of the proposed method is higher than those of the GC-CHE and MSRNIE, it is much lower than that of the NIQE. Thus, the noise amplification of the proposed method is acceptable compared with that of the NIQE. The proposed method is ranked fourth in the average C values. Nevertheless, the difference between the proposed and the best ranked methods (i.e., NIQE) is only 0.1%. Thus, the difference in the overall contrast is negligible.

In summary, the GC-CHE has limited capability in terms of illumination correction and contrast enhancement, but is good in terms of noise suppression. The quantitative analysis results in Table 1 show similar findings. The GC-CHE is ranked the best in terms of the PSNR in both the Pasadena Building and Face datasets, and ranked third in terms of the EME, entropy, and C in the Pasadena Building dataset. The MSRNIE has a moderate illumination correction quality, although it has a good local contrast enhancement performance. This qualitative analysis is supported by the quantitative results of the MSRNIE. The MSRNIE produces the second best EME, entropy, NIQE, PSNR, and C results in the Pasadena Building dataset but the worst EME and entropy in the Face dataset. The NPEA performs excellently in terms of illumination correction but with drawbacks in noise amplification and limited local contrast enhancement. This finding is supported by the quantitative measurements of the NPEA, which has the best C value but the worst PSNR values in both the Pasadena Building and Face datasets. The proposed method has good illumination correction and excellent local contrast improvement, but limited global contrast enhancement. The best average EME, entropy, and NIQE values produced by the proposed method in both the Pasadena Building and Face datasets prove that it has the best local contrast enhancement and image detail preservation capability, which could produce resultant images that are more natural.

5 Conclusion

This study proposes a new method to enhance non-uniform illumination and low-contrast images. The proposed method applies the illumination and reflectance assumption to separate the dark and bright regions of an image. Then, these regions are enhanced using specifically designed dark and bright enhancers, respectively. The modified CHE is applied to the contrast enhancement. Finally, image details are added into the illumination-corrected and contrast-enhanced image as an output image. According to the qualitative analysis, the proposed method performs better than the state-of-the-art methods in terms of improving local contrast, preserving the details and naturalness of images, and reducing the effect of noise amplification. These findings are supported by the best EME, entropy, and NPEA results in the quantitative analysis. In addition, the implementation procedure of the proposed method does not require tuning any parameter. These advantages favor the proposed method as a good contrast enhancement method in automated applications.