# Fast and Provably Accurate Bilateral Filtering

The bilateral filter is a non-linear filter that uses a range filter along with a spatial filter to perform edge-preserving smoothing of images. A direct computation of the bilateral filter requires O(S) operations per pixel, where S is the size of the support of the spatial filter. In this paper, we present a fast and provably accurate algorithm for approximating the bilateral filter when the range kernel is Gaussian. In particular, for box and Gaussian spatial filters, the proposed algorithm can cut down the complexity to O(1) per pixel for any arbitrary S. The algorithm has a simple implementation involving N+1 spatial filterings, where N is the approximation order. We give a detailed analysis of the filtering accuracy that can be achieved by the proposed approximation in relation to the target bilateral filter. This allows us to to estimate the order N required to obtain a given accuracy. We also present comprehensive numerical results to demonstrate that the proposed algorithm is competitive with state-of-the-art methods in terms of speed and accuracy.

There are no comments yet.

## Authors

• 20 publications
• 1 publication
• ### Fast and Accurate Bilateral Filtering using Gauss-Polynomial Decomposition

The bilateral filter is a versatile non-linear filter that has found div...
05/01/2015 ∙ by Kunal N. Chaudhury, et al. ∙ 0

• ### Speeding Up the Bilateral Filter: A Joint Acceleration Way

Computational complexity of the brute-force implementation of the bilate...
02/28/2018 ∙ by Longquan Dai, et al. ∙ 0

• ### Efficient and Accurate Gaussian Image Filtering Using Running Sums

This paper presents a simple and efficient method to convolve an image w...
07/25/2011 ∙ by Elhanan Elboher, et al. ∙ 0

• ### A Probabilistic Least-Mean-Squares Filter

We introduce a probabilistic approach to the LMS filter. By means of an ...
01/27/2015 ∙ by Jesus Fernandez-Bes, et al. ∙ 0

• ### Block DCT filtering using vector processing

Filtering is an important issue in signals and images processing. Many i...
10/19/2017 ∙ by Mostafa Amin-Naji, et al. ∙ 0

• ### Mathematical Modeling of Sediments in the Filter and Improvement of the Filter Construction

The filters work in many areas of technology. There constructions are di...
03/17/2021 ∙ by Yuri Troshchiev, et al. ∙ 0

• ### On Fast Bilateral Filtering using Fourier Kernels

It was demonstrated in earlier work that, by approximating its range ker...
03/26/2016 ∙ by Sanjay Ghosh, et al. ∙ 0

##### This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

## I Introduction

Gaussian and box filters typically work well in applications where the amount of smoothing required is small. For example, they are quite effective in removing small dosages of noise from natural images. However, when the noise floor is large, and one is required to average more pixels to suppress the noise, these filters begin to over-smooth sharp image features such as edges and corners. The over-smoothing can, however, be alleviated using some form of data-driven (non-linear) diffusion, where the quantum of smoothing is controlled using the image features. A classical example in this regard is the famous PDE-based diffusion of Perona and Malik [2]. The bilateral filter was proposed by Tomasi and Maduchi [3]

as a filtering-based alternative to the Perona-Malik diffusion. The bilateral filter has turned out to be a versatile tool that has found widespread applications in image processing, computer graphics, computer vision, and computational photography

[4]. More recently, the bilateral filter has received renewed attention in the context of image denoising [5, 6].

In this paper, we consider a standard form of the bilateral filter where a Gaussian kernel is used for range filtering, and a box or Gaussian kernel is used for spatial filtering [3]. In this setting, the bilateral filtering of an image , where is some finite rectangular domain of , is given by

 fBF(i)=∑j∈Ωw(j) gσr(f(i−j)−f(i)) f(i−j)∑j∈Ωw(j) gσr(f(i−j)−f(i)) (1)

where

 gσr(t)=exp(−t22σ2r). (2)

The spatial filter is a Gaussian:

 w(i)=exp(−∥i∥22σ2s)(i∈Ω), (3)

or a box:

 w(i)=1/|Ω|(i∈Ω). (4)

