Edge-preserving smoothing image filter
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.
Comparison.
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.
One key assumption of the guided filter is that the relation between guidance formula_1 and the filtering output formula_2 is linear. Suppose that formula_2 is a linear transformation of formula_1 in a window formula_5 centered at the pixel formula_6.
In order to determine the linear coefficient formula_7, constraints from the filtering input formula_8 are required. The output formula_2 is modeled as the input formula_8 with unwanted components formula_11, such as noise/textures subtracted.
The basic model：
(1)　　formula_12
(2)　　formula_13
in which:
 formula_14 is the formula_15 output pixel;
 formula_16 is the formula_15 input pixel;
 formula_18 is the formula_15 pixel of noise components;
 formula_20 is the formula_15 guidance image pixel;
 formula_7 are some linear coefficients assumed to be constant in formula_5.
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 formula_2 has an edge only if formula_1 has an edge, since formula_26.
Subtract (1) and (2) to get formula (3)；At the same time, define a cost function (4)：
(3)　　formula_27
(4)　　formula_28
in which 
 formula_29 is a regularization parameter penalizing large formula_30;
 formula_31 is a window centered at the pixel formula_6.
And the cost function's solution is：
(5)　　formula_33
(6)　　formula_34
in which
 formula_35 and formula_36 are the mean and variance of formula_1 in formula_31;
 formula_39 is the number of pixels in formula_31;
 formula_41 is the mean of formula_8 in formula_31.
After obtaining the linear coefficients formula_7, the filtering output formula_45 is provided by the following algorithm:
Algorithm.
By definition, the algorithm can be written as:
Algorithm 1. Guided Filter.
input： filtering input image formula_8 ，guidance image formula_1 ，window radius formula_48 ，regularization formula_29
output： filtering output formula_2
1.
 formula_51 = formula_52
 formula_53 = formula_54
 formula_55 = formula_56
 formula_57 = formula_58
2.
 formula_59 = formula_60
 formula_61 = formula_62
3.
 formula_63 = formula_64
 formula_65 = formula_66
4.
 formula_67 = formula_68
 formula_69 = formula_70
5.
 formula_2 = formula_72
formula_73 is a mean filter with a wide variety of O(N) time methods.
Properties.
Edge-preserving filtering.
When the guidance image formula_1 is the same as the filtering input formula_8. 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 formula_29 of the guided filter. Patches with variance much lower than the parameter formula_29 will be smoothed, and those with variances much higher than formula_29 will be preserved. The role of the range variance formula_79 in the bilateral filter is similar to formula_29 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.
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.
Due to the local linear model of formula_81, it is possible to transfer the structure from the guidance formula_1 to the output formula_2. This property enables some special filtering-based applications, such as feathering, matting and dehazing.
References.
 ;templatestyles src="Reflist/styles.css" / ;