Multi-threading with autopano-sift

From OSP Wiki

Jump to: navigation, search

By immauss

This is the script I use to start a panorama using autopano-sift and Hugin. The script was born mainly because autopano-sift is not multi-threaded and I have a dual processor computer. It annoyed me that I wasn't using both processors.

Basic operation

  1. First, edit the script for you autopano-sift installation directory. (I installed it in /opt/sift/bin/)
  2. copy the script to a directory in your path and make it executable. (I put all of my scripts in /usr/local/bin/ or ~/bin/ )
  3. Copy the files you want to build a pano from into a temporary directory.
  4. Run the script.
  5. The script is setup to make a pano by default from raw files. I you are using jpg, then start it with the -jpg option.
  6. If you are using raw files, make sure you are COPYING the files to a temp directory. The script is setup to remove the raw files after conversion since they take up loads of space. (and I'm running low on space)
  7. The script will automatically start hugin and open the resulting .pto file.

Any questions, drop me a line: scott(somewhere close to)knauss.com

Script code

#!/bin/bash
MONO="/opt/sift/bin/"
if [ "x$1" = "x-jpg" ]; then
	odds=`ls *[13579].jpg`
	evens=`ls *[02468].jpg`
else 
	odds=`ls *[13579].raw`
	evens=`ls *[02468].raw`
	for x in $odds;  do echo "Converting $x from raw to tif"; ufraw-batch --out-type=tiff8 --zip $x; done &
	for x in $evens; do echo "Converting $x from raw to tif"; ufraw-batch --out-type=tiff8 --zip $x; done 
	echo "Done"
	
	while  pgrep ufraw-batch ; do
		echo "Waiting for ufraw to finish"
		sleep 5;
	done
	echo "Cleaning up the Raw files for space conservation"
	rm -v *.raw

	odds=`ls *[13579].tif`
	evens=`ls *[02468].tif`
fi

for x in $odds; do echo "Generating keys for $x"; mono $MONO/generatekeys.exe $x $x.xml.gz 1200; done &
for x in $evens; do echo "Generating keys for $x"; mono $MONO/generatekeys.exe $x $x.xml.gz 1200; done 
echo "Done"
#Wait for all of the genkeys to finish
while  pgrep mono ; do
	echo "Waiting for keys to finish"
	sleep 5;
done

keys=`ls *.xml.gz`
echo $keys
mono $MONO/autopano.exe --maxmatches 12 --refine-by-mean --keep-unrefinable 0 output.pto $keys

hugin output.pto &
Personal tools