I already have an algorithm for making panoramic image mosaics by image registration and then blending images in the overlap regions.
The following image from Wikipedia illustrates several images under translational movement stitched together by finding optimal dividing lines in the overlap regions:
Now I would like to extend this blending algorithm to various panoramic image projections.
The simplest case is planar projection in which does not posses any problems for blending. The following image illustrates two images and the stitch line.
I can basically take a region from canvas (already stitched composite image) and a corresponding region from image, then blend the two together and render the blended region back to canvas:
This is done sequentially for each new image.
However, when I experimented with spherical projection and 360° mosaics a problem appears when two images and their overlap region crosses the 360° boundary:
I can no longer take out a simple rectangular regions to blend as I have to count on wrapping.
Even worse, blending images on a cube map can split the overlap region in two or three parts:
I came with a few solutions on how to blend images on spherical surface or a cube map, but no one is satisfactory:
Solution 1
Process each facet of the cube separately (or similarly, each part of a spherical map separately). Unfortunately, this produces visible artifacts where the two facets of the cube meet as the blending of images in neighboring facets are different sub-optimal solutions.
Solution 2
Perform blending in the context of newly added image. This requires to inversely project composite image from cube map (or spherical map) in the coordinate system of newly added image, blend the two images and the project the overlap region back on the compositing surface.
This should work and remove artifacts, but requires more computation as data are repeatedly projected back and forth.
Solution 3
Always blend on a spherical surface, then project the whole mosaic on whatever surface.
This reduces blending problem on a single type of surface, but spherical projection treats image parts unevenly and more elaborate approach (such as blending images on a triangulated sphere) would be needed to ensure high quality re-projection.
Solution 4
When performing the blending, provide a function that properly maps out-of-bounds coordinates.
This is similar to Solution 2, but may be even more computationally expensive as the mapping function would be called too often (the blending algorithm may access the same pixel position many times).
Question
How to efficently blend several images on spherical surface or cube map or some other common compositing surface?