Hugin. Script to automate stitching of tiled images on a fixed pattern of rows and columna

27 views
Skip to first unread message

Claudio Rocha

unread,
Aug 17, 2022, 7:05:36 PMAug 17
to hugin and other free panoramic software
I have a camera mounted on a rail, so that I can digitize large pieces of flat artwork. The rail allows me to shoot a series of pictures parallel to the surface of the canvas, basically acting like a very large format scanner.
To stitch them together the pictures into a huge file I use Hugin.

As an example I have is 5 columns (say 1 to 5) and 6 rows of images (say A to F). 

If I do the automatic control point finding there are endless errors, as I end with false control points on images that have no overlap.

I've tried cp_find --multirow, but even then the program tries to match each image with many others, not only slowing the process but creating many points that have to be cleaned up manually.

What I would love is to create control points only for the images that are next to each other and no others, so that each image will only be connected with control points to max of 4 of the adjacent pictures. something like: A1-A2-B1, then A2-A3-B2, then A3-A4-B3 and so on... 

I've been creating the control points manually, selecting pairs of images on the same row, clicking on the "create control points" button, and then going over the same process for the columns. The results quite accurate with this workflow.  
I would love to create a script that automates  all this, as it is tiresome to process 30 images per project (and I have several paintings to digitize)
 I can't find information on how to create such a template. Any ideas are welcome.

David W. Jones

unread,
Aug 17, 2022, 10:45:44 PMAug 17
to hugin-ptx
I don't know anything about scripting this, but does the --linearmatch
option handle matching images better? That matches image 1-2, 2-3, 3-4,
4-5, etc.

I don't know what it would do when it hit the end of each row. I suppose
it might try to match images 5 and 6 (end of one row, start of next).
Not what you want.

Perhaps you could precede these steps by using pto_gen to generate a
separate PTO file for each row of images, run cpfind's --linearmatch on
each separate PTO file, then use pto_merge to merge the resulting PTO
files all into a single project file.

Ideas?

--
David W. Jones
gnome...@gmail.com
wandering the landscape of god
http://dancingtreefrog.com
My password is the last 8 digits of π.

Claudio Rocha

unread,
Aug 17, 2022, 10:52:01 PMAug 17
to hugin and other free panoramic software
Thanks for the idea @GnomeNomad. I guess it makes sense to get at least the rows taken care of that way...
Right now I'm trying to understand the file structure of the .pto files to see if it is possible to combine different files (with different Control points into one.

Claudio Rocha

unread,
Aug 17, 2022, 11:27:06 PMAug 17
to hugin and other free panoramic software
Seems to work if I do a pass with --linearmatch first,  and a second pass with  --prealigned. Thanks so much @GnomeNomad!

David W. Jones

unread,
Aug 17, 2022, 11:35:17 PMAug 17
to hugin-ptx
You're welcome!

Combining PTO files is exactly what pto_merge is for.
> http://dancingtreefrog.com <http://dancingtreefrog.com>
Reply all
Reply to author
Forward
0 new messages