mosaicing a sequence of overlapping images
I'm trying to generate a mosaic from a sequence of overlapping images.
I thought that a possible approach could be to loop over each image, find matching points and mosaic the first 2 images, then use the resulting mosaic as input array and find the matching point with the next image... and so on until the last frame. Pseudo code:
def mosaicing(imagesequence):
matchingpoints = {}
#
# imagesequence can be a list of numpy array
#
mosaic=imagesequence[0]
for i in imagesequence[1:]:
xy = find_matching_points(mosaic, i)
# xy could be a list of x and y values for the matching point between 2 arrays
# something like:
# matchingpoints[image_12] = [ [[x1,y1],[x2,y2], ... [xn,yn]] ,
# [[x1,y1],[x2,y2], ... [xn,yn]] ]
# where the first array stores the pixel position for the mathcing points in image_1 ,
# and the second array stores the pixel position for the same points in image_2
#
mosaic = imagestiching(mosaic, i, xy)
# where mosaic is the first image and "i" is the second image
return mosaic
In my use-case each image has an overlap of ~40%, they are collected along a straight line path with minimal pitch/roll, so I guess a rigid affine transformation based on 2 or more matching points should work fine. I stored 4 images sample (png) at [1]
Have you any clue on how to do this using python and opencv? I'm looking for a solution to:
detect matching point between 2 images (numpy nD arrays)
apply matching point to the 2 arrays to generate a new one which can be then used as input to detect the other matching points with the next frame