Saturday, June 09, 2007

Piecing the full picture together

Almost four years ago I picked up a digital camera. I'm not much of a photographer, but I clicked a lot of photos: it costs nothing with a digital camera. To date I haven't printed a single one.

This was a Canon A-80, and served me well till recently, when its colours started going new-age. But before that happened, one of the features that intrigued me was the "panorama mode". You could click multiple overlapping images, and the camera had a "panorama mode" to help you align them (and also to keep the exposure level constant, and so on); and Canon also supplied software to "stitch" these photos together into a larger image.

Unfortunately, the software was Windows-only. I did have a Windows partition on my laptop, but rarely booted into it. But this software didn't even make the pain worthwhile. It provided no fine-tuning capabilities, and the results were rather Dali-esque:

So I abandoned the idea, but still had lots of panorama shots lying around in my laptop.

Recently I tried hugin. It's based on the venerable Panorama Tools, which I found too hard to use when I checked in 2003; but hugin really makes the whole thing much easier. The idea is, you provide "control points" to say where your images overlap (and there's a really neat program called autopano-sift that does this for you, providing output in a format hugin can understand); you optionally indicate lines that should be maintained horizontal (typically, the horizon) or vertical (for example, walls and doors); you choose from various stitching options to correct for various forms of distortion; and, finally, you stitch the program. While hugin can provide the final output by itself, it is recommended that you install enblend, which hugin can then call automatically. Enblend intelligently gets rid of ugly "seams" arising from different light exposure levels, and even deals intelligently with other discrepancies, for example, where people appear in one overlapping frame and not in the other.

It's much slower than Canon's software, but it's quite easy to use after you figure out the basic ideas, and it works beautifully.

Who needs a wide-angle lens?

(The above software claims to work on windows too, but I haven't tried it.)

PS: These examples aren't defect-free. In the first hugin example, the needle is slightly bent (though not as broken as in the Canon stitching). This can be corrected by picking more and better control points. And in the last photo, the same individual appears twice, having been photographed in non-overlapping frames: correcting this is beyond enblend's impressive capabilities.


Abi said...

I'm sure you have seen this on Natasha's blog already. The video -- of a TED talk -- describes some of the cool research by Micro$oft researchers on what all one can do with images.

km said...

Interesting. I'm still on film, but I gotta look at this software.

Anonymous said...

"Who needs a wide angle lens?"

Would you rather go through the trouble of stiching them together than mounting a lens? I guess it has it's advantages, like having one person appear in more than one place in a picture, making picures that are not necessarily rectangular, and avoiding the distortion that wide angle lenses exhibit.

Rahul Siddharthan said...

Abi - I hadn't seen the video, being time-constrained, but will take a look soon, having heard about it in person from you and Natasha...

anonymous -- I must stop using such quips as closing lines. Of course some people (pros) need wide-angle lenses. But they cost several times what my camera did. For that matter, a camera capable of using them would cost several times what my camera did.