I am developing Android application that's supposed to make use of Google Camera's new depth map generation feature.
Basically Google has described the meta data used here
I can access to most of the metadata, but unfortunately the most important data is encoded as extendedXmp, and I can't get any XMP parsing library to parse it correctly!
I've tried Commons-Imaging, metadata-extractor and most recently Adobes XMPCore
XMPCore might be able to handle the extended version, but there's no documentation how can I get it to parse the data from JPG file, its assuming raw XMP data to be passed
Is there any correct implementation of XMP parsing that includes the extended parts of JPG files or am I just doing something wrong?
Here's my tries:
With Commons-Imaging:
try {
String imageParser = new JpegImageParser().getXmpXml(new ByteSourceInputStream(imageStream, "img.jpg"), new HashMap<String, Object>());
Log.v(TAG, imageParser);
} catch (ImageReadException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
With metadata-extractor
Metadata metadata = ImageMetadataReader.readMetadata(
new BufferedInputStream(imageStream), false);
XmpDirectory xmp = metadata
.getDirectory(XmpDirectory.class);
XMPMeta xmpMeta = xmp.getXMPMeta();
String uri = "http://ns.google.com/photos/1.0/depthmap/";
Log.v(TAG, xmpMeta.doesPropertyExist(uri, "GDepth:Format") + " " );
try {
XMPProperty hasExtendedXMP = xmpMeta.getProperty("http://ns.adobe.com/xmp/note/", "xmpNote:HasExtendedXMP");
Log.v(TAG, hasExtendedXMP.getValue().toString() + " " + new String(Base64.decode(hasExtendedXMP.getValue().toString(), Base64.DEFAULT)));
} catch (XMPException e) {
e.printStackTrace();
}