Command-line tool sequence to emulate GUI process

33 views
Skip to first unread message

Paul Thompson

unread,
Apr 28, 2023, 1:48:12 AM4/28/23
to hugin and other free panoramic software
I have been studying the multiple command-line tools to try to emulate the sequence of operations in the GUI Assistant mode. 

Load image (and create .pto)
pto_gen -o file.pto xxx*.jpg

Align ...
cpfind -o file.pto file.pto

Create panorama
Here I break down and get confused. There seem many options, and many partial solutions. Trying a variety, I do get a pano file, but it is 1/1000th the size of the GUI-produced file.

What I have tried is 
cpclean -o %1.pto %1.pto
linefind -o %1.pto %1.pto
rem autooptimiser -a -l -s -m -o %1.pto %1.pto
rem pano_modify --canvas=AUTO --crop=AUTO -o %1.pto %1.pto
nona -m TIFF_m -o %1 %1.pto
enblend -o zp_%1.tif %10*.tif
enfuse -o zp_%1.tif %10*.tif
rem del %10*.tif
convert zp_%1.tif -resize 7000x zp_%1r.jpg

1) Is there a way to get the sequence of commands output from the hugin GUI?

2) Is there a standard tool processing algorithm defined somewhere?

Paul A. Thompson

PanoSeek

unread,
Apr 28, 2023, 8:57:21 AM4/28/23
to hugin and other free panoramic software
I did something similar to stitch 360 panos from my drone.  I wanted to do as much scripting as possible to avoid manual work when I have hundreds of sets to stitch.  So far this has been working well.   More here - https://github.com/RookieITSec/HuginPanoScript

Script -


REM 2023-02-03- This script is being built to take a folder full of folders containing groups of .jpg photos from the drone 360 photo tool and export a 2:1 aspect ration photo to be uploaded to google Maps/Streetview.

REM Guide followed located here - https://wiki.panotools.org/Panorama_scripting_in_a_nutshell#Creating_hugin_projects_on_the_command-line



REM Hugin needs to be installed here C:\Program Files\Hugin

REM - This script is being called by the deployment script. The Deployment script copies this to each folder in the specified directory and then executes it. All sub-folder tasks will run at the same time, so it will take a bit of time when doing many panos.



REM - MAKE SURE YOU DO NOT HAVE ANY NON-PANO IMAGES IN THE FOLDER. THE SOFTWARE TRIES TO EAT THEM AND ADD TO YOUR PANO.



REM - set the name of the variable we will be using. This will be the name of the directory the file is in.

@echo off

for %%I in (.) do set "current_folder=%%~nxI"

echo The current folder is: %current_folder%



REM Build the PTO file with the contents of the directory we are currently in.

"C:\Program Files\Hugin\bin\pto_gen" *.jpg -o %current_folder%.pto

REM Figure out how to rename the pto file to the parent folder name. Remember to tweak the file name below if this changes.



REM Create Control Points in the existing pto file

"C:\Program Files\Hugin\bin\cpfind" --celeste -o %current_folder%.pto %current_folder%.pto


REM Clean up the control points

"C:\Program Files\Hugin\bin\cpclean" -o %current_folder%.pto %current_folder%.pto


REM Find Vertical Lines

"C:\Program Files\Hugin\bin\linefind" -o %current_folder%.pto %current_folder%.pto


REM Optimize

"C:\Program Files\Hugin\bin\autooptimiser" -a -l -s -m -o %current_folder%.pto %current_folder%.pto


REM Optimize Version 2 -

REM "C:\Program Files\Hugin\bin\pto_var" --opt Vb,Vx,Ra,Eev -o %current_sfolder%.pto %current_folder%.pto

REM "C:\Program Files\Hugin\bin\vig_optimize" -o %current_folder%.pto %current_folder%.pto

REM version 2 was far worse.


REM set output/stitcher options

"C:\Program Files\Hugin\bin\pano_modify" -o %current_folder%.pto --fov=360x180 --center --straighten --canvas=9000x4500 --ldr-file=JPG --ldr-compression=100 --output-exposure=AUTO %current_folder%.pto


REM After the pause, it will attempt to stitch.

REM pause


REM Stitch the output - un-rem the next line if you want the script to stitch right away. I had too many at once so I moved over to the batch tool, which is the command below.

REM "C:\Program Files\Hugin\bin\hugin_executor" --stitching --prefix=%current_folder% %current_folder%.pto


REM send to batch to run sequentially.

"C:\Program Files\Hugin\bin\PTBatcherGui.exe" --batch %current_folder%.pto



REM Rename the output to the date it was captured to help clarify the filename.

REM "C:\Program Files\Hugin\bin\exiftool" "-filename<CreateDate" -d %Y%m%d_%H%M%S%%-c.pano.%%le pano.jpg

REM This does not work for some reason?


REM - Figure out how to get rid of black blocks- maybe adding enblend "-l 29" will help?

Harry van der Wolf

unread,
Apr 29, 2023, 2:55:34 AM4/29/23
to hugi...@googlegroups.com

Op vr 28 apr 2023 om 14:57 schreef PanoSeek <rod.b...@gmail.com>:
--
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 hugin-ptx+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hugin-ptx/dadab767-5f9b-4f88-8081-5ed69ccdbb59n%40googlegroups.com.

Paul Thompson

unread,
Apr 29, 2023, 5:08:56 PM4/29/23
to hugin and other free panoramic software
Finally did find that. Following those steps, things seem to work. I still cannot understand why an image created by the GUI is of a different size than the image by the command line tools.

I also find that the edges of the pano need to be cleaned up.

Paul

Reply all
Reply to author
Forward
0 new messages