16bit workflow with hugin

From PanoTools.org Wiki
(Difference between revisions)
Jump to: navigation, search
m (HDR workflow with hugin moved to 16bit workflow with hugin: Not really HDR as noted in [http://thread.gmane.org/gmane.comp.graphics.panotools/38135/ this discussion thread])
m (HDR stuff needs to go in a separate tutorial)
Line 1: Line 1:
 
This tutorial doesn't cover reasons why you might want to shoot with [[RAW]] and
 
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
+
stitch in 16bit format.  It is a simple HOWTO listing the tools available and how
 
to use them with hugin.
 
to use them with hugin.
  
== Preparing the HDR images ==
+
== Preparing the 16bit images ==
  
 
Start by using [[dcraw]] to read the [[RAW]] files and batch convert them into portable 16bit per
 
Start by using [[dcraw]] to read the [[RAW]] files and batch convert them into portable 16bit per
Line 9: Line 9:
 
command looks something like this:
 
command looks something like this:
  
   dcraw -v -4 dscn*.nef
+
   dcraw -v -w -4 dscn*.nef
 +
 
 +
Note that although [[hugin]], [[nona]] and [[enblend]] support floating-point data, there is no real loss
 +
converting [[RAW]] data to 16bit colour depth as [[RAW]] images are typically only 12bit in the
 +
first place.
  
 
These [[PPM]] files are not readable by [[hugin]] or [[nona]], so the next step is to use
 
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:
 
[[ImageMagick]] to create 16bit per channel [[TIFF]] files:
  
   convert -rotate 270 dscn3088.ppm dscn3088.tif
+
   convert -rotate 270 -gamma 2.2 dscn3088.ppm dscn3088.tif
   convert -rotate 270 dscn3089.ppm dscn3089.tif
+
   convert -rotate 270 -gamma 2.2 dscn3089.ppm dscn3089.tif
 
   ...
 
   ...
  
Note that I rotated them at the same time since these are [[portrait]] shots. Also, note that
+
Note that I rotated them at the same time since these are [[portrait]] shots.
although [[hugin]], [[nona]] and [[enblend]] support floating-point data, there is no real loss
+
Gamma correction is also applied at this stage since [[RAW]] data is generally linear
converting [[RAW]] data to 16bit colour depth as [[RAW]] images are typically only 12bit in the
+
and difficult to view without colour profile management (not yet supported by [[hugin]]).
first place.
+
 
 +
You can now delete the intermediate [[PPM]] files.
 +
 
 +
Alternatively [[ufraw]] can be used for the entire conversion from [[RAW]].
 +
 
 +
If necessary, correct [[chromatic aberration]] and [[vignetting]] with [[fulla]] at this stage.
  
 
== Stitching with hugin ==
 
== Stitching with hugin ==
  
The [[TIFF]] images can be loaded into [[hugin]] as per usual with a couple of caveats:
+
The [[TIFF]] images can be loaded into [[hugin]] as per usual except:
  
* 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]].
  
* 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]].
+
[[autopano-sift]] currently only supports 8bit per channel images, so if
 +
you want to use this tool then you need to create temporary 8bit versions of each
 +
image, generate control-points and then replace the images with the full version.  Create
 +
the 8bit files by adding ''-depth 8'' to the ''convert'' command-line above.
  
 
Stitch the images as per usual into a [[TIFF]] file, you can use [[enblend]] as the
 
Stitch the images as per usual into a [[TIFF]] file, you can use [[enblend]] as the
Line 36: Line 48:
 
== Post processing ==
 
== Post processing ==
  
This [[TIFF]] file is in 16bit per channel RGBA format.  Again this will appear
+
This [[TIFF]] file is in 16bit per channel RGBA format, which is not viewable in most image
very dark in most image viewers (if they manage to open it), so you need an extra
+
viewers or web-browsers, so there is an extra step to create final 8bit per channel images.
step to create the final 8bit per channel human-readable images.
+
So open the file in a 16bit aware image editor such as [[cinepaint]] or [[krita]], tweak the
 
+
=== 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 -depth 8 stitch.tif stitch.jpg
+
 
+
=== Adjusting in a GUI tool ===
+
 
+
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]].
 
levels by eye, retouch and save in an 8bit per channel format such as [[JPEG]].
 
[http://www.koffice.org/krita/ Krita] is another image editor (Linux only) that can read [[HDR]] files.
 
 
[http://www.vips.ecs.soton.ac.uk/ VIPS] is an image processing system with a GUI that can be used to manipulate [[HDR]] images.
 
 
The standalone [[UFRaw]] GUI should be able to read these [[TIFF]] files and allow sophisticated
 
conversion to low [[dynamic range]] 8bit formats.
 
 
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
 
  
 
[[Category:Tutorial]][[Category:Tutorial:Specialised]]
 
[[Category:Tutorial]][[Category:Tutorial:Specialised]]

Revision as of 15:01, 27 April 2006

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

Preparing the 16bit 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 -w -4 dscn*.nef

Note that although hugin, nona and enblend support floating-point data, there is no real loss converting RAW data to 16bit colour depth as RAW images are typically only 12bit in the first place.

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 -gamma 2.2 dscn3088.ppm dscn3088.tif
 convert -rotate 270 -gamma 2.2 dscn3089.ppm dscn3089.tif
 ...

Note that I rotated them at the same time since these are portrait shots. Gamma correction is also applied at this stage since RAW data is generally linear and difficult to view without colour profile management (not yet supported by hugin).

You can now delete the intermediate PPM files.

Alternatively ufraw can be used for the entire conversion from RAW.

If necessary, correct chromatic aberration and vignetting with fulla at this stage.

Stitching with hugin

The TIFF images can be loaded into hugin as per usual except:

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.

autopano-sift currently only supports 8bit per channel images, so if you want to use this tool then you need to create temporary 8bit versions of each image, generate control-points and then replace the images with the full version. Create the 8bit files by adding -depth 8 to the convert command-line above.

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, which is not viewable in most image viewers or web-browsers, so there is an extra step to create final 8bit per channel images. So open the file in a 16bit aware image editor such as cinepaint or krita, tweak the levels by eye, retouch and save in an 8bit per channel format such as JPEG.

Personal tools
Namespaces

Variants
Actions
Navigation
tools
Tools