Stitching Panoramas with PTGUI and Panorama Tools


This website Copyright © 2000 by Lutz Kretzschmar

Tools Used

I use an
Thanks to Max Lyons, I was able to get up and running with Panorama Tools relatively quickly. I hope to return the favour and make it easier for people interested in creating panoramas to get started with this toolset.

General Workflow with PTGUI

Using PTGUI you can setup a panorama pretty quickly from photographs made with the C2500L.

The way Panorama Tools work is that you specify images and take a rough guess at how the images are oriented. In other words how (in what direction) you were holding the camera when you took the pictures. Then you specify points on image pairs that point to the same feature in each image. It's important to be as accurate as possible. PTGUI will display two images next to each other and all you need to do is click on a point in one image and on the corresponding point in the other image. Before actually making the panorama, you feed the control points and the guesses for the image orientation to Panorama Tools and it will optimize your inital guesses. PTGUI then reads the results of the optimization and overwrites your initial guesses. This process can be repeated any number of times until a certain accuracy is reached. Panorama Tools displays the distance that the control points differ from each other and once that distance is below 3 pixels (ideal is below 1 pixel) you're ready to stitch the panorama.

Here are some Tips for using PTGUI

This is an explanation of the meanings of the some of the settings on the Tabs of PTGUI:
Lens Settings Lens type The C2500L has a Normal Lens (rectilinear).
HFOV This is explained in one of the next tips.
a, b, c These settings determine how to correct for barrel or pincushion distortion. This also means you do not need to run your images through Camedia Master before importing them into PTGUI.
As starting parameters you should set a=0, b=0.01 and c=0.
Shift, Ignore I've never needed these settings and I'm not sure what they're used for. Set them to 0.
Panorama Settings File Format This is what the stitcher should create the panorama as. I have this set to Photoshop with masks. This allows you to have full control over the places where the stitched images blend into each other. This is useful to eliminate ghosts of elements that moved between shots. And it allows you to use color correction operations on each image after stitching.
Projection Choose the type of panorama that should be created. I generally have it set to Rectilinear.
Width and Height These settings determine how large (in pixels) the generated panorama image is going to be. For first tests to see whether the optimizer is working I usually set this to resolutions around 600. Once I want to see more details I go up.
Note that these settings together with Field Of View determine what part of the panorama will be in the file.
Field of View This setting determines what horizontal field of view the resulting panorama should have. If you have a lot of whitespace to the left and right of the generated panorama, decrease this number. If the images run off to the left or right edge of the panorama, increase this. When the horizontal image data is all present, adjust the Height to make sure that all image data is visible in the vertical direction.
Control Points Here you enter the control points for image pairs. If you have a horizontal, single-row panorama, you can use the Next and Prev buttons at the bottom to go through all the image pairs. Otherwise use the 1, 2, 3, etc. Tabs above the images to select the correct pair. Once you have clicked on a point in both images, click on Add at the bottom of the screen. Once you become comfortable with adding points, check the 'Auto Add' checkbox. This eliminates the need to click on the Add button, and will the point as soon as you have clicked on both images.
Optimizer This is the Tab where PTGUI uses the Panorama Tools Optimizer to refine the parameters of the images. Check the 'Show Script' checkbox so that you can take a look at the script after optimizing. I usually run the optimizer at least 5 times, but sometimes I may run it 20 times, it depends on the accuracy of the control points and my initial guesses.
Once the Optimizer has run, the resulting script will be shown. Take a look at the parameters that you have optimized (they are marked with a (*)). If they look OK, click on OK and then confirm that you want to apply the results. The script also shows how many pixels away the control points are from their ideal position (according to the parameters that are currently set). After the first run, this could be as high as 5 pixels or as low as 1 pixel.
It is not a good idea to make the Optimizer try and optimize all parameters. That gives it too much freedom and it won't find an optimized solution. The order in which parameters should be optimized are shown in the chart below.
Preview I generally don't use this Tab. For initial previews I prefer to use the next Tab (Create Panorama), setting the resolution to something low (Panorama Settings) instead.
Create Panorama With this Tab you can call Panorama Tools Stitcher and have it generate the panorama. Once it's done, I switch to Photoshop and load the panorama to see how it came out.
The Yaw is negative towards the left.
The Pitch is positive towards the top.
The Roll is negative in the anti-clockwise direction.

You can make a rough guess of each of these parameters and enter them in the first Tab (Source Images). Use the field of view to make an estimate of how far the camera was turned to take each image.
For vertical stitching (one column of images stacked on top of each other ), it's safer to stitch them lying on their side. Panorama Tools is more likely to find best stitching parameters in panoramas that are next to each other, rather than on top.
Try to set at least three control points one each overlapping image. I usually have at least 5 or more on each pair of overlapping images.
When optimizing you should alway exclude one image (uncheck it on the Optimizer Tab), so that the Optimizer has a reference from which to determine the parameters for the other images. You can either take the first image or the center image, it doesn't really matter.
If you are not satisfied with the default interpolator (image quality), you can make Panorama Tools use a better interpolator. Before clicking on the button for creating panoramas, check the "Show script" checkbox. Then add a new line like this to the script:

m i0 (for bicubic interpolation) which is the default or
m i1 (for spline 16 interpolation) or
m i2 (for spline 36 interpolation) or
m i3 (for sinc 256 interpolation).

For details on the interpolators, see Helmut Dersch's explanation.
(Thanks to Daniel Thouvignon who got this tip from Ben Kreunen).
For a non-360 panorama, you should try to set the Yaw for each image so that the center of the panorama has a Yaw of 0. This will make the stitcher create an image that is horizontally centered. Otherwise you would need to increase resolution just to be able to cut away the surplus white area on the one side of the panorama.
You can do this at any time. I mostly correct this once the optimizing process is done. I then go back to the Source Images Tab and look at the Yaw values. I then calculate an offset that will make the lowest and highest Yaw have roughly the same number, but with different signs. As an example, if you have Yaws of 0, 15.6, 22.1 and 34.8, I will subtract about 18 from each Yaw in the Source Images Tab, so that they are then set to -18, -2.4, 4.1 and 16.8. Then I run the optimizer once more, optimizing Yaw only and excluding the second or third image from the optimization. This will horizontally center the images on the resulting panorama.
One of the parameters you need to enter is the horizontal field of view (HFOV). This information isn't directly available from the EXIF information in the JPGs, but can be calculated from the focal length, which most EXIT readers will display for you. The C2500L has a focal length range of 36mm to 110mm. The chart below can be used to convert the focal length to the horizontal field of view.
It also includes the method used by Max (and myself) to optimize a panorama.

Further Reading

Check out Max Lyons' site for information about high-resolution panoramas
Check out Joost's site for more information. Specifically his Links page has some excellent resources.

If you have any more tips for PTGUI usage, feel free to let me know and I will add them here.

This website Copyright © 2000 by Lutz Kretzschmar