High Dynamic Range Imaging

by Steven Kappes


Description:


I implemented my high dynamic range imaging using Debevec's algorithm presented in the SIGGRAPH article. My programs loads in images taken with different shutter speeds and outputs the reconstructed high dynamic range image. The algorithm presented in the article is for the most part explicit, with the exception of selecting pixels to use to solve for the camera's response curve.


The article mentions that pixels should be chosen based on intensity distribution and spacial distribution. Therefore, my program first computes the average intensity from the exposures for each pixel.  It choses a few pixels distributed in the low intensity range and a few distributed in the higher intensity range to ensure dark and bright portions of the image are not missed. The remaining pixels used to solve the response function are chosen based purely on their spacial distribution. This approach produced good results in all of the test images I used. In general, I found that different methods of selecting pixels I tried did not have a major impact on the results, since enough pixels are used to overly determine the linear system.


Program Usage:


My program is written for Visual Studio 2005. It relies upon libgil2 for loading and saving images and GSL for solving the linear system. The pre-compiled versions of these libraries can be found here and here. The compiled executable of my program is also include.


When my program runs, it will prompt you for a image list file. The path you need to enter is relative to the path of the program. The image list text file must be formatted like so:

<Number of exposures>

<Image file path> <Whitespace> <Exposure time>

<Image file path> <Whitespace> <Exposure time>

...


The path image file path is again relative to the path of the program. The exposure time can be a floating point number or as a fraction. If the file is not formatted as my program expects, it should give a reasonable error message.  Here is an example of the image list file used for the pictures I took.


The program will then run with a smoothing constant of 1000. As long as the smoothing constant is not too small, the results of the program are fairly consistent. A low value can produce worse results though. The smoothing constant can only be changed by running the program with command-line arguments. The command line arguments need to be in this format:

p1 <image_file.txt> <smoothing constant> <print debug info>


Setting the print debug info to anything but 0 will display extra information when the program runs, particularly the values of the response curve calculated for each color.


The output of the program will be a high dynamic range image named "result.hdr" in the same directory as the program. For instance, if you run the executable as "p1 image_list.txt 1000 1", result.hdr will be produced from my photographs.


Results:


My images I photographed myself are here. The resulting HDR image is here and the tonemap is here.


I chose this picture for my artifact. I wanted to get a good picture outside, but had trouble getting good results. This picture is from the arboretum. I couldn't figure out how to prevent my camera from changing the f-stop when the brightness of the scene changed. Therefore, I only had 3 good source images with the same aperture size, so the rsesult is not perfect as you can see pixelization in the sky.