Get depth map out of Xiaomi MIUI camera photos.

Started by lockhrt999, August 15, 2020, 05:55:25 AM

Previous topic - Next topic

lockhrt999

What would be the command to export depth map out of photos captured by Xiaomi phones MIUI camera app. I think these are using different convention than what google camera does.

I tried this but it creates blank file only.
exiftool -b -DepthMap file.jpg > export.jpg

Attaching a sample file here.

Phil Harvey

I can see the depth map data, but it will take a bit of work to figure out how to make sense of it.  It is definitely uncompressed, but has a large header of some sort.  You can dump the whole thing with this command:

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

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Darshan

Hello.
I managed to parse most of the depthmap for my Redmi Note 9 Pro and i was looking for more samples from different models.

You can check the current code for my extractor here

https://github.com/VincenzoLaSpesa/XiaomiDepthMapExtractor

And you can send me samples if you want.

I also wanted to thank you as this exact thread was my starting point.

Alan Clifford

Quote from: Darshan on December 26, 2020, 06:29:53 AM
Hello.
I managed to parse most of the depthmap for my Redmi Note 9 Pro and i was looking for more samples from different models.


I've got a Xiaomi mi a2 lite if you would like a photo from that.

Phil Harvey

Sure.  If you can attach it here that would be good.  Otherwise upload it somewhere for whoever wants it.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Alan Clifford

Xiaomi m1 a2 lite photo attached.

Sadly the bird died after flying into a window.

Phil Harvey

...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Darshan

Thanks for the file.
But as far as I can tell there is no depthmap inside.
My phone creates a depthmap only in potrait mode, and if an image has it inside you see the tiny "diaphragm" icon when you open it.

This is the "foliage" image posted above and its depthmap converted to a png.

Alan Clifford

So I click on portrait in the camera app and it says "Depth effect"


Phil Harvey

Alan, I think that something has stripped off the depth-map trailer in the images you posted.  There is no depth map in either one.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

defrag1971

Hello,
any news about depth map extraction ?
I've got a Xiaomi Redmi 9t, same problem as stated from the others, the depth map is there but unreadable.
Herewith I attach one example from my phone.

Phil Harvey

I can see some unknown data at the end of this file, but I don't know how to decode it.  You can extract a second image from the file like this:

exiftool Portrait.jpg -trailer -b > image2.jpg

Then you can get the trailer (presumably containing depth map data) like this:

exiftool image2.jpg -trailer -b > unknown.dat

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

defrag1971