1
$\begingroup$

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.

$\endgroup$
0
2
$\begingroup$

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.

$\endgroup$
1
$\begingroup$

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} }$$.

$\endgroup$
2
  • 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$ Given a system with the input output relation $y[n] = T\{x[n]\}$, then if $$T\{ a x_1[n] + b x_2[n] \} = a T\{x_1[n]\} + b T\{x_2[n] \} $$ holds for arbitary (complex) $a,b \neq 0$ and $x_1[n],x_2[n]$, then the systen is said to be linear, otherwise non linear. Now consider the system defined by $$y[n] = e^{(x[n]-x[n-1])^2}$$ can you show that this system cannot pass the linearity test (hence it's a nonlinear system)? $\endgroup$
    – Fat32
    Apr 9 '19 at 20:47

Your Answer

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