A Bilateral Image Filter is a non-linear, edge-preserving smoothing filter that is commonly used in Computer Vision as a simple noise-reduction stage in a pipeline. It calculates the intensity of each output pixel as a weighted average of intensity values from nearby pixels in the input image. Crucially, the weights depend not only on the Euclidean distance between current and neighbor pixels, but also on the radiometric differences (e.g., color intensity differences) between them. The outcome is that edges are preserved while regions with similar intensities are smoothed out.
Input | Parameters | Output |
---|---|---|
![]() | \begin{align*} \mathit{kernelSize} &= 7x7 \\ \sigma_s &= 1.7 \\ \sigma_r &= 50 \end{align*} | ![]() |
The bilateral image filter is defined as:
\[ I'(p) = \frac{1}{W_p} \sum_{q\in\Omega}I(p)k_r(\|I(q) - I(p)\|)k_s(\|p-q\|) \]
and the normalization term, W, is defined as:
\[ W_p = \sum_{q\in\Omega}k_r(\|I(p)-I(q)\|)k_s(\|p-q\|) \]
where
\begin{align*} k_r(p) &= e^{-\frac{\|p\|^2}{2\sigma_r^2}} \\ k_s(p) &= e^{-\frac{\|p\|^2}{2\sigma_s^2}} \end{align*}
Constraints for specific backends supersede the ones specified for all backends.