I sometimes need to blend Hugin panoramas partly manually for best
results, for example moving water. I like Gimp's layer masks but find
its 8 bit limitation problem since I want a 16 bit tiff as end result,
so I can adjust colors, exposure etc after the panorama has been
assembled.

Here's a trick to workaround gimp's limitation, using imagemagick and
libtiff tools (also free software). This workflow allows for hand-made
Gimp blending through layer masks, but you cannot do retouching like
clone/heal and such stuff, if required that must be left to a final 8
bit step.

I use Rawtherapee here as raw handling software (free), but you could
be using something else.

The workflow for blending panorama output from Hugin is a bit extra
complicated (compared to just blending normal images) due to cropped
tif images with canvas size larger than the image itself which neither
Gimp or Imagemagick handles well, so one have to do some extra steps.
For 16 bit panorama editing and blending a 64 bit system with lots of
RAM (8 gig or more) is recommended. The TIF files easily get larger
than a gig.

1. Take photos for your panorama
   - It's ok to have different exposure on different parts of the
     panorama, just make sure there is sufficent overlap so Hugin
     can figure out exposure.
   - Wide overlap also makes it easier to resolve difficult fitting,
     since there's a larger area to do blending in.
2. Develop to 16 bit tiff in RawTherapee, with minimal conversion
   settings
   - Use a wide gamut icc on output (for example prophoto), so color
     space selection can be left to later.
   - No sharpening, no curves, no exposure correction, no black level
     adjustment etc
       - If you want deconvolution sharpening is however preferably
         applied here on the individual images.
   - No lens distortion correction necessary, Hugin has that built in.
   - Enable Highlight reconstruction. This may alter exposure a
little
     but Hugin can deal with this.
   - CA correction, noise reduction if necessary is ok to apply here.
3. Use Hugin to make the panorama.
   - Hand-made control points often superior to auto, especially in
     difficult conditions (stuff moving in the pictures)
   - Use the image with the brightest highlights as Exposure Anchor
to
     avoid clipping
   - Select "Remapped images: Exposure corrected, low dynamic range"
as
     output. Disable any panorama output, it won't be needed.
       - Or maybe you want stitched output too, it may be nice to use
         as base and do manual blends only on the difficult parts.
   - Cropped tiff output from Nona should be enabled (default).
     Unfortunately most tiff programs don't handle cropped tiffs well
     either and this workflow becomes much more messy with it, but it
     is worth it from a memory consumption perspective (gimp consumes
     a lot less memory with cropped layers).
4. Make multipage tiff from Hugin output, using tiffcp.
   - Example command: tiffcp ho-0001.tif ho-0002.tif ... ho-000N.tif
     multipage.tif
   - Multipage tiff is required for Gimp to open all layers with
     correct offsets and canvas size.
5. Blend the panorama using Gimp
   - If not already done, in preferences increase the allowed RAM
     consumption to say 80% of your RAM, hopefully several gigabytes.
     Gimp becomes very slow to work with if RAM cache is too small.
   - Open the multipage tiff, pages as layers. Convert to 8 bit (will
     be done automatically), but keep color space.
       - If you by some reason only want a subset of the layers, still
         open all layers so that you get the correct canvas size, and
         then remove unwanted layers.
   - Blend the images in Gimp using layer masks until satisfactory
     panorama stitching is achieved
   - Save each layer as an individual tiff. Next version of Gimp will
     probably support multilayer tiff which will make this step less
     cumbersome. There are also some scripts out there to save layers
     as tiffs.
   - The layer mask should be transferred to the tiff alpha channel
     (default).
6. Make flat versions of Hugin tif output to be used for alpha channel
   application.
   - This is messy but necessary due to poor canvas/offset handling in
     imagemagick/gimp.
   - You need to know Hugin canvas size and top/left offset, this can
     be seen in the Hugin project, or be calculated from the tif,
     use tiffinfo to get information:
        ImageFullWidth: 12229 (canvas x size)
        ImageFullLength: 16187 (canvas y size)
        Resolution: 150, 150 pixels/inch
        Position: 11.5133, 17.7667 (x offset = resolution * 11.5133 =
        150 * 11.5133 = 1727 pixels)
   - You also need the crop size, can be found out in Gimp or Hugin
     project.
   - Make flat, cropped and repaged versions of the hugin output
     layers, the canvas size, offset and crop must be given because
     imagemagick does not get it:
     "convert ho-0000.tif -page 12229x16187 -flatten \
      -crop 8736x12291+1727+2665 +repage flat-0000.tif"
7. Apply the alpha channel from the Gimp output on the original 16 bit
   Hugin output, using Imagemagick
   - "composite -compose Dst_In ho-0000-gimp.tif flat-0000.tif  \
      masked-0000.tif"
   - The masks will of course be 8 bit and up-converted to 16 bit,
but
     this is no problem for image quality, since blending is dithered
     and the actual blended image data is 16 bit.
8. Combine the masked 16 bit output to one large tiff
   - Note that layers must be combined in the same order as they are
in
     gimp. Use the same ordering throughout the workflow.
   - Imagemagick requires huge amounts of memory if all layers are
     combined at once. You may need to do it a few layers at a time.
     Example convert 1.tif 2.tif 3.tif -flatten s1.tif
             convert s1.tif 4.tif 5.tif -flatten s2.tif
             ...
             convert sN X.tif Y.tif -flatten pano.tif
9. Final processing in RawTherapee
   - Color correction, exposure correction, sharpening, shadows/
     highligths etc
   - This final processing step does not alter the 16 bit panorama
tif
     so it can be made over and over again with different settings,
     which is a key feature of this workflow.

I hope someone finds it useful. Improvements to the workflow or tips
of other programs that can do this in a simpler way are also welcome.

-- 
You received this message because you are subscribed to the Google Groups 
"Hugin and other free panoramic software" group.
A list of frequently asked questions is available at: 
http://wiki.panotools.org/Hugin_FAQ
To post to this group, send email to hugin-ptx@googlegroups.com
To unsubscribe from this group, send email to 
hugin-ptx+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/hugin-ptx

Reply via email to