Image Warping and Mosaicing


Shoot pictures and define correspondence points


The first step to creating photo mosaics was to take pictures that could be used to make a panorama. I chose these pictures because there were a lot of parallelograms in them which would make it easier to define correspondence points. It would have been useful to have a tripod in these situations, but the warping homography will take care of any tilt that occurs due to not holding the camera still.


Recover homographies


Then by using the correspondence points, I was able to recover the homography that would transform the second images correspondence points into the first. This homography matrix would then be used to warp the image to the correct geometry so that when blending the corresponding elements match well.


Warp the images


In order to test the homography matrix, I chose different elements of some of the pictures to be square and morphed it so that that element was a square. This is equivalent to a camera rotation. The most successful was the first one where one of the floor tiles was chosen to be square. The least successful was the second one where a very minor sign on the side of the road was chosen to be square. Since this element was so small, it created a rather strange warp. Lastly I took the picture of the building again and made it so that one of the windows was warped to square. This window was actually a rectangle, but it is easy to see that the homography matrix is doing it's job.


Since the homography matrix worked, it was then time to warp the second image in the set to the first one's geometry. The following are the results of those morphs. I haven't figured out how to get the matlab interp2 to return an image bigger than the one I am sampling from when using inverse warping. This causes some of the morphs to have information cut out of the side, which we don't want in a panorama setting.



Blend images


Now that the images are warped to the correct geometry, they can be blended together to create a mosaic. An alpha channel is useful in getting rid of all of the black in the image so that it doesn't average into the final picture. Since I wasn't able to get interp2 to output something larger than the original image, due to a Subscripted assignment dimension mismatch error, there wasn't much point to blending the warped images together because once the second image was warped to the geometry of the first, it would also move it so that the information that was not in the first image gets cut off. But since that was the information we needed, it becomes useless. Nevertheless, one can see that the warped second picture does match the geometry of the first and if the remaining information was still there, the correspondence points could be matched so that it became a much larger image. Since each picture would be slightly different even when taken the exact same time with a tripod, weighted averaging would be used to blend the two together so that the differences don't show up as glaring artifacts.