Skip to main content

Overview

OpenCV’s Stitcher API provides a complete pipeline for creating panoramas:
  • Feature Detection: Find distinctive points in images
  • Feature Matching: Establish correspondences between images
  • Homography Estimation: Calculate geometric transformations
  • Image Warping: Transform images to common coordinate system
  • Seam Finding: Minimize visible boundaries
  • Blending: Create smooth transitions between images

Basic Stitching

Simple panorama creation with minimal code.

Advanced Stitching Configuration

Customize the stitching pipeline for better control.

Panorama with Rotating Camera

Specialized approach for images taken with a rotating camera around its optical center.

Stitching Modes

Panorama Mode

Optimized for photo panoramas with rotation around camera center.
Best for:
  • Landscape photography
  • 360° panoramas
  • Handheld camera rotation

Scans Mode

Optimized for scanning documents or materials under affine transformation.
Best for:
  • Document scanning
  • Flat surface imaging
  • Parallel camera motion

Configuration Options

Troubleshooting

1

ERR_NEED_MORE_IMGS

Not enough images or too little overlapSolutions:
  • Add more images
  • Increase overlap between images (aim for 30-50%)
  • Reduce setPanoConfidenceThresh() value
2

ERR_HOMOGRAPHY_EST_FAIL

Cannot find valid geometric transformationSolutions:
  • Ensure sufficient texture in images
  • Check image quality and focus
  • Try different feature detector (SIFT instead of ORB)
  • Increase number of features detected
3

ERR_CAMERA_PARAMS_ADJUST_FAIL

Bundle adjustment failedSolutions:
  • Check for extreme distortion
  • Try different bundle adjuster
  • Reduce number of images
  • Use SCANS mode for planar scenes
4

Visible Seams

Obvious boundaries between imagesSolutions:
  • Use multiband blending: Blender_MULTI_BAND
  • Try different seam finder: SeamFinder_DP_COLOR
  • Ensure consistent exposure across images
  • Avoid moving objects in overlap regions

Best Practices

Image Capture Tips:
  • Overlap images by 30-50%
  • Keep camera level and rotate around optical center
  • Use consistent exposure settings
  • Avoid moving objects in scene
  • Capture in good lighting conditions
  • Use tripod for best results
  • Take images in sequence (left to right or top to bottom)
Performance: Stitching high-resolution images is computationally intensive. Consider:
  • Reducing image resolution before stitching
  • Using ORB instead of SIFT for faster processing
  • Limiting number of features detected
  • Processing in batches for large panoramas

Performance Optimization

Next Steps