[ptx] Processing RAW files for use in hugin
Bruno Postle
bruno at postle.net
Wed Jul 26 11:53:27 BST 2006
Attached is the current version of the shell script I use to process
my camera RAW files.
Basically, it creates a rotated deflate-compressed 16bit TIFF file
that is gamma, tca and vignetting corrected. I rotate it because I
typically shoot portrait orientation.
You will need to determine your own TCA and vignetting parameters as
mine will probably make your images worse rather than better:
http://hugin.sourceforge.net/tutorials/tca/
It also copies over any EXIF metadata, bzips the RAW file and
creates a JPEG proof. The idea is to create control points with the
JPEG files, which load quicker and work with autopano-sift, I just
modify the filenames in the .pto file before final stitching with
the TIFF files themselves. After that I delete the JPEG and TIFF
files as they are easily recreated.
You will need dcraw, ImageMagick, fulla (from a recent version of
hugin), libtiff, exiftool and bzip2.
--
Bruno
#!/bin/sh
# Takes camera RAW files, creates rotated zip compressed TIFF files.
# Corrects gamma, tca and vignetting for Nikon D100 / peleng 8mm.
# IMPORTANT: Change the fulla parameters to suit your equipment
# Bruno Postle 2006-07-20
for FILE
do
STUB=`echo $FILE | sed 's/\([[:alnum:]]\)\..*/\1/'`
chmod -x $FILE
dcraw -z $FILE
# Import the RAW file
dcraw -w -4 $FILE
# Create a rotated and gamma corrected TIFF file
convert -rotate '270' -gamma '2.2' $STUB.ppm rotate.$$.tif
# Correct TCA and vignetting
fulla -r 0:0:0.0005628:1.0001510 \
-b 0:0:-0.0002598:1.0010922 \
-c 1:0.198:-0.509:0.2 \
-i 2.2 \
-o tca.$$.tif \
rotate.$$.tif > /dev/null 2> /dev/null
# Deflate compress the TIFF file
tiffcp -c zip tca.$$.tif zip.$$.tif
mv zip.$$.tif $STUB.tif
# Create a JPEG 'proof'
convert -depth 8 $STUB.tif $STUB.jpg
# Transfer metadata lost in PPM stage
exiftool -q -q -tagsfromfile $FILE \
-overwrite_original_in_place \
-exif:all -author=$USER $STUB.tif $STUB.jpg
touch --reference=$FILE $STUB.tif $STUB.jpg
# Clean-up temporary files
rm $STUB.ppm rotate.$$.tif tca.$$.tif
# Compress the RAW file, we don't need it any more
bzip2 $FILE
echo "Created $STUB.tif, $STUB.jpg `date`"
done
More information about the ptx
mailing list