Numerical Details on Roundshot and matching CG Stereoscopic Panoramic Creation

Written by Paul Bourke
February 2006


The following gives the mathematics needed to calculate various attributes of stereoscopic panoramic images, both synthetic and from the Roundshot camera. It is written with the idea that one is creating CG panoramics to be composited with real photographic stereoscopic panoramic pairs. The numbered steps below are in the order the author used to define the camera and stitching parameters for the CG panoramic generation, there are undoubtedly other ways to approach this.

The figures included here are largely intended to illustrate the symbols used within the equations, for example, in figure 1 "W" is the panoramic width in pixels, "H" the height. Ov is the vertical field of view in degrees or radians.

1. Determining vertical field of view from Roundshot camera

Assumes no vertical lens distortion, eg: pinhole perspective camera. If there is a significant lens effect such that matching to the CG is problematic then I propose correcting the Roundshot panos rather than adding lens distortion to the CG frames.


Figure 1

Vertical field of view (Ov) is given by

Ov = 2 atan(H / (2 r))
where r = W/(2 pi)
so Ov = 2 atan(H pi / W)

Maths image (3x3 tiled display, iVEC@UWA.

2. Choosing CG pano strip width


Figure 2

The horizontal field of view 0h of each strip would ideally be continuous, Where this is not possible a finite horizontal width in degrees is chosen. This needs to be an integer divisor of 360 degrees (if a perfect seam is to be achieved at the 0 and 360 wrap around angle). The horizontal field of view matches the rotational increment of the camera for neighbouring strips to align, see figure 3.

If the strip width is too wide then close/large objects will have kinks at the boundary between strips. Even if this is not obvious in a still image it may be noticeable in an animation. The strip width is also related to the final panoramic width, wider panoramic images will require narrower strip. 5 degree strips would be an absolute maximum, I suspect smaller will be required. 1 degree seemed to be satisfactory for the test scenes I constructed. Fortunately negative parallax stereo constraints place limits on how close objects may approach the camera, this may kick in before the artifacts due to finite Oh arise (?).

3. Calculating CG pano strip width in pixels

Given the horizontal field of view in degrees for a strip, the width (w) of the strip in pixels is given by

w = W Oh / 360

There are two constraints, Oh (in degrees) must be an integer divisor of 360, and w must be an integer if greater than 1 or the inverse must be an integer if less than 1. This means that the possible CG stereo pano widths are limited to certain discrete values, see examples later.

4. Calculating CG pano strip height in pixels

Given Ov from the Roundshot pano, and the chosen Oh and pixel width for the strip then the vertical length of the strip in pixels is given by

H
 
tan(Ov / 2)
------
 = 
------------
w
 
tan(Oh / 2)

This is just the standard relationship between the horizontal and vertical field of view for a perspective projection with a particular aspect ratio.

Note that while the Roundshot panoramic image and the CG panoramic image will be different file sizes, the aspect ratio will be identical.

5. Given a stereo pano pair using parallel cameras, calculate the horizontal shift required to achieve a particular zero parallax distance.


Figure 3

The angle O to rotate one of the panos by in order to achieve zero parallax at a certain distance from the cameras is

O = 2 asin(e / (2 fo)

Where e is the camera separation and fo is the desired zero parallax distance. The shift in pixels D is then

D = W asin(e / (2 fo) / pi

Note that since e / (2 fo) is generally quite small, this can be simplified (sine is nearly linear for small values) in most cases to

D = W e / (2 pi fo)

Note that this need not necessarily be applied to the images, it could be an option suppled to the playback software.

Example 1

1. If the Roundshot panoramic is 8000 pixels wide (W) and 1500 pixels tall (H). Ov = 61 degrees.

2. Choose the strip width to be Oh to be 5 degrees.

3. Some possible pixels widths (w) for the strip and the corresponding panoramic width (W) are shown below.

wW
151080
201440
302160
604320

4. If 60 pixel wide strip is chosen the panoramic height (H) = 809 pixels.

5. If the camera separation is 9cm (0.09m) and a zero parallax distance of 1m is chosen, then the offset in pixels is D = 62 pixels.

Example 2

1. Again let the Roundshot panoramic is 8000 pixels wide (W) and 1500 pixels tall (H). Ov = 61 degrees.

2. Choose the strip width to be Oh to be 1 degree.

3. Some possible pixels widths (w) for the strip and the corresponding panoramic width (W) are shown below.

wW
2720
51440
103600
207200

4. If 10 pixel wide strip is chosen the panoramic height (H) = 675 pixels.

5. If the camera separation is 9cm (0.09m) and a zero parallax distance of 1m is chosen, then the offset in pixels is D = 52 pixels.

Example 3

1. Again let the Roundshot panoramic is 8000 pixels wide (W) and 1500 pixels tall (H). Ov = 61 degrees.

2. Choose the strip width to be Oh to be 1/2 degree.

3. Some possible pixels widths (w) for the strip and the corresponding panoramic width (W) are shown below.

wW
1720
21440
53600
107200

4. If 10 pixel wide strip is chosen the panoramic height (H) = 1350 pixels.

5. If the camera separation is 9cm (0.09m) and a zero parallax distance of 1m is chosen, then the offset in pixels is D = 103 pixels.