Why does my Hugin command-line stitch come out distorted, and how can I fix it?

Asked 9/25/2021

159 views

2 answers

0

I'm batch-stitching images with Hugin from the command line. Using commands like pto_gen, cpfind, cpclean, autooptimiser, pano_modify, nona, and enblend, I get a panorama with obvious distortion compared to the source images.

My current workflow includes options such as autooptimiser -s and pano_modify --center --straighten --canvas=AUTO --crop=AUTO.

At what stage is this distortion being introduced, and which settings should I change to get a more natural-looking result?

Originally by Photography Stack Exchange contributor. Source · Licensed CC BY-SA 4.0

Photography Stack Exchange contributor

5y ago

2 Answers

2

I think there are two or three possible issues: one with the commands and two with your photos.

  1. Make sure you (globally) understand the commands you are running. As you have seen for yourself, the resulting picture is a bit disappointing. Check the Hugin components manual for the different commands, their options and their meaning. For example, you use the -s option with the autooptimiser. This automatically tries to pick a suitable projection. I think this is one of the causes for the distorted result. As suggested in the comments, start with a more basic set of commands, and take it from there. For example, this should be a good start:

     # Generate a project file
     pto_gen -o project.pto ./top.jpg ./bottom.jpg
    
     # Auto optimise (note that I don't include the -s option here
     autooptimiser -a -l -m -o ./project.pto ./project.pto
    
     # Set canvas and crop
     pano_modify --canvas=AUTO --crop=AUTO -o ./project.pto ./project.pto
    
     # Process each of the images
     nona -m TIFF_m -o ./project.pto ./project.pto
    
     # Blend the resulting images
     enblend -o project.tif ./project.*.tif
    
  2. I suspect you took the pictures while holding the camera in your hand. As you can see below, I managed to blend the images, but the don't stitch very nicely. This is because there must be a minor shift in the point from where the camera took the first and the second picture. Hugin (or any panorama software) can't correct that. Next time, use a tripod to fixate the point from where the panorama pictures are taken from.

Blended image

  1. It really helps if you put exif info in the file for Hugin. This "metadata" is automatically stored in the image file format by your camera. This includes focal length, which is an important part of the info that Hugin needs to process your photos correctly. Always make sure you use "straight from the camera" images for stitching.

Finally: if you have the opportunity, try the Hugin application (Windows/OSX/X). This guides you through the process and gives you a much more friendly user interface.

Originally by user31874. Source · Licensed CC BY-SA 4.0

user31874

5y ago

0

AI Answer

Generated from our catalog & community — verify before relying on it.

The distortion is most likely being introduced during projection/straightening, not during blending.

From the answers, the main culprits are:

  • pano_modify --straighten
  • autooptimiser -s, which lets Hugin choose a projection automatically

nona and enblend mainly render/blend the panorama; they don’t usually create this kind of geometric warping on their own.

What to try:

  • Start with a simpler pipeline first.
  • Remove --straighten and compare the result.
  • Avoid autooptimiser -s initially so projection isn’t auto-selected.
  • Explicitly choose a projection in pano_modify instead of relying on defaults; one answer reports that --projection=6 fixed the “weird projection” for your sample, and cylindrical was also suggested as a better-looking option.
  • celeste_standalone isn’t needed here if there’s no sky/cloud area to mask.

In short: the stitch is being distorted by projection and straightening choices in the .pto processing stage. Use a simpler command sequence, disable auto projection selection at first, and test different explicit projections (such as cylindrical) until the geometry looks natural.

UniqueBot

AI

5y ago

Your Answer