1 Introduction

As it is well known, machine vision cameras capture the spatial distribution of a light incident on a light-sensitive device and they produce, therefore, bidimensional descriptions of this distribution, known as images. Charge-coupled devices (CCD) were suggested and experimentally verified in the 1970s as image sensors. They have become the major piece of imaging technology and have been included in a lot of current cameras. CCD-based digital cameras are commonly used in a variety of commercial, medical, scientific, and military applications. In its acquisition and transmission, an image is often corrupted by different sources of noise. As a result, an image, degraded by noise, may lead to a significant reduction in its quality. Thus, a pre-processing step (or denoising) is required for the noisy image before it can be used in various applications, for example edge detection and compression. The goal of image denoising is to estimate the unknown signal of interest from the available noisy data. There have been many powerful denoising algorithms proposed over the past few years. Most of them often require their parameters to be adjusted according to the noise level (or noise variance) parameter [14]. In this case, it is desirable to know the noise type and its statistical characteristics (variance, probability density function). In some works, the noise type and characteristics are assumed to be known in advance, which is not actually valid in practical circumstances. However, in current studies, the noise characteristics are usually provided manually, which is a good manner to estimate a reliable noise level, but it becomes tedious and it increases the execution time of the algorithms. As a consequence, several automatic noise estimators for a gray-level image have been suggested such as the algorithms proposed in [57]. The problem of such methods is that they often assume the noise model to be white, signal independent, and with a constant variance over the whole image and to be either pure additive or pure multiplicative. Recently, it has been clearly demonstrated that this noise model is not adequate enough for images captured from the CCD digital cameras [810]. Hence, these approaches cannot fully fit the noise level from the CCD cameras. Consequently, the denoising algorithms with a given poor noise level estimation does not give an optimal image quality. This means that it is necessary to correctly estimate the noise level to improve the effectiveness of the denoising algorithms. In the recent years, particular attention has been given to denoise ultrasound images by the method proposed by Yu and Acton [11], named the speckle-reducing anisotropic diffusion (SRAD). The SRAD filter is very commonly used to reduce, specially, speckle noise. The speckle noise is a type of granular noise which can be found in several kinds of coherent imaging systems like the synthetic aperture radar (SAR), ultrasound, or laser-illuminated images. Regardless of the theoretical goodness of the SRAD to restore an ultrasound image, the key point is the accurate estimation of such a noise parameter. Indeed, they used some assumptions to consider the noise characteristics to be white and signal independent, and purely multiplicative [12]. Unfortunately, the aforementioned assumptions are not always true for a wide range of the images formed by the CCD digital cameras. Specifically, unprocessed raw data produced straightly from the CCD image sensors contain white noise. However, the raw image goes through various image processing steps such as demosaicing, color correction, gamma correction, color transformation, and JPEG compression. As a consequence, the noise characteristics in the final output image deviate significantly from the used noise model (i.e., white multiplicative) [8, 13]. From this fact, it becomes clear that the demand for color image denoising exceeds widely the white noise case [14, 15]. Hence, the main interest of this study is to put forward a new image filtering technique, called the adaptive noise-reducing anisotropic diffusion (ANRAD) filter, using the SRAD filter and a more general automatic noise estimator from a single image in order to better remove the color noise produced by a CCD digital camera. The noise level that will be used is colored, mixed, and modeled as signal-dependent noise whose standard deviation is represented by a function of pixel intensity and is called the noise level function (NLF). That allows to reduce noise to a minimum, in order to achieve good image quality as that of photography and obtain more information from CCD image data. The strength of the proposed filter is that it can therefore be used for images corrupted with any kind of noise, whether multiplicative, additive, or mixed. The amount of denoising is controlled locally by the values of the noise variances correspondent to each intensities of the whole image allowing a better job of a denoising image. In addition, the ANRAD allows denoising to be different along different directions, i.e., denoising on both sides of an edge can be prevented while enabling the denoising along the edge.

The rest of this paper is organized as follows. In Sect. 2, a survey of related works is given. Section 3 bears on the strategy for deriving ANRAD filter. The experimental evaluations and the comparative analysis are presented and discussed in Sect. 4. The advantages and limitations of the ANRAD are presented in Sect. 5. Section 6 is dedicated to the conclusion and future directions.

2 Related work

In image analysis, the goal of image restoration is to relieve human observers from this task (and perhaps even to improve their abilities) by reconstructing a plausible estimate of the original image from the distorted or noisy observation. For several years, a lot of studies have been done on the improvement of the digital images to increase the quality of visual rendering and to enhance contrast and sharpness of the image in order to facilitate a later analysis. Most of these “filtering” methods are:

Bilateral filter: It was developed by Tomasi and Manduchi [16]. It smoothes flat surfaces as the Gaussian filter, while preserving sharp edges in the image. The idea underlying bilateral filtering is to compute the weight of each pixel using a spatial kernel and multiply it by an influence function in the intensity domain (range kernel) that decreases the weight of pixels with large intensity differences. However, the bilateral filter in its direct form cannot handle speckle noise, and it has the tendency to oversmooth edges. Also, it is slow when the kernel is large. Nonetheless, several solutions have been proposed to accelerate the evaluation of the bilateral filter such as [1721]. Unfortunately, most of these approaches rely on approximations that are not based on firm theoretical foundations, and it is hard to evaluate their accuracy. The essential link between bilateral filtering and anisotropic diffusion is examined in [22]. In more recent years, adaptive bilateral filters are proposed in [2325]. These filters retain the general form of the bilateral filter, but differ when introducing an offset in the range of the filter. Both the offset and the width of the range change locally in the image. These locally adaptive approaches require a complicated training-based method and are especially used for image enhancement. In [26], a recursive implementation of the bilateral filter is suggested, where computational and memory complexities are linear in both image size and dimensionality. However, its range filter kernel uses the pixel connectivity and thus cannot be directly employed for applications ignoring the spatial relationships.

