I implemented a function to estimate the homography H in p'= Hp given at least four pairs of data points (p, p').
The homography estimation function allows me to "rectify" an image given the coordinates of four corners. Here are some examples:
Step 1, shoot the images:
Step 2, warp the left and right images into the middle image's projection and calculate their offsets:
Step 3, calculate the size of the final mosaic and translate all the images to their respective position:
Step 4, blend them! (yet to figure out how to set up the alpha channels properly)