a collection of utilities
exrtools is a set of simple command-line utilities for manipulating with high dynamic range images in OpenEXR format. OpenEXR is a high dynamic-range (HDR) image file format developed by Industrial Light & Magic for use in computer imaging applications.
exrtools was developed to help experiment with batch processing of HDR images for tone mapping. Each application is small and reasonably self-contained such that the source code may be of most value to others.
exrtools currently only works with RGBA OpenEXR files. As well, the code assumes that the EXR files and PNG files all use sRGB primaries and gamma function. Fixing this is not very difficult, and the code to fix allows for some interesting possibilities. That said, I do not have time right now, so this will have to wait.
exrtools and its source code is released under an MIT-style license and may be used in both commercial and non-commercial applications without fee. See the license here or in the source distribution below.
|exrblur||Applies a gaussian blur to an image.|
|exrchr||Applies spatially-varying chromatic adaptation to an image.|
|exricamtm||Performs tone mapping using the iCAM method.|
|exrnlm||Performs non-linear masking correction to an image.|
|exrnormalize||Normalize an image.|
|exrpptm||Performs tone mapping using the photoreceptor physiology method.|
|exrstats||Displays statistics about an image.|
|exrtopng||Converts an image to PNG format.|
|jpegtoexr||Converts an image to EXR format from JPEG.|
|pngtoexr||Converts an image to EXR format from PNG.|
|ppmtoexr||Converts an image to EXR format from PPM. Works with the 16 bit per channel PPM files from dcraw for digital cameras with RAW modes.|
exrtools includes implementations of a few published algorithms for tone mapping of images.
Each of these algorithms require that the input be normalized before running the algorithm.
We normalize the input file before running the algorithm. There are some options we can use, see man exrpptm for a description. For memorial, we use a -c value of 1.0 to apply full chromatic adaptation. The output from this algorithm should be normalized before viewing.
exrnormalize memorial.exr memorial.n.exr exrpptm -c 1.0 memorial.n.exr memorial.pp.exr exrnormalize memorial.pp.exr memorial.pp.n.exr exrtopng memorial.pp.n.exr memorial.pp.png
The iCAM method we split into two separate phases, chromatic adaptation and local tone reproduction. Each requires a low-pass version of the image. After tone mapping, the image must be normalized before viewing. The paper on iCAM recommends using a clipping function to avoid having some small parts of the image dominate, but we avoid this step here, making our images a bit darker than they likely should be.
exrnormalize memorial.exr memorial.n.exr exrblur memorial.n.exr memorial.b4.exr 0.25 exrchr memorial.n.exr memorial.b4.exr memorial.chr.exr 0.1 exricamtm memorial.chr.exr memorial.b4.exr memorial.icam.exr exrnormalize memorial.icam.exr memorial.icam.n.exr exrtopng memorial.icam.n.exr memorial.icam.png
This algorithm was not designed for HDR tone mapping, and it gives poor results if the dynamic range of the input is high. However, it provides a nice comparison and is very useful for improving the tone reproduction curves on low dynamic range photographs. The process of using this algorithm is similar to using iCAM: normalize, calculate a blurred image, and then use that to correct the image.
exrnormalize memorial.exr memorial.n.exr exrblur memorial.n.exr memorial.b4.exr 0.25 exrnlm memorial.n.exr memorial.b4.exr memorial.nlm.exr exrtopng memorial.nlm.exr memorial.nlm.png
These are not representative of what the algorithms can do or what they are capable of, merely an example of the kinds of results one can get just playing around.
Here we run the algorithms directly on a typical digital camera picture.
Besides the source package listed here, exrtools is also available in Debian unstable.
If you have any suggestions, improvements, find any bugs, links to images, or anything, send me an email at email@example.com.