Wavelet transforms: Signals are always the input for wavelet transforms, where a signal can be decomposed into several scales that represent different frequency bands. At each scale, the position of the signal’s instantaneous structures can be determined approximately. Such a property can be manipulated in many ways to achieve certain results. These include denoising [2729], compression [3032], feature detection [3335], etc. Several noise reduction techniques based on the approaches of wavelet have been proposed in the literature [3638]. In [39], Yansun et al. developed a denoising method based on the direct spatial correlation between the wavelet transforms over adjacent scales. Threshold-based denoising is another powerful approach based on wavelet transforms to noise reduction. It was first suggested by Donoho [40, 41], which transformed the noisy signal into wavelet coefficients, then employed a hard or soft threshold at each scale, and finally transformed the result back to the original domain and got the estimated signal. In [42], Chang et al. put forward a spatially adaptive wavelet thresholding method based on a context modeling technique. Context modeling is used to estimate the local variance for each wavelet coefficient and then is used to adapt the thresholding strategy. Li and Wang in their work [43] proposed a wavelet-based method, where they decomposed the noisy image in order to get a different sub-band image. They maintain low-frequency wavelet coefficients unchanged, and then, taking into account the relation of horizontal, vertical, and diagonal high-frequency wavelet coefficients, they compare them with the Donoho threshold to achieve image denoising. In [29], image denoising using a wavelet-based fractal method is implemented. In [27, 36], wavelet filters were used for denoising the speckle noise in optical coherence tomography data. Wavelets may be a good tool for denoising images because of their energy compactness, sparseness, and correlation properties, but they are still inadequate in their denoising performance due to the simple thresholding methods.

Non-Local Means (NLM) filter: Buades et al. introduced the NLM filter [44], which assumed that similar patches could be found in the image. The used patch similarity was estimated by a statistically grounded similarity criterion which it derived from the noise distribution model. This filter offers a good performance to reduce the additive white noise Gaussian. However, the NLM filter has a complexity that is quadratic in the number of pixels in the image, which makes the technique computationally intensive and even impractical in real applications. For this reason, a number of NLM methods have been developed such as the fast non-local image denoising algorithm [45], which proposes an algorithmic acceleration technique based on neighborhood pre-classification. In [46], authors gave a comprehensive survey of patch-based non-local filtering of radar imaging data. In [47], the authors implemented an image denoising method that used the principal component analysis (PCA) in conjunction with the NLM image denoising. Wua et al. suggested a version of NLM filter [48], where firstly the curvelet transform was used to produce reconstructed images. Then, the similarity of two pixels in the noisy image was computed. Finally, the pixel similarity and the noisy image were utilized to obtain the final denoised result using the non-local means method.

Anisotropic diffusion: Perona and Malik anisotropic diffusion (PMAD) filtering, being the most common nonlinear technique [49], was inspired from the heat diffusion equation by introducing a diffusion function that was dependent on the norm of the gradient of the image. The diffusion function, therefore, had the effect of reducing the diffusion for high gradients. It has been widely used for various applications such as satellite images [11, 50, 51], astronomical images [52, 53], medical images [5456], and forensic images [57, 58]. However, the PMAD filter has had two limitations up to now. First, it smoothes the information identically in all directions (isotropic). Second, the choice of the threshold on the norm of the gradient needed for the diffusion function is not evident, which makes the technique not truly automatic and cannot effectively remove noise. For this reason, some improvements have been proposed by different researchers. In [59], Weickert suggested a diffusion matrix instead of a scalar. Karl et al. proposed a version of anisotropic diffusion, where diffusion was controlled by the local orientation of the structures in the image [60]. Yu and Acton [11] developed a version of the PMAD filter, called the SRAD, based on the speckle noise model, where the diffusion was controlled by the local statistics of the image. To adopt correctly the SRAD for multiplicative noise, Aja-Fernández and Alberola-López [61] suggested a detail preserving anisotropic diffusion (DPAD) filter, which estimated the noise using the mode of the distributions of local statistics of the whole image [61, 62]. In the recent years, other studies have been developed on new well posed equations such as [6368]. In [63], the authors implemented a ramp preserving PMAD model based on an edge indicator, a difference curvature, which can distinguish edges from flat and ramp regions. Since the anisotropic diffusion is an iterative process, the problem of choosing the optimal stopping time and preventing an over smoothed result is crucial. Therefore, various methods estimating this parameter were proposed [6971]. For instance, Tsiotsios and Petrou, in their work [69], have been proposed a version of anisotropic diffusion filter where an automatic stopping criterion is used which takes into consideration the quality of the preserved edges. More recently, a modified diffusion scheme, suitable for textured images has been described in [72].

3 Proposed method

3.1 Camera noise model

3.1.1 Signal-dependent noise model

In the CCD-based digital cameras, the photons transmitted through the lens system are converted to charge in the CCD sensor. Then, the charge is amplified, sampled, and digitally enhanced to become an image (bits). The typical imaging pipeline of the CCD camera is shown in Fig. 1. The image provided by the CCD imaging system is characterized by high quality; however, it is not completely free from different types of distortions and artifacts. There exist mainly five noise sources, as mentioned in [73, 74]: fixed pattern noise (FPN), dark current noise, thermal noise (\(N_{\rm c}\)), shot noise (\(N_{\rm s}\)), and amplifier and quantization noise (\(N_{\rm q}\))—which is negligible in this work [15].

The final brightness \(I_{N}\) produced by a real CCD imaging system is related to the scene radiance L via the camera response function f (nonlinear imaging system) and is given as [75, 76]:

$$\begin{aligned} I_{N}=f(L+N_{\rm s}+N_{\rm c}) \end{aligned}$$
(1)

Similarly, for an ideal system, if it is necessary to find L, the inverse function g is required, where \(g\,=\,f^{-1}\), and then \(L=g(I)\). Thus, (1) can be modeled as:

$$\begin{aligned} I_{N}=f( f^{-1}(I)+N_{\rm s}+N_{\rm c}) \end{aligned}$$
(2)

Here, I denotes the noise-free image, \(N_{\rm s}\) defines a multiplicative noise component modeled as a Gaussian distribution with a zero mean and the relative variance \(I\cdot \sigma _{\rm s}^{2}\), and \(N_{\rm c}\) describes an additive noise component with a zero-mean Gaussian distribution with the variance \(\sigma _{\rm c}^{2}\) [10, 77]. It can be noted that the multiplicative component of the noise directly depends on the image brightness.

To obtain unknown color information at each pixel location from the CCD image sensor, some interpolation forms (called demosaicing) are carried out to get the full-resolution color image [78]. Accordingly, the noise variance of the interpolated pixels tends to become smaller than that of the directly observed pixels [79]. As a consequence, this process introduces spatial correlations [80] to the noise characteristics in the demosaiced image (see Fig. 2). Thus, the noise becomes colored instead of being white.

