PIXELBANKv9.1.0
Menu

Drago Adaptive Log Mapping

Implement Drago's adaptive logarithmic tone mapping, a technique used in tone mapping to preserve details in high dynamic range images. This method extends traditional logarithmic tone mapping by adapting the base of the logarithm based on local luminance.

The goal is to map high dynamic range images to lower dynamic ranges while preserving details, which is crucial in computational photography. The logarithmic tone mapping approach is based on the idea that human perception of light is logarithmic, and can be represented by the equation Ld=log⁡b(1+L)log⁡b(1+Lmax)L_d = \frac{\log_{b}(1 + L)}{\log_{b}(1 + L_{max})}, where LL is the luminance and bb is the adaptive base.

Here are the key steps:

  1. Compute the luminance LL from the input image.
  2. Determine the maximum luminance LmaxL_{max}.
  3. Calculate the adaptive base bb based on local luminance.
  4. Apply the logarithmic tone mapping using the calculated bb.
Ld=log⁡b(1+L)log⁡b(1+Lmax)L_d = \frac{\log_{b}(1 + L)}{\log_{b}(1 + L_{max})}

This technique is widely used in high dynamic range imaging applications.

Example:

Input:
HDR image
Output:
Tone mapped LDR
Reasoning:

Adaptive log base improves local contrast

Constraints:

  • Input image: 2D numpy array (grayscale or RGB) with shape (height, width) and dtype float32, representing the high dynamic range image
  • Luminance values: in range [0, 1e6], assuming a maximum possible luminance of 1 million
  • Adaptive base calculation: b in range [2, 10], with a minimum and maximum base value to prevent division by zero and ensure meaningful tone mapping
  • Output: return the tone mapped image as a 2D numpy array (grayscale or RGB) with the same shape as the input, and dtype uint8, representing the low dynamic range image
  • Special conditions: assume the input image has at least one pixel with a non-zero luminance value to avoid division by zero in the logarithmic tone mapping equation
🔒

Editor locked

The code editor is locked for Pro problems. It is only available for free problems. Please upgrade to gain access to the code editor for all problems.

solution.py

Test Results

0/0
Run code to see test results.
Drago Adaptive Log Mapping - Hard | PixelBank