hdrprep

Tutorial

This exposure-bracketed sequence was taken at the 2006 Tall Ships Race in Lisbon. It's a brass disc depicting a sun which is attached to the tip of the bowsprit of the Capitan Miranda from Uruguay.

! Before you read any further: This tutorial does not teach you how to create HDR images. It merely demonstrates the use of hdrprep. You should know how to turn exposure-bracketed image sequences into an HDR, for instance with the excellent pfstools.

1 2 3
4 5 6
7 8 9
Exposure-bracketed image sequence of the bowsprit of the Capitan Miranda.

The shots were taken with a Nikon 990 and a 3x tele converter TC-E3ED atop a rather cheap and nasty tripod with full zoom. That means that not only was the camera anything but stable, but the ship moved around quite a bit despite being moored to the quay. This little animation will make this quite clear:

animation
Animation showing the movements of camera and ship.

If you have assembled High Dynamic Range images from exposure-bracketed sequences before, you will appreciate that this is extremely challenging material to deal with. The individual frames need to be aligned for the response curve calibration to work. This particular sequence is actually the reason why I sat down and wrote hdrprep in the first place.

Although with less complicated sequences, we can just run hdrprep and expect a reasonable result, the challenge here is so enormous that the images required some preparation.

First of all, open one of the images in The Gimp, pick up the Crop tool, and select the region that you want registered. It is clear that you can't have both, the background and the brass sun, since they move about relative to one another too much. Don't actually crop the image, just note down the width, height, x and y origin of the area you selected.

cropping
Working out the crop in Gimp.

Now use ImageMagick to crop all images:

$ mkdir cropped
$ for f in DSCN85*.JPG; do convert -crop 837x666+438+363 $f cropped/$f; done
1 2 3
4 5 6
7 8 9
Images after the first crop.

Take a look at all images. Depending on how much the details shifts, you might have to re-crop with different dimensions and/or offsets.

Now you are ready to call hdrprep to register the frames. If you are not happy with having the new images under ./aligned, you may supply a different directory with the -d|--directory option.

$ cd cropped
$ hdrprep --align --verbose --keep --quality 80 DSCN85*.JPG

If you know that there are problems with your HDR software and the EXIF headers from you camera, you should also include the --exif option, which fixes non-standard EXIF information.

1 2 3 4
5 6 7 8 9
Registered image sequence.

If everything went fine, all images should by now be perfectly registered. In case something went wrong, the first place to check is the directory of the new images. Remember, it defaults to './aligned' but may be overwritten with the --directory option. In here, you'll not only find the registered images and transform files, but also intermediate output from ALE.

hdrprep actually calls ALE with pairs of images, and the results of these processes are kept if hdrprep is run with --keep. The intermediate images, which are of no interest in terms of HDR, may be inspected, and will indicate if any two images could not be registered properly. If this is the case, you could try and re-crop the images to bring out the region of interest a bit better by reducing the visible background, or you could even remove one or both of those offending images from the sequence.

detail
Example ALE output. Note the shift required to register the detail in the foreground.

If all you're after is the detail of the brass disk in your HDR, you can now proceed with your HDR software. If, however, you'd like to turn the full-sized image into an HDR, another step is necessary.

The transformation files created by ALE can also be used to register the original, full-sized frames. All you need to do is copy them into a new directory, and run hdrprep with the originals using this directory. Make sure you replace the --align option with --redo.

$ cd ..
$ mkdir aligned1
$ cp cropped/aligned/ale_align.trans? aligned1/
$ hdrprep --redo --directory aligned1 --verbose --keep --quality 80 DSCN85*.JPG
detail  miranda
Normalised HDR of the detail and the uncropped image.

Feel free to download an HDR version of the above:

Just for your information: There is also an HDR version of the common JPEG file format. Trouble is that in order to download the codec, you have to sign an agreement that very much sounds like 'If you download this software, your Soul belongs to us'. For this reason, a JPEG-HDR version is not included above, although it promises to deliver much smaller file sizes, and also to be backward-compatible with existing software (no link included).

That's all. I hope you could follow this little tutorial, and that you find hdrprep useful.