Fast Guided Filter

Kaiming He, Jian Sun

Introduction

Edge-preserving filters are essential tools in modern image processing, enabling tasks ranging from noise reduction to detail enhancement. The original Guided Filter (GF) represented a significant advancement due to its $O(N)$ computational complexity, which is independent of the filter's kernel size. However, as mobile photography entered the "mega-pixel" era, even linear complexity became a bottleneck for real-time applications on smartphones. This paper introduces the Fast Guided Filter, a production-ready optimization that achieves a >10× speedup with virtually no visible loss in image quality, reducing complexity from $O(N)$ to $O(N/s^2)$.

The Fast Guided Filter Algorithm

The standard Guided Filter assumes a local linear relationship between a guidance image $I$ and the output $q$: $q_i = a_k I_i + b_k$. The "Fast" version introduces a subsampling ratio $s$ to accelerate the computation of the linear coefficients $a$ and $b$.

Methodology

  1. Subsampling: The guidance image $I$ and the filtering input $p$ are downsampled by a factor of $s$ using nearest-neighbor or bilinear interpolation.
  2. Low-Res Computation: The local linear coefficients ($a$ and $b$) are computed at this lower resolution. This step involves several "box filters" (mean filters), which are the most computationally expensive part of the original algorithm.
  3. Upsampling: The resulting coefficient maps, $\bar{a}$ and $\bar{b}$, are bilinearly upsampled back to the original image size.
  4. Full-Res Guidance: The final output is generated by applying these upsampled coefficients to the original, full-resolution guidance image: $q = \bar{a}I + \bar{b}$.

The "Carrier" Principle

The core insight of this method is that the guidance image $I$ acts as a high-frequency carrier. Because the coefficients $a$ and $b$ are inherently spatially smooth, they can be computed at a lower resolution (the "envelope") without losing significant information. High-frequency details are "re-injected" in the final step by the full-resolution guidance image, ensuring the output remains sharp.

Applications and Performance

The Fast Guided Filter was evaluated across several common image processing tasks, including edge-preserving smoothing, detail enhancement, and denoising. In both MATLAB and optimized C++ implementations, a subsampling ratio of $s=4$ resulted in a speedup of over 10×.

Figure 1: Comparison of edge-preserving smoothing on a cat image using the original GF and the Fast GF (s=4).

As shown in Figure 1, the visual results of the Fast GF are indistinguishable from the original $O(N)$ version. This fidelity holds true for more complex tasks like detail enhancement, where the algorithm successfully boosts local contrast without introducing artifacts.

Comparison of smoothing (top) and detail enhancement (bottom) on a tulip image, demonstrating the visual equivalence of the Fast GF.

Conclusion and Future Work

The Fast Guided Filter provides a simple yet powerful way to make high-quality edge-preserving filtering viable for real-time consumer products. While the paper suggests $s=4$ as a safe default, future work could explore the theoretical limits of subsampling before aliasing occurs in the coefficient maps. Additionally, further performance gains could be realized through hardware-specific optimizations on GPUs or DSPs, potentially enabling even more complex real-time computer vision pipelines.

Summary updated

BibTeX
@misc{he2015fast,
  author = {Kaiming He and Jian Sun},
  title = {{Fast Guided Filter}},
  year = {2015},
  eprint = {1505.00996},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1505.00996},
}
Figure