Overview

Humans, by nature, can gather detail from scenes with extremely varying illuminations and light patterns. Cameras, on the other hand, do not have sugh a large dynamic range. In order to duplicate the vivid detail our eyes can see in a photograph, we must take multiple exposure images and combine them to create a single high dynamic range photograph.

There are two parts to creating a HDR image: the radiance map must be obtained, and then that radiance map needs to be converted into a viewable image. To accomplish the first task, we retreived the inverse of the function mapping exposure to pixel value. For the second, we used local and global tone mapping to create a displayable image.

Algorithm

The pixel value in an image Zij (i is the pixel in image j), is the result of a function of unknown scene radiance and a known exposure: Zij = f(Ei Δtj ), where Ei is the unknown radiance. We didn't solve for f, but rather for g=ln(f-1). This g function maps pixel values (0:255) to the log of the exposure values: g(Zij = ln(Ei) + ln(tj ). Now, if you've been following along, you'll see that we have four variables: two knowns (Zij, ln(tj ) ), and two unknowns (g and ln(Ei ) ). However, the scene is static so we know that Ei remains constant throughout the image sequence.

An ddditional consideration we took into account was keeping g smooth by adding a penalty accodring to the magnitude of the second derivative: g''(x) = g(x-1) + g(x+1) - 2×g(x).

In order to use the robust systems Matlab already has in place, we simply made a matrix system of equations for Matlab to solve:

Tone Mapping

In order to display the image, we need to implement a local tone-mapping algorithm. We used a version of the algorithm presented in Durand 2002. The steps as follows:

1. Input is the RGB values of radiance
2. Compute the intensity (I). I used a weighted average: 1/61*(R*20 + G*40 + B)
3. Compute the chrominance channels: R/I, G/I, B/I
4. Compute the log of the intensity: L = log2(I)
5. Aplly bilateral filter: B = bf(L)
6. Compute the detail layer: D = L-B
7. Apply an offset and a scale to the base: B' = (B-o)*s