1 Introduction

Remotely acquired digital imagery in diverse circumstances and its indispensable contribution for social welfare, demands an efficient quality enhancement as a core part of image pre-processing. In this manner, the required information can be restored and required parametric features can be sufficiently extracted according to the demand [21]. Researchers get highly fascinated by histogram equalization (HE) [5] and its efficiently modified variations due to their simplicity and less computational complexity. Obviously, the global HE cannot preserve local spatial features of the image which limits the amount of quality enhancement in all parts of the image and hence, researchers started looking for distributing histogram into its constituting sub-histograms for local histogram modifications [8, 15, 17, 18]. Fuzzy inspired histogram smoothening followed by local maxima based sub-division has been also proposed as Brightness preserving dynamic fuzzy HE (BPDFHE) [15]. Exposure-based sub-image HE (ESIHE) [17] has been proposed for low exposure images, where image exposure is utilized for sub-division. Afterward, median-mean dependent sub-image-clipped HE (MMSICHE) [18] has been introduced where histogram clipping is based on the median with bisecting each section to obtain four sub-images, so that they can be equalized locally. Later, recursive-ESIHE (R-ESIHE) [19] by iterative usage of ESIHE till exposure reduced to a predefined threshold. Also, its multi-level histogram separation version termed as recursively separated-ESIHE (RS-ESIHE) [19] has been also introduced. Later on, the averaging histogram equalization (AVGHEQ) [11], HE based optimal profile compression (HEOPC) [30] method for color image enhancement followed by HE with maximum intensity coverage (MAXCOVER) [31] have been also proposed. Also, the adaptive gamma correction with weighting distribution (AGCWD) [7] and its efficient variations [16, 20, 24,25,26,27,28,29,30,31] have been also proposed for dark images. Afterward, the intensity and edge-based adaptive unsharp masking filter (IEAUMF) [10] based enhancement have been also proposed by employing the unsharp masking filter for edge augmentation. Sigmoid mapping through cosine transformed Regularized-HE [4] has been also proposed. Recently, getting fascinated by artificial intelligence and deep learning based methods, various methodologies have been also proposed namely, LIME: Low-light image enhancement via illumination map estimation (LIME) [6], Deep photo enhancer: Unpaired learning for image enhancement from photographs with gans (DPE) [3], Learning to See in the Dark (LSD) [2], and Learning a deep single image contrast enhancer from multi-exposure images (LDSICEM) [1]. In the same sequence, although several kinds of enhancement methodologies have been proposed till date for widely diverse characteristics of images from various domains, (contextual literature survey is explicitly presented in [21, 24, 25]), still most of them are lagging when it comes to the matter of enhancement of different domain images through a single approach. In this paper, a robust and highly adaptive end-to-end framework is proposed for quality enhancement of almost all kind of images. On the first sight, the term “gamma correction” seems somehow conventional; but any approach which is capable for computing the quality enhanced intensity distribution out of the input intensity distribution through raising radical powers comes under the head of the gamma correction. Decision making of adaptive gamma value-set precisely for each individual intensity level of the image, is still an open problem, as most of the proposed gamma based (radically powered) algorithms lead to over-enhancement and extreme ends’ saturation, and hereby proposed algorithm seems free from these drawbacks due to deciding a novel kind of gamma value set through “optimal PSNR based perfectly re-allocated and reconstructed” intensity distribution. Here, as such no greedy behavior based optimization algorithm is involved for a blind random search, and hence, the approach is not iterative as a whole. It needs only 2–4 iterations at most for thresholds identification and subsequent histogram division based on optimal PSNR value, but gamma value-set evaluation non-iterative at all. Here, a precisely re-allocated intensity-span is derived through reconstruction of the image by considering first and second moment for histogram sub-division, and later the cumulative distribution of the reconstructed images itself is utilized for deriving a gamma value set. The corresponding individual values from this set when raised up as radicals over the reconstructed and re-allocated intensity levels of the image under consideration leads to the overall quality enhancement. Remaining manuscript is drafted as follows: after brief literature survey and basic introduction in section 1; section 2 explains the proposed algorithm followed by its stepwise framework. Later, section 3 deals with the experimentation followed by corresponding results and discussion; and in section 4, conclusions are drawn.

2 Proposed methodology

Hue-Saturation-Intensity (HSI) colour image model is generally utilized for separation of chromatic as well as non-chromatic image information. For the proposed quality enhancement for the colour images, hue and saturation channels can be kept unaltered along with relevant processing over intensity channel. The entire methodology using process-flow diagram is presented in Fig. 1, and the corresponding step-wise procedure is as follows:

  1. Step 1:

    Initially, all three channels (R, G, B) are linearly stretched for dynamic range expansion. For R-channel:

Fig. 1
figure 1

Process Flow for the proposed methodology

$$ R\left(u,v\right)\leftarrow \frac{R\left(u,v\right)-{R}_{\mathrm{min}}}{R_{\mathrm{max}}-{R}_{\mathrm{min}}} $$
(1)

Here, Rmax =  max {R(u, v)} and Rmin =  min {R(u, v)} for all the pixel elements (u, v) for R-channel. Similarly, other two channels can be stretched.

  1. Step 2:

    Extraction of intensity (luminance or V-channel) information after RGB to HSI colour space conversion as:

$$ {\left[H\left(u,v\right),S\left(u,v\right),I\left(u,v\right)\right]}^T={T}_{RGB}^{HSI}{\left[R\left(u,v\right),G\left(u,v\right),B\left(u,v\right)\right]}^T, $$
(2)

Here, \( {T}_{RGB}^{HSI} \) is RGB to HSI transformation process.

  1. Step 3:

    Histogram {H(h)} of the luminance channel is employed for further processing. Here, H(h) is count of pixels having hth intensity value. Set a ← min(h) and b ← max(h) which also represents the entire range of histogram starting from its lowest pixel intensity value to largest pixel intensity value. Calculate the mean (μ) and standard deviation (σ) for this operational range [a, b] of the histogram /sub-histogram (for next level division), using:

$$ \mu =\frac{\sum_{h=a}^b hH(h)}{\sum_{h=a}^bH(h)}, $$
(3)
$$ \sigma ={\left(\frac{\sum_{h=a}^b{\left(h-\mu \right)}^2H(h)}{\sum_{h=a}^bH(h)}\right)}^{\raisebox{1ex}{$1$}\!\left/ \!\raisebox{-1ex}{$2$}\right.}, $$
(4)
  1. Step 4:

    Set two threshold values i.e. T1 = μ − σ and T2 = μ + σ, so that the “the operational region” (mentioned in Step 3) can be distributed into its further sub-regions.

  2. Step 5:

    Store [a, T1] and [T2, b] as two parts of the histogram without further distributing them so that they can be retained as such till their equalization in subsequent steps. Consider [T1 + 1, T2 − 1] as sub-histogram region Hk(h) so that operations can perform the next step so that it can be adaptively distributed in further recursive steps.

  3. Step 6:

    Cumulative distribution function (CDF) for each kth sub-histogram can be evaluated as:

$$ cd{f}_k(h)=\frac{1}{N_k}{\sum}_{h_k+1}^{{\mathrm{h}}_{k+1}}{H}_k(h), $$
(5)

Here, intensity span of every kth histogram can be considered in the range [hk + 1 → hk + 1]. Here, Nk is the net pixel count inkthsub-histogram.

  1. Step 7:

    Equalize all sub-histograms independently as:

$$ {\widehat{I}}_k={I}_{k\_\min }+\left({I}_{k\_\max }-{I}_{k\_\min}\right)\ast cd{f}_k(h), $$
(6)
  1. Step 8:

    Overall reconstructed image can be derived as:

$$ \widehat{I}={\widehat{I}}_1\cup {\widehat{I}}_2\cup {\widehat{I}}_3\cup ...\cup {\widehat{I}}_k; $$
(7)
  1. Step 9:

    Calculate the value of PSNR in dB for enhanced intensity channel obtained in this iteration with reference to that in previous iteration as [31]:

$$ PSNR=10{\log}_{10}\frac{255}{MSE}, $$
(8)

Here, RSME is root-mean-square error, defined as [31]:

$$ MSE=\frac{1}{M\times N}{\left\Vert \widehat{I}-I\right\Vert}_2^2, $$
(9)

Here, I and \( \widehat{I} \) are input and output images for every iteration. Find the difference of PSNR value obtained in this step with that obtained in the previous step.

  1. Step 10:

    Now, follow the optimal PSNR criterion to decide the requirement of next level thresholding. Here, recursion is aborted if difference in PSNR values (obtained in successive steps) gets reduced to less than 0.01 dB. In other words, next level thresholding has to be aborted when PSNR value gets saturated, as this saturation symbolizes insignificant further image division/reconstruction; and hence, not appreciated.

  2. Step 11:

    If the optimal PSNR criterion as mentioned in step-10 is not achieved, then assign [a, b] Ɏ ← [T1 + 1,T2–1] and repeat steps 3–9 for further adaptive separation; and hence, adaptively equalized output can be achieved.

  3. Step 12:

    Afterwards, cumulative distribution has to be derived reconstructed image so that the adaptive gamma value-set can be derived as:

$$ \gamma (i)=1- cd{f}_m(i), $$
(10)

Finally, the enhanced output is achieved as:

$$ {I}_{en}(i)={\left[\overset{\frown }{I}(i)\right]}^{\gamma (i)}, $$
(11)
  1. Step 13:

    Finally, the enhanced image can be obtained as:

$$ {\left[R\left(u,v\right),G\left(u,v\right),B\left(u,v\right)\right]}^T={T}_{HSI}^{RGB}{\left[H\left(u,v\right),S\left(u,v\right),\widehat{I}\left(u,v\right)\right]}^T, $$
(12)

Here, \( {T}_{HSI}^{RGB} \) is HSI to RGB transformation process.

At the first attempt, two (2) threshold values are identified and hence, results into three (3) sub-histograms, followed by their individual equalization. If the stopping criterion will not get satisfied (i.e., PSNR >0.01 dB), then both of the above thresholds will be treated as extreme end of the middle sub-histogram which is further subdivided in the similar fashion as mentioned above. Hence, the new threshold values will be identified in-between the previous threshold values. In this manner, by the end of second attempt of division, there will be four (4) threshold values and accordingly five (5) sub-histograms. In most of these cases, it is insignificant to looking forward for further sub-division.

3 Experimental results: performance evaluation and comparisons

Multilevel iterative thresholds are shown in Fig. 2. Table 1 lists the number of iterations and corresponding threshold values evaluated iteratively (as shown in Fig. 3) for all test images. The iteration-count varies adaptively according to the intensity spread of the image. Performance evaluation and comparison is done by proper reimplementation of some very popular state-of-the-art enhancement methodologies namely, GHE [5], BPDFHE [15], MMSICHE [18], RSEISHE [19], AGCWD, AVGHEQ [11], HEOPC [22], MAXCOV [23], RHE-DCT [4], IEAUMF [10], LIME [6], LSD [3], DPE [2] and LDSICEM [1]. Quantitative analysis (Tables 2, 3, 4, 5, 6, 7, 8 and 9) is done by using 8 reliable statistical performance measures namely, average brightness (B), average contrast (V), average discrete information content (or entropy, E), sharpness (S), and colorfulness (C) of the image. Considering intensity value I(u, v) for pixel element located at uth row and vth column of its equivalent image M × N matrix whose size is similar to that of corresponding intensity channel of the image, and its performance measures can be formulated as follows.

Fig. 2
figure 2

Multilevel thresholding of intensity value axis

Table 1 Number of iterations and corresponding threshold values evaluated for images under consideration
Fig. 3
figure 3

Quality enhanced results of different algorithms for “Image 1”

Table 2 Brightness (B) values for comparative quantitative evaluation among various algorithms
Table 3 Contrast (V) values for comparative quantitative evaluation among various algorithms
Table 4 Entropy (H) values for comparative quantitative evaluation among various algorithms
Table 5 Sharpness (S) values for comparative quantitative evaluation among various algorithms
Table 6 Colorfulness (C) values for comparative quantitative evaluation among various algorithms
Table 7 GLCM Homogeneity (GH) values for comparative quantitative evaluation among various algorithms
Table 8 GLCM Energy (GE) values for comparative quantitative evaluation among various algorithms
Table 9 GLCM Correlation (GC) values for comparative quantitative evaluation among various algorithms

Mean represents the average intensity value [11], which indirectly informs about the average image brightness level for the image under consideration. Brightness (B) or mean can be expressed as:

$$ B=\frac{1}{M^{\ast }N}{\sum}_{u=1}^M{\sum}_{v=1}^NI\left(u,v\right), $$
(13)

Likewise, intensity spread or variance (V) or contrast indicates the amount of intensity deviation per pixel with respect to the mean intensity level (B) of the image, as:

$$ V=\frac{1}{M^{\ast }N}\sum \limits_{u,v}I{\left(u,v\right)}^2-{\left(\frac{1}{M^{\ast }N}\sum \limits_{u,v}I\left(u,v\right)\right)}^2, $$
(14)

In this manner, the total sum of the intensity dispersions (w.r.t. mean level) can be identified as contrast and obviously it should be high for proper quality enhancement. In addition, for proper information content evaluation, Shannon entropy based characterization can be applied as:

$$ H=-\sum \limits_{i=0}^{I_{\mathrm{max}}}{p}_i{\log}_2\left({p}_i\right), $$
(15)

where, pi = ni/(M × N) is the possibility of existence of ith level of intensity, and Imax is the maximum available intensity. Here, M × N represents the total number of pixels present in an image. The gradient is obtained from:

$$ S=\frac{1}{M^{\ast }N}\sum \limits_{u,v}\left(\sqrt{\varDelta {u}^2+\varDelta {v}^2}\right), $$
(16)

Δu = Ienh(u, v) − Ienh(u + 1, v)and Δv = Ienh(u, v) − Ienh(u, v + 1) are the local gradients of enhanced image. Higher the gradient value more will be the sharpness of image. Along with above intensity based measures, colorfulness is also used for proper evaluation of the quality of color images. The colorfulness can be expressed numerically, as:

$$ C=\sqrt{\sigma_{rg}^2+{\sigma}_{yb}^2}+0.3\sqrt{\mu_{rg}^2+{\mu}_{yb}^2}, $$
(17)
$$ \varDelta rg=R-G, $$
(18)
$$ \varDelta yb=0.5\left(R+G\right)-B, $$
(19)

Here, μrg, μyb are the mean values and σrg, σyb are the standard deviation values of Δrg, Δyb respectively. Spatial co-occurrence of the image pixels are usually avoided while evaluating the intensity based indices, and hence, to resolve it, Grey-Level Co-occurrence Matrix based performance indices also plays a significant role for texture and other spatially influenced properties. Overall statistical and spatial behavior w.r.t. reference pixel can be derived by calculating the pixel-wise average for all four directional matrices:

$$ GLCM=0.25\left( GLC{M}_0+ GLC{M}_{\raisebox{1ex}{$\pi $}\!\left/ \!\raisebox{-1ex}{$4$}\right.}+ GLC{M}_{\raisebox{1ex}{$\pi $}\!\left/ \!\raisebox{-1ex}{$2$}\right.}+ GLC{M}_{\raisebox{1ex}{$3\pi $}\!\left/ \!\raisebox{-1ex}{$4$}\right.}\right); $$
(20)

In this paper, three well known GLCM based indices, i.e. GLCM-Correlation, GLCM-Energy and GLCM-Homogeneity are evaluated. Any element of the GLCM matrix Ψ(m, n), is usually evaluated by considering the nth neighboring pixel w.r.t. mth pixel, and later on, by calculating the μm, μn, σm, andσn as the corresponding mean values and standard deviation values respectively. GLCM-correlation (GC) stands for the interdependency for the corresponding neighborhood of the pixels w.r.t. reference pixels, expressed as:

$$ GC=\sum \limits_{m=0}^{M-1}\sum \limits_{n=0}^{N-1}\frac{\left(m-{\mu}_m\right)\left(n-{\mu}_n\right)\varPsi \left(m,n\right)}{\sigma_m.{\sigma}_n}, $$
(21)

GLCM-Energy (GE) can be characterized by normalized count of repeated pairs. Intuitively, these are responsible for uniformity of texture, and hence, expressed as:

$$ GLCM- Energy(GE)=\sum \limits_{m=0}^{M-1}\sum \limits_{n=0}^{N-1}\varPsi {\left(m,n\right)}^2, $$
(22)

GLCM-homogeneity (GH) can be characterized by the closeness of neighboring pixels with reference pixels. Intuitively, these are also responsible for uniformity of texture, and hence, expressed as:

$$ GH=-\sum \limits_{m=0}^{M-1}\sum \limits_{n=0}^{N-1}\varPsi \left(m,n\right) lo{g}_2\varPsi \left(m,n\right), $$
(23)

Qualitative (visual) analysis for enhancement of images is shown in Figs. 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21 and 23. Comparative evaluation for Brightness (B), Contrast (V), Entropy (E), Sharpness (S), colourfulness (C), GLCM-homogeneity (GH), GLCM-energy (GE), GLCM-correlation (GC) are listed in Tables 2 to 9, respectively. It can be easily noticed from the tabular results that both entropy and contrast are highly desirable along with image sharpness content of the information. Also, certain amount of brightness should be also increased, which is also desired for clear contrast evaluation in case of dark images.

Fig. 4
figure 4

Quality enhanced results of different algorithms for “Image 2”

Fig. 5
figure 5

Quality enhanced results of different algorithms for “Image 3”

Fig. 6
figure 6

Quality enhanced results of different algorithms for “Image 4”

Fig. 7
figure 7

Quality enhanced results of different algorithms for “Image 5”

Fig. 8
figure 8

Quality enhanced results of different algorithms for “Image 6”

Fig. 9
figure 9

Quality enhanced results of different algorithms for “Image 7”

Fig. 10
figure 10

Quality enhanced results of different algorithms for “Image 8”

Fig. 11
figure 11

Quality enhanced results of different algorithms for “Image 9”

Fig. 12
figure 12

Quality enhanced results of different algorithms for “Image 10”

Fig. 13
figure 13

Quality enhanced results of different algorithms for “Image 11”

Fig. 14
figure 14

Quality enhanced results of different algorithms for “Image 12”

Fig. 15
figure 15

Quality enhanced results of different algorithms for “Image 13”

Fig. 16
figure 16

Quality enhanced results of different algorithms for “Image 14”

Fig. 17
figure 17

Quality enhanced results of different algorithms for “Image 15”

Fig. 18
figure 18

Quality enhanced results of different algorithms for “Image 16”

Fig. 19
figure 19

Quality enhanced results of different algorithms for “Image 17”

Fig. 20
figure 20

Quality enhanced results of different algorithms for “Image 18”

Fig. 21
figure 21

Quality enhanced results of different algorithms for “Image 19”

Fig. 22
figure 22

Comparative analysis for execution times

Fig. 23
figure 23

Quality enhanced results of different algorithms for “Image 20”

Also, for identifying the textural improvement, GLCM based performance measures like GLCM- are also employed and the excellence of the proposed model, and the lower value are desired for GLCM-homogeneity, GLCM-energy, GLCM-correlation for better visualization in context of both human as well as machine-vision perspective.

Finally, it can be easily concluded that this approach outperforms the other state-of-the-art approaches. The novelty of the work can be justified as the re-allocation of intensity levels for corresponding pixel elements is so precise due to least successive differential change in PSNR value which ensures that further division or further reconstruction is obviously redundant. As this statistical moment-based redistribution needs only 2–4 iterations at most for subsequent histogram division, otherwise this approach is free from iterative greedy algorithms and hence system complexity is not so high. Due to this adaptive behavior of the intensity distribution the gamma value-set when derived from it, is obviously highly adaptive and here individual gamma values those evaluated explicitly raised over reconstructed intensity values, unlike conventional gamma correction methods. Unlike greedy algorithms, it is a parameter-free approach, hence no pre-specified count for sub-divisions. It imparts the better gamma-corrected intensity distribution throughout the dynamic range. In addition multiple repetitive equalizations like other methods have been avoided for extreme intensity levels according to the image behavior. Here, only the in-between middle range (μ1 − σ1, μ1 + σ1) is only operated for further sub-division (which is also limited to 2–3 iterations) the range and rest of the intensity values themselves decide their adaptive gamma value-set locally. This is the sole region that over-enhancement (which leads to saturated patches) and under-enhancement (which leads to dark patches) can be easily avoided and hence, naturally looking, quality enhanced images can be achieved. Desired time-complexity analysis is also presented in Table 10 and Fig. 22, by executing the proposed method as well as all the state-of-the-art methodologies in a similar environment. The running time is calculated as an averaged execution time for a set of 120 test images.

Table 10 Average execution time (in seconds) for comparative quantitative evaluation among various algorithms

4 Conclusion

In this paper, a new quality enhancement approach especially for dark or poorly illuminated images with a core objective to re-allocate the processed pixels using reclusive histogram sub-division along with an adaptive stopping criterion based on pixel wise relative L2-norm basis (which itself is intuitively related to optimal PSNR value). Employing such kind information preserved signal reconstruction based stopping criterion makes the desired intensity distribution easy achievable in less iterations and hence complexity hike due iterative behaviour can be easily compensated to a great extent. Hence, iteration count only ranges from 2 to 3. Perfectly reconstructed, moment-centered piecewise sub-equalized statistical distribution which intuitively leads to the adaptive or image dependent evaluation of the desired gamma value-set, so that precise re-allocation of the transformed intensity bin-values. Due to this adaptive behavior of the intensity distribution the gamma value-set when derived from it, is obviously highly adaptive and here individual gamma values are evaluated explicitly raised over reconstructed intensity values, unlike conventional gamma correction methods. This adaptiveness makes the entire methodology highly capable for covering a wide variety of images, due to which robustness of the algorithm also increases. The proposed methodology has been verified on various dark images. The desired performance has been achieved visually and also measured by using relevant image quality matrices.