1 Introduction

The noise level is a crucial parameter for many image processing algorithms and applications, such as image denoising [2, 6, 11, 33], segmentation [1, 28, 31], superresolution [8, 20] and image quality assessment [14]. The noise level is not always available in practice; however, it is often assumed to be known in many algorithms [2, 7, 9, 30, 32]. Thus, accurate and reliable noise level estimation for image processing is currently in high demand.

The model of a noisy image is often expressed as y = x+v. Here, \(\textbf {y}\in \mathbb {R}^{m \times n}\) is a measurement image, \(\textbf {x} \in \mathbb {R}^{m \times n}\) is a noise-free image, and \(\textbf {v} \in \mathbb {R}^{m \times n}\) is added white Gaussian noise with zero mean and variance σ2. The main objective of noise level estimation is to estimate the unknown variance σ2. Over the past decades, many noise level estimation algorithms have been proposed. These algorithms can be broadly divided into filter- [10, 13, 21, 22, 29] and path-based approaches [5, 12, 15, 16, 18, 19, 24, 34].

In filter-based methods, the noisy image is initially filtered by a low-pass filter. Then, the variance is estimated from the difference between the measurement image and its filtered image. The main challenge in these methods is to design suitable filters. Filter-based methods can also be applied in a transform domain, such as the discrete wavelet transform (DWT). Donoho [10] has proposed a method for estimating σ that depends only on the median absolute deviation of the wavelet coefficients at the finest scale. However, it is difficult to prove theoretically whether the result that is estimated via wavelet-based techniques is overestimated or not because the wavelet transformation has difficulty completely separating the image signal from a noisy image that contains complicated structures, edges, and high-frequency components. Oyet et al. [22] and Hashemi et al. [13] pointed out that the algorithm proposed in [10] may be inconsistent with the actual noise variance. Therefore, this estimation result is often used as an initial noise variance to improve the accuracy of noise level estimation [12, 17].

Patch-based methods play an important role in noise level estimation. In these methods, a noisy image is initially decomposed into a group of patches. Then, the flat patches are selected via various statistical techniques [5, 15, 16, 18]. Typically, patch-based methods estimate the noise level based on the minimal eigenvalue of the covariance matrix of the flat patches [15, 19, 24]. Based on the results that were obtained by Blom et al. [25, 26], Chen et al. [5] proved that both WT [19] and PCA [24] may underestimate the noise level. Hence, they proposed a new nonparametric algorithm for efficient noise level estimation. Unlike WT and PCA, wherein the noise level is estimated directly by the minimal eigenvalue, Jiang et al. [15] proposed an algorithm for estimating the noise level by the ratio of the minimal eigenvalue to a constant that is less than one. However, they did not determine whether the estimation results that were obtained by their algorithm were overestimated or not. Additionally, the algorithms [15, 19, 24] did not analyze the effect of the total number of flat patches on the estimation result. This study mainly focuses on solving the above-mentioned problems. Using Blom’s theory, we establish the relationship between the eigenvalues of the covariance matrix of flat patches and the true noise variance. Based on this relationship, an overestimated result is obtained. Then, by combining the two noise level estimation results, namely, the underestimated and overestimated results, we propose a new noise level estimation algorithm.

The main contributions of this paper are as follows. First, based on Blom’s theorem, the effects of the eigenvalues on the final estimation result were analyzed. The conditions for assessing whether an estimate was overestimated or not were presented. Second, a new noise level estimation algorithm was proposed. Moreover, we proved that the estimate that was obtained via the proposed algorithm is a linear combination of the overestimated and underestimated results and that the combinatorial coefficients are related to the number of flat patches. The results of extensive tests demonstrated that our algorithm can realize high performance in most cases, particularly for images that have high noise levels.

The remainder of this paper is organized as follows: Section 2 introduces the principles of that are used to select the weak textured patches and flat patches. An analysis of the basic theory is presented, and the proposed noise level estimation algorithm is described in Section 3. Section 4 specifies the parameter settings, presents the experimental results of a computer simulation that utilized the proposed algorithm, and compares the results with those that were obtained via various other algorithms. The conclusions and a future research direction are discussed in Section 5.

2 Related studies

In this section, we review the weak textured patch selection and flat patch selection methods, which are foundational to this study.

2.1 Weak textured patch selection method

Image structure can be measured effectively by the gradient covariance matrix [33]. Accordingly, Liu et al. [19] developed a weak textured patch selection method. In their study, a noisy image was initially filtered by the horizontal derivative operators, which are denoted by Dh, and the vertical derivative operators, which are denoted by Dv. Then, the filtered image was decomposed into overlapping patches, which are denoted as \(\bar {\textbf {y}}_{j}\) that are of size w × w. The top-left corner positions of all patches were obtained from the set {1,2,⋯ , mw + 1}×{1,2,⋯ , nw + 1}. Subsequently, they were rearranged into vectors of N = w2 elements. The total number of patches is denoted by s, and expressed as s = (mw + 1) × (nw + 1). Finally, an iterative weak textured patch selection algorithm and a noise level estimation algorithm were proposed. In the kth iteration, the threshold, which is denoted as τ, is updated with a significance level δ and noise level σk as follows:

$$ \tau = {\sigma_{k}^{2}}F^{-1}(\delta,\frac{N}{2},\frac{2}{N}tr(\textbf{D}_{h}^{T} \textbf{D}_{h}+\textbf{D}_{v}^{T} \textbf{D}_{v}), $$
(1)

where F− 1(δ, α, β) is the inverse gamma cumulative distribution function.

The weak textured patches that are extracted from the noisy images are denoted by pi. The covariance matrix \({\sum }_{\textbf {p}}\) of the selected weak textured pathes is defined as follows:

$$ {\sum}_{\textbf{P}} = \frac{1}{s^{\prime}}\sum\limits_{j = 1}^{s^{\prime}}(\textbf{p}_{j}-\boldsymbol{\mu})(\textbf{p}_{j}-\boldsymbol{\mu})^{T}, $$
(2)

where \(\boldsymbol {\mu }= \frac {1}{s^{\prime }}\sum \limits _{j = 1}^{s^{\prime }}\textbf {p}_{j}\), and \(s^{\prime }\) is the total number of selected patches. According to the algorithm reported in [19], the noise level can be estimated as follows:

$$ {\sigma_{w}^{2}} = \min\limits_{1 \leq i \leq N}(e_{i}), $$
(3)

where ei represents the eigenvalues of \({\sum }_{\textbf {p}}\).

2.2 Flat patch selection method

In the flat patch selection algorithm, the noisy image is decomposed into overlapping patches. Let P = {yl;l = 1,2,⋯ , s} be the set of all patches from the noisy image y, where yl is the observed patch, which has a patch size of w × w. The average pixel intensity in patch yl is denoted by μ. Then, the local variance is defined by

$$ {\sigma_{l}^{2}} = \sum \limits_{y \in \textbf{y}_{l}}(y -\mu)^{2}/(w^{2}-1). $$
(4)

For all flat patches, it follows that \((w^{2}-1) {\sigma _{l}^{2}}/\sigma ^{2}\sim \chi ^{2}(r)(r=w^{2}-1)\), where χ2(r) is a chi-square distribution with r degrees of freedom. Thus, \({\sigma _{l}^{2}} \sim \gamma (r/2,2\sigma ^{2}/r)\) with the following probability density function (PDF):

$$ f(x)=\left\{ \begin{array}{ll} \frac{1}{{\Gamma}(r/2)}x^{\frac{r}{2}-1}(\frac{r}{2\sigma^{2}})^{\frac{r}{2}}e^{-\frac{r}{2\sigma^{2}}x}, & x\geqslant0, \\ 0, & otherwise. \end{array} \right. $$
(5)

The mean of \({\sigma _{l}^{2}}\) is as follows:

$$ E({\sigma_{l}^{2}})=\frac{r}{2}\times \frac{2\sigma^{2}}{r}. $$
(6)

For the flat patches, the following theorem applies:

Theorem 1

[15] There must exist a unique\(\widetilde {\sigma }^{2} (\widetilde {\sigma } > 0)\)suchthat the following equations hold:

$$ \widetilde{\sigma}^{2} = E({\sigma_{l}^{2}} | {\sigma_{l}^{2}} < \lambda \widetilde{\sigma}^{2} ), $$
(7)

and

$$ \widetilde{\sigma}^{2} = \rho\sigma^{2}, $$
(8)

with

$$ \rho = \frac{{\int}_{0}^{F^{-1}(\delta,\frac{r}{2},\frac{2}{r})}xz(x)dx}{{\int}_{0}^{F^{-1}(\delta,\frac{r}{2},\frac{2}{r})}z(x)dx}, $$
(9)
$$ \lambda = F^{-1}(\delta,\frac{r}{2},\frac{2}{r})/\rho, $$
(10)

wherez(x) = σ2f(σ2x) represents the PDF of\(\gamma (\frac {r}{2},\frac {2}{r})\), F− 1(⋅) is the inverse Gamma cumulative distribution function with\(\frac {r}{2}\)shape parameter and\(\frac {2}{r}\)scale parameter, andδ, which is a specified significance level, denotes the probability that the local variance is does not exceed\(\lambda \tilde {\sigma }^{2}\), i.e., \(P({\sigma _{l}^{2}} \leqslant \lambda \tilde {\sigma }^{2}) = \delta \)(P(⋅) represents the probability).

By employing Theorem 1, Jiang et al. developed an algorithm [15] for selecting flat patches. The main parameters and their interrelations are presented in Table 1. More details regarding the parameter settings and the experiment can be found in [15]. Next, the covariance matrix \({\sum }_{I}\) that is generated from those flat patches is defined by

$$ {\sum}_{I}= \left\{ \begin{array}{cc} \frac{1}{num_{_{V}}-1}(I-{I_{m}^{1}})(I-{I_{m}^{1}})^{T}, & num_{_{V}} \geq w^{2}, \\ \frac{1}{r-1}(I-{I_{m}^{2}})(I-{I_{m}^{2}})^{T}, & num_{_{V}} < w^{2}, \end{array} \right. $$
(11)

where \(I = \{\textbf {y}_{l_{1}}, \textbf {y}_{l_{2}},\cdots ,\textbf {y}_{l_{num_{_{V}}}}\}\) is an \(N\times num_{_{V}} \) matrix and \({I_{m}^{1}}\) and \({I_{m}^{2}}\) are the column averages of I and IT, respectively, where IT is the transpose of I. According to the algorithm that is presented in [15], the noise level of the image is estimated as follows:

$$ \hat{\sigma}=\frac{\bar{\sigma}_{f}}{\sqrt{\rho}}, $$
(12)

where \(\bar {\sigma }_{f}\) satisfies the following equation:

$$ \bar{\sigma}_{f}^{2} = \min\limits_{1 \leq i \leq N}(e_{i}), $$
(13)

in which ei denotes the ith eigenvalue of \({\sum }_{I}\).

Table 1 Different λ and ρ according to δ

3 Main results and algorithm

In this section, the theoretical foundation of the algorithm is discussed and the relationship between the eigenvalues and the noise level is analyzed. Then, we propose a new noise level estimation algorithm that is based on the flat patches and local statistics.

3.1 Eigenvalue analysis

To compute \({\sigma _{w}^{2}}\) in (3) and \({\sigma _{f}^{2}}\) in (13), we need the eigenvalues of the covariance matrix. Regarding the distribution of the covariance matrix eigenvalues, Chen et al. [5] proved the following theorem, which is crucial to this study.

Theorem 2

Given a set of random variables\(\{\textbf {y}_{t}[i]\}_{t = 1}^{s}\), with each element following Gaussian distributionN(0, σ2) independently,the distribution of the noise estimates\(\hat {\sigma }_{i}^{2} =\frac {1}{s}{\sum }_{t = 1}^{s}\textbf {y}_{t}[i]^{2}\)convergesto the distribution\(N(\sigma ^{2},\frac {2\sigma ^{4}}{s})\)as s becomes sufficiently large.

Let \({\Phi }(x)=\frac {1}{\sqrt {2\pi }}{\int }_{-\infty }^{x}e^{-t^{2}/2}dt\) denote the cumulative distribution function of a standard Gaussian distribution. Blom [25, 26] proved the following theorem.

Theorem 3

Givenn independent random variables, namely,x1, x2,⋯ , xN, that are generated from the normal distributionN(σ2, ν2) withorderx1x2 ≥⋯ ≥ xN, then, the expected value ofxicanbe approximated by\(\mathbb {E}(x_{i}) \approx \sigma ^{2} + {\Phi }^{-1}(\frac {N-\alpha + 1-i}{N-2\alpha + 1})\nu \)withα = 0.375.

Corollary 3.1

If\(i>\frac {N + 1}{2}\), then\(\mathbb {E}(x_{i}) < \sigma ^{2}\). If\(i< \frac {N + 1}{2}\), then\(\mathbb {E}(x_{i}) > \sigma ^{2}\).

Proof

If \(i>\frac {N + 1}{2}\), then N + 1 − 2i < 0. By adding N − 2α + 1 to both sides, we obtain 2N − 2α + 2 − 2i < N − 2α + 1, that is, \(\frac {N-\alpha + 1-i}{N-2\alpha + 1}<\frac {1}{2}\). Then, we have \({\Phi }^{-1}(\frac {N-\alpha + 1-i}{N-2\alpha + 1})<0\). Let i = N. We obtain \(\sigma ^{2} + {\Phi }^{-1}(\frac {1-\alpha }{N-2\alpha + 1})\nu < \sigma ^{2}\), with \(\nu = \sqrt {\frac {2\sigma ^{4}}{s}}\). □

The same method can be used to analyze the case of \(i<\frac {N + 1}{2}\).

Corollary 3.2

The estimate of\({\sigma _{w}^{2}}\)in (3) satisfies the following equation:

$$ {\sigma_{w}^{2}} = \sigma^{2} + {\Phi}^{-1}(\frac{1-\alpha}{N-2\alpha+ 1})\nu < \sigma^{2}. $$
(14)

Proof

In (3), the minimum eigenvalue is selected as the noise level. From Theorem 3, it follows that i = N. Then, the following relationship holds:

$$ \mathbb{E}(x_{N}) \approx {\sigma_{w}^{2}} = \sigma^{2} + {\Phi}^{-1}(\frac{1-\alpha}{N-2\alpha+ 1})\nu < \sigma^{2}. $$
(15)

The smallest eigenvalue is smaller than the noise level when the number of redundant dimensions is larger than one. This completes the proof. □

Lemma 3.1

Suppose the following relationship holds:

$$ \sigma_{\rho}^{2} = \frac{\sigma^{2}+\sqrt{\frac{2\sigma^{4}}{s}}{\Phi}^{-1}(\frac{N-\alpha+ 1-i}{N-2\alpha+ 1})}{\rho}. $$
(16)

If\(i < \frac {N + 1}{2}\), then\(\sigma _{\rho }^{2} > \sigma ^{2}\).

Proof

Using the second mean value theorem for integrals, we prove that 0 < ρ < 1, for all δ, rR. Then, for \(i < \frac {N + 1}{2}\), ρ < 1 and \( \sigma _{\rho }^{2} = \frac {\mathbb {E}(x_{i})}{\rho }\), we obtain \(\sigma _{\rho }^{2} = \frac {\sigma ^{2}+\sqrt {\frac {2\sigma ^{4}}{s}}{\Phi }^{-1}(\frac {N-\alpha + 1-i}{N-2\alpha + 1})}{\rho } > \sigma ^{2}\) from Corollary 3.1. □

Lemma 3.2

If\(\frac {N + 1}{2} \leq i \leq N-\alpha + 1-{\Phi }((\rho -1)\sqrt {\frac {s}{2}})(N-2\alpha + 1)\), then\(\sigma _{\rho }^{2} > \sigma ^{2}\).

Proof

First, we prove that \( \frac {N + 1}{2} \leq N-\alpha + 1-{\Phi }((\rho -1)\sqrt {\frac {s}{2}})(N-2\alpha + 1)\). Moreover, let \( H(s)=N-\alpha + 1-{\Phi }((\rho -1)\sqrt {\frac {s}{2}})(N-2\alpha + 1)\). Then, we obtain \( H^{\prime }(s)= \frac {1-\rho }{4\sqrt {\pi s}} e^{-\frac {(\rho -1)^{2}s^{2}}{8}} > 0\). Therefore, \(H(s)>H(0)=\frac {N + 1}{2}\) if \(i < N-\alpha + 1-{\Phi }((\rho -1)\sqrt {\frac {s}{2}})(N-2\alpha + 1)\). It follows that \(N-\alpha + 1-i>{\Phi }((\rho -1)\sqrt {\frac {s}{2}})(N-2\alpha + 1)\), that is, \(\frac {N-\alpha + 1-i}{N-2\alpha + 1}>{\Phi }((\rho -1)\sqrt {\frac {s}{2}})\). Because Φ is a monotonic function, we can obtain \({\Phi }^{-1}(\frac {N-\alpha + 1-i}{N-2\alpha + 1})>(\rho -1)\sqrt {\frac {s}{2}}\). Then \({\Phi }^{-1}(\frac {N-\alpha + 1-i}{N-2\alpha + 1})\sqrt {\frac {2}{s}}> \rho -1\). Finally, we multiply both sides of the above equation by σ2 and simplify it to obtain \(\sigma _{\rho }^{2} =\frac {\sigma ^{2}+\sqrt {\frac {2}{s}}\sigma ^{2}{\Phi }^{-1}(\frac {N-\alpha + 1-i}{N-2\alpha + 1})}{\rho } > \sigma ^{2}\). □

From Lemmas 3.1 and 3.2, we obtain the following corollary.

Corollary 3.3

Suppose the following condition is satisfied:

$$ i_{0} = N-\alpha+ 1-{\Phi}((\rho-1)\sqrt{\frac{s}{2}})(N-2\alpha+ 1). $$
(17)

Ifii0, then the following relationship holds:

$$ \sigma_{\rho}^{2} > \sigma^{2}. $$
(18)

We seti = ⌊i0and denote the corresponding result by\({\sigma _{f}^{2}}\)as follows:

$$ {\sigma_{f}^{2}}= \frac{\sigma^{2}+\sqrt{\frac{2\sigma^{4}}{s}}{\Phi}^{-1}(\frac{N-\alpha+ 1-\lfloor i_{0} \rfloor}{N-2\alpha+ 1})}{\rho}, $$
(19)

From this, we obtain\({\sigma _{f}^{2}} > \sigma ^{2}\).

Using Corollaries 3.2 and 3.3, we establish the following theorem.

Theorem 4

If the conditions of Corollary 3.3 are satisfied, the noise level can be estimated as follows:

$$ \hat{\sigma}^{2} = \frac{d_{1}{\sigma_{f}^{2}}+d_{2}{\sigma_{w}^{2}}}{d_{1}+d_{2}}, $$
(20)

where

$$ d_{1}=-{\Phi}^{-1}\left( \frac{1-\alpha}{N-2\alpha+ 1}\right)\sqrt{\frac{2}{s}}, $$
(21)
$$ d_{2}=\frac{(1-\rho)+{\Phi}^{-1}(\frac{N-\alpha+ 1-\lfloor i_{0} \rfloor}{N-2\alpha+ 1})\sqrt{\frac{2}{s}}}{\rho}. $$
(22)

Proof

From (14) and (19), we obtain the following equation:

$$ \frac{\sigma^{2}-{\sigma_{w}^{2}}}{{\sigma_{f}^{2}}-\sigma^{2}} = \frac{-{\Phi}^{-1}(\frac{1-\alpha}{N-2\alpha+ 1})\sqrt{\frac{2}{s}}\sigma^{2}}{\frac{(1-\rho)+{\Phi}^{-1}(\frac{N-\alpha+ 1-\lfloor i_{0} \rfloor}{N-2\alpha+ 1})\sqrt{\frac{2}{s}}}{\rho}\sigma^{2}}. $$
(23)

Let \(d_{1}=-{\Phi }^{-1}(\frac {1-\alpha }{N-2\alpha + 1})\sqrt {\frac {2}{s}}\) and \(d_{2}=\frac {(1-\rho )+{\Phi }^{-1}(\frac {N-\alpha + 1-\lfloor i_{0} \rfloor }{N-2\alpha + 1})\sqrt {\frac {2}{s}}}{\rho }\). Then (23) becomes

$$ \frac{\sigma^{2}-{\sigma_{w}^{2}}}{{\sigma_{f}^{2}}-\sigma^{2}} = \frac{d_{1}}{d_{2}}. $$
(24)

Therefore, the precise noise level can be estimated by solving (24), that is, \(\hat {\sigma }^{2} = \frac {d_{1}{\sigma _{f}^{2}}+d_{2}{\sigma _{w}^{2}}}{d_{1}+d_{2}}\). □

3.2 Proposed algorithm

Once the initial flat patches have been selected, the eigenvalues of the covariance matrix of these patches can be obtained. In (3), \({\sigma _{w}^{2}}\) is the minimum eigenvalue. According to Theorem 3, \({\sigma _{f}^{2}}\) in (19) is the ⌊i0th eigenvalue divided by ρ. Thus, the noise level can be calculated via (20). The selection of the initial flat patches depends on the actual noise level. Therefore, the flat patches and the noise level estimation result are constantly updated via an iterative process, which increases the accuracy of the final calculation. Based on the analysis that is described above, the proposed algorithm for noise level estimation can be described as follows.

figure c

In the proposed algorithm, the three parameters, σ0, δ, and w are configured. In the method that is suggested in [19], the initial noise level σ0 is initially estimated from the minimum eigenvalue of the covariance matrix of all patches. Then, we only need to consider the remaining parameters, namely, δ and w. The value of parameter δ, which is a significance level, ranges from 0 to 1. Parameter w represents the patch size. To partition an image in a meaningful manner, the value of w should by neither too big nor too small. The selection of these two parameter values is important for the proposed algorithm. In Section 4.1, the parameter design procedure is described in detail.

4 Experimental analysis

In this section, the optimal parameters are determined by testing the proposed algorithm using the parameters in the training set, and the experimental results regarding the accuracy and robustness of the proposed algorithm are presented. We use the following four well-known image datasets, which are typically used to evaluate image noise level estimation methods: The first image dataset is comprised of 10 standard image processing test images from the IVC databases [4]: Avion, Barbara, Boats, Clown, Fruit, House, Isabe, Lena, Mandr, and Peppers. The resolution of these images is 512 × 512. The second image dataset was obtained from the Tampere image dataset(TID2008) [23] and contains 25 images that of size 512 × 384. The third image dataset is LIVE [27], which contains 29 images with various resolutions. The last image dataset is BSDS500 [3], which contains three image folders: BSDS500-test (200 images), BSDS500-train (200 images), and BSDS500-val (200 images); the resolution of these images is 481 × 321. In our experiments, zero-mean Gaussian noise with the standard deviations of σ = 5,10,15,20,25,30,40,50,60,70,80,90, and 100 is added to all the images in the datasets. Finally, state-of-the-art algorithms [5, 15, 19, 24, 34], whose source codes are available onlineFootnote 1,Footnote 2,Footnote 3,Footnote 4, are compared with the proposed algorithm. The code of the proposed algorithm can be found online at https://ww2.mathworks.cn/matlabcentral/fileexchange/64519-natural-image-noise-level-estimation-based-on-flat-patches-and-local-statistics. All the methods are implemented in MATLAB (24 GB RAM, 2.66 GHz CPU, and an Intel(R) Xeon(R) processor).

4.1 Parameter configuration

Parameters δ and w are configured via trial and error. First, we determine the optimal value of w. In the interval (0,1), we use insertion points with a step-size of 0.1 as candidate values for δ and consider limiting w to a reasonable range. In [19], Liu et al. selected w = 7 as the patch size. In [24], the value of w was selected as w = 5 and w increased with the image size. In [15], Jiang et al. selected w = 5 and δ = 0.9 as the optimal values and reported that their algorithm is more suitable for high-frequency images if δ is small. In most algorithms, the optimal patch size is set to a value that is between 5 and 9. Thus, we consider these values as candidate values. To enhance the adaptability of the algorithm to high-frequency images, we consider values that are smaller than 0.9; specifically, the values of 0.7, 0.8, and 0.9 are considered. Then, we introduce these parameters into the proposed algorithm and apply the proposed algorithm to noisy data that are simulated from 200 natural images in BSDS500-train [3]. Additionally, large-range synthetic Gaussian noise with the standard deviations of σ = 5, 10, 15, 20, 25, 30, 40, 50, 60, 70, 80, 90, and 100 is added to each clean image. To improve the accuracy of parameter selection, 50 simulations are conducted in each case and the average value is considered. Subsequently, we evaluate the accuracy and robustness of the proposed algorithm under various parameter values by using the evaluation matrix that is defined in Section 4.2. Figure 1 presents the results for various parameter values. According to Fig. 1a and b, among the values of δ that are considered in the experiments, the estimation result is most accurate when w = 8 because the Bias value and the maximum absolute error (MAE) value are smaller in most cases. Next, we consider the overall performance. As shown in Fig. 1c, the root mean square error (RMSE) values that correspond to w = 5,6,7, and 9 are larger than the RMSE value that corresponds to w = 8 with the same noise level. As shown in Fig. 1d, for all values of δ and w, the difference between the Std values is very small. However, a larger value of σ may lead to a larger Std value. Therefore, we determine 8 to be the optimal value for parameter w. Next, optimal value of parameter δ is determined. We consider the initial value of δ to be 0.1 and increment it to the final value of 0.9 using a step-size of 0.1. The final result is obtained by utilized these values of δ and w in the proposed algorithm. The results are presented in Fig. 2. According to this figure, the Bias, Std, and RMSE values are smaller when δ = 0.8. Therefore, we select δ = 0.8 and w = 8 as the optimal parameter values.

Fig. 1
figure 1

Results of proposed algorithm with various values of parameters δ and w for DSDS500-train (200 images). a Bias, b MAE, c RMSE, and d Std

Fig. 2
figure 2

Evaluation results of the proposed algorithm with respect to δ

4.2 Evaluation metrics

To evaluate the noise estimation performance, we use three well-established criteria, namely, accuracy, reliability and overall performance, which have been considered in most studies in the literature. Accuracy and reliability are typically represented by the average estimation error and the variance of the estimation errors, respectively. Thus, in this study, we employ the following four indictors to evaluate the performance of the proposed algorithm.

Estimation Bias is defined as follows:

$$ Bias(\hat{\sigma})=|\mathbb{E}(\sigma - \mathbb{E}(\hat\sigma))|. $$
(25)

The robustness of an estimator is defined as follows:

$$ Std(\hat{\sigma})=\sqrt{\mathbb{E}[\sigma-\mathbb{E}(\hat{\sigma})]^{2}}. $$
(26)

The RMSE is defined as follows:

$$ RMSE(\hat{\sigma}) = \sqrt{Bias^{2}(\hat{\sigma})+Std^{2}(\hat{\sigma})}. $$
(27)

The MAE is defined as follows:

$$ MAE(\hat{\sigma})=max\{|\hat{\sigma}_{1}-\sigma|,|\hat{\sigma}_{2}-\sigma|,\cdots,|\hat{\sigma}_{M}-\sigma|\}. $$
(28)

4.3 Results

4.3.1 Patch selection

According to (20), the estimation results are closely related to the number of flat patches. Therefore, accurate flat patch selection leads to accurate estimation results. Here, we compare the patch selection results of Algorithm 1 with those of various other algorithms. We chose four images from DSDS500-test, namely, #130066, #77062, #107072, and #108004, which are shown in the first row of Fig. 3. The second row presents the results that were obtained by the weak textured patch selection method that was reported in [19]. The third row presents the results that was obtained via the flat patch selection method that was reported in [15]. The last row presents the results that were obtained by the proposed algorithm. All selected patches are shown in white. In the first two images, the total number of patches that were selected by the algorithm that was reported in [15] exceeds the number of patches that were selected by the algorithm that was reported in [19]. For the last two images, the opposite is true. However, for all images, the flat patches that were selected by the proposed algorithm were closest to the actual flat area. According to Fig. 3, the patches that were used in the proposed algorithm approximated the actual flat area; hence, improved accuracy in flat patch selection was realized.

Fig. 3
figure 3

Comparison of patch selection results, where the white regions represent the patches that were selected using various patch selection methods. The first row shows images #130066, #77062, #107072, and #108004 from BSDS500-test. The second row presents the results that were obtained by the weak textured patch selection method that was reported in [19]. The third row presents the results that were obtained by the flat patch selection method that was reported in [15]. The last row presents the results that were obtained by the proposed algorithm

4.3.2 Noise level estimation results

Using the parameter values that were selected in Section 4.1, we compar the proposed algorithm with state-of-the-art algorithms [5, 15, 19, 24, 34] on various scenes under various noise levels. For the algorithms that were reported in [5, 15, 19, 24], the parameter values that were reported in the original studies are used. For the algorithm that was reported in [34], the result is sensitive to the initial value. To ensure a fair comparison, we select the initial value of 0.5 and increment with a step-size of 0.5 until we obtain the optimal result. In the comparative experiments, the final noise level estimation result is obtained by averaging the noise level estimates of each channel when handling a color image in each image dataset.

First, we present the results that were obtained for the challenging BSDS500-test dataset. This dataset contains 200 images that depict scenes that closely resemble real-world environments. Most of the images in the dataset contain small homogenous areas and rich features. The proposed algorithm yields more accurate noise level estimation results, particularly when the added true noise level is high. According to Table 2, on low noise levels, the algorithm that was proposed in [5] and [19] outperforms the other methods. In contrast, the RMSE and Bias values of the proposed algorithm are smaller than those of the other schemes when the noise level exceeds 30. Hence, for the BSDS500-test dataset, the proposed algorithm is more accurate and scene-independent under higher noise levels.

Table 2 Results of the compared methods for BSDS500-test (200 images), where bold font indicates the best result for each noise level

Moreover, according to Table 3 on the IVC [4] dataset, the proposed algorithm outperforms the other algorithms. The RMSE demonstrates significant comparative advantages for almost all noise levels; hence, the proposed algorithm is more accurate and robust on the IVC dataset.

Table 3 Results of the compared methods for IVC, where bold font indicates the best result for each noise level

Next, we consider the estimation results that were obtained for the TID2008 dataset, which contains 25 RGB images without any compression and wherein one image is artificial while the other images depict real-world scenes. Although the images in this dataset are considered to be noise-free, they still contain low levels of noise, with the exception of the artificial image. By following the methodology that was proposed in [19, 24], we correct each estimation result by calculating \(\sigma _{corr}^{2} = \sigma _{est}^{2}-\sigma _{ref}^{2}\), where \(\sigma _{ref}^{2}\) represents the inherent noise that is contained in each reference image. These values are available online at http://physics.medma.uni-heidelberg.de/cms/projects/132-pcanle. Moreover, \(\sigma _{est}^{2}\) represents the estimation results. According to Table 4, the RMSE, Bias, and MAE values of the proposed algorithm are smaller than those of the other schemes when the noise level is high. There is no significant difference between the Std value that is obtained by the algorithm and the minimum Std value; thus, the accuracy of the proposed algorithm is higher when the reliability is the same.

Table 4 Results of the compared methods for TID2008, where bold font indicates the best result obtained for each noise level

Finally, we apply the proposed algorithm to all images in the IVC, TID2008, LIVE, BSDS500-test, and BSDS500-val datasets. According to the results, which are presented in Table 5, the proposed approach yields the highest accuracy among all compared methods [5, 15, 19, 24, 34].

Table 5 Results of the compared methods for all datasets, where bold font indicates the best result

5 Conclusions and future work

In this paper, we have proposed a new patch-based algorithm that linearly combines overestimated and underestimated results to evaluate the noise levels in images that are contaminated by Gaussian noise. Moreover, we have discussed the relationship between the eigenvalues and the true noise level, which forms the theoretical foundation of the proposed algorithm. Our algorithm can overcome the underestimation of noise level estimation algorithms that employ the minimum eigenvalue. In comparison with five state-of-the-art noise level estimation algorithms, the proposed algorithm yields higher accuracy and robustness for a large range of visual content and noise conditions. The parameters were determined according to the experimental results that were obtained by the algorithm for the dataset. The selected parameters render the algorithm widely applicable, and the results obtained by the algorithm have excellent accuracy. However, the selected parameters may not be the optimal values. The optimal configuration of the algorithm’s parameters will be the subject of future work.