The domain of the spatial kernel is a square neighbourhood, , where for the Gaussian filter. We refer the interested reader to [3, 4] for a detailed exposition on the working of the filter. We note that the bilateral filter has a straightforward extension to video and volume data. Another natural extension is the cross (or joint) bilateral filter [4]. While we will limit our discussion to the standard bilateral filter, the main ideas in this paper can also be applied to the above-mentioned extensions.

### I-a Fast Bilateral Filtering

It is clear that a direct computation of (1) requires operations per pixel. In fact, the computation is slow for practical settings of . To address this issue, researchers have come up with several fast algorithms [7] - [14]

. Most of these are based on some form of approximation, and provide various levels of compromise between speed and quality of approximation. One of the early algorithms for fast bilateral filtering involved the quantization of the image intensities, where the final output was obtained via the interpolation of the output of a set of linear filters

[7]. It was later shown that this approximation can be used to obtain a constant-time implementation which further improves its speed [8]. In a different direction, it was observed in [9] that the bilateral filter can be conceived as a linear filter acting in three-dimensions, where the three-dimensions are obtained by augmenting the image intensity to the spatial dimensions. This observation was used to derive a fast filtering in three-dimensions, which was then sampled to obtained the final output. We refer the interested reader to [10] for a survey of fast algorithms for bilateral filtering.

The algorithms in [10, 11, 12] are particularly relevant to the present work. Here the authors proceed by approximating (2) using polynomial and trigonometric functions, and demonstrate how the bilateral filter can be decomposed into a series of spatial filterings as result. As is well-known, since spatial box and Gaussian filters can be implemented in constant-time using separability and recursion [13], the overall approximation can therefore be computed in constant-time.

### I-B Present Contribution

We propose a fast algorithm for computing (1) which was motivated by the line of work in [12, 14]. In particular, similar to these papers, we present a novel approximation of (2) that allows us to decompose the bilateral filter into a series of spatial convolutions. The fundamental difference between the above papers and the present approach is that, instead of approximating (2) and then translating the approximation in range space, we directly approximate the translated Gaussians appearing in (1). In particular, the computational advantages obtained using the proposed approximation are the following:
(1) For a fixed approximation order (to be defined shortly), the proposed approximation requires half the number of spatial filterings required by the approximations in [8, 10, 12].
(2) The proposed approximation does not involve the transcendental functions and which are used in [12, 14]. It only involves polynomials (and just a single Gaussian), and hence can be efficiently implemented on hardware [15]. Moreover, the rounding error is small when working with polynomials.

As will be demonstrated shortly, the proposed algorithm is generally faster and more accurate than Yang’s algorithm [8], which is currently considered to be the state-of-the-art [10, 16]. In particular, we perform an error analysis whereby we compare the output obtained using the proposed algorithm with that of the exact bilateral filter. Due to the particular nature of the proposed approximation, our analysis is much more simple than that carried out for Yang’s algorithm in [16]. Nevertheless, compared to Yang’s algorithm, we are able to establish a smaller bound on the number of spatial filterings required to achieve a given filtering accuracy. The latter is defined in terms of the error between the outputs of the bilateral filter and the fast algorithm (this will be made precise in Section III). To best of our knowledge, with the exception of [8], this is the only fast algorithm that comes with a provable guarantee on the quality of approximation. At this point, we note that the term “accurate” is used in the paper not just to signify that the output of the fast algorithm is visibly close to that of the target bilateral filter. It also has a precise technical meaning, namely, that we can control the approximation order to make the error between the outputs of the bilateral filter and the fast algorithm arbitrarily small.

### I-C Organization

The rest of the paper is organized as follows. We present the proposed kernel approximation and the error analysis in Section II. In Section III, we develop a fast constant-time algorithm arising from the Gaussian-polynomial approximation. We then analyze the quality of approximation that can be achieved using our algorithm. This gives us a simple rule for tuning the approximation order for a given user-defined accuracy. We present exhaustive numerical results in Section IV, and demonstrate the superior performance of the proposed algorithm over some of the existing algorithms.

## Ii Gaussian-Polynomial Approximation

The present idea is to consider the translated kernel that appears in (1), where and . We can write

 gσr(t−τ)=exp(−τ22σ2r)exp(−t22σ2r)exp(τtσ2r). (5)

For a fixed translation , this is a function of . Notice that the first term is simply a scaling factor, while the second term is a Gaussian centered at the origin. In fact, the second term essentially contributes to the bell shape of the translated Gaussian. The third term is a monotonic exponential, which is increasing or decreasing depending on the sign of ; this term helps in translating the Gaussian to .

We assume (without loss of generality, as will be explained at the start of Section III) that the dynamic range of the image is . That is, the arguments and in (5) take values in . This means that the product appearing in (5) takes values in . Consider the Taylor expansion of the exponential term about the origin:

 exp(τtσ2r)=N−1∑n=01n!(τtσ2r)n+ higher-order terms. (6)

By dropping the higher-order terms, we obtain the following approximation of (5):

 ϕN,σr(t,τ)=exp(−t2+τ22σ2r)[N−1∑n=01n!(τtσ2r)n]. (7)

Being the product of a bivariate Gaussian and a polynomial, we will henceforth refer to (7) as a Gaussian-polynomial, where is its approximation order. By construction, we have the pointwise convergence

 limN→∞ϕN,σr(t,τ)=gσr(t−τ). (8)

We would like to note that the above idea of splitting the kernel and approximating a part of its using Taylor polynomials was employed in [17] in the context of the fast Gauss transform. To the best of our knowledge, this idea has not been exploited for fast bilateral filtering along the lines of the present work.

In Figure 1, we study the approximations corresponding to different . The fundamental difference between the Taylor approximation in [11] and the Gaussian-polynomial approximation (8) is that instead of approximating the entire Gaussian, we approximate one of its component, namely the exponential function in (5). The intuition behind this is that the Taylor polynomial blows up as one moves away from the origin. This makes it difficult to approximate the tail part of a Gaussian using such polynomials. On the other hand, the exponential in (5) is monotonic, and hence can be closely approximated using polynomials. This point is explained with an example in Figure 2. In particular, notice in Figure (b)b that the Gaussian-polynomial approximation is quite precise over the range of interest, and is comparable to the raised-cosine approximation of same order [12].

### Ii-a Quantitative Error Analysis

Before explaining how we can use Gaussian-polynomials to derive a fast bilateral filter in Section III, we study the kernel error incurred by approximating (2) using Gaussian-polynomials. We will see in Section III that a bound on the kernel error can in turn be used to bound the filtering accuracy of the fast algorithm. Note that (8) tells us that Gaussian-polynomial can be used to approximate the range kernel with arbitrary accuracy. However, in practice, we will be required to use a Gaussian-polynomial of some fixed order . A relevant question is the size of error incurred for a given ? A related question is that, given some error margin , how do we fix the smallest such that the corresponding error is within ?

To begin with, we define the error function

 EN,σr(t,τ) =gσr(t−τ)−ϕN,σr(t,τ) =exp(−t2+τ22σ2r)∞∑n=N1n!(τtσ2r)n. (9)

The mathematical problem is one of bounding (II-A) for fixed and . In this work, we consider the error given by

 ∥EN,σr∥∞=max{|EN,σr(t,τ)|: −T≤t,τ≤T}. (10)

This is also referred to as the worst-case or uniform error. We note that one can measure the error using other means, e.g., using the metric. The reason why we choose the metric is that our ultimate goal is to quantify the accuracy of the final filtering arising from the approximation, and a bound on (10) is sufficient for this purpose. Moreover, computing the error is relatively simple.

Using the inequality , we can bound the first term in (II-A) by . Therefore, we have

 ∥EN,σr∥∞≤maxs∈[0,T2] ψN,σr(s), (11)

where

 ψN,σr(s)=exp(−sσ2r)[∞∑n=N1n!(sσ2r)n]. (12)

Using (11), we obtain the following result. We note that this bound is stronger than that derived for the fast Gauss transform in [17].

###### Proposition II.1.
 ∥EN,σr∥∞≤∞∑n=Ne−λλnn!(λ=T2/σ2r). (13)

To arrive at (13), we proceed by writing (12) as

 ψN,σr(s)=1−exp(−sσ2r)N−1∑n=01n!(sσ2r)n.

