TransWikia.com

How to extract depth information from JPEG files?

Photography Asked on September 4, 2021

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?

3 Answers

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 :)

UPDATE: There is a lens blur filter (Filter - Blur - Lens Blur), where you can produce a bokeh effect based on a depth map.

Correct answer by Ivan Kuckir on September 4, 2021

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

Answered by xiota on September 4, 2021

I have to make a ported application called ExifTool on Android. You can easily download it and try to extract the depth information or export the binary file from a photo.

Link download: Exif Tool on Android

How to use:

  • Open app.
  • Choose a photo that have Depth Map data.
  • Tap to XMP tab, then see the DepthMap thumbnail, ImageData thumbnail.
  • Tap to DepthMap or ImageData tag to pick a storage that you want to export.
  • Pick a folder to export.
  • Then, finish. enter image description here

Answered by Võ Anh Kiệt on September 4, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP