ExifTool Forum

ExifTool => Bug Reports / Feature Requests => Topic started by: PhilB on April 23, 2022, 12:11:34 PM

Title: Extracting depth maps from Xiaomi Mi 11 Ultra photos
Post by: PhilB on April 23, 2022, 12:11:34 PM
Dear Phil Harvey,

I am (desperately) trying to find a way to (bulk-) extract the depth maps from my Xiaomi phone photos in order to be able to make the depth adjustments in Photoshop. As far as I understand, smartphone manufacturers all use somewhat differing embedding schemes so I realize that this might be a thankless endeavor for you. I nevertheless would (more than gladly) like to offer my help in trying to find a solution for Xiaomi photos. Please let me know if you would like me to send you a couple of such "portrait" pictures (from one of the best phone cameras, according to DxOMark).

In any event, thank you for your truly invaluable tool!
Very best wishes,
Philip
Title: Re: Extracting depth maps from Xiaomi Mi 11 Ultra photos
Post by: Phil Harvey on April 23, 2022, 04:49:40 PM
Sure.  Send me a sample and I'll take a look (philharvey66 at gmail.com)

- Phil
Title: Re: Extracting depth maps from Xiaomi Mi 11 Ultra photos
Post by: Phil Harvey on April 25, 2022, 03:29:44 PM
I see this information in the XMP:

<depthmap version="2" focuspoint="1627,1695" blurlevel="10" depthsize="0,0" shinethreshold="5" shinelevel="10" rawlength="5731972" depthlength="6933772" mimovie="false" depthOrientation="180" vendor="1" portraitLightingVersion="2" cameraPreferredMode="0">

So it looks as if the depth map data should be 6933772 bytes.

There are 2 trailers attached to each file.  The first is presumably a stereo image, and the second is 6933772 bytes long.  So you can use this command to extract the depth map data to a file called "depthmap.dat":

exiftool FILE -trailer -b | exiftool - -trailer -b > depthmap.dat

The depthmap data begins with the string "MCBOKEHSOT", but I don't know how to decode the depthmap data.  Unfortunately it doesn't look like any standard image format that I know.

- Phil