After differentiation, we get

 ψ′N,σr(s)=1(N−1)!σ2r(sσ2r)N−1exp(−sσ2r)≥0.

Thus, (12) is non-decreasing on , whereby we conclude that the maximum in (11) is attained at . This establishes Proposition II.1.

To get an idea of the tightness of the bound in (13), we compare the mesh plots of (II-A) and (12) in Figure 3 when and . While there is a gap between the error and the corresponding bound at certain values of , the supremum of the latter (which occurs at one of the boundaries as predicted above) is nevertheless of the same order of magnitude as the supremum of the former.

### Ii-B Relation between N and Kernel Error

Having obtained a bound on the approximation error, we consider the problem of finding the smallest such that (10) is within some allowed error margin . Note that the quantity on the right in (13

) is simply the tail probability of a Poisson random variable with parameter

. We recall that a random variable taking values in

is said to follow a Poisson distribution with parameter

if

 Prob(X=n)=e−λλnn!(n=0,1,2,…).

We can thus interpret the quantity on the right in (13) as the probability . In this context, the leading question is the following: given , find the smallest such that . The advantage of expressing the problem in this form is that it brings to our disposal various tools for bounding the tail probability. For example, assuming that , we have the Chebyshev bound [18]:

 Prob(X≥N)≤λ(N−λ)2. (14)

On the other hand, the Chernoff bound [18] when is given by

 Prob(X≥N)≤e−λ(eλ)NNN. (15)

Numerical experiments suggest that for and for a range of values of (to be reported shortly), the empirically computed is always larger than . Under this assumption, we have the following estimate of the smallest using (14):

 N0=[λ+√λ/ε], (16)

where is the smallest integer greater than or equal to .

As is well-known, the Chernoff bound (15) is typically tighter than the Chebyshev bound. However, finding the smallest such that

 e−λ(eλ)NNN≤ε (17)

is somewhat more involved.

###### Proposition II.2.

Let be the inverse of the map on . Then the smallest integer greater than for which (17) holds is

 N0=[q/W0(qe−p)], (18)

where and .

The details are provided in Appendix VI-A. While can be computed using the Matlab script lambertw(0,t), we note that can be approximated using a series expansion [19]. In particular, the first four terms are

 W0(t)=t−t2+32t3−83t4. (19)

However, we observed that (19) provides inexact estimates when is large, that is, when is small. An extremely large number of terms of the series are required to get a precise estimate. To address this problem, we propose to use Newton iterations for finding the positive root of (see Appendix VI-A for notations), where the initialization is done using (18) and (19). Namely, starting with , we run the following iterations for :

 xk+1 =xk−ν(xk)ν′(xk)=xk−xklogxk−pxk−qlogxk+1−p. (20)

In practice, we noticed that about - iterations are sufficient to produce a good solution. In Table III, we illustrate the improvement obtained after performing the Newton iterations. The complete scheme for computing the order for a given accuracy is summarized in Algorithm 1.

Note that for , we use a fixed order of . This is because the condition in (14) and (15) is violated in this regime. Moreover, we have noticed that a small order suffices when is large. In Figure 4, we compare the estimated order obtained using the following methods: Chebyshev (16), Chernoff (18) along with (19), and Chernoff followed by Newton iterations (20). We also compare the corresponding errors (computed using exhaustive search) given by (10). Notice that the estimates are close to that obtained using exhaustive search when ; however, when , the Chebyshev bound is quite loose.

## Iii Fast Bilateral Filtering

We now explain how Gaussian-polynomials can be used to derive a fast algorithm for implementing (1). As a first step, we center the intensity range around the origin. This is in keeping with the Taylor expansion in (7) which is performed around the origin. A simple means of doing so is to set , assuming the dynamic range to be , and to consider the centred image given by

 h(i)=f(i)−tc(i∈I). (21)

The crucial observation is that that the shift operation in (21) commutes with the non-linear bilateral filtering.

###### Proposition III.1.

For ,

 fBF(i)=hBF(i)+tc. (22)

