The software uses various cartographic mapping thingies to account for the distortion in photographic images. However, I'd like to stitch together several images that don't have this problem (backgrounds from animation).

How do you do this?


The only variables that should be optimized when stitching a flat background are the translation variables:

  • X (TrX)
  • Y (TrY)
  • Z (TrZ)

It sounds like you may be optimizing yaw (y), pitch (p), and roll (r), which use the irrelevant lens parameters in the calculations and will introduce the distortion you're referring to by trying to "fix" the lens distortion.

To optimize for translation only, first you need to select Custom parameters in the Hugin expert interface » Photos tab » Optimize » Geometric:

Hugin expert interface » Photos tab » Optimize » Geometric » Custom Parameters

Then go to the new Optimizer tab that appeared:

Hugin expert interface » Optimizer tab

Here, ensure only the rows of the X, Y, and Z columns are checked, except for the anchor image's row. You can do this by right-mouse clicking each of those columns and then clicking Select all:

"Select all" option

Make sure your control points are accurately set. Finally, you can click Optimize now!, and you should see a pretty low error:

Optimization result

You can hit Ctrl+Shift+p to open the Fast Panorama preview. Under the Projection tab, make sure to select Rectilinear as the projection:

Fast Panorama preview » Projection » Rectilinear

Once you're satisfied with the preview and have configured the stitcher, go ahead and stitch!

Additional Resources

  • I've done this several times now, and I'm still getting goofy results. The control points are lining up, but I think it's subtly scaling even as it pans over. Not sure how to describe it or ask a better question. – John O Jun 12 at 20:53
  • @JohnO: I was able to reproduce some blurriness and imprecise scaling with this example project. screenshot.png is the original, Untitled1 - Untitled3.png is the output, and imagemagick-diff.png is a comparison of the two. If you're trying to make a pixel-perfect stitch, perhaps Hugin is the wrong tool for the job. Otherwise, if you can show some samples of your problem, maybe someone can identify what's causing it. – Deltik Jun 12 at 23:46
  • It won't need to do pixel perfect... I intend to take the result and pass it through potrace anyway. But I'm either not doing this correctly, or something about the scaling messes it up more than blurriness alone. I'll be able to spend some more time on it here shortly, maybe I just missed something. – John O Jun 13 at 15:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.