Extract Depth Map information from JPG

Started by ADenisUA, January 05, 2019, 06:12:37 PM

Previous topic - Next topic

ADenisUA

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

Phil Harvey

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/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

ST

I have the same exact issue. Has anyone solved it?

Phil Harvey

#3
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.
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Phil Harvey

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/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

progamerz

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

blue-j

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

Phil Harvey

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
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

blue-j

Can anyone share a sample?  I can try to convert with ImageMagick and share.  - J

Phil Harvey

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/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

blue-j

Any chance I could have a look at the sample?  -J

Phil Harvey

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/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Jaff

#12
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
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)

Phil Harvey

You can write DepthImage and ImageData like this:

exiftool "-depthimage<=SOMEFILE" FILE

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).