Author Topic: Extract Depth Map information from JPG  (Read 3661 times)

ADenisUA

  • Newbie
  • *
  • Posts: 1
Extract Depth Map information from JPG
« 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):

Code: [Select]
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:

Code: [Select]

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

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 17944
    • ExifTool Home Page
Re: Extract Depth Map information from JPG
« Reply #1 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
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

ST

  • Newbie
  • *
  • Posts: 1
Re: Extract Depth Map information from JPG
« Reply #2 on: April 10, 2020, 11:11:04 AM »
I have the same exact issue. Has anyone solved it?

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 17944
    • ExifTool Home Page
Re: Extract Depth Map information from JPG
« Reply #3 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.
« Last Edit: April 10, 2020, 11:00:19 PM by Phil Harvey »
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 17944
    • ExifTool Home Page
Re: Extract Depth Map information from JPG
« Reply #4 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
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

progamerz

  • Newbie
  • *
  • Posts: 1
Re: Extract Depth Map information from JPG
« Reply #5 on: December 18, 2020, 12:04:32 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

blue-j

  • Sr. Member
  • ****
  • Posts: 101
Re: Extract Depth Map information from JPG
« Reply #6 on: December 18, 2020, 03:29:42 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

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 17944
    • ExifTool Home Page
Re: Extract Depth Map information from JPG
« Reply #7 on: December 21, 2020, 03:09:56 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
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

blue-j

  • Sr. Member
  • ****
  • Posts: 101
Re: Extract Depth Map information from JPG
« Reply #8 on: December 21, 2020, 10:51:40 PM »
Can anyone share a sample?  I can try to convert with ImageMagick and share.  - J

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 17944
    • ExifTool Home Page
Re: Extract Depth Map information from JPG
« Reply #9 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
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

blue-j

  • Sr. Member
  • ****
  • Posts: 101
Re: Extract Depth Map information from JPG
« Reply #10 on: January 05, 2021, 07:09:07 PM »
Any chance I could have a look at the sample?  -J

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 17944
    • ExifTool Home Page
Re: Extract Depth Map information from JPG
« Reply #11 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
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Jaff

  • Newbie
  • *
  • Posts: 7
Re: Extract Depth Map information from JPG
« Reply #12 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+)

To see/extract depthmap image and original image you can try this: lens-blur-depth-extractor

edit: worked with
Quote
exiftool -b -DepthImage IMG_20210420_155329.jpg > depth.jpg
and for original image...
Quote
exiftool -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)
« Last Edit: April 20, 2021, 11:50:33 AM by Jaff »