Skip to content

Extract depth maps embedded in the photos taken by some phones

License

Notifications You must be signed in to change notification settings

distorted-media/phonedepth

 
 

Repository files navigation

phonedepth

This repository hosts some small utilities I wrote while looking into the way modern phones store depth data inside their JPEGs.

Example

This are the color image and depth map from a photo taken with a Samsung S9+.

color view

depth map

Usage

The most useful tool is extract_depthmap.c which was tested to work with these phones:

  • Apple iPhone X
  • Apple iPhone XR
  • Apple iPhone XS
  • Huawei Mate 20
  • Huawei Mate 20 Lite
  • Huawei Mate 20 Pro
  • Huawei P20 Pro
  • Huawei P30 Pro
  • Samsung A7
  • Samsung A9
  • Samsung S9+
  • Samsung S10
  • Samsung S10e
  • Samsung S20 FE
  • Samsung S20 Ultra

However, the firmware version might be more important than the actual phone.

In order to use it you have to compile it:

gcc -o extract_depthmap extract_depthmap.c

and then run it:

./extract_depthmap /path/to/file.jpg

It will create some files in the current directory:

  • cv.jpg -- the color image
  • dm.pgm or dm.jpg -- the depth map
  • extra.jpg -- some iPhones store an additional mask. If this file is garbage you should just ignore it.

Feel free to contact me if you have a phone that stores depth data and want it supported.

About

Extract depth maps embedded in the photos taken by some phones

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 96.5%
  • Shell 3.5%