PIXELBANKv8.2.1
Menu

Reinhard Global Tone Mapping

MediumHDR

Implement Reinhard's global tone mapping operator to map High Dynamic Range (HDR) images to a displayable range while preserving local contrast. This technique is crucial in Computational Photography as it enables the display of HDR images on standard devices.

The concept of tone mapping is based on the idea of compressing the dynamic range of an image, which is the ratio of the brightest and darkest areas, to fit within the limited range of a display device. Tone mapping operators like Reinhard's apply a non-linear transformation to the image's luminance values, preventing saturation and preserving details. The transformation involves calculating the log-average luminance of the image, which represents the average brightness, and then scaling the luminance values based on a key value that controls the overall brightness.

To achieve this, the following steps are involved:

  1. Calculate the luminance of each pixel in the HDR image.
  2. Compute the log-average luminance of the image.
  3. Scale the luminance values based on the key value and log-average luminance.
  4. Apply the Reinhard compression function to the scaled luminance values.
Ld=L1+LL_d = \frac{L}{1 + L}

This technique is widely used in image and video processing applications.

Example:

Input:
hdr = HDR image with values > 1.0
key = 0.18
Output:
LDR image with values in [0, 1]
Reasoning:
  1. Compute luminance from RGB
  2. Calculate log-average luminance
  3. Scale by key/log_avg
  4. Apply L/(1+L) compression
  5. Reconstruct color

Constraints:

  • hdr: HDR image (H, W, 3)
  • key: Key value for exposure adjustment
  • Return: Tone-mapped LDR image
Editor

Test Results

0/0
Run code to see test results.