Stereoscopic GIFs

Stereoscopic GIFs from 3D camera video

We don't mean those rather annoying wiggle 3-D images like this:-

A real Stereoscopic GIF is a side-by-side stereo pair which can be viewed in 3D by parallel viewing:-

It's just like an animated side-by-side JPEG, with some movement bringing it to life.

The AVI video files produced by the Fujifilm Finepix Real 3D W3 stereo camera have a proprietary format 3D-AVI which used to be readable by the MyFinePix Studio app, but this is no longer available. These files can now be read by StereoMovie Maker, but only after ffdshow has been installed. StereoMovie Maker can then save a normal side-by-side AVI file which can be read by other apps. This file can be uploaded to the excellent on-line converter cloudconvert to create a GIF. Some other GIF converters can't read AVI files, or can only convert small files. Adobe Express reduces the image width and height during conversion.

The AVI files from the W3 are in 720p 1280 × 720 format but show as 1240 × 720 when loaded into StereoMovie Maker. This is because SMM has performed auto-alignment. The original size can be restored by Adjust→Alignment(Reset).

A GIF downloaded from cloudconvert can be viewed on Windows 10 in the Photos app. The window size can be reduced to allow comfortable parallel viewing. For projection at the Sydney Stereo Camera Club, a GIF needs to be 2 × 1920 × 1080 so that it fills the virtual screen when displayed at full size. This can be achieved by resizing an AVI when saving from SMM, or resizing after loading into cloudconvert. The size and quality of the GIF is comparable whichever method is used. Resizing in cloudconvert is more flexible: it can convert an auto-aligned 2 × 1240 × 720 AVI to 2 × 1920 × 1080 by padding, cropping, or scaling.

To prevent visible jumping when the GIF loops, the first and last frames should be as similar as possible. An AVI can be trimmed in SMM to achieve this by using Frame→Set displayed-frame to start frame and Frame→Set displayed-frame to end frame on selected frames.

It is highly recommended that the camera is mounted on a tripod when recording an AVI file, as was done with the above video. Handheld video is likely to show disconcerting wobble:-

Stabilisation of handheld video needs to be done separately on the left and right videos, but I found that none of the available tools were successful, for example the Online Video Stabilizer or
ffmpeg -i DSCF0037SBS_l.AVI -vf deshake output_l.avi

Effective stabilisation can be performed by using PTGui to align the left or right images as if in preparation for creating a panorama, but saving individual layers instead of a blended panorama:-

The result needs to be cropped to remove the wobbling boundary, but is shown before cropping to show how hard PTGui had to work to achieve alignment. The effectiveness of the stabilisation can be seen after cropping automatically with a Python script:-
The workflow for stabilisation is quite involved:-
  1. Use StereoMovie Maker File→Save Left/Right Movie... to separate the left and right videos.
  2. Use ffmpeg to extract a series of jpeg images from the left and right videos.
  3. Use PTGui on each series of images to load the images, align them, and create a panorama, saving Individual layers only.
  4. Use ffmpeg to assemble each series of layers into a video.
  5. Use StereoMovie Maker File→Open Left/Right Movie... to combine the left and right videos.
  6. Use StereoMovie Maker Adjust→Crop to crop the moving borders.
  7. Use StereoMovie Maker Adjust→Easy Adjustment... to adjust the side-by-side video.
Steps 1-2 and 4-6 could be streamlined using Python scripts.

A similar result can be achived with the align_image_stack tool included with Open Source panorama software Hugin. It is run on each series of jpeg images extracted from the left and right videos:-

align_image_stack -a aligned -C --use-given-order *.jpg

Apart from being free (a PTGui license for personal use costs $275), this has the great advantage that the option -C—Auto crop the image to the area covered by all images removes the need to crop the moving borders which was necessary with PTGui. It's not easy to determine the crop area either by eye or automatically by a Python script. Using align_image_stack, steps 2-6 can be performed with a single Python script.

The align_image_stack tool also has options -S—Assume stereo images and -A—Align stereo window but these did not effectively align side-by-side images for stabilisation. Here is the stabilised result from using align_image_stack:-

The first and last frames of a GIF can be made identical by appending a series of frames in reverse order to the original frames. This will only work for subjects without strong directional movement between static first and last original frames, for example:-

Suitable subjects with similar first and last frames are flaming candles, fountains, and waterfalls. Subjects can have matching first and last frames when they are in cyclical motion, like turntables, swings, roundabouts, and treadmills.

An articlulated subject like an escalator or cable car will have matching frames when one articulated unit (step or car) replaces its neighbour. Another possibility is a moving object entering a static scene at one side and leaving at the other. In this case it's possible by judicious editing (with a Python script in this case) to make multiple copies of the object by splicing each frame with other frames from later in the video:-

Stereoscopic GIFs from 3D models

There are some amazingly detailed 3D models available on the web, for example: these from Sketchfab. On Windows 10, they can be viewed with Microsoft 3D Viewer, which has its own library of 3D models.

These models use the glTF format. There are plenty of other glTF viewers, which allow the model to be moved around in 3D space by mouse movement. Surprisingly, there doesn't seem to be any viewer which allows a model to be viewed stereoscopically. 3D Viewer allows a model to be animated as if rotating on a turntable. It also has a Mixed Reality feature where the rotating model can be superimposed on a webcam feed. This feature allows the rotating model to be recorded on video, including the webcam feed. To hide the webcam feed it would be necessary to cap the webcam or use a dummy webcam. A stereoscopic effect can be produced from such a video by placing consecutive frames side-by-side, using a Python script:-

Here is a model of a twisted toroid which I created with Python scripts:-

Christopher B. Jones 2022-12-14