HDR Notes

Sam Galpin (sgalpin@comcast.net) April 2010

What is HDR?

 HDR is a technique, not a look!  It extends the dynamic range of the camera by using a computer to combine information from images of the same subject shot with different exposures.  It can be used both to create unusual artistic effects and to capture images that would otherwise be impossible.  It is part of a larger family of techniques that include focus stacking for extreme depth of field and image stitching for wide angles and/or increased resolution.

Basic HDR workflow:

1.       Capture bracketed images.

2.       Merge the images together

3.       Adjust image tones to reduce the total dynamic range and maintain local contrast.

4.       Further processing as desired using “normal” workflow

Two basic approaches:

1.       Use layers and masks to make a composite of the properly exposed and adjusted sections of each of the bracketed images.  Use highlight detail form the “under exposed” image, shadow detail from the “over exposed” image, mid range details from a “normal” exposure.  There are many ways of doing this.  The tutorial at  

http://www.luminous-landscape.com/tutorials/digital-blending.shtml is fairly simple.

 http://www.erik-krause.de/index.htm?./blending/ is much more advanced.  I am not going to discuss these techniques further other than to point out that some believe that if the goal is natural looking results this is a much better approach.

2.       Use HDR capable software to combine the multiple exposures into a single HDR image and tone map the result into a normal (LDR) image with viewable and printable dynamic range.  HDR applications vary widely in their ability to perform these two functions.

HDR file formats:

The standard HDR image file ( .hdr) encodes the tone values using 8-bit values for each of the RGB color components plus a shared 8 bit exponent that defines the brightness for a total of 32 bits per pixel.  This give the HDR file a dynamic range of 256 f- stops.  Another HDR format (open EXR) uses 16 bit floating point numbers with a dynamic range of about 30 f-stops. 

The available dynamic range of a 16-bit tiff (or DNG) is more than 16 f-stops.  The data is stored using a non linear gamma curve.  This is substantially larger than screens can display or printers can print.  If you can get the data in and keep the noise out, these formats also have modest HDR properties.  To some extent this is also true of camera raw files, especially when shot at low ISO.  Camera raw files are linear.  For DSLRs they range from 12 to 14 bits, or a theoretical maximum of 12 to 14 stops.  The reality will always be noise limited.

How to shoot for HDR:

HDR workflow starts with a set of matched images shot with bracketed exposures.   The basic plan is to cover a range of exposures that will capture good detail in both the highlights and the shadows.  In an ideal world one would use a solid tripod, carefully spot meter the scene, and choose a set of exposures ranging from an overexposure that raises deep shadows to Ansel Adams’ zone III or IV to an underexposure that pulls the extreme highlights down to zone VII with a difference between exposures of perhaps 1 stop.

In the real world: set your camera to auto-bracket in burst mode with aperture priority.  With good modern software a tripod is no longer required even for HDR panos.  Shooting handheld, make sure the ISO is high enough so that the long exposure is not too long.  With my Canon DSLR, I normally shoot 3 shots with a bracket of 0,-2,+2.  With high speed drive it takes less than a second which helps keep the subject matter steady.  I shoot raw to maximize dynamic range and color control.  The two stop bracket interval works well shooting raw.  Shooting jpeg, one stop bracket intervals is probably better.

Fundamental Limitations:

The subject must keep still!  In landscapes, wind can be a real problem.  High speed burst mode helps.  Some software has features for “ghost” control. 

Lens flare and stray light:  You will find that the ability to capture extreme dynamic ranges will be limited by light that leaks from bright areas into the deep shadow.  Keep your lenses clean!  Consider removing “clear lens cap” filters.  Use a lens shade.

HDR software uses significant computer resources.  My notebook computer is a 2 GHz Pentium M (single core) “mobile workstation” with 2 Gb of ram.  It needs 12 minutes for PTGui Pro to build the HDR sunset pano from 12 8 megapixel 16-bit tiff files.

Merging Images to an HDR file:

The merging process has two basic problems to solve.  First, unless the images are shot from a rock solid tripod, it is necessary to align them.  Two years ago, this was a major issue.  HDR without a tripod was almost impossible.  Now the best HDR software is very good at aligning the images by matching features.  Once the images are aligned, the software needs to calculate the pixel values in the HDR image.  This is normally done by using a combination of the pixel values in the original files and the EXIF exposure data that relates them.

Depending on the software you can convert directly from raw files to HDR or do the raw conversions first.  In the past I was convinced that converting raw files to 16-bit tiffs worked better than converting directly from raw files.  With the latest versions of programs like Photomatix I am no longer sure this is true.  Depending on the situation and the software you are using, your mileage may vary.  As might be expected, raw conversions using DXO seem to offer better control of things like chromatic aberration.  My 17-85mm zoom at 17mm has very substantial distortion.  There is no question that in that scenario without a tripod I get cleaner merges if I preprocess the files with DXO to remove the distortion and chromatic aberration.  This makes much less difference with my 70-300 telephoto.

