Stitching photos to make a panorama

Monday, March 2nd 2015

Modern cameras are exceedingly flexible and allow you to use a wide variety of lenses to capture scenes of various dimensions. I imagine, though, that despite this, every photographer from time to time laments the inability of the camera to capture a very wide scene, for example a sweeping landscape or a parade. Presented with such a subject what is one to do?

Being all too familiar with this dilemma, I was very excited to discover that my new camera (a Panasonic Lumix DMC-G6) offered a panorama function. To use it, you select the appropriate setting on the camera, press the exposure button and sweep the camera slowly from left to right. You can let it run until it stops by itself or you can stop it yourself by pressing the button. You need to sweep at the right speed because if you move too slowly or too fast the camera aborts the operation with a warning message. Here is an example from a previous post:

West End Green
West End Green

This works well for scenes, such as landscapes, where you are standing at a distance from the subject. If you are close to your subject, however, then lens distortion comes into play.

King's Cross Station
King’s Cross Station

The distortion may be mild, as in the above photo of King’s Cross Station, or…

Bromley South Station
Bromley South Station

…it can be so severe that I am disinclined to use the photo.

Admittedly, there do exist photo editing applications that are claimed to be able to correct lens and perspective distortion but, in my experience, they are very much a last resort and do not produce good results. They work by allowing you to stretch the image this way or that as you might a rubber sheet. The problem is that in order to correct one part of the photo, you have to distort another part. That might work if, for example, you want only the central part of the photo and can afford to crop off the now distorted outer regions. If, on the other hand, you are trying to save the whole photo, then you are very unlikely to succeed.

So, what’s the answer?

Thinking about this took me back to a time before I had the new camera and was using one that didn’t have a panorama function. I had then been thinking of getting hold of some stitching software in order to combine several photos into one. I had not persevered with the idea then but it had now come back to haunt me. My idea was this: What if, instead of using the panorama function, I took a set of overlapping photos and used software to stitch these together? Would the result be a panorama without the distortion?

There was one obvious way to answer the question: try it!

To do so, I needed some photos to use as experimental subjects. For the first batch I cheated by taking a panorama and cutting it into three overlapping sections:

Homerton Hospital
Homerton Hospital Homerton Hospital Homerton Hospital
Homerton Hospital

As my second batch, I used four single photos that I had taken of the street art on the wall of the Wheelbarrow in Camden Town. I hoped there would be enough overlap in these to allow the software to stitch them together.

Wheelbarrow art Wheelbarrow art Wheelbarrow art Wheelbarrow art
Art at the Wheelbarrow

I now needed to find some software to stitch the photos together. Here I ran into a problem of terminology. I first searched for “photo stitching” software and ended up with a lot of programs (and online sites) that merely join the photos together, end to end, which is not what I wanted. The term to search for, then is “photo panorama stitching” software. Once I’d tumbled to this, I found  a range of choices.

The first one I tried is Autostitch which is free and doesn’t need installing: just unzip the downloaded file and double click on the exe file. It presents you with three buttons (load, run and settings) and is very easy to use. The version of Homerton Hospital that it produced was almost perfect although the edges are not straight and would need trimming. You might like to compare it with the original panorama version above.

Reconstituted by Autostitch
Homerton Hospital reconstituted by Autostitch

Here is what Autostitch made of the four sections of the Wheelbarrow pub wall.

Reconstituted by Autostitch
Wheelbarrow art reconstituted by Autostich

It has stitched the photos together perfectly but the first thing you notice is the distortion. It’s as though the picture is on a card that has bellied out towards the back, introducing a curved perspective and causing the left and right edges to lean inwards. This is like the distortion introduced by my camera’s panorama function but in reverse! While I thought that this might do, if I were desperate, I wondered whether I could do better.

The second one I tried is ICE – Image Composite Editor by Microsoft Research. It is available in 64-bit and 32-bit editions. It too is easy to use once you work out the disk icon at top left is not for saving the composite photo but for saving the “project” (the job you are currently doing) and that to save the picture you have to use “Export to disk” at stage 4 of the operation.

Here is how ICE performed with the Homerton Hospital fragments.

Reconstituted by ICE
Homerton Hospital reconstituted by ICE

The result is pretty good. In fact it is virtually indistinguishable from the original picture. There are no rough edges or distortion. Another good thing is that by default ICE keeps the photos at the original size, whereas Autostitch reduces them (it may be possible to specify the size in Autostitch but I haven’t investigated this).