Fig. 1
figure 1

CCD camera imaging pipeline

Fig. 2
figure 2

Effect of demosaicing. Noisy image: left without demosaicing, right with demosaicing

3.1.2 Noise model estimation

Let \({\varSigma }^{2}(u, f, \sigma _{\rm s}, \sigma _{\rm c})\) be a correlated NLF to estimate, which depends on the local intensity u and on a set of parameters f, \(\sigma _{\rm s}\) and \(\sigma _{\rm c}\) that are determined by the image acquisition protocol [10, 15, 81]. To compute it, an iterative noise level estimation process is presented in Fig. 3. There are three basic stages we should perform to conduct the noise level function \({\varSigma }^{2}\) effectively:

  • Theoretical model of NLF

  • NLF from a single image

  • Maximum likelihood estimation

Fig. 3
figure 3

Noise estimation process

(a) Theoretical model of NLF

The variance of the generalized noise model term of Eq. 2 is written as [15, 81]:

$$\begin{aligned} {\varSigma }^{2} (u, f, \sigma _{\rm s}, \sigma _{\rm c})= \mathbb {E} \left[ \left( u_{n}(f,f^{-1}, \sigma _{\rm s}, \sigma _{\rm c})- u\right) ^{2} \right] \end{aligned}$$
(3)

where \(\mathbb {E}\left[ .\right]\) is the expected value of the random variable, \(u_{n}\) is the synthesized noisy pixel value, and u is the noise-free pixel value. By changing the three NLF parameters, \(f, \sigma _{\rm s}\) and \(\sigma _{\rm c}\), Eq. (3) can represent the whole space of the NLFs, named the noise level functions database (NLFD). To do that, it is necessary to have a test pattern image u containing 256 gray scale levels (Fig. 4) as well as 201 camera response functions f, which are downloaded from [82], where some are shown in Fig. 5 and where \(\sigma _{\rm s}\) is from 0 to 0.16 and \(\sigma _{\rm c}\) is from 0.01 to 0.06 [15]. For instance, Fig. 6 presents f(60) and some of its NLFs estimated at different values of \(\sigma _{\rm c}\) and \(\sigma _{\rm s}\).

Fig. 4
figure 4

Test pattern image

Fig. 5
figure 5

Some camera response functions (\(f(\cdot )\))

The NLFD is a matrix (\({\varGamma }\)) that consists of all the existing NLFs. Each column in \({\varGamma }\) represents an NLF for a given \(f , \sigma _{\rm c}\) and \(\sigma _{\rm s}\). Also, the column indexes refer to 256 intensity values ranging from 0 to 1. Applying the PCA on \({\varGamma }\), a general form of the approximation model of the NLFs for each red, green, and blue channel is given by [15]:

$$\begin{aligned} {\varSigma }^{2} (u) =\overline{{\varSigma }^{2}}+ \sum _{i=1}^{m} \lambda _{i}V_{i} \end{aligned}$$
(4)

where \(V_{i}\) and \(\overline{{\varSigma }^{2}}\) \(\in\) \(\mathbb {R}^{d}\) (\(d=256\)) are, respectively, the eigenvectors and the mean of the NLF obtained by the PCA, and where \(\lambda _{1},\ldots ,\lambda _{m}\) are the unknown parameters of the model with the number of retained principal components \(m=6\) [15].

Fig. 6
figure 6

Red and blue curves correspond to f(60) and some NLFs estimated at different values of \(\sigma _{\rm s}\) and \(\sigma _{\rm c}\) (color figure online)

(b) NLF From a single image

Basically, one-channel images are considered, assuming that similar operations are performed for each component image of multichannel data. This process is based on the next four steps:

  • Step 1: Pre-segmentation (see Fig. 7): Firstly, smooth out noisy image by convolving it with a low-pass filter and then partition the smoothed image into homogeneous regions with both similar spatial coordinates and RGB pixel values [10, 83, 84].

  • Step 2: Estimate the noise-free signal and the noise variance for each region as follows:

    $$\begin{aligned} \hat{u}_{l}\,=\,& {} \frac{1}{\eta _{l}} \sum _{j=1}^{\eta _{l}} u^{j}_{n} \end{aligned}$$
    (5)
    $$\begin{aligned} \hat{\sigma }^{2}_{l}\,=\,& {} \frac{1}{\eta _{l} } \sum _{j=1}^{\eta _{l}} (u^{j}_{n}-\hat{u}_{l})^2 \end{aligned}$$
    (6)

    where \(\hat{u}_{l}\) is the estimation of the noise-free signal, \(u^{j}_{n}\) is the jth pixel value in the observed region, \(\eta _{l}\) is the number of pixels in the observed region, \(\hat{\sigma }_{l}^{2}\) is the estimated noise variance, \(l=1,\ldots , N_{bl}\), and \(N_{bl}\) is the number of regions that depends upon the image.

  • Step 3: Form scatter plots of samples of noise variances on the estimated noise-free signals of each RGB channel. An example of the obtained scatter plot is represented in Fig. 8a. The points in the scatter plot have the coordinates \(\hat{\sigma }_{l}^{2}\) for the vertical axis and \(\hat{u}_{l}\) for the horizontal axis [85].

  • Step 4: Select the weak textured regions by discretizing of the range of image intensity into \(\kappa\) uniform intervals and then finding at each interval the region with the minimum variance. Consequently, the lower envelope strictly and tightly below the sample points is the estimated NLF curve (the blue dots in Fig. 8).

However, the estimated variance of each region is an overestimate of the noise level because it may contain the signal, so the obtained lower envelope is an upper bound estimate of the NLF.

Fig. 7
figure 7

Pre-segmentation. a Original image, b segmented image

Fig. 8
figure 8

Forming scatter plots on one single channel of a color image

(c) Maximum likelihood estimator

In this subsection, an accuracy model of the NLF is presented which combines the general form of the approximation model of Eq. 4 with the selected weak textured regions [85]. The goal is to infer the accurate NLF model from the lower envelope of the samples. To solve that, an inference problem in a probabilistic framework was formulated in [15]. Mathematically, the likelihood function is:

$$\begin{aligned} \mathcal {L} ({\varSigma }^{2} (u)) ={\varPi }_{t=1}^{\kappa } {\varPhi } \left( \frac{\sqrt{\eta _{t}}(\hat{\sigma }^{2}_{t}-{\varSigma }^{2}(\hat{u}_{t}) )}{\hat{\sigma }^{2}_{t}}\right) \hbox {exp}\left\{ -\frac{({\varSigma }^{2}(\hat{u}_{t})-\hat{\sigma }^{2}_{t})^{2}}{\varepsilon ^{2}} \right\} \end{aligned}$$
(7)

where \(\kappa\) is the number of selected weak textured patches, \(\eta _{t} , \hat{u}_{t}\) and \(\hat{\sigma }^{2}_{t}\) are, respectively, the number of pixels, the mean pixel value, and the estimated variance of the tth weak textured region, \(\varepsilon\) controls how the function should approach the samples, \(\hbox {exp}\left\{ \cdot \right\}\) is the exponential function, and \({\varPhi }(\cdot )\) is the cumulative distribution function of the standard normal distribution. The cost function to be minimized can be obtained from the negative log-likelihood function as:

$$\begin{aligned} E=-\hbox {log}(\mathcal {L} ({\varSigma }^{2} (u))) \end{aligned}$$
(8)

To minimize the cost function, the MATLAB standard nonlinear constrained optimization function “fmincon” is used.

Based on the effect of the correlation between the RGB channels and using the maximum likelihood estimator (MLE), the best approximation of \({\varSigma }^{2}(u)\) for the RGB channels can be given. For more details, the reader can refer to [15, 85].

3.2 Adaptive noise-reducing anisotropic diffusion

In this section, a new version of the SRAD filter is proposed, called the ANRAD, to enhance the images corrupted by color noise whose general model is in Eq. 2. The conventional SRAD filter is presented in the context of ultrasound images corrupted by speckle noise, where it could be written as [11]:

$$\begin{aligned} u_{i,j;t+{\Delta } t}=u_{i,j;t}+\frac{{\Delta } t}{\vert w_{i,j} \vert } \hbox {div}[c(q_{i,j;t}) \nabla u_{i,j;t}] \end{aligned}$$
(9)

Here, \(\nabla u\) is the gradient operator, div is the divergence operator, \({\Delta } t\) is the step time, \(u_{i,j;t}\) is the sampled discrete image, ij denotes the spatial coordinates of a pixel x on a 2D discrete grid (observed image), \(w_{i,j}\) represents the spatial neighbors centered at the current pixel, \(\vert w_{i,j} \vert\) is the size of the four direct neighborhood (4DN) which is equal to 4, and \(c(\ldots )\) is the diffusion function determined by

$$\begin{aligned} c(q_{i,j;t})= \frac{1}{1+ \left[ q_{i,j;t}^{2}-q_{n}^{2}(t) \right] \big /\left[ q_{n}^{2}(t)(1+q^{2}_{n}(t))\right] } \end{aligned}$$
(10)

with

$$\begin{aligned} q^{2}_{i,j;t}= \frac{\hbox {Var}(u_{i,j;t})}{\overline{u}_{i,j;t}^{2}} \end{aligned}$$
(11)

and

$$\begin{aligned} q^{2}_{n} (t)= \frac{\hbox {Var}({\rm area})}{\overline{\rm area}^{2}} \end{aligned}$$
(12)

where \(q_{i,j;t}\) is the instantaneous coefficient of variation of the image, which allows distinguishing homogeneous regions from edges in bright and dark areas and \(q_{n}(t)\) is the speckle NLF at the time t which controls the amount of smoothing applied to the image. Also, Var(area) and area are, respectively, the variance and the mean values of intensities under a homogeneous image area, and \(\hbox {Var}(u_{i,j;t})\) and \(\overline{u}_{i,j;t}^{2}\) are, respectively, the local variance and mean values at each pixel in the image. The SRAD noise estimation scheme has some disadvantages. It admits the speckle noise with some hypotheses like being: purely multiplicative, uncorrelated, equal variance, signal independent, and produced by a linear imaging system. In addition, it needs to know a homogeneous region within the processed image. Although it is not difficult for a user to select a homogeneous region in the image, it is non-trivial for a machine to do that. With these assumptions, the algorithm is not so practical for images captured from CCD digital cameras because, as noted above, the noise is essentially random and strongly dependent on the image intensity level. Also, there are spatial correlations introduced by the effect of demosaicing (color noise). Nevertheless, this filter is not adequate enough for CCD images and accordingly cannot fully fit the noise characteristics and give an optimal image quality. To overcome the disadvantages of the SRAD [recall (9)–(12)] and to have an improved restoration result, Eq. (12) is replaced by a non-stationary scale factor noise \(Q^{2}_{n}(i,j;t)={\varSigma }^{2}(u_{i,j;t})/u_{i,j;t}^{2}\), where its parameters will be estimated automatically, as described in Sect. 3.1.2, after introducing it in (Eq. 10) to obtain the new diffusion function \(c(q_{i,j;t},Q_{n}(i,j;t))\). Hence, the ANRAD is adopted. As it is noticeable, the filter is based on the estimation of the local coefficients of variation of the image \(q^{2}_{i,j;t}\) and of the noise \(Q^{2}_{n}(i,j;t)\). The better they are estimated, the better the filter performance is. Moreover, the choice of the window size greatly affects the quality of the processed images. If the window is too small, the noise filtering algorithm will not be effective and the filter will become very sensitive to noise. If the window is too large, subtle details of the image will be lost in the filtering process. In our experiments, a \(5\times 5\) window is used as a fairly good choice [62].

Let \(F= c. \nabla u\) be the flow diffusion and \(x=(x_{1},\ldots ,x_{N})\) be the current pixel in N-dimensional. The one-dimensional discrete implementation of the divergence term in Eq. (9) is given by:

$$\begin{aligned} \hbox {div} (c(x,t)\nabla u)&= \frac{\partial }{\partial x} (c(x,t).\nabla u(x,t)) \\&\approx \frac{\partial }{\partial x} \left( c(x,t).\frac{1}{\text {d}x} \left( u\left( x+\frac{\text {d}x}{2},t\right) - u\left( x-\frac{\text {d}x}{2},t\right) \right) \right) \\&\approx \frac{1}{\text {d}x^{2}} \left[ c\left( x+\frac{\text {d}x}{2},t\right) .(u(x+\text {d}x,t)-u(x,t)) \right. \\&\left. \quad- c\left( x-\frac{\text {d}x}{2},t\right) .(u(x,t)-u(x-\text {d}x,t)) \right] \\&\approx F_{x^{+}}-F_{x^{-}} \ \ \text {if} \ {\text {d}}x=1 \end{aligned}$$

