2

Some mobile phones support changing the depth of field using depth information calculated from dual cameras. If the depth information is stored in the jpg file, how can it be extracted?

  • Could you provide a source for the claim that this information is stored in the JPEG? – Philip Kendall Jan 15 '17 at 7:18
  • If you can tell me what the EXIF information is for that, I can probably make the software if it can't be done with EXIFTOOL. – MikeD Jan 15 '17 at 9:16
  • @PhilipKendall If I take a picture without using dual cameras, the size of the jpg file may be about 2Mbytes. If I use the dual cameras function to take the same scene, additional 2Mbytes is needed for the jpg file. I guess that depth information is saved in the jpg file. After you have taken the image, you can reload the jpg file and modify DOF in camera app on an Android phone. – Jogging Song Jan 15 '17 at 13:24
  • @MikeD I don't know which filed is used for depth information. JPEG file standard allows users to add private data. I try JPEGsnoop and not succeed. – Jogging Song Jan 15 '17 at 13:29
  • 1
    I've seen some Google phones that store depth information as Base 64 encoded data in XMP segments. Seems like a weird way to store it, but I'm sure they have a reason. Do you have a sample image? Could you open an issue on my project's issue tracker and attach it? github.com/drewnoakes/metadata-extractor – Drew Noakes Jan 15 '17 at 23:37
0

I am the author of Photopea.com - in-browser photo editor.

Photopea supports depth-maps. Open your JPG in Photopea, depth-map (and the original sharp image) will be added as two extra layers. You can save them separately as JPG, PNG, etc.

Just wanted to let you know, that you can do it without downloading or installing anything, or using a command line :)

  • Does your software also automatically use the depth map to simulate bokeh? – xiota Aug 2 at 8:42
  • Do you mean keeping one object sharp, and blurring everything what is closer or further than that object? There is no such feature, but I can implement it. But usually, cameras produce such image themselves. – Ivan Kuckir Aug 2 at 8:54
  • What do you believe to be the purpose of the depth map? I don't use your software, so it doesn't matter to me what you decide to implement. Just wondered whether your software is capable of doing anything useful with the depth map. – xiota Aug 2 at 9:10
  • 1
    It can only "extract" it at the moment (as a layer of pixels). You can save the depth map as PNG to be used in other software (what the person above asked for). – Ivan Kuckir Aug 2 at 9:24
7

Portrait Mode images saved by Google Camera contain the original image and depth map in the metadata. They can be extracted with exiftool:

exiftool -b -ImageData image.jpg > image.gimage.jpg
exiftool -b -Data image.jpg > image.gdepth.jpg 

Google Cardboard panoramas contain audio and 3d image data.

exiftool -trailer:all= image.jpg -o image.1.jpg
exiftool -b -ImageData image.jpg > image.2.jpg
exiftool -b -AudioData image.jpg > image.audio.mp4

For dual camera Android phones, the exact command required depends on which tags a specific phone or app uses to store extra images. To find the name of the tags, use:

exiftool image.jpg | grep -i binary

For example, the original images stored by the Samsung S9+ can be extracted with the following commands:

exiftool -trailer:all= image.jpg -o image.1.jpg
exiftool -b -EmbeddedImage image.jpg > image.2.jpg
0

Would the exiftools depth map extraction method work for the Nokia Pureview DNG files?

  • Why not give it a try and find out? – scottbb Oct 31 at 19:21
  • 2
    If you have a new question, please ask it by clicking the Ask Question button. Include a link to this question if it helps provide context. - From Review – inkista Nov 1 at 4:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.