I took the pictures on my iPhone camera with the exposure and focus locking feature turned on. The set of images were obtained by rotating the field of view while keeping the camera position fixed.
At least four points of correspondence are taken to formulate a least square problem and solve for the homography transformation.
Select 4 points on the image that should form a rectangle if viewed from the right orientation. Warp the image to the supposed rectangle using the homography transformation matrix.
Here is an example:
I defined 8 points of correspondence for each mosaic. I first implemented naive blending which is just stacking the warped images together. The edge of the warped images are apparent. I tried many ways to blend them more smoothly, and I ended up with a nice blending scheme that is inspired by the SoftMax function. For every overlapping pixel, I calculate its Euclidian distance to the nearest edge of each image, take the exponential of that distances with some tuned temperature and divid the distance to the first image by the sum of the two distances.
exp(distance1) / (exp(distance) + exp(distance2))
The original images and the mosaic are as follows: