6. December 2011

Reinventing the Wheel: Panorama Stitching with Matlab

A set of images that have some common overlapping regions can be stichted together to form a panorama picture. Some recent camera models can even compute the panorama picture internally and do not require post-processing on the computer. While this is a problem that has already been solved (for example, there is AutoStitch, here are some hints on classic DIY-panorama-stitching using Matlab, SIFT, DLT and RANSAC.

Before going into some technical details have a look at the following figure. Here we can see the two input images that show the faculty of mathematics and computer science of Technische Universität München. Clearly, the part of the building is shown on both pictures.

Full size

Given these pictures and no other information, we want to stitch the two pictures together such that they form a larger picture of the whole building. This can be done by finding keypoints in both images. These keypoints are described by a local neighborhood in the respective images. Matching these keypoints allows us to compute the homography (a transformation) between the two images, for example, using the Direct Linear Transformation. Furthermore, we can use DLT in combination with the RANSAC algorithm to achieve robust estimation in the presence of noise. The keypoints and matches between those keypoints are depicted in the figure below. Matches in green have been used to compute the homography between the two images. Matches in blue have been accurately identified as noise by RANSAC.

Full size

A key ingredient to the Matlab implementation that stitched the two images above together is the vlfeat library that allows to compute SIFT
keypoints and provides matching algorithms.

Further information about homographies, DLT, SIFT, and RANSAC can be found in

  • Hartley, R. and Zissermann, A., “Multiple View Geometry”
  • Lecture at Technische Universität München: “Tracking and Detection”