Real-time Bilateral Filtering

Many users have become accustomed to reducing wrinkles, freckles, and various blemishes from human subjects for a more visually appealing image or video. This can be achieved by applying an edge-preserving filtering called bilateral filter. However, a vanilla bilateral filter typically has a high computational cost necessitating a powerful CPU / GPU to process images in real-time. So I had been looking for an efficient alternative algorithm, and finally found

Qingxiong Yang. Recursive bilateral filtering. European Conference on Computer Vision 2012.

that can achieve a good trade-off.

I made a lightweight C++ library for this algorithm, and obtained the following results (RecursiveBF):

Original Image RecursiveBF (18ms)
Original Image RecursiveBF (18ms)
Gaussian Blur OpenCV's BF (896ms)
Gaussian Blur OpenCV’s BF (896ms)

The algorithm is pretty fast compared with most edge-preserving filtering methods

  • computational complexity is linear in both input size and dimensionality:
  • takes about 43 ms to process a one megapixel color image (i7 1.8GHz & 4GB mem)
  • about 18x faster than Fast high-dimensional filtering using the permutohedral lattice
  • about 86x faster than Gaussian kd-trees for fast high-dimensional filtering

For more details of the algorithm, please refer to the original paper.