High Dynamic Range Imaging

Chaman Singh Verma and Mon-Ju



  1. Introduction
  2. Implementation Details.
  3. Results
    1. Response Curves and Radiance Map
    2. Tone mapping and Perceptual Image Quality
    3. Performance
    4. Comparison with other software.
  4. Improvement and Future work.
  5. Appendix
    1. Dataset.
    2. Software usage guide.


Human eyes have extremely high visual range that can easily differentiate between very bright and dark regions in the same scene.  High Dynamic Range Imaging is a technique to emulate this behavior with the low end commercial cameras available in the market by taking images of the same static scene at various exposures and then merging the images.

In a simple static setting, the process of HDR starts from image acquisition at various exposures of the same scene at quick succession so that effect of changing light conditions can be ignored. Despite using tripods for greater control, some perturbation is inevitable, therefore, image alignment is often necessary.

In this class project, we have implement Debevec algorithms to calculate the radiance map.

Tone mapping goes in reverse direction, the HDR values calculated from the step three, cannot be used on devices which has limited dynamic range. The idea of tone mapping is to reduce the dynamic range in a way that preserves the features in the HDR images and present colors which are pleasing and appreciable to human eyes.


Implementation Details:

The radiance equation from the Devebec paper is given as:


Two important issue  in solving this equation  are:
  1. Sampling:  As described in the paper, we need not select all the pixel available in the image, but only to satisfy N(P-1) > (Zmax-Zmin). We have chosen about 100-200 pixels randomly from middle exposed image in the range of (5-250).  Presently, for each color channel sampling is done independently.
  2. Lambda : The second term in the equation is the penalty term and proper selection of lambda ensures that the resulting response curve is smooth.

Results and Conclusions:

HDR with pfstools
Our Implementation


Response Curves:

For each red, green and blue channels, radiance map is calculated from the Debevec equations. Ideally, the radiance map must be smooth and monotonically increase, but because of errors introduced in solving the equations and possibly imperfect imaging devices, we get little perturbations in the calculated maps. Polynomial fitting could be used to get the smooth curves, but this is not done in this study. It is also likely that near the saturation ends ( 0 and 255 values ), the curve show some erratic behavior, but  this can be handled by truncating or clampiing the graph.

RedResp GreenResp

     (Z, lnE) radiance map of Red, Green and Blue colors.

Tone Mapping and Perceptual Image Quality:

                                                           HDR Image with Reinhard02 tone Mapping

HDR with Fast Bilateral Tone Mapping

As we can see, both Reinhard algorithm preserves the color better than Durand's Fast Bilateral tone mapping as can be seen near the upper arch, where Reinhard has more yellow color preserved. But Durand's algorithms preserves the sharp edges far more better than Reinhard algorithm.

Performance Results

The results were taken on HP-9308NR notebook with 1GM RAM. For a dataset of 30 images, the table shows that the maximum time is taken in loading the images and extracting the colors. The HDR process is independent of image size and take fraction of overall time.

Execution Time(sec)
Execution time (Sec)
loading images
Extracting {R,G,B} Color
Selecting random points
03 18
Generating Matrix
Solving least square problem (Lapack)
Generating HDR image.



These dataset are from beautiful Madison Capitol building.

Data Set

Software and User Guide:

      The entire software UWHDR is written in standard C++ on Linux running ubuntu 9.04. There are some public domain software that we have used in developing this code and they are:

Software Usage:

Assuming that all external software are installed on the machine then use makefile to compile the code. Create one directory that contains all the images ( tested with JPEG ). Make sure that only the relevant image files are in the directory. Then use

                                                uwhdr <directory_name>  <lambda>

where directory_name is the directory where images are stored. The value of lambda depends on the image set which is used to smooth out the radiance map. Start with small values (~0.1 ) and increase the value till a smooth monotonically radiance map is obtained. It is however likely that the near end points the radiance map may be erratic and therefore, care must be taken to clamp the radiance map rather than changing the "lambda" values. For most of the cases, the lambda value (1.0-5.0) was good enough.

This will generate "scene.hdr" file. which becomes input for tone mapping.

                                            pfsin scene.hdr |  pfstmo_reinhard02 -s | pfsout scene.png

Besides generating "scene.hdr" uwhdr also generates red, green and blue radiance maps. They are stored in lnE0.dat, lnE1,dat and lnE2.dat.

To visualize the scene.png image:

                                            display scene.png

Mon-Ju has written similar code in Matlab HDR.m.


Recoveing High Dynamic Range Radiance Map from Photographs:  Paul E. Debevec and Jitendra Malik.