max planck institut
mpii logo Minerva of the Max Planck Society



PFScalibration package provides an implementation of the Robertson et al. 2003 method for the photometric calibration of cameras and for the recovery of high dynamic range (HDR) images from the set of low dynamic range (LDR) exposures.

Tools provided with this software can be used for photometric calibration of both off-the-shelf digital cameras and HDR cameras as described in the MPI Research Report. A short tutorial on calibration of the LDR cameras and the recovery of the HDR images from multiple exposures is provided below. For details on the calibration of the HDR cameras please refer to the research report.


23 August 2006 - PFScalibration 1.3 released

Full support for exposure parameters: any combination of exposure time/aperture/iso speed can be used for source exposures. The luminance in the output HDR image is now in [cd/m2] (with relative error expected to be below 8%). Initial support for camera RAW files. Several bugs have been fixed. Available for download at SourceForge.

Tutorial: Recovering an HDR Image from LDR Exposures

Sample exposures
Set of LDR exposures used to recover an HDR image.

We show an example procedure necessary to perform the photometric calibration of a camera and then we show how create an HDR image from multiple expsoures.

In the tutorial, we assume that several jpeg images are located in /var/tmp/images with the following names img01.jpg,img02.jpg,... img12.jpg. Each image is a shot of exactly the same target scene, but taken using different exposure settings (preferably different exposure time).

We provide a sample set of appropriate images: exposures.tgz (~2.8MB)

HDRGEN script

First step is to create an hdrgen script:

$ jpeg2hdrgen /var/tmp/images/img*.jpg > sample.hdrgen

The HDRGEN script file is a plain text file in which each line contains:

path_to_an_image inverse_of_exposure_time_in_seconds aperture_size iso_speed 0

In case the jpeg2hdrgen program could not parse the exif information from jpeg files, it is necessary to create this file by hand. For reference, we provide a sample.hdrgen file.

Recovery of the response curve

The next step is to recover the response curve. For detailed information refer to manual page of pfshdrcalibrate.

$ pfsinhdrgen sample.hdrgen | pfshdrcalibrate -v -s camera.response

Camera response
Sample camera response plotted with GnuPLOT.

To view the camera response use GnuPLOT:

$ gnuplot
gnuplot> plot "camera.response" with dots

Applying the response curve (creating HDR image)

Tone mapped HDR image
Tone mapped sample HDR image: sample.exr.

Finally, to create an HDR image and save it in OpenEXR file format use:

$ pfsinhdrgen sample.hdrgen | pfshdrcalibrate -v -f camera.response | pfsoutexr sample.exr

Often, certain pixels of the HDR images may not be recovered due to the insufficient number of exposures. To prevent having null values in the output HDR image it is often a good idea to clamp them to the minimum values using percentile.

$ pfsin sample.exr | pfsclamp --min 0.001 -p | pfsoutexr sample.exr

The image can be viewed using 'exrtools' package:

$ exrdisplay sample.exr

It is important to note that the response curve can be reused for any set of images, as long as they have been taken using the same camera. Different white-balance and sensitivity settings may affect the quality though.

Software Download

PFScalibration package is available for download with the complete source code at SourceForge.

The sources of PFScalibration are located on the CVS server at SourceForge. I hope this will help in a collaborative development and will eventually lead to a robust implementation which can successfully calibrate versatile types of cameras.

This software is implemented using the floating-point pipe streaming implemented in PFStools library. PFStools is a free library and can be downloaded from SourceForge along with the PFScalibration.


Estimation-Theoretic Approach to Dynamic Range Improvement Using Multiple Exposures
M. Robertson, S. Borman, and R. Stevenson
In: Journal of Electronic Imaging, vol. 12(2), April 2003.
[project page]

Photometric Calibration of High Dynamic Range Cameras
G. Krawczyk, M. Goesele, H.-P. Seidel
In: MPI Research Report MPI-I-2005-4-005.
[bibtex] [report] [poster]


Several resources related to the recovery of HDR radiance maps:


Comments and suggestions related to the project are very welcome. For further information please contact Grzegorz Krawczyk.