I created that gif manually, but I wondered if it was possible to create such an animation in an automated fashion. Turns out, it’s pretty easy! This relies on ImageMagick – which is a powerful image manipulation tool. All of these scripts work on Ubuntu – and they should work on any GNU/Linux disto as well as Windows and Mac.
Get Your Image
I just pressed “Print Screen” while watching a Half-Side-by-Side (HSBS) movie in full screen. You can use mplayer or VLC to capture the image if you wish.
For mplayer, you can run this simple command to grab a single frame at the 20 minute and 5 seconds mark
mplayer video.avi -frames 1 -vo jpeg -nosound -ss 20:05
Split the Image
We want the left and right image separated.
mogrify -crop 50%x100% 2D.jpg
This will result in two files: 2D-0.jpg and 2D-1.jpg.
Warning: this will destroy your original image. Make sure you have a backup.
HSBS means that the aspect ratio of each image is squashed. We want to stretch each one back to full width.
mogrify -resize 200%x100% 2D-0.jpg mogrify -resize 200%x100% 2D-1.jpg
The two JPGs files are replaced by images with the correct aspect ratio.
The split and stretch commands can be amalgamated into:
mogrify -resize 200%x100% -crop 50%x100% 2D.jpg
ImageMagick makes it really easy to create gifs – in this case, we want a 250ms delay between each frame.
convert -delay 25x100 -loop 0 2D-0.jpg 2D-1.jpg movie.gif
convert -delay 25x100 -loop 0 *.jpg movie.gif
You can knock the file size down by about a quarter using dithering. Although the resulting image won’t look so good.
convert +dither +map -delay 25x100 -loop 0 *.jpg movie.gif
A few interesting examples.
Reconstructing Depth Information
How easy is it, I wonder, to turn a stereoscopic image into a 3D model.
I used Stereoscan from AgiSoft (Linux, Mac, Windows) to turn this:
Doctor Who Geek Side Note
Interestingly (well… to geeks like me) the shot of Capaldi’s eyes is not in 3D. I can only assume they filmed his cameo separately. There are a few other shots which aren’t in 3D – those of the old Doctors (including Eccleston) and the original title sequence.