Guided filter

from Wikipedia, the free encyclopedia

A guided filter (English Guided filter) is in the image processing applied filter . It smooths, but preserves edges.

principle

The guided filter uses a mask image in addition to an input image to smooth the input image. The mask image should have edges similar to the input image. The input image can also act as a mask at the same time.

The output image is calculated as follows:

Where:

  • - The mask image at the pixel .
  • - The output image at the pixel .
  • - A factor to be calculated at the point that is multiplied by the mask image.
  • - A factor to be calculated at the point that is added to the values ​​of the input image.

and are calculated from the input image and the mask image at each pixel as follows:

For this purpose, the calculation is covariance between the mask image (here ) and input image (here )

and the variance of the mask image

necessary at every pixel.

is a quadratic mean value filter at the point , the size of which is a freely selectable parameter.

is a freely selectable parameter that defines the distinction between flat spots and edge areas.

Behavior of the parameters:

  • Dominates on flat spots while is small
  • Dominates on edges while is small

example

advantages

  • The filter has a linear complexity since the square filter kernel of the mean value can be calculated using offset sums. It is much less complex than the bilateral filter .
  • The result is smooth, but edge-retaining images.

Web links

Example implementation in Python

Individual evidence

  1. Kaiming He, Jian Sun, Xiaoou Tang: Guided Image Filtering . 2010 ( kaiminghe.com [PDF]).