0

My team is developing an app for HTC phones that uses the stereo camera. In order to do our processing, we require the still images taken by the 3D camera to be in MPO format. By default it is returning JPS images.

How can I make the camera return MPO images? Is there someplace that this is documented?

I have spent a while on HTCs site but was unable to find source code for their API or camera app that might help (since their camera app can do MPO files).

Max Ehrlich
  • 2,479
  • 1
  • 32
  • 44

2 Answers2

1

I don't know an API for this, but it is pretty straight forward to do yourself. The JPS format is just a single image with the left half being one camera and the right half being another. So first step just convert it to two separate images. Create new bitmaps from it with rectangles for either side:
http://developer.android.com/reference/android/graphics/Bitmap.html#createBitmap(android.graphics.Bitmap,%20int,%20int,%20int,%20int,%20android.graphics.Matrix,%20boolean)

The MPO format is just two JPG images in one file, one after the other. So next write two JPG images using the compress method to the same file output stream:
http://developer.android.com/reference/android/graphics/Bitmap.html#compress(android.graphics.Bitmap.CompressFormat,%20int,%20java.io.OutputStream)

You can find a lot of sample code online for Android for cropping images and saving them to JPG, which is pretty much all you need.

Lance Nanek
  • 6,377
  • 2
  • 24
  • 19
  • 1
    I believe there's a couple bitmap utils with the included sample code that may help. MPO was initially the default format but it was changed to JPS which is considered the industry standard (and easier to share and edit) - but check camera settings first to see if you still have the option to save in either format – dljava May 07 '13 at 16:17
  • I think we will just switch over to JPS entirely. HTCs documentation says that JPS files are "compressed horizontally" but when I examine the MPO output from the camera app and the JPS files the app people are giving me I see no difference. – Max Ehrlich May 08 '13 at 13:20
1

The MPO format is not just

two JPG images in one file, one after the other.

http://www.cipa.jp/english/hyoujunka/kikaku/pdf/DC-007_E.pdf English translation of the 2009-02-04 standard of the Camera and Image Processing Association's Standard Development Working Group, Multi-Picture Format Sub-Working Group.

https://www.htcdev.com/devcenter/opensense-sdk/stereoscopic-3d/s3d-sample-code/ Shows some sample code for working with the HTC EVO 3D camera.

Comet
  • 11
  • 1