If you convert the raw files first, be wary of operations that are going to manipulate the tone values.  Clearing out lens aberrations, noise, and vignetting are generally worthwhile.  Things that selectively lighten shadows or recover highlights are probably counterproductive.  You normally want to use the same settings on all images in the set.  The conversion to HDR reads the EXIF exposure data to interpret the pixel values in the file.  Turn off the options in the raw converter that will upset this relationship.  If the HDR file has noise problems, cleaning up the source files will help.  Doing the raw conversions first clearly provides opportunities to gain an extra level of control over the final result.

Save the HDR image file before moving on to the tone mapping phase.  Even with practice it is not easy to get the tone mapping right.  If you do not save the HDR file first, the tone mapping operation will destroy it.  If you save it you can reload it.  That is much easier than starting over.

Single Raw File HDR Conversion

Some HDR packages will also create an HDR file from a single raw or 16-bit tiff.  It is also possible to do multiple conversions of a single raw file with different exposure adjustments and merge the results.  Obviously this limits the dynamic range available, but it does provide a way to extract the full range from the raw file.  With the latest raw conversion software if you are working in 16-bit mode it is not clear that this is worth the effort.

Tone Mapping

An image with really high dynamic range cannot be viewed on a screen or printed.  The light areas go white and/or the dark areas go black.  Flattening the overall contrast solves the range problem, but leaves the image flat and lifeless.  In general, global contrast must go down and local contrast must go up.  Imagine a stair case that must have 100 steps six inches high, but can only climb a total of 10 feet instead of the original 50 feet.  That is the problem tone mapping algorithms must solve.  The “HDR look” with its characteristic halos is a byproduct of the tonal range distortions created by tone mapping.  It is the result of tilting the steps on our imaginary staircase.

Tone mapping algorithms are improving all the time.   It is now usually possible to make very natural looking images.  The surreal effects are still available, but are now controllable.  Be aware that tone mapping is inherently a noise amplifier.  Too much noise in the image sometimes prevents tone mapping algorithms from working.  At that point, the options are to either try a different algorithm or apply noise control to the original images and rebuild the HDR image.

Finally, think of the tone mapped image as a starting point for your normal workflow.  All your normal editing tools are now applicable.  If you use a workflow that supports layers, you have a number of options not normally available.  You can combine different tone maps or use parts of one or more original image.   

My Primary HDR Software Tools

Photoshop:

Photoshop versions prior to CS2 do not support HDR file formats.

I have used the HDR conversion functions in CS2, CS3, and CS4.  CS2 does well if the images match perfectly.  CS3 will merge some images that do not match perfectly.  Some handheld sets will merge really well.  It is much better than CS2.  CS4 is a huge improvement over CS3 in all functions that use content based image registration.  It stitches panos, does handheld HDR merges, and builds focus stacks very smoothly.  It also allows some editing functions directly on HDR files.  CS4 extended supports layers for HDR mode image files.  I have not tried this.  Editing an HDR file is difficult because you can view only part of the tone range at any time.

Photoshop can do rudimentary tone mapping using the image mode dialog.  Note that Shadows/Highlights is a true tone mapping operator.  Used in combination with the image mode conversions it will frequently do a good job.

Photomatix Pro: ( www.hdrsoft.com )

The ability of the latest version of Photomatix Pro (standalone) to merge images to HDR is similar to Photoshop CS4.  It will also put a custom tag into the HDR file specifying the color space of the source images and when it tone maps the image and converts it back to LDR (normal) mode it includes the color space data in the LDR file.  It will make both true HDRs and exposure blended 16-bit tiffs.  It will start with most file formats including raw.  If you start with raw, you can choose sRGB, Adobe, or ProPhoto color space.

The tone mapping is excellent.  It has two basic algorithms with an array of sliders.  “Detail Enhancer” is the preferred choice in most cases.  It offers a wide array of sliders and presets ranging from “natural” which tends to be too flat to “grunge” which is over the top.  “Tone Compression” is very mild in its actions, but works very well for some images.

The merge and tone mapping functions can be used independently.  Tone mapping will work on normal 16-bit image files.

Photomatix Plugin for Aperture or Photoshop CS2 and higher.

The new (Feb 2010) version 2.0 tone mapping filter plugin is much better than the previous version.  It now has all the features of the standalone version.  In the past there were occasional images which only the standalone version could properly tone map.  This is now less of a problem, but the standalone version can still handle images the plugin cannot.  Image size can be an issue.

