Autostitch - Panorama Creation

CS5670 Project 3 - Introduction to Computer Vision
Cornell University, Spring 2025

Stitch images together to create seamless panoramas.

This project implements a complete panorama creation pipeline including spherical warping, feature matching with RANSAC alignment, and advanced blending techniques to combine multiple overlapping photographs into a single seamless panoramic image.

Final Panorama Result
Complete panorama created from multiple overlapping images using RANSAC alignment and feathering blend

Project Details

Language: Python with NumPy, SciPy, OpenCV
Key Concepts: RANSAC, homographies, spherical warping, image blending

Overview

Panorama creation is a fundamental computer vision task that combines multiple overlapping photographs into a single wide-angle view. This project implements the complete autostitch pipeline, from raw photographs to seamless panoramic images.

The system supports two different alignment approaches: translation-based alignment using spherically warped images (ideal for 360° panoramas), and homography-based alignment for direct image registration (suitable for planar scenes and handheld photography).

Pipeline Architecture

Complete Autostitch Pipeline

  1. Image Acquisition: Capture overlapping photographs (50% overlap recommended)
  2. [Optional] Spherical Warping: Transform to spherical coordinates for 360° panoramas
  3. Feature Extraction: Use ORB detector to find discriminative keypoints
  4. Feature Matching: Find correspondences between overlapping images
  5. RANSAC Alignment: Robust estimation of inter-image transformations
  6. Global Alignment: Chain transformations and correct for drift
  7. Image Blending: Seamless composition with feathering weights
  8. Final Processing: Crop and optimize the resulting panorama

Implementation Details

Part 1: Spherical Warping

For 360° panoramas and wide-angle sequences, spherical warping corrects for the curved nature of the camera's field of view.

Spherical Coordinate Transformation:

Spherical Warping Mathematics

Radial Distortion Correction:

Radial Distortion Equation

Camera Parameters Used:

Campus Dataset:
f = 595, k1 = -0.15, k2 = 0.00

Yosemite Dataset:
f = 678, k1 = -0.21, k2 = 0.26

Key Insight: Spherical warping linearizes the motion between camera positions, making translation-based alignment much more effective for wide-angle sequences.

Part 2: Motion Models and Alignment

The system supports two motion models for different scenarios:

Translation Model

Use Case: 360° panoramas with spherical warping

DOF: 2 parameters (tx, ty)

RANSAC: 1 correspondence needed

Assumption: Pure camera rotation

Homography Model

Use Case: Planar scenes, handheld photography

DOF: 8 parameters (3×3 matrix)

RANSAC: 4 correspondences needed

Assumption: Planar world or distant scenes

Part 3: RANSAC-Based Alignment

Robust estimation of inter-image transformations using Random Sample Consensus (RANSAC).

RANSAC Algorithm:

  1. Sample: Randomly select minimal correspondence set
  2. Estimate: Compute transformation from minimal set
  3. Evaluate: Count inliers using distance threshold
  4. Iterate: Repeat for maximum number of trials
  5. Optimize: Least-squares refinement on best inlier set

Homography Estimation via SVD:

Homography SVD Mathematics

SVD Solution: For the equation Ah = 0, the solution h is the right singular vector corresponding to the smallest singular value of A.

Part 4: Image Blending and Composition

Seamless composition of aligned images using advanced blending techniques.

Feathering Blend

Distance-based weighting function for smooth transitions between images

Alpha Compositing

Weighted accumulation with proper normalization to avoid artifacts

Drift Correction

Linear warping to eliminate vertical misalignment in 360° panoramas

Blending Pipeline:

  1. Bounding Box Calculation: Determine final panorama dimensions
  2. Inverse Warping: Resample each image to final coordinates
  3. Weight Accumulation: Apply feathering weights during composition
  4. Normalization: Divide by accumulated weights to avoid artifacts
  5. [360° Only] Seam Blending: Perfect alignment at left/right edges

Feathering Weight Function:

Feathering Weight Mathematics

My Results

Implementation Achievements

Successfully implemented the complete autostitch pipeline with both translation and homography-based alignment methods.

Pipeline Visualization

Input Image Sequence
Input Image Sequence
Overlapping photographs with ~50% overlap
Feature Matching Results
Feature Correspondences
ORB features matched between adjacent images

Spherical Warping Results

Original Image
Original Image
Planar projection from camera
Spherically Warped Image
Spherically Warped
Corrected for camera rotation and distortion

Final Panorama Results

Translation-Based Panorama
360° panorama using translation alignment with spherical warping
Homography-Based Panorama
Planar panorama using homography alignment (handheld sequence)

Technical Challenges and Solutions

Key Implementation Challenges

Key Learnings

Computer Vision Concepts

Mathematical Insights

Extra Credit Explorations

Advanced Techniques Implemented

Exposure Compensation

Exposure Compensation

Automatic brightness adjustment between images

Ghost Removal

Moving Object Handling

Handling moving objects in overlapping regions

Advanced Blending

Pyramid Blending

Multi-resolution pyramid blending for seamless transitions

Applications and Impact

Real-World Applications

Virtual Reality: Creating immersive 360° environments for VR experiences

Architectural Documentation: Complete building documentation and virtual tours

Surveillance Systems: Wide-area monitoring with multiple camera feeds

Scientific Imaging: Large-scale imaging in astronomy, microscopy, and remote sensing

Mobile Photography: Automatic panorama modes in smartphone cameras