Guided filtering
Use a guidance image to decide how a local linear model should smooth another image.
The same scene stays here while the working view changes.
The orange 3 × 3 window surrounds one output location. The clean scene is the guide in this example. Local fits follow its boundaries while smoothing noise in the input.
The clean scene is the guide in this example. Local fits follow its boundaries while smoothing noise in the input. One output value is 159.6; the window then moves across the image.
The whole image has now been processed. The highlighted input value 156 becomes 159.6.
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
Experiment at pixel level
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.
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
Select a pixel
Select a pixel
When to use it
Refine masks, smooth depth or transfer edge structure from a cleaner guide.
How it works
- 01Fit a local linear relationship between guide and filtered signal.
- 02Regularize the model to avoid unstable fits.
- 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.
Related methods
Gaussian blur
Replace each pixel with a weighted average that gives nearby pixels more influence.
Box filtering
Average a rectangular neighbourhood with equal weight at every position.
Median filtering
Choose the middle value of a pixel neighbourhood instead of averaging its intensities.
Bilateral filtering
Smooth nearby pixels only when their colours are also similar.