Every filter so far only trusted nearby pixels. Non-Local Means throws that rule away — it searches the whole neighbourhood for patches that look like the one you're denoising, wherever they are, and averages those. Repetition anywhere in the image becomes ammunition against noise.
Click anywhere on the image to see which patches NLM found as "twins" for that spot — glowing lines will point to every match, with brighter = higher trust. A bar chart below ranks them.
Noise at any pixel is an independent random number — no relationship to noise anywhere else. But real image texture (brick, fabric, skin, grass) repeats constantly. If you find 20 patches that share the same underlying texture, their noise mostly cancels when averaged, while the shared texture survives.
NLM compares whole small patches (e.g. 5×5), not single pixels — a single noisy pixel is unreliable, but a 25-pixel patch has enough signal to say "this looks like that" with confidence. The comparison itself is done with a Gaussian-weighted sum of squared differences between the two patches.
Checking every candidate patch in a search window is far more expensive than Gaussian or bilateral's local-only search — that's why real implementations (including OpenCV's fastNlMeansDenoising) use optimised C++ and still run slower than simpler filters. Worth it when quality matters more than speed: astrophotography, forensics, old-photo restoration.
You have a noisy photo of a brick wall (lots of repeating texture) and a noisy photo of a single person's face on a plain background (very little repetition). Non-Local Means will help more on which one?