I have a source (that I can't share) that states that bilateral filtering isn't shift-invariant (that is, it depends on the input signal), hence we cannot use convolution and the Fourier convolution theorem (that is, convolution is the spatial domain corresponds to multiplication in the spectral one).

Why isn't bilateral filtering shift-invariant? Why exactly can't we apply convolution and the convolution theorem to the bilateral filtering of an image? Why wouldn't a Gaussian filter also be signal dependent?

I understood that bilateral filtering combines domain and range filtering, that is, when updating a pixel of an image, it weights the contribution of other pixels in the image using both their Euclidean distance (to the pixel being updated) and their intensity (in case of grayscale) value. However, I don't get why we couldn't also use the convolution theorem to filter an image using BF.


The bileateral filter (as defined in the wiki page ) is non-linear, hence, is not an LTI system; therefore does not have an impulse response and thus convolution cannot be used to compute its output... (note: for its shift invariance property look at the other answer given by @OlliNiemitalo)

To mathematically illustrate its nonlinearity, a very primitive 1-D prototype filter that has the bilateral filter property (according to wiki page definition above) can be defined as (with Gaussian range and spatial kernels) :

$$y[n] = \sum_{k=n-1}^{n+1} x[k] \cdot e^{- \frac{(n-k)^2}{2\sigma_d^2} } \cdot e^{- \frac{(x[n]-x[k])^2}{2\sigma_r^2} } $$

which is has a non linear input / output relationship due to the term $$e^{- \frac{(x[n]-x[k])^2}{2\sigma_r^2} }$$.

  • $\begingroup$ Is convolution only applied to (defined for) LTI? $\endgroup$ – nbro Apr 7 '19 at 22:01
  • $\begingroup$ @nbro in the context of signal processing, only LTI systems output can be computed by a convolution. For nonlinear systems, there is no impulse response and hence the convolution integral / sum can not be applied. $\endgroup$ – Fat32 Apr 7 '19 at 22:10
  • $\begingroup$ But then why can we apply the convolution theorem to the Gaussian low-pass filter? $\endgroup$ – nbro Apr 7 '19 at 22:12
  • 1
    $\begingroup$ The name Gaussian shall not decieve. The Gaussian lowpass filter is by definition an LTI system with an impulse response function of a Gaussian pulse, similar to : $h[n] = e^{- n^2 / \sigma^2}$. So its input output relation is like : $$y[n] = \sum_{k} x[k] e^{ (n-k)^2 / \sigma^2 }$$ which defines a linear shift invariant system $\endgroup$ – Fat32 Apr 7 '19 at 22:26
  • $\begingroup$ Why is the term $e^{- \frac{(x[n]-x[k])^2}{2\sigma_r^2} }$ and not $e^{- \frac{(n-k)^2}{2\sigma_d^2} }$ that makes the filter non-linear? $\endgroup$ – nbro Apr 9 '19 at 13:07

The bilateral filter can be written as:

$$y[i, j] = \frac{\displaystyle\sum_{k,l\in \mathbb Z^2}x[i+k, j+l]\,f\Big(x[i+k,j+l] - x[i,j]\Big)\,g\Big(k^2+l^2\Big)}{\displaystyle\sum_{k,l\in \mathbb Z^2}f\Big(x[i+k,j+l] - x[i,j]\Big)\,g\Big(k^2+l^2\Big)}\tag{1}$$

Shift invariance can be defined as any shift $m,n$ of the input $x$ resulting in the corresponding shift in the output $y$:

$$x[i,j] \to x[i-m,j-n]\quad\Rightarrow\quad y[i,j]\to y[i-m,j-n].\tag{2}$$

By doing the first substitution on all occcurrences of $x$ on the right side of Eq. 1 we get as the output:

$$\begin{gather}\frac{\displaystyle\sum_{k,l\in \mathbb Z^2}x[i+k-m, j+l-n]\,f\Big(x[i+k-m,j+l-n] - x[i-m,j-n]\Big)\,g\Big(k^2+l^2\Big)}{\displaystyle\sum_{k,l\in \mathbb Z^2}f\Big(x[i+k-m,j+l-n] - x[i-m,j-n]\Big)\,g\Big(k^2+l^2\Big)}\\ =\frac{\displaystyle\sum_{k,l\in \mathbb Z^2}x[i-m+k, j-n+l]\,f\Big(x[i-m+k,j-n+l] - x[i-m,j-n]\Big)\,g\Big(k^2+l^2\Big)}{\displaystyle\sum_{k,l\in \mathbb Z^2}f\Big(x[i-m+k,j-n+l] - x[i-m,j-n]\Big)\,g\Big(k^2+l^2\Big)},\end{gather}\tag{3}$$

where we can recognize $i-m$ and $j-n$ as $i$ and $j$ of Eq. 1, so we have:

$$= y[i-m, j-n],\tag{4}$$

showing that the bilateral filter is shift-invariant.

However, these are shifts with integer $m$ and $n$. The non-linearity of the bilateral filter will make it not invariant to fractional shifts carried out by (sinc) interpolation. Perhaps this is what your source was referring to.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.