Mosaic optimizer puzzle

143 views
Skip to first unread message

tbransco

unread,
Aug 7, 2020, 3:37:52 PM8/7/20
to hugin and other free panoramic software
Hello,

I'm using hugin 2019.0.0 to stitch a 15-image mosaic together.  The subject is a flat wall composed of evenly sized and spaced blocks and covered in graffiti.  I started with a 3-image stitch composed of the middle 3 images in the series and have been adding an image to either end in successive stages.  I've successfully completed 4 such stages and reached a successful 9-image mosaic, but the 11-image stage has stumped me, specifically the optimization step.

Like all previous stages, I add control points using "cpfind --linearmatch --ransacmode hom -o %o %s" then remove any that are not located on the main plane of my subject (there are slight protusions in places).  I then add a (horizontal) line set to 'mode=Line n' to each image at about the same place on the wall as all previous stages, and one vertical line near the left and right sides of the image.  In the Optimizer tab, I begin each stage by marking only the X, Y, and Z parameters for the new images and running the optimizer.  I then clear those marks and add marks to the r, p, and y parameters for only the two new images before optimizing again.

Up to this stage a simple click of the 'Fit' button on the Move/Drag tab of the Fast Preview window and i'd be off to the Stitcher tab and success, but with 11 images the 'Camera translation' column in the Optimizer tab is showing "not active" for the two new images, when all previous stages this status was confined to the anchor image.  If I accept the optimizer results and view the Fast Preview, the two new images are not at opposite ends of the mosaic, but overlie the central anchored image.  Very strange.

Can anyone here please offer advice on how my workflow might be at fault?  Thanks.

Terry

Bruno Postle

unread,
Aug 8, 2020, 2:49:40 AM8/8/20
to hugi...@googlegroups.com


On 7 August 2020 20:37:52 BST, tbransco wrote:

>with 11 images the 'Camera translation' column in the Optimizer tab is
>showing "not active" for the two new images, when all previous stages this
>status was confined to the anchor image.

This is odd, though the optimiser tab does have some glitches.

It could be a bug, can you attach a PTO project that shows the problem? no need to include the images.

--
Bruno
Message has been deleted

tbransco

unread,
Aug 8, 2020, 3:25:10 PM8/8/20
to hugin and other free panoramic software
Thanks for jumping in, Bruno.

I think I've confused things a bit by reporting a 'not active' status for camera translation in the Optimizer tab.  I believe this status showed as it did because I'd saved the PTO file after adding the images, but before optimization.  I've rerun the optimization just now and the status shows 'active' for all but the anchor image, as expected I guess.  What's not changed is the bad result for the TrZ parameter of the first and last image.  Both are way off the values calculated for the other images when they were added in previous stages.  PTO attached.

Thanks again for looking in.
Terry
_8041934 mosaic 11x.pto

Bruno Postle

unread,
Aug 8, 2020, 5:51:04 PM8/8/20
to hugin and other free panoramic software
On Sat 08-Aug-2020 at 12:25 -0700, Terry Bransco wrote:
>
> I think I've confused things a bit by reporting a 'not active'
> status for camera translation in the Optimizer tab. I believe
> this status showed as it did because I'd saved the PTO file after
> adding the images, but before optimization. I've rerun the
> optimization just now and the status shows 'active' for all but
> the anchor image, as expected I guess. What's not changed is the
> bad result for the TrZ parameter of the first and last image.
> Both are way off the values calculated for the other images when
> they were added in previous stages. PTO attached.

Basically, the optimiser couldn't get some other unrelated control
points to fit, so was stuck and unable to do anything with the two
new photos as a result.

The problem was that there were control points connecting images 2
& 8, and 3 & 7 that seem completely out of place - I'm not sure if
these were intended to be straight-line control points, but as
normal control points they made no sense. So I deleted these points
and the mosaic now optimises fine, attached.

--
Bruno
_8041934 mosaic 11x fixed.pto

tbransco

