Skip to content

Guided filtering

Use a guidance image to decide how a local linear model should smooth another image.

Try it on your image ↓

VISUAL WALKTHROUGHFiltering
REFERENCE INPUTNoisy or uneven image

The same scene stays here while the working view changes.

RESULTApply the rule at every pixel

The whole image has now been processed. The highlighted input value 156 becomes 159.6.

STEP 03 / 03

Average overlapping local predictions.

Computed teaching example on a 24 × 16 image. Small kernels and simplified settings keep each change visible; use the image laboratory for native OpenCV.

Try it on an image

YOUR IMAGE · REAL OPENCV

Experiment at pixel level

Open full lab ↗

Use the colour image as its own guide for edge-preserving filtering.

The engine loads on your first run. Your images stay in this browser.

Input448 × 320
OutputWaiting for a result

Scroll over either image to zoom at the pointer. Use the scrollbars to pan both views over the same relative area. Zoom is relative to the input; pixel coordinates belong to each image. Warps can change scene correspondence.

Pixel inspector RGBA · native values · matched scale · 9 × 9 output pixels
Hover to inspect. Click to pin a pixel.
Input
Select a pixel

Output
Select a pixel

Sample models and licenses

When to use it

Refine masks, smooth depth or transfer edge structure from a cleaner guide.

How it works

  1. 01Fit a local linear relationship between guide and filtered signal.
  2. 02Regularize the model to avoid unstable fits.
  3. 03Average overlapping local predictions.

output ≈ a · guide + b within each local window

What to tune

radius sets local support; eps controls edge sensitivity relative to the guide’s value scale.

Where it breaks down

Guide texture can be transferred into the output. The guide and input must be geometrically aligned.

TypeScript API

Open an entry for its exact overloads, parameter descriptions, result ownership and pinned upstream source.

All of these calls execute on the CPU. Native objects need explicit disposal. See matrices and ownership and build compatibility.