Hi All

I created a little script in order to generate the Hugin project file 
automatically for multiple pano images based on the wiki pages:
http://wiki.panotools.org/Panorama_scripting_in_a_nutshell

The script will create the ".pto" files for all pano images based on the 
file names.

Maybe is usefull for somebody...

*Assumptions\requisites:*
*Operating System:* MacOS
*Hugin:* 2014 (I didn't tried with a different version)
The script should be on the same folder than image files.
All the files that compon the same panoramic image, should end with the 
same pano number "Pano1", "Pano2", etc..

*Usage:*
1) Open script with a text editor and adapt this 2 lines with the number of 
panos (4 in this example) and the format of the images  (tif, tiff, jpg, 
jpeg, etc...)(jpg in this example)
export PANO_NUM_MAX=4
export FORMAT=jpg
2) Open terminal in MacOS and run:
./Hugin_pto_Generator.sh

*Input example:*
DSC001_Pano1.jpg
DSC002_Pano1.jpg
DSC003_Pano1.jpg
DSC004_Pano1.jpg

DSC030_Pano2.jpg
DSC031_Pano2.jpg
DSC032_Pano2.jpg

DSC067_Pano3.jpg
DSC068_Pano3.jpg
DSC069_Pano3.jpg
DSC070_Pano3.jpg
DSC071_Pano3.jpg

DSC089_Pano4.jpg
DSC090_Pano4.jpg
DSC091_Pano4.jpg
DSC092_Pano4.jpg
DSC093_Pano4.jpg
DSC094_Pano4.jpg

....

*Output example:*
DSC001_Pano1_DSC004_Pano1.pto
DSC001_Pano1_DSC004_Pano1.pto.log

DSC030_Pano30_DSC032_Pano2.pto
DSC030_Pano30_DSC032_Pano2.pto.log

DSC067_Pano3_DSC071_Pano3.pto
DSC067_Pano3_DSC071_Pano3.pto.log

DSC089_Pano4_DSC094_Pano4..pto
DSC089_Pano4_DSC094_Pano4..pto.log


Please find below the script. Copy the text, save it as a 
"Hugin_pto_Generator.sh" on the same folder of images, and grant it 
execution permissions (chmod +x :Hugin_pto_Generator.sh).
------------------------------------------------------------------------------------------------------------------------------
#!/bin/bash

#Setting Hugin Path"
export HUGIN_PATH="/Applications/Hugin/Hugin.app/Contents/MacOS/"

echo "*** Number of PANOS $PANO_NUM_MAX *** "
export PANO_NUM_MAX=4
export FORMAT=jpg

for PANO_NUM in $(seq 1 $PANO_NUM_MAX)
do
    
    echo "*** Setting PANO $PANO_NUM of $PANO_NUM_MAX *** "
    #Setting File Names"
    export PANO_FILES="$(ls *Pano$PANO_NUM.$FORMAT)"
    export PANO_FILES_TMP1="$(ls -1 *Pano$PANO_NUM.$FORMAT | head -n1 | cut 
-d . -f 1)"
    export PANO_FILES_TMP2="$(ls -1 *Pano$PANO_NUM.$FORMAT | tail -n1 | cut 
-d . -f 1)"
    export PANO_NAME=$(echo "$PANO_FILES_TMP1"_"$PANO_FILES_TMP2".pto)
    echo "*** Merging $PANO_FILES *** " >> $PANO_NAME.log
    echo "*** As a name of $PANO_NAME *** " | tee >> $PANO_NAME.log

    echo "*** Creating pto file *** " | tee >> $PANO_NAME.log
    $HUGIN_PATH/pto_gen -o $PANO_NAME $PANO_FILES >> $PANO_NAME.log

    echo "*** Finding control points *** " | tee >> $PANO_NAME.log
    $HUGIN_PATH/icpfind -o $PANO_NAME $PANO_NAME >> $PANO_NAME.log

    echo "*** Remove control points in clouds *** " | tee >> $PANO_NAME.log
    $HUGIN_PATH/celeste_standalone -t 0.5  -o $PANO_NAME -i $PANO_NAME >> 
$PANO_NAME.log

    echo "*** Statistical cleaning of control points *** " | tee >> 
$PANO_NAME.log
    $HUGIN_PATH/cpclean -o $PANO_NAME $PANO_NAME >> $PANO_NAME.log

    echo "*** Searching for vertical lines *** " | tee >> $PANO_NAME.log
    $HUGIN_PATH/linefind -o $PANO_NAME $PANO_NAME  >> $PANO_NAME.log

    echo "*** Checking all images are connected *** " | tee >> 
$PANO_NAME.log
    $HUGIN_PATH/checkpto $PANO_NAME >> $PANO_NAME.log

    echo "*** Optimise project *** " | tee >> $PANO_NAME.log
    $HUGIN_PATH/autooptimiser -a -m -l -s -o $PANO_NAME $PANO_NAME >> 
$PANO_NAME.log

    echo "*** Setting output options *** " | tee >> $PANO_NAME.log
    $HUGIN_PATH/pano_modify --canvas=70%% --crop=AUTO -o $PANO_NAME 
$PANO_NAME >> $PANO_NAME.log

done



-- 
A list of frequently asked questions is available at: 
http://wiki.panotools.org/Hugin_FAQ
--- 
You received this message because you are subscribed to the Google Groups 
"hugin and other free panoramic software" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/hugin-ptx/60610ff1-e8fb-4ec8-85e8-3b62a06ec3cb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to