Non-local means denoising
Average pixels whose surrounding patches look similar, even when they are not immediate neighbours.
The same scene stays here while the working view changes.
The orange 3 × 3 window surrounds one output location. A 7 × 7 search compares 3 × 3 patches. Similar neighbourhoods contribute more than visually different patches.
A 7 × 7 search compares 3 × 3 patches. Similar neighbourhoods contribute more than visually different patches. One output value is 156.2; the window then moves across the image.
The whole image has now been processed. The highlighted input value 156 becomes 156.2.
Average corresponding pixel values using those weights.
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
Denoise the colour image by comparing similar patches.
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
Reduce image noise while preserving recurring texture and structures.
How it works
- 01Compare the patch around a pixel with nearby candidate patches.
- 02Convert patch similarity into weights.
- 03Average corresponding pixel values using those weights.
weight depends on patch similarity, not only pixel distance
What to tune
h controls filtering strength; templateWindowSize sets patch size; searchWindowSize sets the candidate region.
Where it breaks down
Strong filtering can make textures waxy. Larger search windows cost more, and multi-frame variants depend on temporal consistency.
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
Image inpainting
Fill a masked region by propagating nearby image structure and colour into it.
Seamless cloning
Blend a region by solving for pixel values that fit selected image gradients and boundary conditions.
HDR merging and tone mapping
Combine exposure information or fuse well-exposed regions, then map the result into a displayable range.
Panorama stitching
Combine overlapping images through matching, camera estimation, warping and blending.