ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: ADenisUA on January 05, 2019, 06:12:37 PM

Title: Extract Depth Map information from JPG
Post by: ADenisUA on January 05, 2019, 06:12:37 PM
Could anyone extract Depth Map information (image? png? tiff?) from Samsung (or any other then GCamera app) JPG?

One example (Samsung Mobile Camera Portrait photo):


Embedded Image                  : (Binary data 3696405 bytes, use -b option to extract)
Depth Map Data                  : (Binary data 762048 bytes, use -b option to extract)
Thumbnail Image                 : (Binary data 8826 bytes, use -b option to extract)


When I'm extracting "Depth Map Data" I can't read it by any image viewer (tried to open it as JPG, PNG, TIFF)

Another photo that I was trying to analyze is from Sharp Mobile Camera:



MP Image 2                      : (Binary data 13172279 bytes, use -b option to extract)
MP Image 3                      : (Binary data 762064 bytes, use -b option to extract)
MP Image 5                      : (Binary data 13172233 bytes, use -b option to extract)
MP Image 6                      : (Binary data 762064 bytes, use -b option to extract)
Thumbnail Image                 : (Binary data 11056 bytes, use -b option to extract)



But when I try to extract any of these I'm getting:

"Warning: [minor] MPImage2 is not a valid JPEG image - IMG_20181215_191841.jpg"

and the resulting image is always has 0 bytes size

I would appreciate any help
Title: Re: Extract Depth Map information from JPG
Post by: Phil Harvey on January 05, 2019, 08:28:12 PM
Send me a sample and I'll take a look.  My email is philharvey66 at gmail.com

- Phil
Title: Re: Extract Depth Map information from JPG
Post by: ST on April 10, 2020, 11:11:04 AM
I have the same exact issue. Has anyone solved it?
Title: Re: Extract Depth Map information from JPG
Post by: Phil Harvey on April 10, 2020, 10:27:53 PM
I don't think I ever received a sample.

- Phil

Edit: Ah.  I just checked my mail and found the sample you sent.  Great.  I'll look into this as soon as I get a chance and post back here when I know more.
Title: Re: Extract Depth Map information from JPG
Post by: Phil Harvey on April 17, 2020, 12:34:05 PM
Sorry for the delay in looking into this.

The DualShotData in this image is a raw 960x718 pixel image.  Just the raw data, no header.  You can open it in any image display program that is able to display raw data.

- Phil
Title: Re: Extract Depth Map information from JPG
Post by: progamerz on December 18, 2020, 12:04:32 PM
Quote from: Phil Harvey on April 17, 2020, 12:34:05 PM
Sorry for the delay in looking into this.

The DualShotData in this image is a raw 960x718 pixel image.  Just the raw data, no header.  You can open it in any image display program that is able to display raw data.

- Phil

Hello, i'm having the same issue, could you please explain me how to generate a depth map? My phone is Galaxy S10 Lite
This is the depth map info from the GUI Application
(https://i.imgur.com/EBL1MIy.png)
Title: Re: Extract Depth Map information from JPG
Post by: blue-j on December 18, 2020, 03:29:42 PM
Quote from: Phil Harvey on April 17, 2020, 12:34:05 PM
The DualShotData in this image is a raw 960x718 pixel image.  Just the raw data, no header.  You can open it in any image display program that is able to display raw data.

Do you have one you recommend?  Any with a CLI?  Can ImageMagick convert such data, for example?  - J
Title: Re: Extract Depth Map information from JPG
Post by: Phil Harvey on December 21, 2020, 03:09:56 PM
Quote from: progamerz on December 18, 2020, 12:04:32 PM
Hello, i'm having the same issue, could you please explain me how to generate a depth map?

The command is:

exiftool -depthmapdata -b FILE > depth.dat

I can view this with GraphicConverter since it has the ability to view raw image data.  I'm sure ImageMagick can convert it, but I don't know what the command would be.

- Phil
Title: Re: Extract Depth Map information from JPG
Post by: blue-j on December 21, 2020, 10:51:40 PM
Can anyone share a sample?  I can try to convert with ImageMagick and share.  - J
Title: Re: Extract Depth Map information from JPG
Post by: Phil Harvey on January 05, 2021, 01:09:33 PM
I should have also realized that ExifTool generates a Composite DepthMapTiff image for Samsung files like this.  Basically, this is the DepthMapData with an attached TIFF header.  This feature was added in ExifTool 11.66 but I had forgotten about it.

- Phil
Title: Re: Extract Depth Map information from JPG
Post by: blue-j on January 05, 2021, 07:09:07 PM
Any chance I could have a look at the sample?  -J
Title: Re: Extract Depth Map information from JPG
Post by: Phil Harvey on January 05, 2021, 09:36:00 PM
I don't know if I can share my samples publicly.  Send me an email and I'll let you have them.

- Phil
Title: Re: Extract Depth Map information from JPG
Post by: Jaff on April 20, 2021, 10:56:49 AM
Hello people! I had same problem extracting depthmap data... 0 size (exiftool -depthmapdata -b IMG_20210420_155329.jpg > depth.jpg). I extracted manually the raw data (GImage data) and tried to convert it but somewhere it has some bad data inside due to APP1 extended XMP segment storing format. Anyway, I've been able to look at original file online to see as layers the original image (Layer 1), modified image (Main) and the depth map data on this site: https://www.photopea.com/

I used this software on my old phone for the blurry background that those days require 2 cameras... pff. Was the latest version that worked on may old Samsung J500F. Camera software can be downloaded from here: Google Camera 3.2.045 (2821762-30) (arm-v7a) (nodpi) (Android 6.0+) (https://www.apkmirror.com/apk/google-inc/camera/camera-3-2-045-release/google-camera-3-2-045-2821762-30-android-apk-download/)

To see/extract depthmap image and original image you can try this: lens-blur-depth-extractor (https://www.clicktorelease.com/tools/lens-blur-depth-extractor/)

edit: worked with
Quoteexiftool -b -DepthImage IMG_20210420_155329.jpg > depth.jpg
and for original image...
Quoteexiftool -b -ImageData IMG_20210420_155329.jpg > ImageData.jpg

For optimisation purpose... can a optimised DepthImage / ImageData be reinserted in original file?

sample photo attached (used Samsung J530F)
Title: Re: Extract Depth Map information from JPG
Post by: Phil Harvey on April 25, 2021, 11:11:15 AM
You can write DepthImage and ImageData like this:

exiftool "-depthimage<=SOMEFILE" FILE

- Phil