Create High Dynamic Images

-by Nan Chen

1         Description

This project implements Debevec's algorithm to reconstruct the irradiance response function for a particular camera to create high dynamic range images. The program takes a text file as input, describing the filename of the images, as well as the exposure time of the images. The output of the program is a name specified as an argument with extension ÒexrÓ.

2         Program implementation

2.1        Instructions for run

The program is implemented in Matlab using only basic operations and functions. To call the program, simply use

HDR( images.txt,  figure.exr)

as command. HDR is the main function name, and images.txt is the file contains the number of images, and corresponding image names and exposure times. The format is shown below:

11

Picture_005.jpg  0.0025

Picture_006.jpg  0.003125

figure.exr is the output high dynamic range image file name with the format of OpenExr.

2.2        Implementation details

The response curves are calculated for RGB channels respectively. A random sampling strategy is used to choose the points used to solve the least square equations. The sample size and penalty factor can be specified in the program. For the sample images, the constructed response curve for different channel is shown as

 

 

And the created high dynamic range images (Tone mapped) is also shown above.

 

The HDR image is stored as OpenExr format, and I download a function written in C to save and read exr image files, and can be called from Matlab. These two function files are included in the submitted file, named exrWrite.mexw32 and exrRead.mexw32.

3         Parametric response curve

The Debevec's algorithm basically constructs a non parametric response curve based on the images taken. However, it requires estimating a lot of parameters to get the curve. Instead, if we specify the curve in a parametric form, as given by Mitsunaga and Nayar, we can largely eliminate the parameters. For example, in my program, I assume the response is a seven order polynomials with 500 samples, and the calculated response curve is shown as

From the figure, we can see the result is pretty unsatisfactory. The possible reason is that I do not use weighting function for the pixel values. Therefore, the pixels close to 0 or 255 may introduce a lot of noise in estimation. Also there is no impose on the shape of the curve, such as monotonically increasing, therefore, the results may not be as desired. Because of the limited time, this issue has not been resolved completely.

4         Image alignment

Since I could not figure out how to control the shutter through computer, therefore the camera is not fully stabilized. Therefore, it is necessary to use image alignment algorithm to adjust the difference caused by moving. The MTB alignment method is used. I first create the binary map with different resolutions, as shown below:

 

However, the alignment results are not very satisfactory, because the movements of the leaves are not easy to align. And there is some ripple/ghost effects in the leaves because of the movement.

5         Results

Following lists the results processed from the program.

Camp Randall

 

Another one is the inside scenery of Engineering Center Building (ECB) as shown below:

 

Engineering Center Building

 

From the results, we can find that they are not satisfactory. The major reasons include the shake of the camera while taking pictures; unstable background objects which causes difficulties in alignment; and the contrast in the image is not enough to fully elaborate the advantages of high dynamic range images. In the future, these should be paid special attention.