Stitching

The Wonderful World of Image Stitching

There are a number of reasons why a photographer would want to stitch multiple images together. The most obvious is to create panoramic panels‚ composites that provide a wide field of view. The second is to produce a digital file that has higher resolution than that produced by a single frame, often of interest when shooting with a low to moderate resolution digital camera.

This technique is equally useful when shooting with 35mm film to create composite frames that are wide enough and large enough to produce extremely large high-quality prints‚ equivalent to those shot with large format. All it takes is a bit of care when shooting and some work on the computer. Results can be excellent.

In both cases there are a number of specialized software programs available that can automate the task. Some are better than others. My long-time favourite,PowerStitch, is unfortunately no longer available, but there are a number of alternatives, and links to several current products are provided at the end of this article.

Arno, Florence: May 2001

Photographed with a Canon D30 and 28~135mm f/3.5L IS lens at ISO 100

This photograph is of the south bank of theArno Riveras it runs throughFlorence, Italy. It was stitched from 3 frames shot at a35mm focal length. These were overlapped when shooting by about 30%.

One of the reasons why many people prefer to use high-powered stitching programs is because in addition to seamlessly merging multiple abutting frames they also deal with the distortions inherent in combining shots taken at different angles from the same vantage point.

But, many photographers prefer to use the tools that they have at hand rather than purchase yet another expensive image processing program. This tutorial is on how to effectively stitch together multiple images using Photoshop, though it will work with minor modifications in most image processing programs that featureLayerscapability. Versions of this technique have appeared in print a number of times, most recently in George Lepp’sThe Digital Imagenewsletter.

This tutorial is intended for users of intermediate Photoshop skill. Though I’ll do my best to explain each important step I won’t explain every keystroke‚ assuming that you have some familiarity with basic Photoshop operations. Here then is my approach to this technique.

Shooting Considerations

Though there’s no need to become too compulsive about it there are a few things to bear in mind when shooting frames for panoramic panels that are going to be stitched together.

Keep it Level:Place your camera on a tripod and level it. In addition to producing a better looking image you will find that you’ll be able to maximize the amount of vertical space in the frame. Sloppy shooting leads to very narrow panels.

Shoot Vertically:Though it appears counterintuitive to shot vertically when shooting for panoramic images, it is a real benefit. You’ll end up with more frames to stitch, but also less perspective distortion.

Overlap:When taking each successive frame overlap with the previous frame by about 25% ‚30%. This may seem wasteful, but you need the margin when lining up the frames in Photoshop.

Lock Focus & Exposure:Turn autoexposure off. Take a representative exposure reading and don’t change it for any of the frames. Also, except in special situations, turn off autofocus and leave the focus setting uncharged between frames. Image size actually changes with focus shift and you’ll have a devil of a time trying to get alignment, in addition to other problems.

If your digital camera has auto-white balance, turn this off and set the white balance manually.

Don’t Use a Polarizer:Anything wider than the coverage of a 28mm lens and the use of a polarizer will produce an uneven sky. If you use one on frames intended to be stitched, even if the angle of coverage is narrow, you’ll end up with visible banding.

Identification:It’s a good idea to identify the frames that are intended for a panoramic panel or other form of stitching at the time of shooting. What I do is to hold up my hand with fingers spread in front of the camera and take a frame. When I see an out-of-focus hand on-screen or among my slides I know that the frames that precede it are intended for a stitched panel. Otherwise after a long and productive shoot consisting of hundreds, if not a thousand or more frames, you may overlook what you originally intended.

Scanning:If you are going to be scanning film set the scanner’s parameters for the first scan and then scan the remaining frames with the same settings. All of the scanner’s auto functions should be turned off.

 

Stitching With Photoshop

Photoshop is the Swiss Army knife of image editing programs. It can do almost anything you can imagine. Some tasks are just more difficult or tedious than others. Stitching panoramics isn’t terribly difficult, but it can take time and it certainly requires that you understand conceptually what it is that you’re doing.

So, let’s take this one step at a time.

Like most tasks in Photoshop, being familiar with Photoshop’s keyboard shortcuts can make work much easier. If you don’t already use them, you should, because they’ll make operations much quicker not only for this task but for all of your work.

Step By Step

