16bit workflow with hugin

From PanoTools.org Wiki
Revision as of 17:20, 19 October 2005 by Bruno (Talk)

Jump to: navigation, search

This tutorial doesn't cover reasons why you might want to shoot with RAW and stitch in HDR format. It is a simple HOWTO listing the tools available and how to use them with hugin.


Preparing the HDR images

Start by using dcraw to read the RAW files and batch convert them into portable 16bit per channel PPM files. RAW pictures from my Nikon 8700 have a .nef extension, so the command looks something like this:

 dcraw -v -4 dscn*.nef

These PPM files are not readable by hugin or nona, so the next step is to use ImageMagick to create 16bit per channel TIFF files:

 convert -rotate 270 dscn3088.ppm dscn3088.tif
 convert -rotate 270 dscn3089.ppm dscn3089.tif

Note that I rotated them at the same time since these are portrait shots.

Stitching with hugin

The TIFF images can be loaded into hugin as per usual with a couple of caveats:

  • Everything will appear very dark since our images represent linear sensor data.
  • Information about the field of view was lost during the PPM stage, so this will need to be re-entered manually or re-optimised with PTOptimizer.

Stitch the images as per usual into a TIFF file, you can use enblend as the final step.

Post processing

This TIFF file is in 16bit per channel RGBA format. Again this will appear very dark in most image viewers (if they manage to open it), so you need an extra step to create the final 8bit per channel human-readable images.

Gamma adjustment

Sometimes all that is needed is to adjust the gamma and save, this ImageMagick command will output a usable JPEG image:

 convert -gamma 2.2 stitch.tif stitch.jpg

Adjusting by eye

Open the TIFF file in a HDR aware image editor such as cinepaint, tweak the levels by eye, retouch and save in an 8bit per channel format such as JPEG.

Alternatively, use pfstools to manipulate the image.

pfstools has the facility to read HDR TIFF files, unfortunately it chokes on the alpha channel created by nona and enblend, so you have to strip this out first. You can do this by converting to PPM format using ImageMagick:

 convert stitch.tif stitch.ppm

This can be viewed with the pfsview GUI tool:

 pfsinppm stitch.ppm | pfsview

A quick way to create a usable 8bit per channel image is to select a gamma of 2.2, fit to dynamic range, zoom 1:1 and save as PNG.

Tone mapping

A related package to pfstools called pfstmo can do automatic tone mapping of a HDR image and compress it into a low dynamic range output. There are many options and techniques available, commands look like this:

 pfsinppm stitch.ppm | pfstmo_drago03 | pfsgamma -g 2.2 | pfsout stitch.png
Personal tools