A guided filter is an edge-preserving smoothing image filter. As with a bilateral filter, it can filter out noise or texture while retaining sharp edges.[1][2]

Comparison

edit

Compared to the bilateral filter, the guided image filter has two advantages: bilateral filters have high computational complexity, while the guided image filter uses simpler calculations with linear computational complexity. Bilateral filters sometimes include unwanted gradient reversal artifacts and cause image distortion. The guided image filter is based on linear combination, making the output image consistent with the gradient direction of the guidance image, preventing gradient reversal.

Definition

edit

One key assumption of the guided filter is that the relation between guidance   and the filtering output   is linear. Suppose that   is a linear transformation of   in a window   centered at the pixel  .

In order to determine the linear coefficient  , constraints from the filtering input   are required. The output   is modeled as the input   with unwanted components  , such as noise/textures subtracted.

The basic model:

(1)   

(2)   

in which:

  is the   output pixel;
  is the   input pixel;
  is the   pixel of noise components;
  is the   guidance image pixel;
  are some linear coefficients assumed to be constant in  .

The reason to use a linear combination is that the boundary of an object is related to its gradient. The local linear model ensures that   has an edge only if   has an edge, since  .

Subtract (1) and (2) to get formula (3);At the same time, define a cost function (4):

(3)   

(4)   

in which

  is a regularization parameter penalizing large  ;
  is a window centered at the pixel  .

And the cost function's solution is:

(5)   

(6)   

in which

  and   are the mean and variance of   in  ;
  is the number of pixels in  ;
  is the mean of   in  .

After obtaining the linear coefficients  , the filtering output   is provided by the following algorithm:

Algorithm

edit

By definition, the algorithm can be written as:

Algorithm 1. Guided Filter

edit

input: filtering input image   ,guidance image   ,window radius   ,regularization  

output: filtering output  

1.

  =  
  =  
  =  
  =  

2.

  =  
  =  

3.

  =  
  =  

4.

  =  
  =  

5.

  =  

  is a mean filter with a wide variety of O(N) time methods.

Properties

edit

Edge-preserving filtering

edit

When the guidance image   is the same as the filtering input  . The guided filter removes noise in the input image while preserving clear edges.

Specifically, a “flat patch” or a “high variance patch” can be specified by the parameter   of the guided filter. Patches with variance much lower than the parameter   will be smoothed, and those with variances much higher than   will be preserved. The role of the range variance   in the bilateral filter is similar to   in the guided filter. Both of them define the edge/high variance patches that should be kept and noise/flat patches that should be smoothed.”

Gradient-preserving filtering

edit

When using the bilateral filter to filter an image, artifacts may appear on the edges. This is because of the pixel value's abrupt change on the edge. These artifacts are inherent and hard to avoid, because edges appear in all kinds of pictures.

The guided filter performs better in avoiding gradient reversal. Moreover, in some cases, it can be ensured that gradient reversal does not occur.

Structure-transferring filtering

edit

Due to the local linear model of  , it is possible to transfer the structure from the guidance   to the output  . This property enables some special filtering-based applications, such as feathering, matting and dehazing.

Implementations

edit

See also

edit

References

edit
  1. ^ He, Kaiming; Sun, Jian; Tang, Xiaoou (2013). "Guided Image Filtering". IEEE Transactions on Pattern Analysis and Machine Intelligence. 35 (6): 1397–1409. doi:10.1109/TPAMI.2012.213. PMID 23599054.
  2. ^ Guided Image Filtering
  3. ^ "Guided filtering of images - MATLAB imguidedfilter".
  4. ^ "OpenCV: Filters".
  5. ^ "FFmpeg Filters Documentation".