.MPO to Anaglphic or Stereo Pair JPG

Get Adobe Flash player

I recently bought the new Fujifilm FinePix W3, it a nutshell its a camera with stereoscopic lenses (see below) which means you can shoot 3d photography and hd footage. It doesn’t stop there though, on the back of the camera you have a 3.5-inch glasses free 3d display. Without a doubt the coolest gadget I’ve ever bought.

Fujifilm FinePix W3

Fujifilm FinePix W3

One thing that surprised me was the format in which the W3 saves stereoscopic images, the file extension is called .mpo and I can’t say I’ve ever heard of it. I was expecting it would save as a stereo pair .jpg or .jps which would be easier to view and edit on a regular computer display.

It turns out there are a few programs out there that will convert .mpo to .jpg, but not that many. So i decided to look into the possibility of converting in actionscript. Because the .mpo format is basically multiple jpgs saved within the one file it turned out to be pretty straight forward. Building on Thibault Imbert’s work on jpg decoding I simply wrote a few classes to parse the .mpo into separate jpg byteArrays and then output the result as a stereo pair or a anaglyphic image.

7 Comments

  1. Hi Pete, This is awesome! I tried using your app but the left picture does not get sized correctly. Would you mind sharing how you did this in flash?

  2. Hi Kyle

    Hmmm I usually post the source, but i seem to have forgotten in this case… and to make matters worse i don’t remember where i saved the working files. they might even be on an old computer. but from memory basically all I’m doing is loading the .mpo into a bytesarray and then searching for header info which states where each images starts and ends (an mpo file is pretty much just two jpgs with a bit of extra info about where each image is in the file and the offsets, etc etc), splitting them into two bytesarrays and then decoding the images.

  3. I’ve just decompiled the swf, but doing this kinda of messes up the code (all the variables lose there names)..
    so I’ve also replaced all the 3rd party library src, but all my code (in campaign) and main.as will be a little unreadable, but you should still be able to see whats going on. source can be downloaded from: http://peteshand.net/blog/media/downloads/mpoToJpeg.zip

    If you end up adding any functionality I’d be interested in hearing about it.

    Cheers
    Pete

  4. This is great, kudos and thank you for sharing.
    If I’m not mistaken, however, the anaglyphic render reverses the left and right eye. On the example .mpo that you provide too, using my red/cyan glasses in reverse was necessary to correctly see the depth (red is on the left eye, cyan on the right one as the convention seems to be).

  5. quite possible I had my anaglyphic glasses folded the wrong way.

  6. I’m currently trying to do the opposite to what you did! I have 2 jpgs that I would like to combine into an MPO. Reading both jpgs to byte arrays and simply combining the 2 (with or without padding) doesn’t seem to create a valid mpo file. Did you come across anything in your research that hinted as to how these files are created by the camera?

    Cheers!

  7. Hey Richard, What you’ll need to do is open a valid .mpo in a hex editor (or look at the documentation for the format) and work out what header info you need to place at the start of the file, unfortunately simply appending one bytesarray after another will not produce the desired results.

Submit a Comment

Your email address will not be published. Required fields are marked *