Guided filter
≈ 3 min read
Names in other languages
No names in other languages are held for this entry yet.
Article bodies are English and are not machine-translated. A name in another language is not a translation of the article.
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.
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) q_i = a_k I_i + b_k, \forall i \in \omega_k (2) q_{i} = p_{i} - n_{i} in which: q_{i} is the i_{th} output pixel; p_i is the i_{th} input pixel; n_{i} is the i_{th} pixel of noise components; I_i is the i_{th} 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. 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_{i} = p_{i} - a_k I_{i} - b_k (4) E(a_{k},b_{k})=\sum_{i{\epsilon}{\omega}_{k}}^{}((a_{k}I_{i} + b_{k} - p_{i})^{2} + {\epsilon}a_{k}^{2}) in which \epsilon is a regularization parameter penalizing large a_{k} ; \omega_{k} is a window centered at the pixel k . And the cost function's solution is: (5) a_{k} = \frac{\frac{1}{\left|\omega\right|}\sum_{i\epsilon\omega_{k}}I_{i}p_{i} - \mu_{k}\bar{p_{k}}}{\sigma^{2}_{k}+\epsilon} (6) b_{k} = \bar{p_{k}} - a_{k}\mu_{k} in which \mu_{k} and \sigma^{2}_{k} are the mean and variance of I in \omega_{k} ; \left|\omega\right| is the number of pixels in \omega_{k} ; \bar{p}_{k} = \frac{1}{\left|\omega\right|}\sum_{i\epsilon\omega_{k}}p_{i} is the mean of p in \omega_{k} . After obtaining the linear coefficients (a_k, b_k) , the filtering output q_i is provided by the following algorithm: mean_{I} = f_{mean}(I) mean_{p} = f_{mean}(p) corr_{I} = f_{mean}(I.*I) corr_{Ip} = f_{mean}(I.*p) 2. var_{I} = corr_{I} - mean_{I.} * mean_{I} cov_{Ip} = corr_{Ip} - mean_{I.} * mean_{p} 3. a = cov_{Ip}./(var_{I} + \epsilon) b = mean_{p} - a. * mean_{I} 4. mean_{a} = f_{mean}(a) mean_{b} = f_{mean}(b) 5. q = mean_{a.} * I + mean_{b} f_{mean} is a mean filter with a wide variety of O(N) time methods. 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.
Text derived from https://en.wikipedia.org/w/index.php?oldid=1258164511 under CC BY-SA 4.0; modifications have been made.