Tell hugin relative position of pictures to be stitched ?

817 views
Skip to first unread message

Henner Zeller

unread,
Jan 23, 2013, 9:06:45 PM1/23/13
to hugi...@googlegroups.com
Hi,
I recently started to do photo stitching with Hugin and I love it. You
guys really made it easy to have a shallow learning curve, but also
provide all the command line tools to run things in bash scripts or
Makefiles for 'pro' work. Nice!

I have a question that I came across while doing experiments with HDR
panoramas (I like to do night-panoramas
https://plus.google.com/113917390722624035964/posts/FsNq9ECfpM3 ). For
these 360/180 panoramas with multiple exposures, it is common that I
have over 100 pictures to be stitched (I don't have a fisheye yet). It
takes Hugin a loong time to match up the adjacent pictures because it
compares each picture with every other picture to find if there are
matching control points. This is an O(n^2) operation which takes
forever (didn't really time it because I walked away from the
computer, but one hour is probably a good order of magnitude).

Is it possible to tell Hugin in advance which pictures are adjacent
(or partially overlapping) ? That way, it would only need to match up
control points between these adjacent pictures. So essentially for
each picture, tell it which is right, left, top, below from it and
which are mostly overlapping (e.g. for stacked HDR pictures).

I presume, this should be possible by telling it the rotating and tilt
angles, maybe ideally directly in the EXIF or XMP metadata. I plan to
build a motorized panorama head, so that would then allow to
automatically add this meta-data to the pictures.
Of course, _ideally_, this would even be with error margins (42
degrees +1.1 / -1.5), so that Hugin can use this as a hint to know in
which range it has to search for matching control points.

Also, this technique might help to make it easier to stitch parts of
featureless areas (say the sky).

Is there something like this ?

-henner

T. Modes

unread,
Jan 25, 2013, 12:16:14 PM1/25/13
to hugin and other free panoramic software
>
> Is there something like this ?
>


Yes.

Variant 1: first assign stack numbers to the stacked images. Then use
cpfind with the multirow switch (cpfind --multirow). This will
drastically reduce the number of image pairs checked.

Variant 2: assign rough positions to all images (set yaw, pitch and
roll accordingly), then use cpfind with the prealigned matching
strategy (cpfind --prealigned). The GUI has already a setting for this
use case (named "Hugin's CPFind (prealigned)")

Thomas

Henner Zeller

unread,
Jan 25, 2013, 12:39:16 PM1/25/13
to hugi...@googlegroups.com
Wonderful, thanks Thomas, I'll try that on the weekend.

-h

>
> Thomas
>
> --
> --
> You received this message because you are subscribed to the Google Groups "Hugin and other free panoramic software" group.
> A list of frequently asked questions is available at: http://wiki.panotools.org/Hugin_FAQ
> To post to this group, send email to hugi...@googlegroups.com
> To unsubscribe from this group, send email to hugin-ptx+...@googlegroups.com
> For more options, visit this group at http://groups.google.com/group/hugin-ptx
>
>
>

Bruno Postle

unread,
Jan 29, 2013, 5:31:18 PM1/29/13
to hugin and other free panoramic software
On Fri 25-Jan-2013 at 09:16 -0800, Thomas Modes wrote:
>
> Variant 2: assign rough positions to all images (set yaw, pitch
> and roll accordingly), then use cpfind with the prealigned
> matching strategy (cpfind --prealigned). The GUI has already a
> setting for this use case (named "Hugin's CPFind (prealigned)")

I just added a CSV --input option to match-n-shift (only in
Panotools::Script in panotools SVN for now).

(match-n-shift is a script that turns a list of photos into a Hugin
.pto project, very similar to pto_gen)

The idea is that if you can put your shooting arrangement in a
spreadsheet and save it as a CSV file, match-n-shift can then turn
this into a Hugin .pto project that has all the photos distributed
appropriately around the scene - but without using any control
points or editing a .pto project manually.

The background to this is we have often discussed creating a GUI in
Hugin where users can specify a shooting arrangement, but this got
way complicated very quickly. It seems to me that if someone is
capable of shooting a huge multirow panorama then they are probably
also capable of simply describing the photo positions in a
spreadsheet.

This functionality (basing a new project on a CSV file) would make a
good python 'action' in the Hugin GUI. Do any python coders fancy
trying this?

--
Bruno

T. Modes

unread,
Jan 30, 2013, 11:38:33 AM1/30/13
to hugin and other free panoramic software
Hi Bruno,

> I just added a CSV --input option to match-n-shift (only in
> Panotools::Script in panotools SVN for now).
>
> (match-n-shift is a script that turns a list of photos into a Hugin
> .pto project, very similar to pto_gen)
>
> The idea is that if you can put your shooting arrangement in a
> spreadsheet and save it as a CSV file, match-n-shift can then turn
> this into a Hugin .pto project that has all the photos distributed
> appropriately around the scene - but without using any control
> points or editing a .pto project manually.
>

pto_var --set-from-file provides a similar feature. In contrast it
works on an existing project and does not generates a new project.

Thomas

Bruno Postle

unread,
Jan 31, 2013, 4:41:53 PM1/31/13
to hugin and other free panoramic software
Ah, you beat me to it by three days! It looks like they are
complimentary methods, pto_var is much more scriptable and allows
batch setting of parameters, whereas match-n-shift makes you do all
the work in a spreadsheet.

So if I understand it you can set the roll, pitch and yaw for four
photos by creating a file like this:

r0=0.0,p0=20,y0=0.0
r1=0.0,p1=-20,y1=90.0
r2=0.0,p2=20,y2=180.0
r3=0.0,p3=-20,y3=270.0

The equivalent CSV file for match-n-shift would be:

PHOTO_01.JPG, 0.0, 20, 0.0
PHOTO_02.JPG, 90.0, -20, 0.0
PHOTO_03.JPG, 180.0, 20, 0.0
PHOTO_04.JPG, 270.0, -20, 0.0

--
Bruno

T. Modes

unread,
Feb 1, 2013, 2:32:09 PM2/1/13
to hugin and other free panoramic software
Hi Bruno,

On 31 Jan., 22:41, Bruno Postle <br...@postle.net> wrote:
> Ah, you beat me to it by three days!  It looks like they are
> complimentary methods, pto_var is much more scriptable and allows
> batch setting of parameters, whereas match-n-shift makes you do all
> the work in a spreadsheet.

Crossing ideas.

>
> So if I understand it you can set the roll, pitch and yaw for four
> photos by creating a file like this:
>
>    r0=0.0,p0=20,y0=0.0
>    r1=0.0,p1=-20,y1=90.0
>    r2=0.0,p2=20,y2=180.0
>    r3=0.0,p3=-20,y3=270.0
>

Correct. If you want to set the roll value for all images to zero you
can also use the short cut r=0.

Thomas

T. Modes

unread,
Feb 3, 2013, 4:50:22 AM2/3/13
to hugin and other free panoramic software
Hi Bruno,

On 31 Jan., 22:41, Bruno Postle <br...@postle.net> wrote:
> So if I understand it you can set the roll, pitch and yaw for four
> photos by creating a file like this:
>
>    r0=0.0,p0=20,y0=0.0
>    r1=0.0,p1=-20,y1=90.0
>    r2=0.0,p2=20,y2=180.0
>    r3=0.0,p3=-20,y3=270.0
>

I added an expression parser to pto_var. Now this can be written even
shorten:
y=i*90,p=-1^i*20,r=0

Thomas

Agustin Lobo

unread,
Feb 21, 2013, 1:00:49 AM2/21/13
to hugi...@googlegroups.com
Thomas,

I do not see the "Hugin's CPFind (prealigned)" option among the ones
listed in my version (Mac OSx 2012 

2012.0.0 built by Harry van der Wolf)

Can I add it? Or do I have to use the command line cpfind?

Thanks

Agus

T. Modes

unread,
Feb 21, 2013, 11:39:36 AM2/21/13
to hugin and other free panoramic software

Hi Agus,

On 21 Feb., 07:00, Agustin Lobo <aloboa...@gmail.com> wrote:
> Thomas,
>
> I do not see the "Hugin's CPFind (prealigned)" option among the ones
> listed in my version (Mac OSx 2012
>
> 2012.0.0 built by Harry van der Wolf)
>

I see it, that this setting is missing in the Mac version.

> Can I add it? Or do I have to use the command line cpfind?
>

You can add it. Go to preferences, tab control point detector and add
it.
See http://wiki.panotools.org/Control_Point_Detector_Parameters#Cpfind
for the parameters.

Thomas
Reply all
Reply to author
Forward
0 new messages