Creating Digital Panoramas | From Luminous Landscape
Posted on November 26, 2010 in [ Photography
] By Joe Beda
Getting Started with Digital Panoramas
I dream about being able to afford 22 megapixel medium format backs. I think that it would be great to be able to capture that much detail with one click of the shutter. Heck, I’d love to be able to afford a Canon 1Ds. However, for most amateur photographers that type of hardware is out of reach. But, with a little bit of practice, you can get some of the same eye popping detail using much more modest equipment. The answer is to take multiple exposures and stitch them together using software that costs as much as a somewhat nice dinner.
Here is an example of what you can do:
Image Copyright © 2004, Joe Beda, All Rights Reserved
Rocks on Hillside near Waitomo, North Island, New Zealand
This image is 6 different photographs that have been stitched together. The resulting image is 9430 by 2652. This works out to 25 megapixels. Each image was shot handheld with a Canon D60 and EF 300mm f/4L IS lens at 1/250 and f/4. Total time taken to shoot all 6 frames was 18 seconds. (EXIF info is great!)
So, with this “panorama” I’ve effectively taken my 300mm lens and small D60 sensor and simulated a much larger sensor. This isn’t the same as using a wider angle lens as the perspective hasn’t changed. This is much more similar to using a sensor that is five times as wide as the native D60 sensor. While the native field of view for the 300mm lens on the D60 is about 3 degrees across, this total composition is close to 15 degrees.
You don’t have to restrict yourself to long lenses and only one row of images. The following image is a stitch of 6 images that were taken in a 2 by 3 grid. Each image was taken with a fixed 20mm lens. As you can see I’ve achieved both a super wide angle look (about 100 degrees across) with a quite a bit of resolution and detail – the final image is 4770 by 2736 or 13 megapixels and looks great when printed on A3 paper.
Image Copyright © 2004, Joe Beda, All Rights Reserved.
Overlooking bay near Omapara, North Island, New Zealand
And of course, you can a more “traditional” panorama. This is a 3 image stitch done with the 20mm. This is the image I’ll use for my example below.
Image Copyright © 2004, Joe Beda, All Rights Reserved
“Mordor” Rocks along Tongariro crossing, North Island, New Zealand
Capturing the Images
When shooting a panorama there are quite a few things to keep in mind when capturing the source images. Here are some tips.
Shoot raw mode whenever possible. Not only can you do the stitch before any sharpening this way, but you can also ensure that you use the same white balance when converting from raw. And as always, you don’t have any jpeg compression artifacts.
Try to find a scene with even illumination. While you can stitch photos that are shot at different exposures, I’ve found it simplest if you can shoot all images with the same exposure. When shooting handheld, I generally scan the intended scene and find the highest exposure suggested. I then use exposure lock to lock that in and shoot my images. I then check the histogram on all of the images to make sure that I haven’t blown the highlights. If so, I start over.
If using a wide angle lens, try to stop down to reduce vignetting. While slight vignetting might not be noticeable on a single frame, it can become quite apparent if there are abrupt brightness changes in the middle of an image.
Don’t use a polarizer. The color change near the edges of the frame when using a polarizer will become obvious during the stitch. This is similar to problems caused by vignetting.
Try to minimize parallax as much as possible. Parallax is when the relationship between objects at different distances changes relative to the camera’s viewpoint. Think of how you can get different speed readings from your speedometer depending on how you move your head from side to side. You can reduce or eliminate parallax by buying expensive tripod heads which ensure that the camera only rotates around the nodal point of the lens. If you can’t afford such beasties or if you want to travel light, you can carefully pick your scene such that you minimize foreground elements. You can also try to rotate about the camera instead of having the camera rotate around you. If you don’t get it perfect, you can do quite a bit after the fact when doing the stitch. If there is one foreground element (say a big rock or a bush) that you want to make sure comes out looking good, take an extra frame with that element in the center. You can redraw the seams around that element.
Stay level. If you take a long row of images along a diagonal, you won’t be able to get a very large rectangular crop. I always make sure that the horizon (if it is in the image) stays about the same place in my viewfinder. If I do this then even if the images are tilted (and they often are) the panorama as a whole isn’t.
Make sure your images overlap. You don’t have to have a ton of overlap, but you do have to have some. I try to overlap by about a quarter to a fifth of the frame.
About the Software
There are many software packages out there for stitching panoramas. A simple and function package came with my camera. However, if you want to do something other than a cylindrical projection (I’ll explain further down) or do a multi-row stitch, you probably want something more advanced. The solution that I use has all of the power you might want, is a little tricky to use and is very inexpensive. The downside (at least to some) is that, as far as I know, it is only available on Windows. People have run these under VirtualPC and I think that there are front ends for the Mac, but I haven’t tried. There isn’t just one program in my workflow but actually three.
The first piece of software is called PanoTools written by Helmut Dersch. This is essentially a stitching engine. No one uses this all by its lonesome. It is fed by a “script” file telling it how your images exist in relation to other images. This is free and the source is available. The best place to download this (with a nice Windows installer) is from Max Lyons' site. If you are running on a Mac, there are probably precompiled versions out there somewhere.
The second piece of software is called PTAssembler. This is a front end that will help you use PanoTools. It will also automatically run PanoTools for you. This is written by Max Lyons and is available here. This package is shareware and well worth the cost to register it. This is where you will be spending most of your time when stitching your panoramas. There is a great tutorial for PTAssembler which will help fill in stuff that I can’t cover. This is only available on Windows.
The third piece of software is Photoshop. While this isn’t cheap (by any stretch of the imagination!) there is a good chance you already own it. While it is possible to use these tools with out Photoshop, one of the main advantages of PanoTools is that it can output to a .psd file. Each of your source images is placed on its own layer so that you can manually edit and adjust the seams.
Doing the Stitch
For this example, I’ll go through the process of producing the “Mordor” image above. Here are the three original images lined up next to each other.
The first step is to convert your raw images. Generally, I stick with TIFFs to eliminate jpeg compression artifacts. I also make sure that I turn off any sharpening as that really needs to be done after the stitch. The last crucial step is to make sure you convert each image with the same white balance. With BreezeBrowser there is a simple checkbox when converting a set of images to use the same white balance for all of them. I’m sure that other raw converters have the same capability. I’m not sure how PanoTools handles different color spaces (and my D60 only supports sRGB) so some experimentation is needed here if you want to use something like AdobeRGB.
Step 1: Importing your images
PTAssembler is set up as a simple wizard. The first step is to load each image into PTAssembler. Hit the Add button and then use the Ctrl key to select multiple images at once.
Step 2: Setting up parameters
The next step it set up a bunch of parameters. You can access this screen by hitting the “Step 2” button near the top of the window. The first time through, there are two things that you have to adjust: the type of projection and your lens field of view (FOV).
The first is the type of projection that you want. This is accessed via the “Panorama Projection” dropdown. If you have a relatively narrow composition, you probably want to try a rectilinear projection. If you have a more traditional panorama that is super wide, you probably want a cylindrical projection. With a rectilinear projection, the software simulates taking the world as defined by your images and projecting it on to a regular rectangle. After this type of projection straight lines are still straight. The downside is that you end up with very large distortions toward the edges of your image if your final panorama is wide. With a cylindrical projection the world is mapped on to a cylinder. This cylinder is then cut and unwrapped to form a flat image. The upshot is that you can deal with very wide compositions with no apparent distortions. Relative sizes of objects are kept constant across the image. The downside of this projection is that straight lines in the foreground can end up curved. (Interestingly QTVR type software takes a cylindrical or spherical mapped image and converts it to a rectilinear image on the fly to simulate looking around.)
The second parameter you have to set is your lens field of view. This can be complicated to calculate on your own. Instead, PTAssembler lets you input your lens length and your “lens multiplier.” For my Canon D60 (and I assume the D30, 10D and 300D) you can use a multiplication factor of 1.56. There is also a handy button to try and calculate this information from the EXIF data in the image. Since the lens used in this example is a 20mm lens on a D60, I ended up with a horizontal FOV of 42.075. If your FOV is only an estimate you can let PTAssembler vary this parameter when doing the final “solve” of your panorama.
Step 3: Setting the control points
This step is by far the most tedious part of the process. What you need to do here is identify pairs of points between each overlapping image. You are giving data that the PTAssembler will then use figure out exactly where each input image lies relative to the other input images. Try to find detail that is common between each pair of images. Things like rocks or trees silhouetted on a hill work well. I always make sure I have at least three control points per pair of images. Try to make these somewhat far apart. If you didn’t use a special tripod head, you should probably avoid picking points that are too near the camera. The further away something is the less parallax will be apparent. PTAssembler gives you a very helpful zoomed in view of where you are setting each control point. The ‘n’ key will move you to the next pair of images.
Step 4: Solving the panorama
Before you can solve the panorama, there is one last piece of information you have to provide. You have to tell it where the aggregate center of your image is. This is because while the control points can help orient each image relative to each other, they can’t help orient the images relative to the world at large. To help the software out, you have to pick an image and set the “Reference Point”. You generally want this to be in the middle of the images and on the horizon. This is essentially the direction your “virtual” camera is pointing. If you don’t set this at the center you can effectively “shift” your camera. If you don’t get this correct, you can always change it and try again. If you hit the “equalize” button under the “yaw” section, you can center the “virtual” camera between all of the images that you took in the horizontal direction. Less useful, if your horizon is dead in the center of every image you can hit the “equalize” button in the pitch section.
If you only estimated your lens field of view, you will want to hit the checkbox next to the FOV item in the “Lens Parameters” list box.
After you have set your center you can hit the “Optimize” button and PTAssembler will iteratively run the solver to reduce your error. Error is defined by the distance between a pair of control points in the final image. At each step PTAssembler will play with the parameters that are checked. Generally it will mess with the yaw, pitch and roll of all images except for your reference image. It will also mess with the lens parameters that are checked. In this case the “b” parameter is used to correct simple barrel or pincushion distortion. After things have stopped changing, it will pop up a dialog telling you how you did. If things don’t look good you can adjust your control points or play with some of the other parameters (like lens FOV).
Step 5: Making the panorama
You can now preview your panorama by doing a stitch at a small size. This is the first time you will actually see everything put together. Go to the last tab, hit the “Auto Size” button and watch PTAssembler call PanoTools to make the magic happen.
When creation of the mini preview panorama is completed, PTAssembler will display it. You will see the edges where you don’t have any picture data.
If you can see seams, there are some things that you can do immediately. If the seams are due to brightness changes, you can go back to Step 2 and turn on “Brightness Only” correction in the upper right hand corner of the window. This will work to even the brightness across the images. I’ve found this most useful in adjusting for vignetting in wide angle lenses. Another approach to deal with seams is to make the “feathering” between images greater. In the Step 5 screen you can up the number of pixels used to feather the interface between the images. This can help mitigate many parallax issues.
After you are happy with your preview, you can do the final stitch. Make sure you are exporting to “Layer Photoshop w/ masks.” This can take a while. After this is done, we are ready to move in to Photoshop.
Advanced Technique: Morph-to-fit
If you have really bad parallax errors you can ask PanoTools to do extra morphing to try and correct for those errors. Remember that nothing replaces good images to begin with. First, you need to check the “morph all control points” option in the lower right hand corner of Step 2. Next you need to set up control points in the foreground of your images where parallax is the worst. You will want to right click on these control points and uncheck the “Use when optimizing parameters” item to tell PTAssembler not to use them when solving the panorama. Now, when you do your final stitch PanoTools will work to do extra distortion to the images to get these extra control points to line up. They won’t be used by PTAssembler when positioning of the images as a whole.
Touch up in Photoshop
Once you bring your final stitch in to Photoshop, you can crop out all of the areas where you don’t have an image. I’ve actually used the clone tool to create a little extra space so that I could make sure that an important foreground element is in the final crop.
After this, you can edit the layer masks to work around visible seams. There are multiple techniques you can use and you should get creative. Generally I either route around a seam by including a foreground element from only one layer or I use the airbrush tool to soften the transition between images. You’ll want to pay special attention to things like water or fast moving clouds.
The images you can get from these techniques are truly stunning. With minimum investment ($0 if you use PTAssembler within the trial period) you can pretend you have a super high resolution 22 megapixel back. Granted, while these techniques don’t apply to every subject you may want to photograph (wildlife is pretty much ruled out) you can create landscapes that can stand to be printed in sizes larger than you ever thought possible from your humble camera. You don’t even have to be using a digital SLR. You can do this with film (with the added step of scanning – ug!) or with your pocket digicam.
© 2004 Joe Beda
Joe Beda is a full time software developer working for the man. When not slaving away on the latest scheme to take over the world, he is out taking photographs. He has a blog where he sometimes posts his thoughts on work, photography and other random stuff.