How to get Depth map image(jpg) of an JPG image in Android? (JAVA/KOTLIN)-ThrowExceptions

Exception or error:

I am using a Java library named icafe( for generating a depth map image from a jpg image. It can extract and insert XMP as well as ExtendedXMP.

One of the use-case for the ExtendedXMP is for Google’s depth map data which is a grayscale image hidden inside the actual image as metadata, and in the case of JPEG, as XMP data. The following is an example image and the extracted depth map:enter image description here

The original image comes from here

I have used the libraries following code to get a depth map image:


More details of how we achieved the output with this library can be found here.

But the problem is that the only sample pictures are providing outputs. Other images like pictures taken on pixel 2 xl or pixel 3(Even in the portrait mode) are not working.

The library does not ensure that it will generate depth map image from all the jpg images from Android Camera, But is there any workaround in camera 2 API that can help me to find the depth map photo?

How to solve:

Leave a Reply

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