Final Project: HDR

Donnie Kendall (dkendall)

Introduction

For this project I used a series of image stacks, two of which I downloade from the internet and the rest of which I captured myself with a Canon 450D. Unfortuatnely, only the pair of image stacks which I downloaded showed uniformly good results, which underscores the difficulty of capturing a good image stack for use in HDR. My camera has a auto exposure bracketing feature which will automatically vary the shutter speed to capture 3 images of differing exposure, but I found that only three images was typically insufficent to fully model the scene.

Since the canon 450D actually captures images as 14 bits per color channel per pixel I experimented with using a single RAW image to tone map. Unforuantely, I didn't have code available to read the RAW files, and using Lightroom to adjust exposure resulted in response curves which were completely nonsensical.

The image stacks may be viewed here.

Algorithm

Recovery of Camera Response Curves

My camera response curve recovery is pretty much an exact implementation of Debevec & Malik. In order to get enough data to overconstrian the system to an acceptable degree I sample the image randomly enough times that it is very likely that all of the data points needed will be hit (in this case, I use 1024 samples. The results would probably be similar with less). There is one point that they gloss over completely that I discivered during testing: if in the fastest expsoure is already clipping then every other exposure in the stack will also be clipping at that point. This contributes no useful information to the response curve, so in cases where a point such as this has been selected I through it out and select a new point.

Global Tone Mapping

I implemented two global tone mapping operators. The first I implemented is the simple one suggested in general which maps any range of tones onto [0,1). This is:

This operator has an interesting "problem" that I ran into on some of the images that I captured myself. It maps the input range [0,1] to [0,0.5] and then maps the entire remaining range of (1,infinity) onto (0.5,1). This is obvious in retrospect, but when first implementing it it didn't occur to me that only the very darkest regions were getting mapped to fully half of the output range. This means that if you have any images that are predominantly bright that it works very, very poorly.

In order to get around this, I also implemented a logarithmic gloabal operator, given by:

This has the dual benefits that it works in log space and it takes into account both the minimum and maximum radiances in the scene. Because of both of these it tends to do a better job of global compression without assuming that the image will have both light and dark regions. This is also the only operator that I got consistently decent results out of.

Local Tone Mapping

For local mapping I implemented Reinhard, et. al. I chose this paper because its motivation is based on photographic technique, namely dodging and burning to adjust the exposure of differing sections of the photograph based on the surrounding contrast.

The algorithm makes a few passes over the luminosity map. In the first pass it uses a series of gaussian kernels of differeing sizes to calcualte the average change in intensity of illumination in that area by convolving the kernel with an illumination matrix. On the 2nd pass it finds the largest scale for each pixel such that the change in intensity across that scale is less than some epsilon. Finally, on the last pass, it uses this information to attempt to compress the luminosity of the image.

The intensity change is calculated across 8 different scales at each pixel. The overall idea is that in areas of rapid changing of intensities the intensities probably need to be compressed more, whereas in areas of slowly changing intensity they need to be compressed less. Below I provide images which show the scale level chosen for each pixel as a grayscale image. Darker areas indicate more rapdily changing intensities (and thus lower scales), whereas lighter areas indicate more slowly changing intensities (and thus larger scales).

Results

Results are also located on the iamge stacks page, here.

References

Recovering High Dynamic Range Radiance Maps from Photographs; Debevec & Malik
Tone Mapping for HDR Image using Optimization - A New Closed Form Solution; Qiu, Guan, Duan & Chen
Photographic Tone Reproduction for Digital Images; Reinhard, Stark, Shirley, Ferwerda
Gradient Domain High Dynamic Range Compression; Fattal, Lischinski & Werman
Quantization Techniques for Visualization of High Dynamic Range Pictures; Schlick