Embed Hugin in my software

40 views
Skip to first unread message

Michael Schnell

unread,
Feb 19, 2026, 8:09:39 AM (6 days ago) Feb 19
to hugin and other free panoramic software
Question from a newbie to the experts: 
I want to embed (rather complex) panorama stitching fu8nctionality in a software project. 

(How) is it possible to call Hugin with a set of pictures (plus geometry specifications) in order to create a single "stitched" panorama picture, from a user program  (in Python or Rust) running on a headless Linux system ?
Thanks !

Paul Thompson

unread,
Feb 19, 2026, 8:19:13 AM (6 days ago) Feb 19
to hugi...@googlegroups.com
There are scripting commands for hugin which enable you to write Windows command-line programs. 


Paul A. Thompson

--
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 visit https://groups.google.com/d/msgid/hugin-ptx/5a222205-0b5a-4177-ae45-5460e79151d0n%40googlegroups.com.

Bruno Postle

unread,
Feb 19, 2026, 9:41:02 AM (6 days ago) Feb 19
to hugin and other free panoramic software
There's also a python API, that hasn't had much attention recently but worked last time I looked, it doesn't have all Hugin functionality.

Bruno

Michael Schnell

unread,
Feb 24, 2026, 4:37:49 PM (19 hours ago) Feb 24
to hugin and other free panoramic software
Thanks a lot for you kind replies ! This is very encouraging !
So let me describe what I am up to. 
I want to do an automatic (industrial) project (supposedly Rust software on an appropriate powerful Linux box).
At one point I have a folder with some 4000 pictures shot by an automatic apparatus. 
They are arranged in a grid of (e.g.) 4 * 1000 (each picture about 3000*2000 pixels) 
The location in the grid supposedly is very exactly known, but not perfect. Maybe 50 pixel and/or 1/2 degree "Jitter". 
They are shot completely planar and all in exactly the same distance from a plane holding the motive (but maybe some wide-angle distortion)
They will overlap by - say - 200 pixels in each direction. They will show rather sharp contours (e.g. pencil lines) 
It is essential that the result is a rectangle that is perfectly aligned with the average angle of the components. 
I found that it would be good to first stitch the many rows of four each, and then stitch the column of the about 1000 resulting rectangles.
I found that I should create "PTO" files with my software and start Hugin with those. 

Is this a viable ways to go ? 
Should the (possible) wide range distortion be eliminated by some other software before feeding the pictures to Hudin, or can Hudin  easily do this on the fly  ? 

I was told the process should take about 15 Minutes on a - say - 12 Core CPU with enough RAM and fast SSD. 

 Thanks again for any advice !
-Michael

wirz

unread,
Feb 24, 2026, 5:16:58 PM (18 hours ago) Feb 24
to hugi...@googlegroups.com
Hello Michael,

> They are shot completely planar and all in exactly the same distance from a
> plane holding the motive (but maybe some wide-angle distortion)

So the motive is completely planar and the camera moves relative to the
object? That's not a problem, but be sure to optimise the translation
parameters.

> They will overlap by - say - 200 pixels in each direction. They will show
> rather sharp contours (e.g. pencil lines)
> It is essential that the result is a rectangle that is perfectly aligned
> with the average angle of the components.

Up to rotation that should be the natural outcome. You can define
horizontal and vertical lines to bias the optimisation towards that.
Depending on the motive, and demands, maybe fiducial markers can be
considered.

> I found that it would be good to first stitch the many rows of four each,
> and then stitch the column of the about 1000 resulting rectangles.

I don't see an immediate reason to split the project, unless you are
running into hardware (memory) limitations. Otherwise I'd assume you're
better off with a single project containing all photos.

> Is this a viable ways to go ?
> Should the (possible) wide range distortion be eliminated by some other
> software before feeding the pictures to Hudin, or can Hudin easily do this
> on the fly ?

Assuming you are always using the same lens, I would recommend to
calibrate the lens / find the lens parameters and input them to hugin
(including the field of view). You can also optimise the lens
parameters together with the image positions but it's just more degrees
of freedom, ie, takes longer to optimise and it's easier to get bad
results.

best regards, lukas wirz

Michael Schnell

unread,
Feb 24, 2026, 5:36:43 PM (18 hours ago) Feb 24
to hugin and other free panoramic software

Great !
So Hugin can take lens parameters that sounds good. 
I don't understand define
horizontal and vertical lines to bias the optimisation. In fact this needs to be fully automatic. No GUI / manual interaction at all.just the grid of pictures with rather well known only minimally changing relative  locations and angles. 
Now the algorithm should optimize the grid by fitting the overlapping areas. 
Additional  question: maybe the grid is not really a rectangular grid but the colums are slightly shifted up respectively by a known bias. Can Hugin handle this or should the pictures be cut by a preprocessor ?  
Reply all
Reply to author
Forward
0 new messages