Thursday, May 9, 2013

Automatic panorama

Coded in OpenCV 2.4.2 and C++. I initially tried to use OpenCV's Python wrapper, but the documentation was quite bad. So it was C++ instead, which was pretty fun. Like, in Python I'd just think of sticking an ArgumentParser for command line arguments, but in C++ it felt natural to write a recursive option parser. I decided not to use Matlab because (1) I don't have it on my laptop, (2) I wanted something I could play with later, or use easily.

The human eye naturally recognizes the relationship of points in two photographs. First I did manual landmarking (user clicks pairs of interesting points on the two images he/ she wants to stitch). To mosaic more than one image, do manual consecutive mapping for better results (the order that you put images together is important).

Automating manual clicking

Then with feature detector and extractors, I obtained descriptors of landmarks, and matched them. This was all done with the OpenCV library. However, it's findHomography function, where it finds the projective transformation from image 1's coordinate system to the other, was not very good. For non-planar surfaces, they would fail immediately.

So instead of using that, I implemented my own outlier/ inlier algorithms. It was really quite easy, but with some inaccuracies. It was also slower.

No comments:

Post a Comment