This will be a lot more interesting if you practice with your own images, so go out and shoot a panoramic set, keeping in mind the do’s-and-don’ts that I’ve listed above. In this tutorial I’ll just discuss and illustrate what to do with the first two panels, but everything described also applies to the third, fourth and so on.

  1. Load each of the frames that you’ll be working with into Photoshop

  2. Create a new file to hold the stitched panel.File / New. Set the background to White and the file size to the resolution that you want your final print to be. Set the horizontal and vertical size of the file to slightly larger than the combined size off all of the individual frames that you’ll be stitching‚ taking into account that there’ll be a lot of overlap. For example, if you have 4 panels, each 6" wide by 12" high, overlapping by 30%, then you’ll want to create a new file that’s about 16" high by 16" wide. You’ll be able to crop it down to only what’s needed later on.
     

    Fig-1

     

  3. Using theMove Tooldrag each of the images to the new file. The resolution will be automatically changed to match that of the new file. Each file will become a Layer. If you drag them onto the new file in the correct order (say, if they were shot left to right) then their layers will be automatically named Layer 1, Layer 2, etc. Otherwise give the layers meaningful names, or you’ll become awfully confused.
     

    Fig-2
     

  1. Click onLayer 2, the leftmost layer. Using theOpacityslider on the Layers palette change the opacity to about 50%.  Then using theMove Tooldrag the image so that something prominent in the middle of the frame is superimposed. In this example I’ve used the green sign at the top of the tallest building. Magnify the frame so that it’s atActual Pixelsand using theArrow Keysnudge Layer #2 so that this object exactly overlaps.

    You’ll notice that no matter how careful you were when shooting, even if you leveled the camera, parts of the overlapping frames won’t align. (This is the job that the best stitching programs do automatically‚ resizing and stretching the images so that they do). Don’t worry about it though because we’ll be dealing with this in a moment.

    SelectView / Show Rulersand drag a couple of rulers so that they line up with whereLayer #1andLayer #2overlap at both sides of the frame. This will be useful in a few minutes. Change the opacity ofLayer #2back to 100%

  2. WithLayer #2selected, click on theAdd a Maskicon at the bottom of theLayers Palette. Press theDkey to set the default foreground and background colors. Next select a paintbrush. It’s best to use a brush that has an intermediate edge, so create aNew Brushwith aHardnessof about 65. You’ll be changing the size as needed later using the left and rightsquare bracketkeys.

  3. The plan now is to use the medium-soft edged brush that you’ve created to erase the layer underneath and to select where the transition between the layers is to take place. In this example a good place is in the sky along the edge of the tallest tower.
     

     

    Fig-3

  4. In Fig-3 I have turned offLayer #1so that you can see what is being done.Layer #2is being "erased" under the brush so thatLayer #1shows through. Because I turned#1off momentarily you can see the white background behind it. The Ruler that was placed where they meet helps show the demarcation point.

    Here’s the concept. What you are trying to do is to move the sharp edged line whereLayer #2coversLayer #1beneath it (and which will show the transition) to a place where it won’t show, and you’re using a soft edge brush to "paint" that edge‚ blending the layers so that the new transition you’re creating takes place in the place that you choose rather than at the straight edge where the frames overlap. Once this new edge is defined you can use a large brush size to remove the rest of the bottom layer and a small brush at high magnification to trace along the edge to refine the transition.

  5. If you now magnify the spot where the two layers meet you’ll see that there is no visible join because you’ve moved the spot where they join to an irregular place where you can blend the transition invisibly. Be aware that if you go past a frame edge and start to show white, you can simply press X to switch from erasing the background layer to erasing the foreground layer.

  6. One thing that can get you into trouble is if you pop out ofLayer Maskmode. If so you’ll end up painting with Black or with White instead of erasing. Just click on the icon to the left of the layer’s title and you’ll be back in Mask mode.

  7. Now return to Step #3 above and drag the next panel onto the stitched file and repeat the steps.

    I know that this all seems confusing, and this process is likely impossible to learn simply by reading, but if you work with files of your own and follow the steps above I promise that it will be both comprehensible and fairly quick.

  8. Once all the layers are satisfactory aligned you should saved the file, naming it appropriately so that you’ll be reminded that it still has all its layers, and that it’s unsharpened and uncorrected.

    Fig-4 Fig-5

  9. Now proceed to crop, color correct and sharpen the file. My final stitched panoramic is shown as Fig-4 above. You can see a somewhat larger version by clicking on it. It was taken with a Canon D30 and 28-70mm f/2.8L lens set at at 45mm. It is stitched from 7 separate shots. The total time needed to stitch all seven frames using the technique described above was about 30 minutes.

    Next to it in Fig-5 is a single frame taken at the same time with the same lens. It was taken at a focal length of 31mm. It’s there to illustrate two points. First, it is a 9MB file that can produce a 6" X 9" print at 240 ppi. The stitched frame, Fig-4, is a 22mb file and can produce an 16"-wide print at 240 ppi.

    The second thing to note is that the single frames shows keystoning, because I was pointing the lens slightly upward and the zoom was set to a moderate wide-angle. This could be corrected in Photoshop, but the point is that the stitched panel hardly shows keystoning at all because each of its composite frames was taken with a longer focal length.

  10. That’s it. As I said at the beginning, this is not a simple procedure, but once you understand conceptually what is being done by the use of a Layer Mask, and practice a bit, it’s a very powerful tool. It’s also worth noting that this masking technique is the same as is used in my tutorialBlended Exposures, so once mastered offers the user a great deal of image control.

What’s Next

If all of this seems like too much work and bother there are, as mentioned earlier, a number of programs which automate the stitching process. They range from shareware to expensive. Here are some of the ones that I know of. This list is by no means all-inclusive and I have only limited experience with a few of them, socaveat emptor.

Panorama Tools

PanaVue

Arcsoft Panorama Maker

The Panorama Factory

If your interest in panoramic photography and stitching is insatiable then you need to visitPanoGuide.com, the best resource on the web related to panoramic imaging.

Finally, this technique will be featured in a live hands-on tutorial in a forthcoming issue ofThe Video Journal.