Beyond the Lens

Digital Adjustment of Wide Angle Perspective

A few years ago I began to wonder why there were no photographs that looked like the impressive wide-angle cityscapes painted in 18th Century Italy. You can see those on every postcard rack in Rome and Venice, beside modern photographic views—and the photos look narrow and drab by comparison. Surely, I thought, photographers could do better than that. I’ve learned how to make photographs that can at least stand up to comparison with 18th Century view paintings, and I know why there were no such photos before. It is because you can’t take pictures like that with a lens.

This article is a brief introduction to digital panoramic photography (DPP), a technology that literally separates an image from the lens that took it, then “re-photographs” it with a lens made of software instead of glass. I’ll demonstrate that magic with the software lens I designed to simulate the wide perspectives of 18th Century views, the Panini projection.

DPP programs are called stitchers, because one of their jobs is to merge separate photos. However, stitching is not important for our present purpose.

The technique described here applies equally well to single photographs, taken with wide, ultra-wide or fish-eye lenses, as do panoramas made from multiple photos. The real problem is how to make a flat image covering a very wide field of view look believable. The goal is to convince the viewer that your picture looks like the real thing, or better still, that the real thing looks like your picture. Many view paintings are geometrically inaccu- rate, but all make you believe “yes, that must be how it really looks.”

By wide field of view I refer to anything over 75 degrees, about the horizontal field of a 28mm lens on a 35mm camera. At that width, in a normal (rectilinear) image, the stretching at the edges called perspective distortion begins to disturb some people. It increases very rapidly as the field gets wider, so ultra-wide normal lenses, that cover 110 to 125 degrees make badly distorted images, that really need some adjustment. The need to “fix the perspective” is even more obvious with fisheye lenses and stitched panoramas. The Panini projection handles them all. It works well up to 150 degrees wide for most subjects, and even beyond 180 degrees in some cases.

My professional wide-angle perspective tool, Panini-Pro is scheduled for release this fall. But for these examples I used Hugin, a free, open source DPP software suite for Windows, Linux and Mac OS. Hugin offers many fixed and several adjustable “software lenses” called projections in DPP- speak. It has an interactive preview window where you set up views to be rendered (stitched) to high-resolution image files. Hugin gives top quality results, but is challenging to learn.

The rectilinear view does not look like the real space. There is extreme perspective distortion, especially noticeable in the proportions of the woman on the balcony, and the relative size of the woman by the escalator. Even at a glance, the whole image seems badly out of balance. This is a straight rectilinear projection, without any adjustment of proportions; a pinhole camera could theoretically have made the same image.

Processing the ImageI suggest you try processing a single ultra-wide or fish-eye photo first, unless you are already comfortable with panorama stitching. The instructions here are a general guide, you will need to discover many details on your own. There are detailed tu- torials on the Hugin website.

1. Load your image and set its projection parameters. For a photo or set of photos, that means the lens type, focal length and crop factor, or field of view—or ideally a lens calibration.

2. Open the “GL” (fast) preview window and set its hfov and vfov sliders to roughly your intended field of view. Select the adjustable Panini projection, called “panini-general” (ignore the other two “panini” projections) and you are ready to start creating a wide perspective view.

3. The hardest part is framing your image in the output window. The source image is now on a sphere, so you do that with angles, not by shifting pixels. This is the part of DPP that takes the most getting used to. Try to imagine a sphere with your image painted on it, with a flat rectangle, the preview window, sitting beside it. The “software lens” projects part of the sphere onto the window. By rotating the sphere, you point different parts of the image toward the window. Do that by dragging in the preview window (right-drag for roll). As you rotate the sphere, you’ll see the perspective change.

4. You definitely want “up” in your image to agree with “up” in the window. To fully align the vertical axis of the sphere takes two rotations at right angles to each other (roll and pitch). Right-dragging the image controls roll, dragging the center vertically controls pitch. You may have to adjust both several times to get all vertical lines upright and parallel.

5. Get the perfect view by adjusting yaw and pitch, hfov, vfov, crop limits and the Panini compression parameter “Cmpr.” That parameter controls the amount of horizontal angle compression, relative to a rectilinear projection. At Cmpr = 0, the Panini projection is the rectilinear projection. As you increase compression, the middle of the im- age grows, and the edges shrink, while vertical and diagonal straight lines stay straight. The best settings will depend on many factors, so experiment, and judge carefully. I made the example image with a slight downward pitch and Cmpr = 92, somewhat less than the default value of 100.

6. Hugin’s panini-general has two more controls “Tops” and “Bots”, that reduce bowing of horizontal lines at top and bottom center. The downside is that they also make flat vertical structures seem to curve inward at the sides of the image. Here, I set both to about -36.

7. To render the view, go to the stitcher tab. Set the image size you want. If your source is a multi- photo set, check the appropriate “panorama” output; otherwise, to skip a lot of needless processing, uncheck all “panorama” outputs and check “uncorrected remapped images” output. Click “Stitch now” and enter an output file name (Hugin adds “0000.tif” to that for remapped images).

8. Reduce the vertical scale of the final image to something like 80–95% before printing it. Hugin won’t do that, but it is important for natural looking proportions. The correct amount depends on field of view and compression. Choose a prominent human or circle and experiment. To give the woman on the balcony a good shape, I reduced the example image to 77% of its “stitched” height in Photoshop, while also touching up tone and color. I usually render somewhat oversize and do my final cropping at this stage too.

I made a rectilinear view right after the Panini view, by reducing the compression parameter to zero, to ensure that the images would be identical except for projection. You decide which one looks more believable.

Calibrating the LensFor professional results, you should calibrate the lens. For that you need a set of photos, shot from a properly aligned panoramic tripod head, covering 360 degrees with 50% or more overlap between adjacent images. There should be unique details all around the circle (my cluttered office is a fine subject). Load them into Hugin and click “align images.” If everything has been set up right, Hugin will find a lot of matching control points linking pairs of images. Make sure all six lens parameters (fov,a,b,c,d,e) were enabled for opti- mization, if not, check them on the optimizer tab and re-optimize. Then on the “Camera and Lens” tab, select and save the lens. Later, when processing images taken with the same lens, at the same zoom, load the saved lens parameters. If your camera makes different sized images you need a separate calibration for each image size.

About the Author

Thomas K. Sharpless is a retired software and systems engineer who worked in cancer research, medical imaging and chip design. He got hooked on panoramic photography in 2004. He also develops open source panography software (Hugin, Panini). His current interest is exploring new ways of controlling wide-angle photographic perspective, made possible by using software instead of lenses.