Image denoising (Non-Local Means) — computer vision in the browser

Non-Local Means denoising cleans a grainy photo by averaging similar patches from across the image, so it removes noise while keeping edges and texture. A common computer-vision pre-processing step. This fetches a real low-light photo and runs cv2.fastNlMeansDenoisingColored. Run it live.

Image denoising (Non-Local Means) — example output

Example code (Python / OpenCV)

"""
Image denoising (Non-Local Means)

Non-Local Means denoising cleans a grainy photo by averaging similar patches from across the image, so it removes noise while keeping edges and texture. A common computer-vision pre-processing step. This fetches a real low-light photo and runs cv2.fastNlMeansDenoisingColored. Run it live.
"""

import cv2
import requests
import numpy as np

# A real photo, fetched live from the web — nothing is uploaded
url = "https://images.unsplash.com/photo-1506863530036-1efeddceb993?w=480&q=70"
# no-cache: always fetch a fresh copy so a stale browser-cache entry can't break decoding
resp = requests.get(url, headers={"Cache-Control": "no-cache"})
img = cv2.imdecode(np.frombuffer(resp.content, np.uint8), cv2.IMREAD_COLOR)

cv2.imshow("original", img)

# Non-Local Means denoising — removes grain while keeping detail (slower)
den = cv2.fastNlMeansDenoisingColored(img, None, 10, 10, 7, 21)   # raise 10 for stronger
cv2.imshow("denoised", den)

More computer-vision techniques →