Understanding multiband and feather blending techniques for seamless image stitching
The Stitcher library provides two powerful blending algorithms to merge overlapping images seamlessly: multiband blending and feather blending. Each method has distinct characteristics and use cases.
Multiband blending uses Laplacian and Gaussian pyramids to blend images at multiple frequency bands, producing the highest quality results with minimal visible seams.
This ensures the pyramid has enough levels to cover the entire image while respecting the MAX_BANDS limit of 7.
2
Compute Laplacian Pyramids
For each pyramid level, the algorithm computes the Laplacian by upsampling the next level and subtracting it from the current level:
blending.c
void compute_laplacian(ImageS *original, ImageS *upsampled) { for (int i = 0; i < total_size; ++i) { upsampled->data[i] = original->data[i] - upsampled->data[i]; }}
This captures the high-frequency details at each scale.
3
Create Gaussian Mask Pyramids
Masks are downsampled to create a Gaussian pyramid that matches the image pyramid structure. This allows smooth transitions between images at each frequency band.
4
Blend Each Level
At each pyramid level, images are blended using their corresponding mask weights:
Feather blending is a simpler, faster technique that performs weighted averaging based on mask values. It’s ideal for real-time applications or when computational resources are limited.
Multiband: Requires memory for multiple pyramid levels. For an image of size W × H:
Memory ≈ W × H × channels × (1 + 1/2 + 1/4 + ... + 1/2^n) × sizeof(type)
Feather: Only requires memory for the output canvas, approximately:
Memory ≈ W × H × channels × (sizeof(float) + sizeof(short) + sizeof(unsigned char))
Processing Time
Multiband: O(n × w × h × bands) where n is number of images
Feather: O(n × w × h)
Both use multi-threading with pthread for parallel processing
Quality vs Speed
Use multiband blending when quality is paramount and processing time is acceptable. Use feather blending for interactive applications or when processing many images in sequence.