where \(F_{x^{+}}= F(x+\frac{\text {d}x}{2},t)\) and \(F_{x^{-}}= F(x-\frac{\text {d}x}{2},t)\).

For an image in N-dimensional, the divergence term is generalized as:

$$\begin{aligned} \hbox {div} (F) \approx \sum _{i=1}^{N} \frac{\partial F_{x_{i}}}{\partial x_{i}} \end{aligned}$$
(13)

where F is expressed by the vector \((F_{x_{1}},\ldots ,F_{x_{N}})\).

The flow F is estimated between two neighboring pixels, and the following discretization of Eq. 13 can be written as:

$$\begin{aligned} \hbox {div} (F)(x) \approx \sum _{i=1}^{N} \dfrac{F_{x^{+}_{i}} -F_{x^{-}_{i}} }{\text {d}x_{i}} \end{aligned}$$
(14)

with \(\ \ \forall \ i, \ dx_{i}=1, F_{x^{+}_{i}}= F_{x_{i}}(x+\frac{dx_{i}}{2},t)\) and \(F_{x^{-}_{i}}= F_{x_{i}}(x-\frac{dx_{i}}{2},t)\). The focus of the present work is on dealing with a two-dimensional (2D) images; thus, N is equal to 2.

Up to this level, the algorithm cleans up the image noise in the homogeneous areas, but it is not efficient near or on the edges (it does not enhance edges—it only inhibits smoothing near edges). To improve more the robustness of the proposed algorithm, a matrix diffusion D is introduced in Eq. (9) instead of the scalar diffusion c. D is a positive definite symmetry matrix, which can be written in terms of its eigenvectors and eigenvalues. Therefore, the divergence term in Eq. (9) becomes:

$$\begin{aligned} {\text {div}}(D\cdot \nabla u ) \end{aligned}$$
(15)

Following the chosen eigenvalues and eigenvectors, different matrix diffusions can be obtained [60]. The diffusion matrix proposed by Weickert [59, 86] has the same eigenvectors as the structure tensor, with eigenvalues that are a function of the norm of the gradient. This allows the smoothing effect to be different along various directions. Focusing on edge-enhancing diffusion, the chosen eigenvectors are defined as follows [60, 87]:

$$\begin{aligned}&v_{1} \Vert \nabla u_{\sigma } \end{aligned}$$
(16)
$$\begin{aligned}&\quad v_{2} \perp \nabla u_{\sigma } \end{aligned}$$
(17)

where \(\nabla u_{\sigma }\) is the gradient of the regularized (or smoothed) version of the image using a Gaussian filter of a standard deviation \(\sigma\).

Similarly, the diffusion flux \(F= D\cdot \nabla u\) can be decomposed as a sum of diffusions in each direction of the orthogonal basis B = \(\left( v_{1},v_{2}\right)\), and the divergence term becomes [60, 88]:

$$\begin{aligned} \text {div}(F)= \text {div}( \phi _{1}\cdot v_{1}+ \phi _{2}\cdot v_{2})= \text {div}( \phi _{1}\cdot v_{1})+\text {div}( \phi _{2}\cdot v_{2}) \end{aligned}$$
(18)

where \(\phi _{1}=c(\langle u(x)\rangle _{v_{1}}, \hbox {Var}(u(x))_{v_{1}})\cdot u_{v_{1}}\) is the diffusion function in a local isotropic neighborhood and \(\phi _{2}=c(\langle u(x)\rangle _{v_{2}}, \hbox {Var}(u(x))_{v_{2}} )\cdot u_{v_{2}}\) is the diffusion function in a local linear neighborhood oriented by the vectors \(v_{2}\). \(u_{v_{i}}=\triangledown u\cdot v_{i}, \hbox {Var}(u(x))_{v_{i}}\) and \(\langle u(x)\rangle _{v_{i}}\) are, respectively, the first order derivative, the local variance and the local mean of the intensity u at the current point x, estimated in a proposed direction \(v_{i}, i\in \left\{ 1,2\right\}\). In all the experiments, the local scalar mean and variance are used, respectively, as:

$$\begin{aligned} \langle u(x)\rangle _{v_{1}} = \frac{1}{\vert \eta _{x} \vert } \sum _{p\in \eta _{x}} u(p) \end{aligned}$$
(19)

and

$$\begin{aligned} {\text {Var}}(u(x))_{v_{1}} = \frac{1}{\vert \eta _{x} \vert } \sum _{p\in \eta _{x}} (u(p)-\langle u(x)\rangle _{v_{1}})^{2} \end{aligned}$$
(20)

where p is the neighbor pixel, \(\eta _{x}=5\times 5\) is the neighborhood centered at the current pixel x , and \(\vert \eta _{x} \vert\) is the size of the neighborhood. Also, a linear neighborhood size is chosen subsequently to 7 [88] (see Fig. 9). Thus, the local linear mean and variance values are computed at the pixel x as follows:

$$\begin{aligned} \langle u(x)\rangle _{v_{2}} = \frac{1}{7} \sum _{p=-3}^{3} (u(x+p v_{2})) \end{aligned}$$
(21)

and

$$\begin{aligned} {\text {Var}}(u(x))_{v_{2}} = \frac{1}{7} \sum _{p=-3}^{3} (u(x+p v_{2})- \langle u(x)\rangle _{v_{2}})^{2} \end{aligned}$$
(22)
Fig. 9
figure 9

a Green vector indicates \(v_{1}\), and red vector indicates \(v_{2}\). b Planar neighborhood. c Linear neighborhood (color figure online)

4 Results

This paper aims to improve the quality of the image using an iterative anisotropic diffusion technique based on the noise level. The implementation of the filter has been done in MATLAB, on a personal computer with a 2.13-GHz Intel Core Duo processor and 4 GB of memory and has achieved a processing rate of 1.1615 s/iteration for a 321 \(\times\) 481 \(\times\) 3 image. In this section, the experiments have been performed on both synthetic and real medical images.