In other words, we can first centre the intensity range, apply the bilateral filter, and finally add back the centre to the output. Henceforth, we will assume that the range of the input image is . For an -bit grayscale image, .

### Iii-a Fast Algorithm

The underlying mechanism of the proposed fast algorithm is related to the fast algorithms in [12, 14]. The subtle difference is that instead of directly approximating (2), we approximate its translates in (1). In particular, we fix some order , and approximate the range kernel in (1) using (7). This gives us the following Gaussian-Polynomial Approximation (GPA) of (1):

 fGPA(i)=∑j∈Ωw(j)ϕN,σr(f(i−j)−f(i))f(i−j)∑j∈Ωw(j)ϕN,σr(f(i−j)−f(i)). (23)

Next, for , we define the images

 Gn(i)=(f(i)σr)n,  Fn(i)=exp(−f(i)22σ2r)Gn(i), (24)

and set

 ¯Fn(i)=(Fn∗w)(i)=∑j∈Ωw(j)Fn(i−j). (25)

We can then write (23) as (cf. Appendix VI-B)

 fGPA(i)=P(i)Q(i), (26)

where

 P(i)=σrN−1∑n=01n!Gn(i)¯Fn+1(i), (27)

and

 Q(i)=N−1∑n=01n!Gn(i)¯Fn(i). (28)

Notice that we have effectively transferred the non-linearity of the bilateral filter to the intermediate images in (24), which are obtained from the input image using simple pointwise transforms. The computational advantage that we get from the above manipulation is that the spatial filtering in (25) can be computed using operations per pixel when is a box or a Gaussian [13]. The overall cost of computing (23) is therefore per pixel with respect to the filter size . This is a substantial reduction from the complexity of the direct implementation of (1).

The complete algorithm for computing (23) is summarized in Algorithm 2, which we will continue to refer as GPA. Note that we efficiently implement steps (24) to (28) by avoiding redundant computations. In particular, we recursively compute the images in (24) and the factorials in (27) and (28). Notice that steps 2-2, 2-2, 2-2, and 2 are cheap pointwise operations. The main computation in Algorithm 2 is the spatial filtering in step 2, and the initial filtering in step 2. That is, the overall cost is dominated by the cost of computing spatial filtering. In this regard, we note that for the same degree , the number of spatial filterings required in [12, 14] is , and that in [8] is . Moreover, we note that the proposed algorithm involves the evaluation of a transcendental function just once, namely in step 2. In contrast, the algorithm in [8] requires evaluations of the Gaussian over the whole image. Thus, the present algorithm has smaller rounding errors, and is better suited for hardware implementations [15] compared to the above mentioned algorithms. Yet another key advantage with the Algorithm 2 is that we need just six images (excluding the input and output images) for the complete pipeline. As against this, the algorithm in [8] requires the computation and storage of principal images, which are interpolated to get the final output.

### Iii-B Filtering Accuracy

It is clear that the kernel error, and hence the overall quality of approximation, is controlled by the order . In this regard, we need a rule to fix in Algorithm 2. As before, we will consider the worst-case error given by

 (29)

By bounding (29), we can control the pixelwise difference between the exact and the approximate bilateral filter. In particular, we have the following result which formally establishes the intuitive fact that the filtering accuracy is essentially within a certain factor of the kernel error given by (10). The details of the derivation are provided in Appendix VI-C.

###### Proposition III.2.

Suppose that the spatial filter is non-negative and normalized, i.e., for all , and

 ∑j∈Ωw(j)=1. (30)

Then

 ∥fBF−fGPA∥∞≤2T∥EN,σr∥∞w(0)−∥EN,σr∥∞. (31)

We note that the spatial filters (3) and (4) are non-negative, and that appears in both the numerator and denominator of (1) and (23). Therefore, we can assume (30) without any loss of generality. In fact, (30) is automatically true for the box filter. We also recall that the range of the image is assumed to be centered; the intensity values are in the interval , where for most grayscale images.

### Iii-C Relation between Accuracy and N0

Note that by combining (31) with the bound in (15), we get a direct control on the filtering accuracy in terms of the approximation order. In particular, suppose that we want (29) to be within . A sufficient condition for this is that

 ∥EN,σr∥∞≤w(0)δ2T+δ.

