Sometimes Hugin struggles to stitch seemingly "simple" panoramas.

Asked by Vin on 2017-11-02

I have used Hugin extensively before. I never fully understood all the parameters involved but usually it would always be quite smart and stitch things the way I wanted, pretty much.
Now I am using it again after a long time to stitch a basic horizontal panorama of 3 pics, which visibly connect very well, and it tells me it can't recognize pics to be connected. Even when adding pairs of control point, it produces something really bad. There is no difficulty in this panorama, no difficulty due to perspective or anything like that. I am wondering if there are parameters that have changed and that I should reset. Now i can't seem to make anything work properly.

Question information

Language:
English Edit question
Status:
Solved
For:
Hugin Edit question
Assignee:
No assignee Edit question
Solved by:
tmodes
Solved:
2017-12-28
Last query:
2017-12-28
Last reply:
2017-12-26

This question was reopened

  • 2017-12-24 by Vin
tmodes (tmodes) said : #1

With this information it is impossible to say what can be the cause.
Check first if the lens projection and the focal length/field of view fov is correct.
Otherwise provide the pto file and an example image.

Launchpad Janitor (janitor) said : #2

This question was expired because it remained in the 'Needs information' state without activity for the last 15 days.

Vin (vinsands) said : #3

OK i guess the easiest would be for me to send sample images that Hugin decides are not connectable. How to attach images on here?

Vin (vinsands) said : #4

I'm just back from a long trip, with many nice panoramas to stitch, but I'm so frustrated that Hugin doesn't seem to work for me like it used to. It's not like I always understood all parameters, but it somehow worked most of the time, at least with simple perspectives.
Now i have REALLY simple panoramas, with no difficult foreground that would cause distorsion difficulties. Even trying to stitch 2 simple pictures with a proper overlap seems now impossible, with Hugin telling me that my images are unconnected. Imposing pairs of contact points manually doesn't help either.
I wish I could share an example here, not sure how to include files.
I suspect that maybe i should set proper initial parameters (focal, etc.) but I'm not quite sure what else may have happened to make the software all but impossible to use for me. Any help would be extremely appreciated!

tmodes (tmodes) said : #5

There are free file hoster you could use and then post the link here.

So you mentioned the initial parameters, a good starting value for fov would be 50 deg.

But I assume you have wrong values in the Hugins lens database. See FAQ https://wiki.panotools.org/Hugin_FAQ#After_adding_an_image_the_focal_length_is_another_value_than_the_EXIF_value to fix this.

Vin (vinsands) said : #6

In the following link are 5 pictures to illustrate the kind of "simple" panoramas that I can no longer stitch:
https://we.tl/rRAZIFiAml

- IMG_6663 / IMG_6664 = panorama of 2 images
- IMG_6677 / IMG_6678 / IMG_6679 = panorama of 3 images using a different zoom level

If this works easily for you, I would love to know how to set initial parameters right for these panoramas.
Thanks for your help!

tmodes (tmodes) said : #7

The examples work fine here. The assistant connects them fine.
So there is probably a wrong information in the lens database. In Hugin go to Help>About, tab system and search the label Hugin lens and camera database and remember the filename. Then close Hugin and delete the lens database file.
Then restart Hugin again. It should work. (As already described in the linked FAQ above.)

Vin (vinsands) said : #8

Here is what I get in the system tab:
  Path to resources: /Volumes/Hugin 2013.0.0 Release/Hugin.app/Contents/Resources/xrc/
  Path to data: /Volumes/Hugin 2013.0.0 Release/Hugin.app/Contents/Resources/xrc/
  Path to public lensfun database: /Volumes/Hugin 2013.0.0 Release/Hugin.app/Contents/Resources/lensfun
  Path to user lensfun database: /Users/myusername/.local/share/lensfun

I guess you suggest that I delete the file "lensfun"? Thing is, I tried to search for it, and there is no file with that name on my computer (there is not even any subfolder ".local" within the myusername folder). I'm confused...

Vin (vinsands) said : #9

To give an example of the lens values that i get when i open the sets of photos in my examples:

- the first panorama (IMG 6663/64) gets the values: Focal length 8.8 mm / Focal length multiplier: 2.741x
- the second panorama (IMG 6677/78/79) get the values: Focal length: 28.872 mm / Focal l. multiplier: 2.741x

Are those obviously "wrong"?

tmodes (tmodes) said : #10

You are using a very old version 2013.0. Current version is 2017.0 (and we are in a release cycle for 2018.0).
So update first to recent version.

Vin (vinsands) said : #11

Yes indeed! After update, those simplest panoramas can indeed be stitched.
Here is however another seemingly simple panorama of 2 images: files can be downloaded at https://we.tl/CZGgzpoq6F

Several questions:
- which lens type to use by default? If i use "Normal (rectilinear)" then the separate images start distorted (see screenshot). However if I start with "Panoramic (cylindrical)" then the images are loaded without any distorsion (see other screenshot). I assume this is the standard thing to start with?
- after using the "Panoramic" lens type and selecting "Align..." in the Assistant, the result is very bad (see other screenshot) and no amount of "straighten" or moving around helps with the alignment. The problem seems to come from the fact that there is water in the foreground, and Hugin tries hard to assemble wavelets of water which by definition have been moving between shots. Is there a way to essentially tell Hugin: "Hey, just stitch the background rocks and don't worry too much about the water in the front!"

The .pto file and the original images are in the link above. All suggestions and advice on how to approach that kind of panoramas would be welcome!