Fig. 10
figure 10

Synthesized noisy image and its corresponding NLF model noise. a Original image. b Synthesized noisy image. Model noise on the blue (c), green (d), and red (e) channels (color figure online)

4.1 Noise estimation

Natural images from the Berkeley segmentation data set [89] are used, and synthetic mixed (additive and multiplicative) noise, according to the general noise model in Eq. 2, is generated to test the proposed algorithm.

Fig. 11
figure 11

Model noise of synthetic pure additive Gaussian noise with noise level 5 %. a Noisy image, b NLF of red, c green, and d blue channels (color figure online)

Fig. 12
figure 12

Model noise of synthetic pure additive Gaussian noise with noise level 5 %. a Noisy image, b NLF of red, c green, and d blue channels (color figure online)

Fig. 13
figure 13

Model noise of synthetic pure additive Gaussian noise with 5 % noise level. a Noisy image, b NLF of red, c green, and d blue channels (color figure online)

Fig. 14
figure 14

Filtered images using different filters. a Original synthetic 2D image. b Original image with a Gaussian white noise with a 0 mean and standard deviation 0.1. c Result of PMAD. d DPAD. e Bilateral filter. f FBAD. g ANRAD

To illustrate the model noise estimation, an example (Fig. 10) of the scatter plots obtained for the test image is considered, with a great amount of uniform areas (Fig. 10), corrupted by CCD noise (\(f(60) ,\, \sigma _{\rm c}= 0.06\) and \(\sigma _{\rm s}= 0.16\)). In Fig. 10, the red, green, and blue curves represent the estimated NLFs in each corresponding color band, whereas the ground truth NLF (in black) is produced using the training database in Sect 3.1.2. Figure 10 shows that the noise level (or noise variance) depends on the mean local intensity, so there is a good agreement between the training data and the predictions of the model. It can be seen that the NLF curves are found just below the lower envelope of the samples (blue dots). To further verify the ability of the noise level estimation, similar experiments are carried out using additive noise. Three natural images are selected with different color ranges and luminosity and are synthetically degraded by additive Gaussian noise with a 5 % noise level (Figs. 11, 12, 13). It is noted that the noise level is proportional to the intensity throughout the picture. The results presented in Figs. 12 and 13 indicate that the estimated NLFs are significantly modeled even though the color distribution does not span the full intensity range, showing the ability of the method to explore the NLF beyond observed image intensities. From these experiments, it is noticeable that the noise level estimation process is reliable and there is a very good agreement between the NLFs in each color component.

Table 1 Parameters and results of the different filters for the synthetic 2D image

4.2 Filtering of synthetic images

To illustrate the ANRAD filtering behavior, some experiments have been done. First, the proposed algorithm is tested in the event of pure additive noise and then in case of pure multiplicative noise before testing its efficacy for the mixed signal-dependent noise [90]. To evaluate the numerical accuracy, two quality indexes are used: the signal-to-noise ratio (SNR) rate [91], where the higher the SNR is the better the result is, and the Mean Structural Similarity Index Measure (MSSIM) [61]. The later index is used to measure the similarity between the noise-free image and the denoised one, which is between 0 and 1.

4.2.1 Pure additive noise

In the first experiment, a synthetic image (Fig. 14a) is used, which is artificially corrupted with additive Gaussian noise having a 0 mean and standard deviation 0.1 (Fig. 14b). Figure 14 presents the filtering results using three anisotropic diffusion versions (Perona and Malik anisotropic diffusion (PMAD) [49], flux-based anisotropic diffusion (FBAD) [60], and the detail preserving anisotropic diffusion (DPAD) [61]), the proposed filter (ANRAD), and the Bilateral filter [21]. The parameters of each filter are mentioned in Table 1, where the step time is denoted by \({\Delta } t\), the number of iterations is denoted by itr, the window size is denoted by \(\eta _{x}\), and Thres is a constant threshold on the norm of the gradient on the image. In the suggested algorithm, the smoothing step time is set to 0.2 and the denoising process runs adaptively with 100 iterations. The ANRAD shows better results for both SNR and MSSIM, as shown in Table 1, where it has a good performance with the greatest SNR value, which is equal to 76.7737, and the highest MSSIM score which is equal to 0.9831 (close to 1). This means that the denoised image is close to the original one. Figure 14 shows that the recovered image by applying the proposed method (Fig. 14g) has also a better visual quality in comparison with the other methods. Clearly, the ANRAD performs better and produces smoother results, whereas the edges are well preserved and the contrast is improved better.

Table 2 Simulation results of the different filters for the multiplicative noise

4.2.2 Pure multiplicative noise

To better evaluate the efficiency of the proposed algorithm, simulation studies have been carried out using a synthetic image downloaded from [89] and synthetically corrupted with pure multiplicative noise (see Fig. 15). In this case, the noise level has been taken as 10 %. In Fig. 15, it can be seen that the estimated NLFs are found just below the lower envelop of the distribution samples, where there is a very good agreement between each color band. Figure 15a shows the noisy image, whereas Fig. 15b–d show the image processed by the SRAD, the DPAD filter, and the ANRAD, respectively. In the SRAD method, the smoothing time step is set to 0.02 and the denoising process ran adaptively with 200 iterations. In the DPAD method, the filtering time step is set to 0.02 and the smoothing process ran adaptively with 200 iterations. In the suggested algorithm, the step time is set to 0.2 and the denoising process ran adaptively with 150 iterations. The performance quality of experiments, in terms of SNR and MSSIM, is listed in Table 2. Comparing the denoising results (Fig. 15b–d), it is noted that the three denoising methods can eliminate pure multiplicative noise in most homogeneous regions. In Table 2, it may be qualitatively observed that a very good restoration result for the DPAD filter compared to the others is obtained. It can be seen that the DPAD filter has a better behavior for both SNR and MSSIM measures. A justification of this behavior is that the DPAD filter has used the mode of the distribution of all the CVs of the noise over the whole of the image as an estimator of the NLF value, which is the best among the other estimators in the case of this kind of noise. Also as noticed before, the use of a \(5\times 5\) neighborhood in the DPAD filter instead of the four direct neighbors, like the original SRAD, to compute the local coefficients of variation is more accurate and thus allows obtaining better results.

Fig. 15
figure 15