To summarize, we have the following guarantee that follows from (31).

###### Corollary III.3.

Suppose that is set using Algorithm 1, where is given by

 ε=w(0)δ2T+δ. (32)

Then the output of Algorithm 2 is within of the output of the bilateral filter.

## Iv Experiments and Discussion

We implemented the proposed GPA algorithm using Matlab on an Intel GHz Linux system with GB memory. The Matlab implementation has been shared here [20]. The set of grayscale images used for the experiments are shown in Figure 5. We compared the proposed algorithm with the following fast algorithms: Yang [8], Paris [9], Weiss [22], and the Shiftable Bilateral Filter (SBF) [14]. We used the Matlab implementation of these algorithms to make the comparison fair; moreover, we used the parameter settings suggested in the respective papers. For determining the order in [8] for a given accuracy parameter , we have used (34).

Experiment 1 The output of the proposed GPA algorithm on a couple of images are shown in Figures 6 and 7. We also provided the output obtained using exact bilateral filtering. We performed the comparison using the box and the Gaussian kernels for the spatial filter. Notice that the speedup obtained is significant. Moreover, the filtered images are visually identical and numerically very close, in terms of the and mean-squared errors. We have used the following definition of mean-squared error (MSE):

 MSE=10log10{|I|−1∑i∈I(fBF(i)−fGPA(i))2},

where denotes the number of pixels in the image.

To get a better understanding of how varies with , we used the following approximation (see Appendix VI-D):

 N0≈1.72(Tσr)2+log(2Tw(0)δ). (33)

An important point to note in (33) is the logarithmic dependence on . In fact, the factor can be traced back to the tail bound in (15), which, in turn, follows from the particular splitting in (7). The implication of the logarithmic dependence is that we can force to be quite small without blowing up .

To further highlight the importance of (33), we compared (33) with the corresponding estimate for Yang’s algorithm [8]:

 N0≈1.14×105δ1/2σ2r. (34)

The above estimate was recently derived in [16]. In particular, notice that the dependence on is similar to that in (33). However, the dependence on is much more strong in (34) compared to (33), since when . Moreover, the leading constant in (34) is much larger than the constant in the first term in (33). As an example, when and , we have for Yang’s algorithm (this is the estimate reported in [16]). On the other hand, the corresponding estimate for our algorithm is (assuming that and that we use a box filter of size ). The difference becomes dramatic for smaller values of . For example, when and , the estimate from (33) is , while that from (34) is . Further comparisons are provided in Table II. Notice that the order for Yang’s approximation explodes when (sub-pixel accuracy). It is also seen from the table that (33) provides a close approximation of (18) for the setting under consideration.

Experiment 2 A graphic comparison of the algorithms for various settings of the spatial and range kernels is presented in Figures 8 and 9. As before, we performed the comparison for both the box and Gaussian spatial filters. It is evident from these results that the proposed method is competitive with existing methods in terms of the speed-accuracy tradeoff.

Experiment 3 We next compared the proposed algorithm with existing fast algorithms on the images shown in Figure 5. A summary of the comparisons (in terms of maximum pixelwise error and MSE) is provided in Figure 10.

Experiment 4 Finally, we performed a detailed comparison of the proposed algorithm with Yang’s algorithm, which is widely considered to be the state-of-the-art algorithm. In the first comparison, we fixed an image and the parameters of the bilateral filter. The order was then varied and the corresponding error and run times were noted. The results are presented in Table III. Notice that the run time of GPA is consistently smaller than that of Yang’s algorithm for both the box and Gaussian kernels. Indeed, as remarked earlier, for a fixed order , Yang’s algorithm [8] requires spatial filterings, while GPA requires only spatial filterings. Thus, the runtime of GPA is about half of that of Yang’s algorithm. Moreover, beyond a certain , GPA provides much better filtering accuracy. We performed a similar experiment by varying , the results of which are reported in Table IV. Notice that the run time of Yang’s algorithm becomes prohibitively large when is small.

## V Conclusion