When using the tone mapping plugin set the 32 bit view options to exposure = 0, gamma = 1.00.  The plugin also operates on normal 16-bit files.

The plugin also enables a very smooth Lightroom based HDR workflow using the LR photo->edit->merge to HDR in Photoshop.  Select the images, send them to PS to build and tone map the HDR, save the result in PS, and continue in LR.  One caveat: this requires substantial computer resources to flow smoothly.

PhotoAcute Studio: ( www.photoacute.com )

PhotoAcute is an image stacking program.  Although it will work with tiff and jpeg images, this program works best with DNG files.  It will automatically convert raw files to DNG using the Adobe DNG converter.  My preferred workflow with this software is to export the images I want to stack as raw or DNG from Lightroom, stack with PhotoAcute, and import the resulting DNG back into Lightroom.

Using bracketed sets of exposures as input, PhotoAcute will create an extended dynamic range output file.  Strictly speaking this is not a true HDR work flow, but the end result is very similar.  The great merit of a PhotoAcute stack is that the result is almost noise free.  The data in a DNG file is probably linear, like a raw file.  The maximum dynamic range is therefore 16 f-stops.  This seems to work well with my Canon 50D and +/- 2 stop brackets, but I suspect that is about the limit.  For wider range, use true HDR.     

HDR with PTGui Pro ( www.ptgui.com )

Panoramas that cover a wide angle frequently include both brightly lit and deep shadow areas.  Finding a single exposure that will cover the range is sometimes impossible.  Shooting the pano in HDR requires only that each section be captured with a bracketed set of exposures.  With current software, the typical “casual” pano that is done with a single row of overlapping frames in portrait mode can usually be shot hand held in HDR and assembled with no difficulty.  As recently as two years ago this was impossible.

PTGui  is a powerful panorama stitching tool.  It will stitch almost any set of overlapping images into a good pano.  The Pro version adds HDR capability.  It will merge sets of LDR images into a stitched HDR file.  It requires that the f-stop stay constant and that the bracketed exposures are matched sets.  For example, all f-8 with exposures of 1/60, 1/250, 1/1000 (two stop bracket).  If this is not the case it is possible to adjust the images during raw conversion and override the exposure data PTGui reads from the EXIF.  PTGui Pro also includes a tone mapping capability.  Because I have Photomatix, I save the HDR file and continue with either Photomatix or Photoshop.

PTGui began as a user friendly front end for a set of open source utilities called Pano Tools.  Pano Tools now has its own open source front end called Hugin.  Hugin is now stable enough for normal users and very capable.  It is a viable alternative to PTGui Pro.  The major weakness is that the documentation is typical open source: thin to none.

DXO (www.dxo.com)

This is primarily a raw conversion tool.  Its great strength is its ability to correct for lens weaknesses, especially those that relate to image geometry.  It is worthwhile only if your camera and lens are included in the list of supported combinations.  If they are, it can be like a substantial lens upgrade.  Distortion disappears; chromatic aberration almost disappears.  The basic raw conversions keep pace with the competition (ACR etc.).  For anything other than top quality lenses it probably offers the best image quality available for the lens/body combinations it supports.  What it does for my EFS 17-85mm is almost magical.

Color Management Issues:

Most of the image file formats we use include an embedded color space definition such as sRGB or AdobeRGB.  I typically work in ProPhoto because that is Lightroom’s standard working color space.  HDR files are officially supposed to be linear, meaning they have no color space.  What actually seems to happen is that HDR files inherit the color space of the files they are made from.  This can result in some major surprises, especially when HDR files are passed between applications.  The result can be very confusing and more than slightly frustrating.

The following tips are based on my experience working with combinations of Photoshop, Photomatix, and PTGui Pro.

1.       Choose a single color space and make sure that everything that touches an HDR file is done in that color space.  For example, if you choose ProPhoto.  Convert the raw files to ProPhoto 16-bit tiff.  Merge the tiffs to HDR.  Save the HDR file in HDR format.  You may need to go back to it.  If you load the HDR into Photoshop make sure the working space is ProPhoto.  Note that ProPhoto may not be a good choice.  Study the preference menus of your software.  Pick a color space they all know how to work in.

2.       If the colors in the tone mapping previews look seriously wrong, be cautious about manipulating colors during tone mapping.  What you see is probably not what you will get.  Instead, ignore the colors and work on getting the overall brightness values close to what you want.  When you finally convert to LDR don’t be surprised if you see a very large color shift.  If you have resisted the urge to “fix” the colors while tone mapping, the colors are likely to shift back toward where you want them.  The colors will probably not be what you want, but are probably close enough so you can fix them.

