HOME

TheInfoList



OR:

A Guided filter is an
edge-preserving smoothing Edge-preserving smoothing or edge-preserving filtering is an image processing technique that smooths away noise or textures while retaining sharp edges. Examples are the median, bilateral, guided, anisotropic diffusion, and Kuwahara filters. I ...
light filter. As with a
bilateral filter A bilateral filter is a non-linear, edge-preserving, and noise-reducing smoothing filter for images. It replaces the intensity of each pixel with a weighted average of intensity values from nearby pixels. This weight can be based on a Gaussian d ...
, it can filter out noise or texture while retaining sharp edges.Guided Image Filtering
/ref>


Comparison

Compared to the bilateral filter, the guided image filter has two advantages: bilateral filters have high
computational complexity In computer science, the computational complexity or simply complexity of an algorithm is the amount of resources required to run it. Particular focus is given to computation time (generally measured by the number of needed elementary operations) ...
, while the guided image filter uses simpler calculations with
linear Linearity is the property of a mathematical relationship (''function'') that can be graphically represented as a straight line. Linearity is closely related to '' proportionality''. Examples in physics include rectilinear motion, the linear r ...
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 I and the filtering output q is linear. Suppose that q is a linear transformation of I in a window \omega_k centered at the pixel k. In order to determine the linear coefficient (a_k, b_k), constraints from the filtering input p are required. The output q is modeled as the input p with unwanted components n, such as noise/textures subtracted. The basic model: (1)  q_i = a_k I_i + b_k, \forall i \in \omega_k (2)  q_ = p_ - n_ in which: : q_ is the i_ output pixel; : p_i is the i_ input pixel; : n_ is the i_ pixel of noise components; : I_i is the i_ guidance image pixel; : (a_k, b_k) are some linear coefficients assumed to be constant in \omega_k. The reason to use a linear combination is that the boundary of an object is related to its
gradient In vector calculus, the gradient of a scalar-valued differentiable function of several variables is the vector field (or vector-valued function) \nabla f whose value at a point p is the "direction and rate of fastest increase". If the gradi ...
. The local linear model ensures that q has an edge only if I has an edge, since \nabla q = a \nabla I. Subtract (1) and (2) to get formula (3);At the same time, define a cost function (4): (3)  n_ = p_ - a_k I_ - b_k (4)  E(a_,b_)=\sum_^((a_I_ + b_ - p_)^ + a_^) in which : \epsilon is a regularization parameter penalizing large a_; : \omega_ is a window centered at the pixel k. And the cost function's solution is: (5)  a_ = \frac (6)  b_ = \bar - a_\mu_ in which : \mu_ and \sigma^_ are the mean and variance of I in \omega_; : \left, \omega\ is the number of pixels in \omega_; : \bar_ = \frac\sum_p_ is the mean of p in \omega_. After obtaining the linear coefficients (a_k, b_k), the filtering output q_i is provided by the following algorithm:


Algorithm

By definition, the algorithm can be written as:


Algorithm 1. Guided Filter

input: filtering input image p ,guidance image I ,window radius r ,regularization \epsilon output: filtering output q 1. mean_ = f_(I) mean_ = f_(p) corr_ = f_(I.*I) corr_ = f_(I.*p) 2. var_ = corr_ - mean_ * mean_ cov_ = corr_ - mean_ * mean_ 3. a = cov_./(var_ + \epsilon) b = mean_ - a. * mean_ 4. mean_ = f_(a) mean_ = f_(b) 5. q = mean_ * I + mean_ f_ is a mean filter with a wide variety of O(N) time methods.


Properties


Edge-preserving filtering

When the guidance image I is the same as the filtering input p. 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 \epsilon of the guided filter. Patches with variance much lower than the parameter \epsilon will be smoothed, and those with variances much higher than \epsilon will be preserved. The role of the range variance \sigma_r^2 in the bilateral filter is similar to \epsilon 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 q = aI + b, it is possible to transfer the structure from the guidance I to the output q. This property enables some special filtering-based applications, such as feathering, matting and dehazing.


Implementations

*
MATLAB MATLAB (an abbreviation of "MATrix LABoratory") is a proprietary multi-paradigm programming language and numeric computing environment developed by MathWorks. MATLAB allows matrix manipulations, plotting of functions and data, implementation ...
*
OpenCV OpenCV (''Open Source Computer Vision Library'') is a library of programming functions mainly aimed at real-time computer vision. Originally developed by Intel, it was later supported by Willow Garage then Itseez (which was later acquired by In ...
*
FFmpeg FFmpeg is a free and open-source software project consisting of a suite of libraries and programs for handling video, audio, and other multimedia files and streams. At its core is the command-line ffmpeg tool itself, designed for processing of vid ...


See also

*
Bilateral filter A bilateral filter is a non-linear, edge-preserving, and noise-reducing smoothing filter for images. It replaces the intensity of each pixel with a weighted average of intensity values from nearby pixels. This weight can be based on a Gaussian d ...


References

{{Reflist Computer graphics Image processing Image noise reduction techniques