Converting an equirectangular image to a cylindrical panoramic projectionWritten by Paul BourkeNovember 2010 Update (Aug 2018): Added panoramic vertical shifting.
See also:
sphere2fish to convert an equirectangular projection to a fisheye 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
Older version: Convert spherical projections to cylindrical projectionWritten by Paul BourkeFebruary 2006
The following utility was written to convert spherical projections into cylindrical projections. Of course only a slice of the spherical projection is used. The original reason for developing this was to convert video content from the LadyBug3 camera (spherical projection) to a suitable image for a 360 cylindrical display. This a command line utility and as such straightforward to script to convert sequences of frames that make up a movie. sph2pan [options] sphericalimagename Options: t n set max theta on vertical axis of panoramic, 0...90 (default: 45) a n set antialias level, 1 upwards, 2 or 3 typical (default: 2) w n width of the spherical image r n horizontal rotation angle (default: 0) v n vertical rotation angle (default: 0) f flip insideout (default: off) Sample spherical projection (from the LadyBug3)
Click for original image (5400x2700 pixels).
As with all such image transformations, one considers a point in the destination image noting that the point may be a sub pixel (required for supersampling antialiasing). This point corresponds to a vector in 3D space, this is then used to determine the corresponding point in the input image. Options such as rotations and flips correspond to operations on the 3D vector. Sample derived cylindrical projections
The following show example transformations illustrating some of the more important options. In particular the ability to specify the vertical field of view and the vertical offset for the cylindrical image.
