.bat file to run hugin

30 views
Skip to first unread message

Paul Thompson

unread,
May 16, 2023, 3:08:05 PM5/16/23
to hugin and other free panoramic software
I've created a .bat file to run hugin. This is a windows command-tool file. To run this, hugin needs to be on the environmental path, and imagemagick should be as well

.bat file 

rem Build panorama from call
rem Arg 1 - resultant file name
rem Arg 2 - name of files to be used in pano
rem
pto_gen  -o %1.pto %2.jpg
cpfind -o %1.pto %1.pto
celeste_standalone -i %1.pto -o %1.pto
cpclean -o %1.pto %1.pto
autooptimiser -a -l -s -m  -o %1.pto %1.pto
pano_modify --canvas=AUTO --crop=AUTO -o --center --straighten %1.pto
nona -m TIFF_m -o %1 %1.pto
enblend -o z%1.tif %100*.tif
del %1*.tif
rem convert z%1.tif -resize 7000x z%1r.jpg

To run this .bat file, you can do something like this:

pano_fix panores afile0*

That call would produce a panofile termed zpanores.tif.

In my use, I set up a .bat file to call the bat file:

convert file0436.jpg afile01.jpg
convert file0439.jpg afile02.jpg
 ..... convert more files 
call pano_fix panores afile0*

Paul A Thompson

Maarten Verberne

unread,
May 16, 2023, 4:18:47 PM5/16/23
to hugi...@googlegroups.com
i'm sure you have good reason for the elaborate approach, can you
explain what would be the advantage of what you are doing here compared
to the basic stitching approach.

nona -g -o out -m TIFF_m template.pto left/DSC_0001.JPG right/DSC_0001.JPG
enblend -o DSCWIDE_0001.gif --compression 100 out0000.tif out0001.tif

this is what i use as cmd for stitching images that are numbered equally
in left and right.
i just use the same template over and over with changing imagenumbers

Maarten




Op 16-May-23 om 21:08 schreef Paul Thompson:
> --
> A list of frequently asked questions is available at:
> http://wiki.panotools.org/Hugin_FAQ <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
> <mailto:hugin-ptx+...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/hugin-ptx/2c37233e-4007-46c1-afe0-7b3816269147n%40googlegroups.com <https://groups.google.com/d/msgid/hugin-ptx/2c37233e-4007-46c1-afe0-7b3816269147n%40googlegroups.com?utm_medium=email&utm_source=footer>.

PanoSeek

unread,
May 16, 2023, 4:55:34 PM5/16/23
to hugin and other free panoramic software
My personal use case for the pano script is to use hugin to stitch my 360 photo sets taken by my drone.  The drone software does it, but lowers the image quality and does not include GPS coords.  By scripting it, I can automate the process with hugin for a bunch of photo sets.  More detail on my case here - https://github.com/RookieITSec/HuginPanoScript

Maarten Verberne

unread,
May 16, 2023, 5:02:53 PM5/16/23
to hugi...@googlegroups.com
I would think the 360 photo sets would have an identical stitch pattern,
so one template file should be enough for all image sets.

i'm not sure though what the added value is for what happens before nona
in your script.
or how you are including the gps coordinates.

Op 16-May-23 om 22:55 schreef PanoSeek:
> https://groups.google.com/d/msgid/hugin-ptx/2c37233e-4007-46c1-afe0-7b3816269147n%40googlegroups.com <https://groups.google.com/d/msgid/hugin-ptx/2c37233e-4007-46c1-afe0-7b3816269147n%40googlegroups.com> <https://groups.google.com/d/msgid/hugin-ptx/2c37233e-4007-46c1-afe0-7b3816269147n%40googlegroups.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/hugin-ptx/2c37233e-4007-46c1-afe0-7b3816269147n%40googlegroups.com?utm_medium=email&utm_source=footer>>.
>
> --
> A list of frequently asked questions is available at:
> http://wiki.panotools.org/Hugin_FAQ <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
> <mailto:hugin-ptx+...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/hugin-ptx/13077eac-d3b1-4ef8-988b-cf56a4541ec0n%40googlegroups.com <https://groups.google.com/d/msgid/hugin-ptx/13077eac-d3b1-4ef8-988b-cf56a4541ec0n%40googlegroups.com?utm_medium=email&utm_source=footer>.

T. Modes

unread,
May 17, 2023, 12:21:04 PM5/17/23
to hugin and other free panoramic software
patj...@gmail.com schrieb am Dienstag, 16. Mai 2023 um 21:08:05 UTC+2:
I've created a .bat file to run hugin. This is a windows command-tool file. To run this, hugin needs to be on the environmental path, and imagemagick should be as well

pano_modify --canvas=AUTO --crop=AUTO -o --center --straighten %1.pto

This command is not doing what you think it does. The -o switch requires a filename - so the result of this command is written to a file --center and the --center command is not done.
Look at the output of the commands. You should be see something like:
Written output to --center

(Do not simply copy and paste. Try to understand to commands and look also at the output, it can contain a lot of additional information. Otherwise there are more high level functions available - see below.)

rem convert z%1.tif -resize 7000x z%1r.jpg
Not sure what you doing here. Instead of creating a pano and then resize it adjust the pano_modify command to get the final size in one go.
 
In my use, I set up a .bat file to call the bat file:

convert file0436.jpg afile01.jpg
convert file0439.jpg afile02.jpg
 ..... convert more files 
Why this? Converting a jpg file will require a new re-compression and this will degrade the image quality.
So rename the file only or copy it.
Or more easily Hugin can also handle non consecutive numbered image. So there is no need to rename the files.

But a final remark: I don't understand what you try to achieve. PTBatcherGUI has already a lot of functions for automatic running assistant and stitching.
Activate option stitch after assistant in PTBatcherGUI and then
pto_gen -o %1.pto %2
ptbatchergui --assistant %1.pto

Even if you don't want to use PTBatcherGUI the whole script can be simplified to a three liner
pto_gen  -o %1.pto %2
hugin_executor --assistant %1.pto
hugin_executor --stitching --prefix=z%1 %1.pto


Reply all
Reply to author
Forward
0 new messages