Converting an equirectangular image to a cylindrical panoramic projection

Written by Paul Bourke
November 2010
Update (Aug 2018): Added panoramic vertical shifting.

See also: sphere2fish to convert an equirectangular projection to a fisheye projection
and sphere2persp to convert an equirectangular projection to a perspective projection

The source code implementing the projections below is only available on request for a small fee. It includes a demo application and an invitation to convert an image of your choice to verify the code does what you seek. For more information please contact the author.


In what follows I describe software for extracting a cylindrical panorama from an equirectangular (spherical) projection. There are various reasons why one might want to do this, the driver here is creating images for large scale cylindrical displays. Diagramatically, for some displays and 360 cameras used by the author this diagram illustrates the geometry.

Usage string

sphere2pano [options] sphericalimagename
Options:
   -t n   vertical FOV of panoramic, 0...180 (default: 45)
   -a n   set antialias level, 1, 2 or 3 typical (default: 2)
   -w n   width of the spherical image (default: 1024)
   -z n   horizontal rotation angle (default: 0)
   -v n   vertical rotation angle (default: 0)
   -f     flip in longitude (default: off)
   -d     enable verbose debugging mode

Like an equirectangular projection, the horizontal axis of a cylindrical panorama is equal steps of longitude. However the vertical axis resembles a perspective projection. As such, while an equirectangular can represent from -90 to 90 degrees in latitude, a cylindrical panorama becomes increasingly inefficient after about 140 degrees vertical field of view (FOV).

The following equirectangular will be used to illustrate the basic transformations.

The following is a 45 degree vertical FOV.


sphere2pano -w 4096 sample.jpg

The following is a 70 degree vertical FOV.


sphere2pano -w 4096 -t 70 sample.jpg

As is usual with such mapping the process is performed in reverse, that is, one considers each pixel in the output cylindrical panorama and computes the best estimate in the input image, the equirectangular in this case. Antialising is performed here using a straightforward supersampling of each output pixel.

To illustrate the vertical shifting consider the following which was filmed using the Obsidian R 360 camera.

The following are increasing vertical offsets from 0 (first) to 30 degrees (last), the vertical FOV in each case is 50 degrees.


sphere2pano -w 4096 -t 50 -v 0 sample.jpg


sphere2pano -w 4096 -t 50 -v 10 sample.jpg


sphere2pano -w 4096 -t 50 -v 30 sample.jpg