ch High Dynamic Range

Introduction

The objective of this high dynamic range algorithm is to combine multiple exposures of the same scene to create an image that captures details from the full range of radiance values. This is important because it allows with a single exposure, there may be areas in a photograph that are too bright (overexposed) or too dark (underexposed). This is especially relevant in photographs that have both indoor and outdoor components. However, by combining the whole range of data from multiple exposures, we can create an image that has better detail in all areas than is physically possible with any one exposure. This algorithm can be split into two sections: 1) recovering the high dynamic range radiance map and 2) tone mapping the radiance map into a displayable image.


Radiance Map Construction Algorithm

The following steps describe using tone mapping to turn a high dynamic range radiance map from the previously described algorithm to a displayable image. This technique is based on (Debevec, Malik 1997). .

  1. Calculate the discrete inverse response function g for each color channel
  2. A function must be found that maps input exposure pixel values to radiance values. The following equation from (Debevec, Malik 1997) is used for this calculation, where g is the unknown response function, w is a parameterized weighting function, t is the exposure time, E is the unknown radiance, i is the pixel index, j is the exposure index, and P is the total number of exposures.

    Using this equation, a system of linear equations is created with a random sampling of points (one equation for each pixel coordinate). In addition, additional linear constraints are placed on the second derivative of g to make g a smooth function. Finally, the last constraint is added to our linear system of equations is fixing g(Zmid) = 0 in order to force our solution to scale around this point.

    This process is repeated to discover g for each color channel. The following figure shows the plotted g calculated from the input exposure images.

    Input exposures

    Response functions for red, green, blue channels

    One thing that I noticed was that the correlation between the red, green, and blue curves seems to affect how good the final result looked. A higher correlation between these curves appears to produce more realistic colors and less color spot artifacts.

  3. Create radiance map using response functions
  4. Once the response functions are known for each color channel, we can simply plug in our exposure values to generate a radiance map. The following image shows the radiance map (scaled for visualization) recovered from the input exposure images in the previous step.

    Radiance map


Tone Mapping Algorithm

The following steps describe local tone mapping a high dynamic range radiance map into a displayable range. This technique is based on (Durand 1997).

  1. Find the log intensity, L, of the input radiance map
  2. The intensity of the input radiance map is found by using a luminance function. The base 2 logarithm of the intensity is then found.

  3. Seperate L into a base layer, B, and a detail layer, D, using a bilateral filter
  4. This seperation is done so that the contrast can be lowered on the base layer while still preserving the detail layer. The bilateral filter returns the base layer, B so that the detail layer can be computed using D = L - B. The detail and base layers are shown below.

    Base layer (left) vs. Detail layer (right)

  5. Scale the base layer
  6. The base layer is then scaled using the following equation to lower the contrast. A dynamic range value, dR of 4 is used.

    B = (B - max(B)) * dR / (max(B) - min(B))

  7. Combine the base and detail layers and restore color channels
  8. The base and detail layers are linearly combined and the base 2 logarithm is reversed by raising the combined image to the power of 2. The color channels are then restored by multiplying the image to the chrominance channels of the input radiance image. The result is the tone mapped image, T.

    T = 2^(B+D) * (input_radiance_map / I)

  9. Gamma compression
  10. Finally, the tone mapped image, T, is then further modified with a parameterized gamma compression.

    T = T^(gamma)

    The final tone mapping result compared with the original input exposures is shown below. Details from all three exposures are preserved to create a photograph that normally wouldn't be possible.

    Input exposures

    Tone Mapping



Results

The following results show the local tone mapping of the default data set compared to a simple global tone mapping operator: 1/(1 + input_radiance_map).

Simple global tone mapping (left) vs. Our local tone mapping (right)

Simple global tone mapping (left) vs. Our local tone mapping (right)

Simple global tone mapping (left) vs. Our local tone mapping (right)

Simple global tone mapping (left) vs. Our local tone mapping (right)

Simple global tone mapping (left) vs. Our local tone mapping (right)

Simple global tone mapping (left) vs. Our local tone mapping (right)

Simple global tone mapping (left) vs. Our local tone mapping (right)

Simple global tone mapping (left) vs. Our local tone mapping (right)