Now for the more difficult task, that of combining four separate images.

Reconstituuted by ICE
Wheelbarrow art reconstituted by ICE

Here we do have  some ragged borders and a leaning right edge but I am happy to accept that this is largely because of the way the photos were taken: I took no special care to make them compatible as I didn’t expect to be stitching them. It is a far more competent result than that achieved by Autostitch.

For the time being at least, I shall be adopting ICE as my photo stitcher. When taking photos that I intend to stitch, I will be careful to leave plenty of space around the subject to allow for trimming off the black jagged edges. I think that in some circumstances, for example when I am close to the subject, stitching multiple images with ICE will give better results than using the camera’s panorama setting.

Copyright © 2015 SilverTiger, https://tigergrowl.wordpress.com, All rights reserved.

About SilverTiger

I live in Islington with my partner, "Tigger". I blog about our life and our travels, using my own photos for illustration.
This entry was posted in Photography and tagged . Bookmark the permalink.

10 Responses to Stitching photos to make a panorama

  1. brianbarder says:

    Fascinating and extremely useful: thank you.

  2. Keith Nichols says:

    All your examples are quite usable for conveying the scenes you saw, especially to folks such as myself who will probably never see them firsthand. Distortion and jagged edges are irrelevant. I used to try this with a 35-mm film camera by standing in one spot and turning 360 degrees, snapping a frame every several degrees. Then I’d splice the prints together, cutting them vertically wherever needed to put the splices in areas where distortion would be least noticed. I have one such composite in which a man in a red jacket appears in several consecutive frames, as he was walking along at just the right speed in front of me and then made a right turn that kept him in front of me. Also, I’ve pieced together a block of storefronts across the street by walking and shooting one or two storefronts per frame, thus minimizing distortion. The resulting panoramas don’t mystify anyone as to the technique employed, but they show the relationship of things.

    • SilverTiger says:

      The example pictures (and others I have posted) “work” in the sense that they show you the view and relationships within it. In some situations, that is enough. Also, we have become used to various sorts of “distortion” in art and have learned to interpret Impressionist or Cubist representations.

      On the other hand, I like to present a scene as nearly exactly as the eye sees it as possible. Perhaps I am obsessively perfectionist but I have a low tolerance for distortion, at least in my own photos. I think, too, that when showing art works, it is particularly important to show these as they appear and as the artist intended. Any distortion to some extent falsifies the artist’s intentions.

      I have in a couple of instances on the blog spliced photos manually to produce a complete view of something. I am now thinking of revisiting those pictures and reworking them with the stitcher!

      Something similar to your man in a red jacket is my woman with two heads in my panorama photo of King’s Cross Station.

  3. Shannon says:

    ICE really seems to have done the best job with the compositing, and in reading about its features, it seems like the “automatic image completion” can cut down on the amount of empty edges or space that one might get around the end results.

    In light of the fact that the only thing I know of that would do a similar job is Photoshop’s “content-aware fill”, that certainly says a lot for ICE, as well. And the price certainly seems unbeatable!

    By the way, my mind completely ignored the two-headed, three-legged woman in the photograph at King’s Cross Station, until you pointed her out!

    • SilverTiger says:

      Photoshop is now so expensive that it has opened the market to cheaper alternatives. This can only be a good thing.

      The two-headed lady is an amusing side-effect of the panorama process and if we look carefully we may perhaps find others.

  4. Keith Nichols says:

    Some years ago, elementary schools had panorama pix made of their enrollees. The cameras were equipped with focal-plane shutters that swept rather slowly across the film in sync with the turntable on which the camera was mounted. The game was for one or two kids on the end of the back row to run to the other end during the exposure so they appeared at both ends of the row. Sometimes it worked and sometimes not.

    • SilverTiger says:

      Such photos were taken at the secondary school I attended and mine is packed away somewhere. There was a legend that a boy placed at the starting end had run round the back to the other end and thus appeared twice though I never saw any proof of this.

      The staff and pupils were arranged in an arc with the camera at the focus but in the photo we appear to be in a straight line because we were all at the same distance from the camera. The school building in the background was too far away to be affected by the distortion caused by curved field of view.

  5. WOL says:

    I can see how this would be useful to your documentation of street art, and other less than ideal situations where you can’t get far enough away from the subject to get a unified image.

Genuine comments are welcome. Spam and comments with commercial URLs will be deleted.

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s