tmodes (tmodes) said : #12

The lens projection of (mostly) all lenses (also of your Canon PowerShot) is rectilinear (an exception are fisheye lenses). So keep the projection at rectilinear - don't change it. Then also your new example images work.

When you loaded the images there is no distortion, that is a result of the default output (panorama) projection, don't worry about this. Just let the assistant do its work.

(When you change the lens projection and then stitch a pano, this information is saved in the lens database. When you now start a new project these information is loaded from the database, but this wrong information confuses the assistant. So keep the lens projection at rectilinear.)

Vin (vinsands) said : #13

Indeed that works much better!

Now to refine the result:
The aligned result tend to 'deform' the cliff on the left side of the image, in the Cylindrical projection that i used. (similar distorsions or worse are obtained with other projection options). See screenshot at the link https://we.tl/y5n4IWr5bZ

I would intuitively want to "squeeze in" the top left and top right parts of the image. This effect is even more pronounced in the second screenshot that I provided (that's another assembly of 3 pictures): I would want to "push" the left part of the cliff which sits outside the rectangle crop frame, and also "push" the part of the boat which sits outside the rectangle.

Is there a way to limit that effect? Or should I save them as is and use another software like photoshop to "re-deform" it slightly?

tmodes (tmodes) said : #14

You intuition fools your. From a physical point of view the result is correct. Assume you would have a building and would squeeze it in this way. Then it would be slanting.
So this is not possible in Hugin. Either shoot more images which covers a wider range. Otherwise you need to do the "squeeze" in another program.

Vin (vinsands) said : #15

Thanks tmodes, that solved my question.

Vin (vinsands) said : #16

This sloves about 90% of my cases: thus, I am back to my basic level which allowed me to make Hugin work well for simple cases. Thanks!
Now, I still have some problems that arise in specific configurations which "should" be simple enough. I had this problem as well in the past, so I guess it's a good opportunity for me to ask here (Since the sample images that I am linking to will no longer be downloadable after a week or so, I take the liberty to ask my question here as a direct follow-up: maybe this is not the proper way to do and i ought to start a brand new question...)

Sometimes, the result of the alignment is very dark, with some lighter halo around the middle of each constituant picture.

At the following link, I show 5 examples of problematic panoramas with different variations of the same problem. For each of the 5 examples, I include the 2 constituant images, the .pto file and the resulting image panorama. I don't quite understand what these situations have in common to create this problem, because in many similar cases, it works perfectly: see for example: the last example (IMG_9099/9100) is bad, but I have also managed to get beautiful results with similar cases (see the good results obtained with IMG_9103/9104 and IMG_9105/9106 which I have also included).

Any advice on why this occurs and how to correct it or avoid it would be greatly welcome!

Vin (vinsands) said : #17

Oops I forgot the link: https://we.tl/Co9Al9LomB

Best tmodes (tmodes) said : #18

The problem is the inconsistent brightness because of back light (in most of the examples). As a result the vignetting correction is wrong estimated. (I improved the checks for the next version 2018.0. It will be in 2018.0 rc1).

To correct this open the panorama editor from view menu. In the list on photos tab open the context menu (don't open the context menu on an image, right click below). Then select reset>reset photometric parameters.
Now it should look better.
(You could now try the photometric correction again. Select calculate (beside optimize, photometric, leave default option LDR). Check the result in the preview. If it is not better, do undo.)

Vin (vinsands) said : #19

In general, something very odd is that I just tried to stitch again 2 images that gave a bad result sent to you earlier. And this time, the result was good. I have observed that sometimes, trying again a panorama a few days later suddenly works, making it seem as it Hugin has its bad and good mood days. How is that possible?
See for example this link: https://we.tl/CAkwvkQl1U
the old version is bad and the new version (labeled "b") is good. I included the JPG and the .pto file for both versions, as well as the original images.
I didn't make any of the corrections you suggested, it just worked like that...

Speaking of the corrections you are suggesting, I need more clarifications:

> open the panorama editor from view menu.

You mean just after the images have been uploaded? before trying to align them? or after trying to align them?

> In the list on photos tab open the context menu

Where is the "context menu"?
Do I have to have certain photos selected? do you mean the "Feature matching" or "optimise" menus below the photos list?

> don't open the context menu on an image, right click below

right click below each image? I don't understand

> Select calculate (beside optimize, photometric, leave default option LDR).

you mean "calculate" beside Optimize (leaving the default option "Position (incremental, starting from anchor)"?
and "don't touch "photometric"?

> Check the result in the preview. If it is not better, do undo.

So that means we should make this correction after trying to align the pictures, right?

tmodes (tmodes) said : #20

>> open the panorama editor from view menu.
>You mean just after the images have been uploaded? before trying to align them? or after trying to align them?

After alignment. Or when you reopen an already aligned project with the black ring.

>Where is the "context menu"?
The context menu is the menu which appears when click with the right mouse button.

>Do I have to have certain photos selected? do you mean the "Feature matching" or "optimise"
No image should be selected. Do a right mouse click in the list box direct under the images.

>> Select calculate (beside optimize, photometric, leave default option LDR).
> you mean "calculate" beside Optimize (leaving the default option "Position (incremental, starting from anchor)"?
and "don't touch "photometric"?
No, vice versa.
There is
Optimize
  Geometric [] Calculate
  Photometric [] Calculate
Click the calculate beside photometric and leave the choice at the default value. Don't click calculate beside geometric.

>So that means we should make this correction after trying to align the pictures, right?
Yes.