The good news in this area is that with the latest Photomatix software the situation appears to be much better.  Both Photomatix Pro and the plugin now seem to have a much greater level of “color awareness” than they did a year ago.

Workflow Tips and Tricks

1.       Don’t forget to save your HDR file.

2.       Think of the tone mapped image as a starting point for your normal adjustment workflow.

3.       You can combine multiple tone mappings and source images using layers.

4.       Using a source image in a layer is a way to fix ghost images of things that move.

5.       Normal images where the lighting is dull and flat can be brought to life with tone mapping.  Try doing this with layers and adjusting the opacity and/or adding some masking.

6.       Experiment!

Other Software

Open source software:

Open source is typically harder to use than commercial software.  Frequently the major weakness is the documentation.  This will all run under Linux and probably on Apple computers.  I have only tried the Windows versions.

QTPFSGUI: (this is the Panotools of the HDR world – very capable, minimal documentation) http://qtpfsgui.sourceforge.net     doc at http://osp.wikidot.com/qtpfsgui-manual tutorial at  http://garmahis.com/tutorials/hdr-tutorial-free-software.  For parameters used by tone mapping algorithms see http://osp.wikidot.com/parameters-for-photographers

 IMPORTANT NOTE: To get the software you must go into the download page at the sourceforge find the current stable version and find the windows install file.  It is in the middle of a long list.  After you install it you must configure the directory (folder) it will use for temporary files.  It is under a preferences pick.

It does a good job merging to HDR.  (It uses the Panotools libraries).

Tone mapping offers extensive options, but is not easy to do.  Note that the very different results from different algorithms can be combined by using different layers.

Picturenaut 3: ( www.hdrlabs.com )

Relatively easy to install and use.  Still a bit of a work in progress.

Has some nice tone mapping algorithms.  Alignment is shaky – auto only.

I got good results using it to tone map HDRs made by QTPFGSGUI.

Hugin:  (www.hugin.sf.net) (aka panotools).   Panotools is the original base for most of the good stitching software available including PTGui.  Hugin is a relatively new open source graphical interface to the very powerful panotools library.  It is now stable enough for normal users.  It is a viable alternative to PTGui Pro.  The documentation is thin.

I have used it to stitch a pano from HDR files.

Commercial SW

Photomatix, CS4, PTGui Pro, and PhotoAccute all make excellent HDR images.

CS4 is MUCH better at image alignment than CS3.  CS3 is better than CS2.  CS4 extended version supports layers working directly with HDR files.  I have not tried it.

PTGui Pro makes nice HDR panos from bracketed sets.

Photomatix in my view is the best tone mapper.  Version 2 of PS plugin finally released in FEB 2010.  See www.stuckincustoms.com/hdr-tutorial/ for a 15% off coupon code.

HDR PhotoStudio (www.unifiedcolor.com) is a very different take on working with HDR.  It can create and edit HDR files.  It does its editing in 32bit mode.  The basic concept seem to be play with the sliders and finally save as a 16 bit tiff (or  jpeg), and then continue with Photoshop or whatever…. It has some nice features but seems to lack a clear focus on how to get to a useful standard output in a standard color space.  When I go to save a tiff, it offers to attach my monitor profile!  It crashed when I tried to edit the HDR pano. 

Most of the reviews I read are favorable and do not reflect the problems I have had.

PhotoAcute is an image stacking program that does a number of interesting things by stacking multiple images of the same subject.  Under favorable conditions it can virtually eliminate noise, build excellent focus stacks, increase dynamic range, eliminate moving objects from a scene, and double the linear pixel dimensions of an image (i.e. a 10mpix image becomes a 40mpix image) with increased visible detail.

See also http://wiki.panotools.org/HDR_Software_overview

Resources from www.hdrsoft.com/resources

References from www.hdrsoft.com/resources

 

FAQ on HDR images for photography

 

List of Auto Exposure Bracketing (AEB) settings by camera model.

Online articles and tutorials

 

Photomatix Pro tutorial by Ferrell McCollough, author of the "Complete guide to High Dynamic Range digital photography" book.

 

A Plea For HDR: Informative essay on the HDR technique and its critics by Alexandre Buisse on the Luminous-Landscape website.

 

HDR Tutorial from artist Trey Ratcliff.

 

Beginner's Guide to HDR

 

RAW HDR Processing: Using HDR techniques with a single RAW file (note: for most scenes, it is still highly recommended to take more than one exposure).

 

How to create 'High Dynamic Range' images using Photomatix by Pete Carr.

 

Tone Mapping in Photomatix and other HDR tutorials.

 

High Dynamic Range digital photography: Well documented article published in the Royal Photographic Society Journal, November 2006.

 

HDR Landscape Photography Tutorial: very comprehensive article covering both theoretical and practical aspects of HDR photography.