We presented a novel fast algorithm for approximating the bilateral filter. The algorithm was shown to be both fast and accurate in practice using extensive experiments. The space and time complexity of the proposed algorithm is smaller than the state-of-the-art algorithm of Yang [8], and, moreover, was shown to provide much better accuracy. We also performed an error analysis of the approximation scheme, and presented a rule for setting the approximation order that can guarantee the filtering accuracy to be within a desired margin. Before concluding, we note that the proposed algorithm can be used to perform cross bilateral filtering, and can also be extended for the filtering of video and volume data.

## Vi Appendix

### Vi-a Derivation of (18)

Taking the logarithm of (17), we can restate the problem as one of finding the smallest integer such that

 ν(x)=xlogx−px−q≥0 (35)

where and .

Notice that and . Hence, is strictly convex over with a minimum at . Since when , we conclude that there exists some for which . The smallest integer solution of (17) is precisely . To find , we solve the equations and . Note that we can write as

 qθexp(qθ)=qe−p, (36)

which is of the form , where . The inverse of the mapping is a well-studied function called the Lambert W-function [19]. In particular, the inverse (which is generally multivalued) in this case is given by

 qθ=W0(qe−p),

where is one of the two branches of the Lambert W-function [19]. This gives us estimate (18).

### Vi-B Derivation of (26)

In terms of (24), we can write as

 σrexp(−f(i)22σ2r)N−1∑n=01n!Gn(i)Fn+1(i−j). (37)

On substituting (37) in the numerator of (23), and exchanging the summations, we get

 ∑j∈Ωw(j)ϕN,σr(f(i−j)−f(i))f(i−j)=exp(−f(i)22σ2r)P(i),

which gives us (27) where we have used (25). Similarly, on substituting (37) in the denominator of (23), and exchanging the summations, we get

 ∑j∈Ωw(j)ϕN,σr(f(i−j)−f(i))=exp(−f(i)22σ2r)Q(i),

where is given by (28). Cancelling the common exponential term from the numerator and denominator, we get (26).

### Vi-C Derivation of (31)

To establish (31), we write (1) as , where

 P1(i)=∑j∈Ωw(j) gσr(f(i−j)−f(i)) f(i−j),

and

 Q1(i)=∑j∈Ωw(j) gσr(f(i−j)−f(i)).

Similarly, we write (23) as , where

 P2(i)=∑j∈Ωw(j) ϕN,σr(f(i−j)−f(i)) f(i−j),

and

 Q2(i)=∑j∈Ωw(j) ϕN,σr(f(i−j)−f(i)).

We can then write as

 =P1(i)(Q2(i)−Q1(i))+Q1(i)(P1(i)−P2(i))Q1(i)Q2(i) =1Q2(i)[fBF(i)(Q2(i)−Q1(i))+P1(i)−P2(i)]. (38)

We uniformly upper-bound (resp. lower-bound) the numerator (resp. denominator) in (VI-C). In particular, note that

 ∥fBF∥∞≤T. (39)

This follows from the fact that in (1) can be expressed as a convex combination of . On the other hand, is

 ∑j∈Ωw(j)[gσr(f(i−j)−f(i))−ϕN,σr(f(i−j)−f(i))].

Therefore, using (30), we get

 ∥Q1−Q2∥∞≤∥EN,σr∥∞. (40)

Similarly,

 ∥P1−P2∥∞≤∥EN,σr∥∞T. (41)

To uniformly lower-bound , we note that for ,

 Q1(i)=w(0)gσr(0)+∑j∈Ω∖{0}w(j)gσr(f(i−j)−f(i))≥w(0),

where we have used the non-negativity of the range and spatial kernels. Using the inverse triangle inequality along with (40), we have for ,

 |Q2(i)|≥Q1(i)−|Q2(i)−Q1(i)|≥w(0)−∥EN,σr∥∞. (42)

Combining (VI-C) - (42), we arrive at (31).

### Vi-D Derivation of (33)

Note that typically . For example, is in hundreds for a grayscale image, whereas, . Therefore, it follows from (32) that . On the other hand, from (18) and (19), we have

 N0≈qt−t2=eλ1−(q/eλ),

where and . Since ,

 11−(q/eλ)≈1+(q/eλ).

Therefore, .

