{
  "id": "enwiki-001258164511",
  "slug": "guided-filter",
  "title": "Guided filter",
  "qid": "",
  "lead": "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.",
  "body": "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.",
  "categories": [
    "20313410",
    "22920081",
    "23034721",
    "23074040",
    "23603337",
    "24043274",
    "26220375",
    "26748027",
    "29379983",
    "31347309"
  ],
  "license": "CC BY-SA 4.0",
  "source_uri": "https://en.wikipedia.org/w/index.php?oldid=1258164511",
  "content_hash": "",
  "created_at": null,
  "updated_at": 1731933323.0,
  "claims": [],
  "contradictions": [],
  "confidence": 0.6,
  "csl": {
    "id": "enwiki-001258164511",
    "type": "webpage",
    "title": "Guided filter",
    "author": [
      {
        "family": "Anticloud FZ LLE",
        "literal": "Anticloud FZ LLE"
      }
    ],
    "container-title": "encyclopegia.org",
    "publisher": "Anticloud FZ LLE",
    "publisher-place": "Dubai, United Arab Emirates",
    "URL": "https://encyclopegia.org/a/guided-filter",
    "issued": {
      "date-parts": [
        [
          2026,
          11,
          21
        ]
      ]
    },
    "accessed": {
      "date-parts": [
        [
          2026,
          11,
          21
        ]
      ]
    },
    "license": "CC BY-SA 4.0",
    "DOI": "eo1:enwiki-001258164511",
    "isBasedOn": "https://en.wikipedia.org/w/index.php?oldid=1258164511",
    "note": "Immutable snapshot enwiki-001258164511"
  }
}