TL;DR
Classic image stitching breaks down when photos are taken from different viewpoints (parallax) or under wildly different lighting and styles. This paper introduces generative panoramic image stitching, which blends multi-view imagery by fine-tuning an inpainting diffusion model conditioned on spatial coordinates rather than text prompts. The resulting system iteratively outpaints a coherent, wide-angle panorama from a single view while faithfully weaving in structural details and content from the other captures.
What Problem Does This Paper Address?
Traditional panoramic stitching algorithms (like AutoStitch or modern mesh-warping methods) assume the camera simply rotated around its optical center. When photos are taken casually—stepping a meter to the side, altering exposure, or capturing a scene across different times of day—this zero-parallax assumption collapses, resulting in severe ghosting, misalignments, and harsh seams.
While recent generative diffusion models can outpaint images using reference photos (e.g., RealFill), they struggle with panoramas: they lack a concept of global layout, frequently repeating objects or inventing inconsistent scene geometry over large canvases. This work bridges that gap by marrying classic coarse geometric alignment with generative diffusion to produce seamless, photorealistic panoramas under challenging parallax and stylistic differences.
Methods
The proposed framework proceeds in three stages:
- Coarse Layout Estimation: The authors first estimate feature matches (using SIFT) and compute homographies to project each reference image onto a wide cylindrical canvas, resulting in a collection of sparse, single-image panoramas.
- Position-Aware Diffusion Fine-Tuning:
- The authors adapt Stable Diffusion 2.1 (Inpainting).
- Instead of standard text prompt conditioning, they inject a multi-frequency sinusoidal positional encoding map of the panorama coordinates. A compact 3-layer convolutional context encoder transforms these spatial coordinates into embeddings fed directly into the UNet's cross-attention layers.
- Optimization: To balance stability and expressiveness, they freeze the base UNet and VAE, apply LoRA to self-attention layers, and fully fine-tune the cross-attention layers alongside the context encoder.
- Perturbation Augmentation: Random similarity transforms perturb the position of cropped reference images during training, discouraging the network from memorizing sharp boundaries or seams.
- Iterative Panoramic Outpainting & Seed Selection:
- At inference, the model begins with one central reference view and outpaints overlapping $512 \times 512$ tiles in a breadth-first search order based on distance from the center.
- The authors generate multiple random seeds (10 by default) and automatically select the most structurally faithful panorama using LoFTR feature matching against the coarse geometric layout.
Reference Images
│
▼ (SIFT + Homography Warping)
Sparse Panoramas + Positional Map
│
▼ (LoRA + Cross-Attention Fine-Tuning)
Position-Conditioned Inpainting Diffusion Model
│
▼ (Iterative Tile-by-Tile Outpainting)
Final Seamless Panorama
Datasets
The authors evaluated their method on two newly collected datasets across eight diverse indoor and outdoor scenes (e.g., Backyard, Livingroom, Donuts, Subway, Waterfront):
- Tripod-captured dataset: Minimal parallax rotations used to build high-quality reference "ground truth" panoramas via classical stitching.
- Casually captured dataset: Handheld captures exhibiting 1–2 meter camera baseline translations, dynamic lighting (day vs. night, indoor lights on/off), color filtering/white balance shifts, and seasonal variations (winter vs. summer).
Key Insights and Ideas
- Repurposing Cross-Attention for Spatial Coordinates: Diffusion models natively align cross-attention with textual semantics. Replacing text tokens with learned embeddings of positional coordinates guides the diffusion model to respect where each scene element belongs in the overall panoramic coordinate frame, preventing repetitive patterns.
- Generative Synthesis over Image Warping: Instead of stretching pixels through complex mesh-warping algorithms (which distort textures when 3D depth varies), the generative model re-synthesizes transitioning regions, effectively hallucinating plausible geometry that resolves parallax disparities.
- Perturbation Prevents Seams: Randomly jittering the training crops prevents the model from treating the hard edges of warped sparse inputs as ground-truth scene boundaries.
Key Results
- Visual Consistency & Fidelity: Across both datasets, the proposed method eliminated the ghosting and blending seams seen in AutoStitch, while avoiding the duplicate objects and structural drift produced by RealFill.
- Tripod Benchmark:
- Outperformed RealFill in perceptual similarity: 0.107 vs. 0.198 on DreamSim (lower is better).
- Maintained dramatically better spatial alignment: 15.11 px LoFTR L2 distance vs. 43.01 px for RealFill and 85.45 px for baseline Stable Diffusion.
- Casual / Parallax Benchmark:
- Achieved the highest DreamSim score (0.137) and DINO semantic similarity (0.971), outperforming AutoStitch (0.202 DreamSim) and RealFill (0.197 DreamSim).
Limitations and Future Work
- Per-Scene Optimization: The model requires scene-specific fine-tuning (~4.5 hours on 2$\times$ NVIDIA A100 GPUs), precluding real-time or instantaneous feed-forward stitching.
- Dependency on Coarse Alignment: Because layout initialization relies on classical feature matching and homographies, scenes with severe motion (e.g., crowds, moving traffic) can fail during the initial warping step.
- Hallucinated Fidelity: As a generative model, it generates believable intermediate content rather than strictly preserving pixel-level ground truth, which may not suit scientific or metrology applications.
Summary updated