Scripted Hugin Panos from Drone - Fighting the curvature of the earth?

Skip to first unread message


Aug 21, 2023, 10:58:10 PMAug 21
to hugin and other free panoramic software

After reading the latest thread about multi-row pano's, I have been inspired to refine my hugin script I use to build 360 spheres from my DJI Mini 2.  I ran into an interesting artifact that I cannot get rid of - A jagged line in the horizon. 

All files (Result image, source images, script, template pto, and project pto) are located here if you want to check it out -!Ah3sXKXawuGfgaNmIaPmfLW4lakbVg?e=P39pc6

My script does this -
1. Generates a new PTO for the specific folder
2. import template details.
3. cpfind (with pre-aligned)
4. clean control points
5. geocpset to "match" images without CP's...this was needed for areas of water/snow that are mostly featureless.
6. clean control points
7. linefind (not really seeing a benefit to this one, but that is another story)
8. Autooptimiser
9. Pano_Modify - tweak the settings to get the output I want.
10. send the PTO to batch processor to not completely kill my computer when doing large sets. 

Note - I can run this script on a single folder by copying it and the template to the directory with the images, but I usually run it from another bat file that iterates through all directories to make my workflow easier after shooting a bunch of panos. 

I think I am fighting the curvature of the earth with the straighten tool because when viewing the final PTO file (after the script runs and the image is built), the horizon is straight between the two points where water and land meet, but has a jagged jump.  You can see the water get slightly "higher" in the middle, but that breaks the line.  In the above OneDrive location, I uploaded a snip of the Hugin GUI in expert mode (move/drag tab) that shows this. 


Is there a way to tweak my script to allow for some curvature in the "straighten" command?  Am I missing something obvious?  :)

Thank you!

Bruno Postle

Aug 22, 2023, 2:09:22 AMAug 22
to hugin and other free panoramic software
On Tue, 22 Aug 2023, 03:58 PanoSeek wrote:

After reading the latest thread about multi-row pano's, I have been inspired to refine my hugin script I use to build 360 spheres from my DJI Mini 2.  I ran into an interesting artifact that I cannot get rid of - A jagged line in the horizon.

Curvature of the earth shouldn't be a problem, it would just result in a slightly lower horizon line. More likely this is a more mundane problem: too much fixity (none of your images should have roll or pitch fixed); wrong camera angle of view (360° panoramas are very sensitive to this, you should always optimise angle of view); or bad control points (look for problems near where there are high control point distances).


Sean Greenslade

Aug 22, 2023, 3:00:07 AMAug 22
I took a look at your 100_0278.pto. A bunch of your overlapping images
don't have any control point pairs at all. This will definitely lead to
artifacts. I don't think your geocpset call worked as intended.

To get better alignment, you will probably need to add some manual
control points. In this case, I would suggest adding line control points
on all of the photos that have the unobstructed horizon visible. Make
sure to use custom lines and not plain horizontal lines, since those
provide co-linear constraints to help the optimizer get them all in line
with each other.



Aug 22, 2023, 9:16:33 AMAug 22
to hugin and other free panoramic software
Thanks!  I have been spinning my wheels on this one, but with the script I use, I think this is probably as close to perfect as I can get without manual intervention.

My batch script finished overnight and I have a few additional examples to show this anomaly -
100_300 - horizon line broken over water when water is at the horizon.
100_311 - horizon solid when water not at the horizon, but lots of water.
100_318 - lake superior (water at the horizon) on the left side of center in this one and a smaller step in the horizon on each side.  This could also be helped by the ship at almost the center of the horizon line. 

It seems to "step" more depending on the field of view when looking at the large body of water that is at/over the horizon, which led me to the theory of the earth curvature messing with the process a bit.

Do you have a suggested tweak to the geocpset command to help with my low-detail images?  This is a problem I have been working on ever since going down the road of scripted stitching with snow and water. 

This is really a nitpick compared to where I was with the script just a few days ago.  I appreciate your detail!
Reply all
Reply to author
0 new messages