Exposure Fusion
Implement exposure fusion to blend multiple exposures without HDR tonemapping, leveraging quality metrics to produce a seamless image. This technique is crucial in HDR Imaging as it allows for the combination of differently exposed images, capturing a wider dynamic range.
Exposure fusion directly blends images using weight maps based on contrast, saturation, and well-exposedness. Each input is an image with 8-bit values (0–255); first scale every image to . Then, for each image and each pixel, with the grayscale value (mean of R, G, B):
- Contrast : the absolute value of the 4-neighbour discrete Laplacian of (sum of the four neighbours minus 4 times the centre; at the border the edge pixels are mirrored), divided by its maximum over the image plus .
- Saturation : the (population) standard deviation across the colour channels.
- Well-exposedness , a Gaussian centred at 0.5 with .
Normalise the weights across the images so they sum to 1 at every pixel (use as the denominator), then blend: , with the same weight applied to all three channels. Clip to , multiply by 255 and convert to 8-bit unsigned integers (truncating). Return an array.
This technique is widely used in digital photography to capture high-contrast scenes.
Example
images = [dark_exposure, medium_exposure, bright_exposure]
Fused image with details from all exposures
- Input:
imagesholds exposures of one scene, each an array of 8-bit values. Simplest case: flat grey frames at 0 (dark), 128 (medium) and 255 (bright), which scale to , and . - Contrast and saturation: a flat frame has no edges, so ; R = G = B, so . Each weight shrinks to ; the offsets stop it collapsing to zero.
- Well-exposedness (): dark , medium , bright .
- Normalise: dividing by their total gives about , , .
- Blend: ; times 255 is , stored as 127 at every pixel of a result.
- Notice: the medium frame dominates, sitting nearest 0.5. In real photos and vary per pixel, so each region borrows from the exposure that shows it best: a fused image with details from all exposures.
Constraints
- images: List of differently exposed images
- Return: Fused image