Guided filter

From Wikipedia, the free encyclopedia


Guided filter is a kind of edge-preserving smoothing filter. Same as bilateral filter, this image filter can also filter out noise or texture while retaining sharp edges.[1]

Unlike the bilateral filter, the guided image filter has two advantages: first, Bilateral filters have very high computational complexity, but the guided image filter does not use too complicated mathematical calculations which has linear computational complexity. Furthermore, due to the mathematical model, bilateral filters sometimes have unwanted artifacts and cause image distortion. While the guided image filter, since the filter is mathematically based on linear combination, the output image must be consistent with the gradient direction of the guidance image, and the problem of gradient reversal does not occur.

Definition[]

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. Model the output as the input subtract some unwanted components , such as noise/textures.

The following is the basic model of the guided image filter:

(1)  

(2)  

In the above formula:

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 define as 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 the above formula:

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

And the cost function's solution is given by:

(5)  

(6)  

In the above formula:

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

After obtaining the linear coefficients , we can calculate the filtering output by (1)

Algorithm[]

By definition, the algorithm can be written as:

Algorithm 1. Guided Filter

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[]

  • Edge-Preserving Filtering

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

Specifically, one can define what is a “flat patch” or a “high variance patch” by the parameter of the guided filter. Those 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 “where are the edge/a high variance patches that should be kept. what is noise/flat patch that should be smoothed.”

  • Gradient-Preserving Filtering

When using the bilateral filter to filter an image, some artifacts may appear on the edges. This is because the pixel value abrupt change on the edge. These artifacts are inherent and hard to avoid, because edges usually 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

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[]

  • Guided filter is included in the official MATLAB[2]
  • Guided filter is included in the official OpenCV[3]

See also[]

References[]

  1. ^ Guided Image Filtering
  2. ^ "Guided filtering of images - MATLAB imguidedfilter".
  3. ^ "OpenCV: Filters".
Retrieved from ""