How can I align two already-stitched panoramas taken years apart for comparison?
Asked 3/3/2013
6 views
2 answers
0
I have two panoramas of the same town, shot from roughly the same location four years apart. Both images are already stitched, and I want to align them so viewers can compare them side by side and see changes over time.
I tried adding control points in Hugin, but the alignment is poor. Some matched points end up far apart, which makes me think Hugin may not be the best tool for aligning finished panorama images with existing projection distortions.
What is a good way to align two already-stitched panoramas for visual comparison? If Hugin is not ideal here, what kind of transform should be used instead?
Originally by Photography Stack Exchange contributor. Source · Licensed CC BY-SA 4.0
Photography Stack Exchange contributor
13y ago
2 Answers
3
I have developed my own solution which worked quite well. The main idea is to use linear regression to find out a 2d transform function. I used 4th order polynomial. I.e:
$x' = a_1 + a_2 * x + a_3 * y + a_4 * x^2 + a_5 * x * y + ... + a_15 * y^4$
$y' = b_1 + b_2 *x + b_3 * y + b_4 * x^2 + b_5 * x * y + ... + b_15 * y^4$
The control points GUI in Hugin looks like this:

The text data of the control points can be found in Hugin project file. Like this:
# control points
c n0 N1 x34.0000205966735 y1931.00001347956 X2011 Y1818 t0
c n0 N1 x8268 y1116 X8380 Y1292 t0
c n0 N1 x9431 y991 X9273 Y1132 t0
c n0 N1 x9345 y2083 X9263 Y1851 t0
c n0 N1 x2403 y2254 X3856 Y2090 t0
c n0 N1 x1702 y2180 X3311 Y2026 t0
After a little reformat of the text data, my morph program can transorm the top image into the bottom image using the control points. I have added some grid lines to demostrate the trandormation. The max error distance is only 2 pixels. Considering image's dimentation 10456x2664, it's hard for human eye to tell the error.
A more detailed blog can be found in my github.io page.
Originally by user17517. Source · Licensed CC BY-SA 4.0
user17517
2y ago
0
Generated from our catalog & community — verify before relying on it.
Hugin is mainly designed to stitch source photos, not to precisely register two finished panoramas that may already contain different projection and distortion characteristics. So yes, it may be the wrong tool for this job.
A practical approach is to mark matching control points in both panoramas, export those point pairs, and fit a 2D transform that warps one panorama onto the other. From the shared solution here, a polynomial warp worked well: using linear regression to solve for x′ and y′ as 4th-order polynomial functions of x and y.
In other words, instead of trying to identify a lens type or field of view for the stitched panoramas, treat the task as image registration/morphing based on control points.
If you only need a rough visual comparison, a simpler manual edit—cropping, resizing, and placing the images side by side—may be enough, but it will not align all areas accurately.
So the best answer is: use control points plus a fitted geometric warp (such as a polynomial transform), rather than relying on panorama-stitching software to infer the projection correctly.
Recommended products
UniqueBot
AI13y ago
Your Answer
Related Questions
How can I align RGB and NIR images from two side-by-side cameras?
How can I align two photos of the same building taken years apart?
What software can batch-align handheld photos of the same scene taken over time?
Can I manually align bracketed photos before merging to HDR in Photoshop CS5?
How can I align and warp two overlapping maps using matching reference points?
