The Pannini Projection

Pannini San Pietro
The Pannini projection is a mathematical rule for constructing perspective images with very wide fields of view.  It is named in honor of Gian Paolo Pannini, an 18th Century Roman painter and professor of perspective, who may very well have used it to draw spectacular views such as the one above; for it can be realized with drawing instruments almost as easily as the standard rectilinear perspective projection.  However it is not now taught in art schools, and was apparently never described in print before its recent rediscovery by a team of open source software developers.

The Pannini projection is now embodied in several software packages for creating and viewing panoramic photographs.  In the future it may also be used to create ultra-wide angle television, movies and games.

Examples of the Use of the Pannini Projection

Fine Art Photography  Click on images for larger views / more information.


St. Francis Xavier, 145x85 degrees

Schuylkill River Bridges, 170x85 degrees


Rivelin Valley Bridge, 171 degrees wide

Friends' Arch Street Meeting, 130x60 degrees

Ultra-Wide Video


Video shot with a 180 degree fisheye lens, rendered in modified Panini projection at 170 degrees

Controlling
Wide Angle Perspective
Comparison of rectilinear, cylindrical, Pannini and General Pannini projections
How perspective varies with Pannini compression
Correcting an architectural snapshot
Converting fish-eye snapshots into realistic looking photos

Ultra-wide Game Views
Stills from a flight simulator
Videos from a combat game

Published Implementations of the Pannini Projection

PanoTools Library
    SourceForge Project Page
    Wiki Page: The General Panini Projection
    libpano13 supports 3 projections called 'pannini':
    These projections are available in the script-driven panotools as well as in Hugin; but not in front-ends such as PTGui and PTAssembler that use libpano12.

Hugin
  Project Web Page



Hugin is a comprehensive open source panoramic photography suite.  Versions released in 2010 provide all variants of the Pannini projecton  found in libpano13.  The screen shot above shows Hugin's fast preview window displaying a fisheye photo in General Pannini projection.

Panini Panorama Viewer and Perspective Tool
    Project Page
    Panini Support Group



Panini implements generalized spherical and cylindrical projections with OpenGL graphic operations.  The current verson 0.7 (2009) has a movable second projecton center, giving adjustable horizontal compression; version 1.0 (due in late 2010) does the full General Pannini projection with refinements.   The screen shot above shows Panini 0.71  displaying a partial cubic panorama in Pannini projection.  

Helmut Dersch's PTStitcherNG
PTStitcherNG is a very fast GPU-based panorama stitcher by the original author of PanoTools. Version 0.7b implements panini_general like libpano13, using the same script commands.

Joost Nieuwenhuis' PTGui
PTGui is a proprietary panorama stitcher based on PanoTools. The 'vedutismo' projection is equivalent to the variable eye-distance cylindrical projection in Panini.

Max Lyons' PTAssembler
PTAssembler is a proprietary panorama stitcher based on PanoTools.  Its 'recti-perspective' projection is the same  projection used in Panini, and its 'compressed rectilinear' projection is similar but not identical to the general Pannini projection with full "hard squeeze".  Lyons developed both of these projections independently using mathematical methods, at about the same time that the Pannini projection was rediscovered.

Klaus Reinfeld's KRPano
KRPano is a widely used web panorama viewer and publishing software.  It provides several alternatives to the standard rectilinear view, including the stereographic and Pannini projections.  For example, right-click on the panorama  [here].

Thomas Sharpless' Panini-Pro
An ambitious expansion of the original Panini, with higher resolution and local image reshaping tools, published in 2011.  Although intended as a commercial product, only a free beta version was ever made available.

Thomas Sharpless' Panini-Video
A commercial video transcoder that applies the general Panini projection, late 2012.

History and Mathematics of the Pannini Projection

Pannini: A New Projection for Rendering Wide Angle Perspective Images 
Thomas K. Sharpless, Bruno Postle and Daniel M. German;  International Symposium on Computational Aesthetics, London, June 2010.

Numerical Analysis of Paintings

This Excel spreadsheet  contains the analysis presented in Table I of the paper (and more).

The 1772 Painting of Wyatt's "London Pantheon"

This is by far the widest 18th century view we know of, covering a field of about 170 degees.  It was probably drawn by the Venice-trained architect, James Wyatt, though the painting is ascribed to William Hodge.  Move the mouse over the image to see how well a Pannini projection of a modern 3D CAD model matches the painting's perspective.  No other projection of the model even comes close.

Drawing a Rectilinear Projection

To draw the horizontal aspect of a rectilinear projection, locate the view point on a plan of the scene, and draw a horizontal line representing the picture plane.   Transfer each point of the plan to the horizon line along a straight line through the view point.   In this example, the vertical aspect is developed by means of straight lines through a vanishing point in the middle of the horizon line, a shortcut that often works for architecture.  



Drawing a Pannini Projection

To draw the horizontal aspect of a Pannini projection, add a circle around the view point, representing the intermediate cylindrical image surface.  Transfer points from the plan to the circle along straight lines through the view point (red).  Then transfer points from the circle to the horizon line along straight lines through a second projection center (blue).  Here, the second center is on the surface of the cylinder, giving the standard Pannini projection.   Moving it closer to the view point would give less compression, farther away, more compression.  Pannini himself used the most compressed form, in which the second set of  lines are parallel (second center infinitely distant).




Comparison with Carroll's Method

Carroll, Agrawala and Agarwala [CAA09] present a method for generating ad-hoc projections that can improve the perceptual quality of wide angle images by straightening sets of lines, designated by the user,  while minimizing numerical estimates of "distortion energy" like those used by Zorin and Barr [ZB95].   For many images, the method renders plausible perspective views, given a dozen or so suitably chosen control lines; the authors also present some cases in which it failed.  More information, including the control line sets used for the example images,  [here].

In the following table the first column is one of  the original images used by Carroll et. al., the second is the result of their method (cropped), the third is a General Pannini projecton with horizontal and vertical compressions adjusted to match Carroll's result as nearly as possible.  

It should be pointed out that the General Pannini image is obtained in real time, by interactive adjustment of just three numerical parameters, while the Carroll method requires skilled placement of the control ines followed by extensive computations.

Original Image Carroll's General Pannini

For the followng images, Carrol et al. considered that their method failed.

Original Image Carroll's General Pannini

Bibliography

[CAA09] Carroll R., Agrawal M., Agarwala A. Optimizing content-preserving projections for wide-angle images. In SIGGRAPH '09, pp. 1-9.
[ZB95]  Zorin D., Barr A.H., Correction of geometric perceptual distortions in pictures. In
SIGGRAPH '95, pp. 257- 264.