(This is a work in progress...)
Tools
The following tools are used in the tutorial or to create the input to this tutorial:
Software:
- HUGIN Panorama Tools GUI
- pfstools High Dynamic Range Image Processing
- PFStmo tone mapping operators
- PFScalibration photometric calibration of HDR and LDR cameras
- dcraw Raw Digital Photo Decoder
Hardware:
- Nikon D70
- Nodal Ninja Panoramaic Tripod Head
- HDR Fire Controller Automated HDR Camera Control.
Getting Started
Things you need:
- The above software installed properly.
- Some images to process. If you don't have any you can try the ones I used from here: http://www.sdwphotography.com/pano/sample.html. I did this using RAW files shot using the HDRFC rig on a good solid tripod at 1 2/3 stops apart. In reality 2 stops also would have been fine. Since this is just a tutorial there were only 4 different views in the panorama each with 8 HDR images(32 total).
- Some spare time, this isn't a fast process.
Processing:
Generally the first thing I do is convert all the files into full resolution TIFF using dcraw, I don't do any White Balance correction here so they all stay as the sensor recorded them and then color correct the final image as needed. The other option would be to force color correction but be sure not to use auto or similar which may make different images different colors.
dcraw -T -4 *.NEF
Then I create a base hdrgen file to use in various places.
dcraw2hdrgen *.NEF | sort >base.hdrgen
Next, I determine the 'best' exposure to feed into hugin/autopano so it can create a pto file with minimal manual intervention. I do this by visually inspecting the images. In this case that is the 0.033333 exposures in the hdrgen file. So, to copy all these into a single directory called workdir:
for i in `cat base.hdrgen | grep ' 0.0333333 ' | sed 's/NEF/tiff/' ` ; do cp $i workdir/ ; done
You can also just chose the images within hugin for those exposures if you don't want to copy them. But I find it easier with large panoramas to just select everything in a directory.
At this point, run hugin normally to create your panorama using the selected exposures. At the last step, where you'd usually actually stitch the panorama select the following options in the last tab: Set Panorama and Field of view as you want them. Choose stitch with custom settings, set the image size as you want. Stitching engine: nona. Output file format: multiple TIFF and compression as you want. Now, save the .pto file(File-Save) and exit hugin, don't stitch.
Now we create one .pto file for each exposure level we want to use. Look at your hdrgen file and make sure it looks like the files are grouped appropriately, you should have all the files for the different exposures of the first 'view' then the second, etc. Now, split the hdrgen file into a set of new hdrgen files: split -l X base.hdrgen hdrgen_x X is the number of exposures per 'view'
Check the resulting hdrgen_x?? files and make sure each reflects the proper number of exposures.
I've written a small perl script ptomaker.pl which will generate the 'new' PTO files from the base PTO file that you saved from hugin. It assumes the hdrgen files are named hdrgen_x?? and expects the .pto base file on the command line. It creates pto output files named nnn.pto where nnn is the last 3 digits of the DSC_0nnn for each exposure level in the hdrgen_xaa file. If your files are named differently you may need to correct this. It also assumes the files within each hdrgen are .NEF and the output files that you want to process are actually .tiff
So, I then run: ptomaker.pl base.pto
And get: 234.pto to 251.pto represnting how to stitch each exposure level.
Then I run nona on those pto files.
for i in 2??.pto ; do bn=`basename $i .pto` ; nona -o $bn $i ; done
The output files from nona are called nnnxxxx.tif so we run enblend on those files, I use the pto files as a key for the nnn part.
for i in 2??.pto ; do bn=`basename $i .pto` ; enblend -o $bn.tif $bn????.tif ; done
Now, if you're using my samples, you have 8 .tif files with the same name as the original .pto files each representing one exposure level. At this point I copy the hdrgen_xaa file to tif.hdrgen and edit it by hand so the DSC_0???.NEF file names are actually ???.tif to match the stitched files.
From here on out, it's standard HDR processing with pfstools.
pfsinhdrgen -v tif.hdrgen | pfshdrcalibrate -v --calibration none --bpp 16 --response linear >merged.pfs
I generally save the pfs file and then run the standard tone mapping against that file instead of reprocessing and recalibrating. i.e. pfsview <merged.pfs or pfstmo_durand02 <merged.pfs >merged-durand02.pfs and then view that file and convert. Also, for huge files you can scale down the pfs: pfssize -x 1600 <merged.pfs >merged-scale.pfs and then process the scaled file to get an idea of what looks best. Just be aware the tone mapping won't look exactly the same on the scaled versions as the full version so you'll likely need more tuning.