unread,
Aug 8, 2020, 10:49:59 PM8/8/20
to hugin and other free panoramic software
Thank you, Bruno!  I never thought to even look for such control points, as I'd assumed the "--linearmatch" option for cpfind.exe would create cp's only in adjacent images.  I've no idea how these slipped in at such a late stage of the workflow.  I will definitely keep a special eye out for this in future stitches.

Again, thank you for sorting this.  It's much appreciated.

Terry

tbransco

unread,
Aug 9, 2020, 8:29:46 PM8/9/20
to hugin and other free panoramic software
Unfortunately, the urge to start over took hold and I again built up this mosaic by stages.  My workflow gets me to the same stage as previously; but now, having cleaned up the unrelated cp's, I can still only get to a 9-image mosaic.  Adding image 10 and 11 again results in a scrambled result in the Fast Pano preview.  The translation parameters after optimization look ok, so perhaps there really is a bug?  One workflow step I did change, based on further reading in the Hugin FAQ, was the mode of the horizontal line I've added to each image.  That mode is now set to 'horizontal line' rather than 'Line #', as it seems better suited to the purpose at hand.

I've attached the PTO file in the hopes it can reveal the issue I'm having now.  If the images would help I can upload them to the cloud and post a link.

Thanks for any insights you can offer.

Terry
_8041934 mosaic 11x.pto

Bruno Postle

unread,
Aug 10, 2020, 4:04:11 AM8/10/20
to hugin and other free panoramic software
On Sun 09-Aug-2020 at 17:29 -0700, tbransco wrote:
> Unfortunately, the urge to start over took hold and I again built
> up this mosaic by stages. My workflow gets me to the same stage
> as previously; but now, having cleaned up the unrelated cp's, I
> can still only get to a 9-image mosaic. Adding image 10 and 11
> again results in a scrambled result in the Fast Pano preview. The
> translation parameters after optimization look ok, so perhaps
> there really is a bug? One workflow step I did change, based on
> further reading in the Hugin FAQ, was the mode of the horizontal
> line I've added to each image. That mode is now set to
> 'horizontal line' rather than 'Line #', as it seems better suited
> to the purpose at hand.