From left to rightfirst line red, green and blue NLFs. Second line denoising experimental results: noisy sub-image; sub-image results obtained by: SRAD SNR \(=\) 56.4128, iter \(=\) 200), DPAD (SNR \(=\) 57.3503, iter \(=\) 200) and ANRAD (SNR \(=\) 57.1214, iter \(=\) 150) (color figure online)

4.2.3 Mixed signal-dependent noise

It is interesting in this phase to denoise the images corrupted with mixed color signal-dependent noise according to the general noise model in Eq. 2. Some color test images, namely Peppers, Starfish, and Firefighters, have been used as a ground truth, which are artificially corrupted by mixed color signal-dependent noise according the following parameters: (\(f(30), \sigma _{\rm c}=0.04, \sigma _{\rm s}=0.10\)), (\(f(30), \sigma _{\rm c}=0.06\), and \(\sigma _{\rm s}=0.16\)) and (\(f(60), \sigma _{\rm c}=0.06\), and \(\sigma _{\rm s}=0.16\)) given, respectively, in (Figs. 16, 18, and 20). Figure 16c shows the noise variance maps of each of the red, green, and blue channels of Fig. 16a. It is noticeable that the variance noise varies locally in the image, depending also on each color components. These experiments confirm that noise in photography images is not white and is signal dependent. The proposed filter used the noise variance maps as a common diffusion controlling term for noise filtering of a color image implying a more effective denoising than the traditional SRAD filter. In other words, the amount of noise reducing is not uniform over the whole image. Consequently, an adaptive denoising is treated. The noisy images shown in Figs. 16, 18, and 20 are filtered using the ANRAD, the SRAD, and the DPAD methods, and the results are presented in Figs. 17, 19, and 20. The performance quality of the experiments, in terms of SNR, is presented in Table 3. As indicated in Figs. 17, 19, and 20, the suggested method has achieved better noise removal in most homogeneous regions and structure preservation than the SRAD and DPAD methods. Figure 17 shows the image denoised with the proposed method, the DPAD, and the SRAD. It is observed that the ANRAD reduces color noise and improves the image quality. It can also be seen that there is an improvement in preserving the image structure. Based on the SNR in Table 3, it is also noticeable that the proposed method performs better than the other two methods.

Based on the experiments in Fig. 20, some observations can be drawn. The ANRAD filter can effectively improve the quality of the noisy image and also enhance better edges and preserve more details than the other filters. In contrast with the DPAD filter, the result shows that it blurs the image and causes a loss of information regarding the fine structures of the image and edges.

Table 3 Simulation results of different filters for mixed signal-dependent noise
Fig. 16
figure 16

a Original image; noisy image, segmented image. b The corresponding NLFs (red, green and blue curves). c Variance noise maps of each of red, green and blue channels (color figure online)

Fig. 17
figure 17

Result of our filter on loaded image from Berkeley database. The first row original image; image corrupted with color noise (\(f(30), \sigma _{\rm c}=0.04\), and \(\sigma _{\rm s}=0.10\)), result of our filter (SNR \(=\) 48.1295, iter \(=\) 30), DPAD filter (SNR \(=\) 38.6194, iter \(=\) 300), and SRAD filter (SNR \(=\) 36.7871, iter \(=\) 150). Second row corresponding zoomed images

Fig. 18
figure 18

First line original image; noisy image; segmented image. Second line three NLFs (red, green, and blue curves) (color figure online)

Fig. 19
figure 19

Result of our filter on loaded image from Berkeley database (12003.jpg). The first row original image; image corrupted with color noise (\(f(30), \sigma _{\rm c}=0.06\), and \(\sigma _{\rm s}=0.16\)), result of: ANRAD (SNR \(=\) 48.3407, iter \(=\) 40); DPAD (SNR \(=\) 41.1171, iter \(=\) 400) and SRAD (SNR \(=\) 39.5224, iter \(=\) 600). Second row corresponding zoomed images

Fig. 20
figure 20

Denoising experimental results—from left to right noisy image by color noise ((\(f(60), \sigma _{\rm c}=0.06\), and \(\sigma _{\rm s}=0.16\))); noisy sub-image; sub-image results obtained by: SRAD (SNR \(=\) 31.8152, iter \(=\) 250), DPAD (SNR \(=\) 39.4481, iter \(=\) 600) and ANRAD (SNR \(=\) 40.8260, iter \(=\) 60)

Fig. 21
figure 21

Estimated NLF for a red, b green, and c blue channels

The denoising method in [92], called the fast non-local means (FNLM), is used to show the effectiveness of the proposed method, which outperforms the methods in [9395] and can be considered as the state of the art in image denoising. To the test Lena image in Fig. 22a (size, 512 \(\times\) 512), the synthesized noise with the following parameters: \(f(60) , \sigma _{\rm c}=0.01\) and \(\sigma _{\rm s}=0.02\) is added. The noisy image is filtered using the FNLM with a fixed NLF as an input value (equal to 0.07, see Table 4). However, the ANRAD uses three estimated NLFs. Figure 21 shows the results of the three estimated NLFs for each component (red, green, and blue). The simulation results are shown in Fig. 22 of both filters. Zoomed restored images are displayed in Figs. 23, 24, and 25 to show more details for small objects after denoising. It can be seen that the proposed method preserves image structures much better than the FNLM filter. The ANRAD algorithm outperforms the FNLM filter and its images get denoised well and the edges and fine details are preserved. For instance, in Fig. 24, the line patterns on the hat of Lena are prominent and with sharp edges in the ANRAD restored image as compared to that of the FNLM restored one. The ANRAD filter seems to have better visual quality than the other filter. The qualitative results are shown in Table 4. It shows a significant rise in the SNR value for the proposed algorithm (SNR \(=\) 66.3848) in comparison with the FNLM filter (SNR \(=\) 63.6967).

Table 4 Simulation results of the different filters for the multiplicative noise
Fig. 22
figure 22

a Clean image, b noisy image, c denoised image by FNLM, and d denoised image by ANRAD

Fig. 23
figure 23

a Original sub-image, b noisy sub-image, c denoised sub-image by FNLM, and d denoised sub-image by ANRAD

Fig. 24
figure 24

a Original sub-image, b noisy sub-image, c denoised sub-image by FNLM, and d denoised sub-image by ANRAD

Fig. 25
figure 25

