Computer Vision Project Report 1

High Dynamic Range Imaging

Tuo Wang, Guoliang Jin and Yupu Zhang

{tuowang, aliang, yupu} @ cs.wisc.edu

Tuo Wang: Debevec's algorithm
Guoliang Jin: Robertson's method
Yupu Zhang: Ward's MTB algorithm and Ashikhmin's tone-mapping algorithm

 

Goal

To generate High Dynamical Range images based on a series of different exposed images.

 

Algorithms

We have implemented the algorithms below:

HDR: Debevec's algorithm[1] in Matlab and Robertson's method[2] in Visual Studio 2005

Alignment:  Ward's MTB algorithm[3] in Matlab

Tone Mapping: Ashikhmin¡¯s algorithm[4] in Matlab

 

Approach  NOTE: For all matlab implementation, please type in 'help functionname' in the command window of Matlab to see how to use these functions. For VS2005 implementation, compile it and run it.

Taking photos

We used the camera Powershot A640 to take 3 images with different exposure time (1/10, 1/40, 1/160). We used AHDRIA [5] to control the shutter speed remotely from our own computer in order to prevent the hand-shaking when pressing the shuter.

Alignment

We implemented MTB algorithm [3] in Matlab as a function. The function header is       

[xo, yo] = alignment(pic1, pic2, th, to, shiftbits)

where the return value [xo, yo] is the offset of pic2 with respect to pic1, based on the threshold value th, tolerance value to and maximum shiftbit value shiftbits. Note that positive xo means that pic2 has to be moved right xo pixels and positive yo means that it has to be moved up yo pixels.

HDR

1) Debevec's algorithm

    HDRmain.m is a function in Matlab:   

 

      HDRmain(inputdir, outputfile) 

 

where inputdir is the name of the directory that contains differently exposed pictures and outputfile is the filename and extention(.hdr) of the   generated HDR file. The hdr file will be generated in the current directory of Matlab.

 

Note that the filename of an image must contain two numbers specifying the exposure time of that image. The first number specifies the nominator, the second one the denominator. E.g. "img_1_2.jpg" specifies that this image has been taken with an exposure of 1/2 second.

 

2) Robertson's algorithm

 

All configurations are hard coded, including the file names, exposure time and number of pictures. The handed in version can generate HDR image for the pictures we taken. It takes a long time (more than 2 hours) for the program to finish. The program generates an HDR file in each interation, and the program stops when the rate of decrease in the objective function to fail below some threshold. One can also continue the interation, but the result will become very blue and very dark. So we just choose the one looks best from the serial of intermediate HDR files.

 

All three channels use initial function with =1.0.

 

Tone Mapping

 

1) Photomatix[6]

 

    Use Photomatix to do Tone Mapping and save the result as a jpg file.

 

2) Ashikhmin¡¯s algorithm

 

   We also implemented Ashikhmin¡¯s algorithm in Matlab:

 

tone(input, output)

 

   where input is the hdr file and the output is the output jpg file.

 

 

Results based on our own photos

 

Alignment

Since we used AHDRIA to control the camera, there was no obvious handshaking during the photo-taking process. The result of our alignment function is [0, 0].

In order to test our function, we applied the function to some sample pictures that are included in the gil. It works pretty well and the result is shown below:

 

>> [xo, yo] = alignment('s7708_01.bmp', 's7708_03.bmp', 50, 4, 5);

The offset [xo yo] is [0 1]

result.jpg

HDR & Tone Mapping

1) Debevec's algorithm

 

   Response Curve

 

Debevec_response.jpg

 

   Source pictures (exposure time: 1/10s, 1/40s, 1/160s)

 

AHDRIA_1_10.jpgAHDRIA_1_40.jpgAHDRIA_1_160.jpg

 

    Tone-mapped picture (Photomatix)

 

OurImage.jpg

 

 

Tone-mapped picture (Ashikhmin)

 

OurImage.jpg

 

 

Photomatix¡¯s result is pretty good. But Ashikhmin¡¯s result looks bad. Although many datails of the scene are shown in the picture, some color is saturated and the whole scene looks dark. We exactly followed the steps mentioned on the paper and tried to tweak every possible variables that could be tweaked, but we still can¡¯t figure out why our implementation does not work well.

 

 

 

2) Robertson's algorithm

 

Source pictures are the same as those in Debevec's algorithm.

 

As in the program, one can change the threshold to make any intermediate result as final. We just take one intermediate HDR image, tone map it and show it. The following is based on the 50th intermediate HDR image.

 

Tone-mapped picture (Photomatix)

 

 

Tone-mapped picture (Ashikhmin)

 

OurImage2.jpg

 

The result is not good comparing to Debevec¡¯s.

 

 

 

More Results based on sample photos from the Internet

 

Click me

 

 

 

References

[1] Paul E. Debevec, Jitendra Malik, Recovering High Dynamic Range Radiance Maps from Photographs, SIGGRAPH 1997.

[2] Mark A. Robertson, Sean Borman, Robert L. Stevenson, Estimation-theoretic approach to dynamic range enhancement using multiple exposures, Journal of Electronic Imaging 2003.

[3] Greg Ward, Fast Robust Image Registration for Compositing High Dynamic Range Photographs from Hand-Held Exposures, jgt, 2003.

[4] Michael Ashikhmin, A Tone Mapping Algorithm for High Contrast Images, EGWR 2002.

[5] Automatic HDRI Acquisition with AHDRIA: http://www2.cs.uh.edu/~somalley/hdri_images.html

[6] Photomatix: http://www.hdrsoft.com