Basically the optimiser gets stuck on a local minima with this set
of images - the mosaic optimisation is nowhere near as stable as the
'normal' panorama optimisation (it is the same code, just the more
variables you try to optimise at once, the more likely it is to
come to a conclusion you don't like).

So I reset all the XYZ position parameters, then optimised just X
for all images (except the anchor), added Y to the optimisation,
then Z. This seemed to be ok, so I added in rotation parameters
using the 'Position and Translation (r,p,y,x,y,z)' preset.

--
Bruno
_8041934 mosaic 11x fixed.pto

tbransco

unread,
Aug 10, 2020, 12:29:33 PM8/10/20
to hugin and other free panoramic software
Thank you, Bruno.

The workflow you suggested makes an enormous difference getting the images to appear in the correct relation to each other in the preview modes, and I can replicate your optimization values if I use that workflow on my original PTO.  Unfortunately, your PTO (fixed) results in a great stitch, while mine inexplicably results in only a narrow horizontal band of the mosaic along its 'equator' appearing correctly exposed in the preview.  The rest of the images are very dim.  This band is also the only bit that gets stitched into the final image.  I've used the Move/Drag tab's 'Fit' and 'Center' buttons, along with the Stitcher tab buttons to calculate 'field of view' and 'optimal size', and also tried adjusting the preview sliders, but nothing changes this band.  I've attached my PTO again, but it looks almost identical to yours.  Please advise if any other information or screen shots might be useful.

Despite the persistent problems I really appreciate the help with the workflow.  Hopefully, others read this thread and have success with their own projects.
_8041934 mosaic 11x.pto

Bruno Postle

unread,
Aug 10, 2020, 1:58:52 PM8/10/20
to hugi...@googlegroups.com
The only other thing I did was to set the crop to the whole preview canvas, it was previously set to a narrow letterbox shape.

--
Bruno

tbransco

unread,
Aug 10, 2020, 6:54:57 PM8/10/20
to hugin and other free panoramic software
Wow, another face palm moment for me.  Thanks, Bruno!  I was studiously avoiding the Crop tool in the preview pane and on the Stitcher tab, so did not think to look there.  Many thank again.  Fingers crossed I won't mess up again before reaching the full 15-image mosaic.

Terry

John Muccigrosso

unread,
Sep 11, 2020, 1:08:58 PM9/11/20
to hugin and other free panoramic software
I gotta say that my experiences with Hugin lately are similar to this, and really disappointing. The interface is confusing as hell. There are numerous things you have to look out for. And I get poor results most of the time now, which leads me to avoid using it. And this is with a simply mosaic.

I don't know if it's me or the software, but I feel like a few years ago things just worked better. 

David W. Jones

unread,
Sep 12, 2020, 12:04:17 AM9/12/20
to hugin-ptx
Hmm, the UI is confusing. There are like 3 of them in the main window -
Simple, Advanced, Expert. Plus the two different panorama preview
windows (each with difference capabilities), and inside them is the
Assistant tab which seems sort of like a "wizard UI" to Hugin.

I think the primary UI should be the Fast Preview Window, but I
mentioned that ages back and it didn't go anywhere.

I seem to get good results pretty much all the time, but I haven't done
a mosaic pano for a couple of years now.

I have a process I generally follow - CPFIND without clouds, vertical
lines, optimize for position, clean control points, optimize everything
without translation. Sometimes then I need to look at the control points
list and get rid of ones with large distances.

If I feel lazy, just running the Assistant almost always works.

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

Bruno Postle

unread,
Sep 12, 2020, 12:59:37 PM9/12/20
to hugi...@googlegroups.com


On 12 September 2020 05:04:10 BST, "David W. Jones" wrote:

> I think the primary UI should be the Fast
> Preview Window, but I mentioned that
> ages back and it didn't go anywhere.

With a fresh Hugin install you initially see only the fast preview window with the assistant tab open.

--
Bruno

David W. Jones

unread,
Sep 12, 2020, 6:06:21 PM9/12/20
to hugin-ptx
Which version started doing that, and when?

Bruno Postle

unread,
Sep 13, 2020, 2:39:12 AM9/13/20
to hugin-ptx
On Sat 12-Sep-2020 at 12:06 -1000, David W. Jones wrote:
> On 9/12/20 6:59 AM, Bruno Postle wrote:
> > On 12 September 2020 05:04:10 BST, "David W. Jones" wrote:
> >
> > > I think the primary UI should be the Fast Preview Window, but
> > > I mentioned that ages back and it didn't go anywhere.
> >
> > With a fresh Hugin install you initially see only the fast
> > preview window with the assistant tab open.
>
> Which version started doing that, and when?

2013 :)

http://hugin.sourceforge.net/tutorials/new-gui/en.shtml

--
Bruno

David W. Jones

unread,
Sep 13, 2020, 3:15:54 AM9/13/20
to hugin-ptx
Thanks. I have Hugin 2018.0.0.5abfb4de7961 and have done a complete
reinstall at least once, including wiping out my existing Hugin config
files ... and have never seen that new GUI.

Ah, it's the Simple GUI. I guess I did see it after the previous
reinstall, just before I switched it to Expert.

That wasn't my complete suggestion. My complete suggestion was the
panorama image and when you rightclicked on it somewhere, you got a
popup menu tree of whatever was an appropriate action based on what you
clicked on, what was selected, etc. Like my idea of the ultimate image
processing UI, that of TARGA TIPS from ages ago... 0

I just installed it fresh on a Debian 10 VM I have here and tested
remaking a pano from ages ago. For some reason, the find vertical lines
option found no vertical lines - on a pair of images with strong
vertical lines. Ideas?
Reply all
Reply to author
Forward
0 new messages