## Vii Acknowledgements

The authors thank Dr. Alessandro Foi and the anonymous reviewers for their useful comments and suggestions.

## References

• [1] K. N. Chaudhury, “Fast and accurate bilateral filtering using Gauss-polynomial decomposition,” Proc. IEEE International Conference on Image Processing, pp. 2005 - 2009, 2015.
• [2] P. Perona and J. Malik, “Scale-space and edge detection using anisotropic diffusion,” IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 12, no. 7, pp. 629-639, 1990.
• [3] C. Tomasi and R. Manduchi, “Bilateral filtering for gray and color images,” Proc. IEEE International Conference on Computer Vision, pp. 839-846, 1998.
• [4] S. Paris, P. Kornprobst, J. Tumblin, and F. Durand, Bilateral Filtering: Theory and Applications, Now Publishers Inc., 2009.
• [5] C. Knaus and M. Zwicker, “Progressive image denoising,” IEEE Transactions on Image Processing, vol. 23, no.7, pp. 3114-3125, 2014.
• [6] K. N. Chaudhury and K. Rithwik, “Image denoising using optimally weighted bilateral filters: A SURE and fast approach,” Proc. IEEE International Conference on Image Processing, pp. 108-112, 2015.
• [7] F. Durand and J. Dorsey. “Fast bilateral filtering for the display of high-dynamic-range images,” ACM Transactions on Graphics, vol. 21, no. 3, pp. 257-266, 2002.
• [8] Q. Yang, K. H. Tan, and N. Ahuja, “Real-time bilateral filtering,”

Proc. IEEE Conference on Computer Vision and Pattern Recognition

, pp. 557-564, 2009.
• [9] S. Paris and F. Durand, “A fast approximation of the bilateral filter using a signal processing approach,” Proc. European Conference on Computer Vision, pp. 568-580, 2006.
• [10] K. Sugimoto and S. I. Kamata, “Compressive bilateral filtering,” IEEE Transactions on Image Processing, vol. 24, no. 11, pp. 3357-3369, 2015.
• [11] F. Porikli, “Constant time bilateral filtering,” Proc. IEEE Conference on Computer Vision and Pattern Recognition, pp. 1-8, 2008.
• [12] K. N. Chaudhury, D. Sage, and M. Unser, “Fast bilateral filtering using trigonometric range kernels,” IEEE Transactions on Image Processing, vol. 20, no. 12, pp. 3376-3382, 2011.
• [13] R. Deriche, “Recursively implementing the Gaussian and its derivatives, Research Report, INRIA-00074778, 1993.
• [14] K. N. Chaudhury, “Acceleration of the shiftable algorithm for bilateral filtering and nonlocal means,” IEEE Transactions on Image Processing, vol. 22, no. 4, pp. 1291-1300, 2013.
• [15] J. M. Muller, Elementary Functions: Algorithms and Implementation, Birkhauser Boston, 2006.
• [16] S. An, F. Boussaid, M. Bennamoun, and F. Sohel, “Quantitative error analysis of bilateral filtering,” IEEE Signal Processing Letters, vol. 22, no. 2, pp. 202-206, 2015.
• [17] C. Yang, R. Duraiswami, and N. A. Gumerov, “Improved fast gauss transform,” Technical Report CS-TR-4495, UMIACS, Univ. of Maryland, College Park, 2003.
• [18] M. Mitzenmacher and E. Upfal. Probability and Computing: Randomized Algorithms and Probabilistic Analysis, Cambridge University Press, 2005.
• [19] R. M. Corless, G. H. Gonnet, D. E. Hare, D. J. Jeffrey, and D. E. Knuth, “On the Lambert W function,” Advances in Computational Mathematics, vol. 5, no. 1, pp. 329-359, 1996.
• [20] K. N. Chaudhury and S. Dabhade, Fast and Accurate Bilateral Filtering (www.mathworks.com/matlabcentral/fileexchange/56158), MATLAB Central File Exchange, retrieved March 25, 2016.
• [21]
• [22] B. Weiss, “Fast median and bilateral filtering,” Proc. ACM Siggraph, vol. 25, pp. 519-526, 2006.