a Original sub-image, b noisy sub-image, c denoised sub-image by FNLM, and d denoised sub-image by ANRAD

4.2.4 Real image results

For decades, the automatic methods for extracting and measuring the vessels in retinal images have been required to save the workload of ophthalmologists and to assist in characterizing the detected lesions and identifying the false positives [87, 96101]. However, the use of rough images is not desirable, if one wishes to detect automatically the vessels of the vascular network. Therefore, an image pre-processing is required before any treatment. To reduce image noise, most of algorithms assume the noise to be additive, uniform, and independent of the RGB image data [102108]. Afterward, these approaches cannot effectively recover the “true” signal (or its best approximation) from these noisy acquired observations. In this section, the improvement in the quality of visual rendering of the retinal images using the ANRAD algorithm is focused on in order to facilitate a later analysis. A real retinal image of a human is shown in Fig. 27a. The data have been downloaded from a publicly available database named the STARE Project database [109], which was acquired using a Topcon TRV-50 fundus camera at a 35 field of view (FOV), which was digitized with a 24-bit gray-scale resolution and a size of 700 \(\times\) 605 pixels. The green scale is considered as the natural basis for vessel segmentation because it normally presents a higher contrast between the vessels and the retinal background (Fig. 26a) [110116]. Figure 26c–f shows the zoomed smoothed images processed by the four filters (the proposed filter, the PMAD, the SRAD, and the DPAD) tested on the gray scale of a real picture (im0077) taken from the Stare Project database. Figure 27 presents the results of the three corresponding model noise (red, green, and blue channels). The figure shows that the estimated curves of the noise function are found just below the lower envelope of the samples. Some other NLF are displayed in Figs. 28, 29, 30, and 31. According to these results, it has been found that the retinal fundus images do not contain uniform, white and additive noise because it can be seen that each estimated curve of the NLF is a nonlinear function describing the variance noise as a function of local intensity throughout the image. Also, it is different from one color channel to another. For the results shown in Fig. 26c, e, f (except d), it appears that the fine vessel at the bottom-right of the image in Fig. 26b has been markedly degraded or lost. Nevertheless, from Fig. 26d, it is seen that the proposed method is much more able to smooth out flat regions and to keep thin vessels than the other methods. The major region boundaries are preserved, especially by the ANRAD technique. Although this processed result is purely qualitative, it shows promise for the ANRAD as a general purpose CCD noise-reducing filter for retinal images.

Fig. 26
figure 26

a Real noisy retinal image (green channel); b sub-image of original image (a); c PMAD diffusion result (Thres \(=\) 15, iter \(=\) 30, \(\hbox{d}t=0.05\)); d ANRAD result (iter \(=\) 30, \({\Delta }t=0.2\)); e SRAD (iter \(=\) 50, \({\Delta }t=0.2\)); f DPAD (iter \(=\) 50, \({\Delta }t=0.2\)) (color figure online)

Fig. 27
figure 27

Real retinal noisy images and their corresponding NLFs model noise. a Original image. Model noise on the blue (b), green (c), and red (d) channels (color figure online)

Fig. 28
figure 28

Real retinal noisy images and their corresponding NLFs model noise. a Original image. Model noise on the blue (b), green (c), and red (d) channels (color figure online)

Fig. 29
figure 29

Real retinal noisy images and their corresponding NLFs model noise. a Original image. Model noise on the blue (b), green (c), and red (d) channels (color figure online)

Fig. 30
figure 30

Real retinal noisy images and their corresponding NLFs model noise. a Original image. Model noise on the blue (b), green (c), and red (d) channels (color figure online)

Fig. 31
figure 31

Real retinal noisy images and their corresponding NLFs model noise. a Original image. Model noise on the blue (b), green (c), and red (d) channels (color figure online)

5 Advantages and limitations

The SRAD method has been developed to remove the speckle noise, a form of multiplicative noise, in imagery by utilizing a variance noise as an input value which is usually done from a selected region from the background pixels. The SRAD assumes noise to be multiplicative, uniform and uncolored. This assumption simplifies image filtering. The proposed denoising method is developed for color signal-dependent noise by using a general NLF as an input value. The estimated noise level is a continuous function describing the variance noise as a function of local intensity throughout the image. Consequently, the current denoising algorithm is truly automatic and can effectively remove various types of image noise. As the SRAD filtering near an edge is very weak, the noise reducing near the edge is also small. The ANRAD allows the filtering to be different along various directions defined by the gradient direction and its orthogonal. Thus, the filtering on both sides of an edge can be prevented while permitting the filtering along the edge. This prevents the edge from being smoothed and then being removed during denoising. As shown in Sect. 4, the experimental results have been conducted, with both quantitatively convincing and visually pleasing results. Some image tests are shown with zoomed zones to validate the efficiency of this approach.

The proposed filter shows a very good behavior both in edge preservation and noise cleaning. However, it does not prevent some limitations from existing: This approach does not work well for images with textures, specially those with great variability, because textures usually contain high frequencies and greatly affect the estimated noise variance. The used size and shape of the window to compute the coefficients of variation may affect the quality of processing images, like eliminating some of the details in the original image and blurring it a little. A more significant limitation is in the computation time. It has an additional expensive step of noise estimation, which makes it slower than the DPAD and SRAD algorithms.

6 Conclusion

In this paper, a new version of the SRAD technique has been developed, named the ANRAD, to remove various types of color image noise produced by today’s CCD digital cameras. Unlike the SRAD technique that processes a known type of noise and with some assumptions, such as a linear system and uncorrelated, white, and purely multiplicative noise, the proposed technique processes the data adaptively with an instantaneous RGB noise level. The adopted noise level is a nonlinear function of the image intensity depending on the external parameters related to the image acquisition system. In all our experiments, the proposed ANRAD method has exhibited better performances than the conventional SRAD technique, in terms of smoothing uniform regions and preserving edges and features. Its performance is directly related to the goodness of the employed noise estimation process. Choosing a good dynamic estimator beside, combined with the iterative process of the ANRAD, shows a very good performance of noise cleaning. This new technique shows the importance of a careful selection of a noise estimator in the SRAD method. The method presented in this study has several possible applications, and a future work will focus on the fact that the filter can be generalized to 3D images and can improve the performances of 2D and 3D segmentation approaches for the reconstruction of image regions.