Image panels on a fisheye image

Written by Paul Bourke
July 2005

Added support for spherical mirror dome projection.
March 2006

Update (May 2008): This can also be performed in realtime with a custom warpmesh for the warpplayer application.


The following illustrates three ways (from an infinite set) by which a planar image can be projected onto a fisheye for projection into a planetarium. The very specific options shown here are chosen as suitable ways of displaying 2 dimensional slides for a planetarium presentation, for example slides from a package such as KeyNote or PowerPoint. The goal is to make the 2D slide look as though it is actually sitting on a plane rather than wrapped around in dome space. As such the three orientations for the plane are shown on the right. In the first one imagines an upright wall with the 2D image painted on it, while this is a nice effect it has the problem of reduced resolution near the top of the image which is likely to be exactly where slide titles and the important information resides. The second and third cases have the plane rotated at 45 and 30 degrees respectively, the height of the panel is set so that it just appears above the horizon (in the examples here the image proportions are assumed to be 4:3). In all these cases while the text appears curved in fisheye space. it should look straight in the dome as should the frame sof the plane.

 

Test pattern

The image on the right was used as the initial test pattern, the results for each of the panel positions is shown below (click on images for the full size fisheye). As expected there is quite a bit of compression involved so good antialiasing is mandatory, in the cases shown here a 3x3 adaptive antialias was employed.

 

Upright

Rotate by 45 degrees

Rotate by 30 degrees

Another example - A slide from a KeyNote presentation

Slides for spherical mirror full dome projection




Slides to fisheye

Written by Paul Bourke
An alternative, April 2006

This utility converts slides or perspective images for fulldome display using one of the many possible mappings. The particular mapping used attempt to optimise the trade off between maximising resolution, create a reasonable field of view, and minimising distortion. The geometric model is to imagine the image on a plane that extends from the pole of the fisheye to the horizon, inclined at 45 degrees. The width of the plane will be chosen such that the aspect ratio is preserved.

This implementation will transform both TGA (default) and JPG images. The format of the input image and the output image is determined from the file name extension, namely ".tga" or ".jpg". In the later case the compression quality may be chosen, the highest quality is 100 (the default). Supersampling antialising is employed, typically values of 2 (the default) or 3 are appropriate. A single image will be converted by default but if the file name contains a "C" style string substitution string "%d" then a sequence of sequentially numbered files will be converted. In both cases the output files will have the same name as the input files but with the string "_fish" added.

Command line usage
Usage: slide2fish [options] imagefilename
Options:
-d     enable verbose debug mode (default: quiet mode)
-a n   set antialias level, 1 upwards, 2 or 3 typical (default: 2)
-w n   width of the fisheye image, height = width (default: 500)
-q n   set the output quality (jpeg only), 0 to 100 (default: 100)
-n n   set the start frame number if convering a sequence (default: 1)
If the imagefilename contains a C style %d then an entire sequence
of files will be converted. For example if the slides are called
   slide00.tga slide01.tga slide02.tga ....
Then the command line might be something like this
   slide2fish -a 2 -n 0 -w 2200 slide%02d.tga
Example 1

Example 2




Mapping images into fisheye space so they appear to be on an upright cylinder in a planetarium

Written by Paul Bourke
April 2007

Aim is to map rectangular images onto a fisheye image such that when viewed in a planetarium the images appear to be wrapped onto cylindrical sections.

Choose the width and position in longitude for the image, this is theta1 and theta2. Also choose the latitude of the base of the image, for example, it might be 0 if the image is to start at the horizon. The image width and height are dx and dy in pixels. We need to determine phi2 such that the image appears in proprotion and upright in the dome.

Figure 1

The images are imagined to be wrapped around a cylinder.

Figure 2

Define "r" as the radius of the hemisphere in pixels = dx / (thet2 - theta1)
Define dy1 as the height of the base of the image in pixels = r tan(phi1)
Then

tan(phi2) = (theta2 - theta1)(dy + dx tan(phi1)) / dx

For the final fisheye image the goal is to find r1 and r2, once they are known the x,y normalised coordinates of the four corners of the image rectangle in the fisheye can be determined, namely

r1(cos(theta1),sin(theta1)), r1(cos(theta2),sin(theta2)), r2(cos(theta2),sin(theta2)), r2(cos(theta1),sin(theta1))

Figure 3

r1 = 2 (pi/2 - phi1) / pi
r2 = 2 (pi/2 - phi2) / pi

Notes

  • phi1 and phi2 are measured in the normal latitude sense in figure 1 and 2, that is, 0 at the horizon. It is traditional to measure angles in fisheye space from the pole (z axis) rather than from the horizon. See the equations for r which contain terms pi/2-phi1 and pi/2-phi2.

  • If the image is to start from the horizon (phi1 = 0) then the expression for phi2 is phi2 = atan((theta2-theta1) dy / dx)

  • When drawing the image as a texture using OpenGL say, one needs to compute smaller quads over subsections of the longitude range.