ExifTool Forum

General => Metadata => Topic started by: petemc on February 22, 2022, 05:48:40 PM

Title: Extract depth map from portrait mode image from samsung A70
Post by: petemc on February 22, 2022, 05:48:40 PM
I am trying to get the depth map from the attached image that was taken in portrait mode on a samsung A70 phone.

I was able to use the following command to extract the depth map from an image taken on a Pixel 3a :

exiftool PXL_20220211_211848299.PORTRAIT.jpg -trailer -b | exiftool - -trailer -b > depth.jpg

but cannot manage to find anything that works for the image from samsung A70
Title: Re: Extract depth map from portrait mode image from samsung A70
Post by: StarGeek on February 22, 2022, 07:23:48 PM
That attached image appears to have been stripped of all data except for the ICC_Profile.
Title: Re: Extract depth map from portrait mode image from samsung A70
Post by: petemc on February 23, 2022, 10:54:40 AM
thanks for the quick reply. It was shared with me as an email attachment, I'm guessing that stripped everything except the ICC_Profile. Would uploading the photo to a cloud storage account from the phone preserve the depth data?
Title: Re: Extract depth map from portrait mode image from samsung A70
Post by: StarGeek on February 23, 2022, 11:04:14 AM
Yes, cloud storage will probably preserve the data, though MS's OneDrive might alter the file, as OneDrive sometimes edits the metadata of images uploaded to it.  Zipping the file up before sending it will also preserve the data.
Title: Re: Extract depth map from portrait mode image from samsung A70
Post by: petemc on February 28, 2022, 03:21:05 PM
Thanks. I have this image that was uploaded to dropbox and it looks like it retained all of the metadata, but when I try to get the original image out using:

exiftool 20220228_093025.jpg -trailer -b > 20220228_093025_original.jpg

I get a file that looks to be about the right size, but its corrupted..

Title: Re: Extract depth map from portrait mode image from samsung A70
Post by: Phil Harvey on February 28, 2022, 03:38:14 PM
> exiftool 20220228_093025.jpg "-embedded*" -a
Embedded Image Name             : DualShot_1
Embedded Image                  : (Binary data 1512973 bytes, use -b option to extract)
Embedded Image Name             : DualShot_2
Embedded Image 2                : (Binary data 649775 bytes, use -b option to extract)
Title: Re: Extract depth map from portrait mode image from samsung A70
Post by: petemc on February 28, 2022, 04:02:55 PM
Thanks Phil. I'm able to get the original image using:

exiftool -b -EmbeddedImage 20220228_093025.jpg > 20220228_093025_output.jpg

when I try to do:

exiftool -b -DepthMapData 20220228_093025.jpg > 20220228_093025_output.jpg

I get a file that again appear the right size but when I try to open it, it is corrupted. I have also tried:

exiftool 20220228_093025.jpg -b -DualShot_2 > output.jpg

but that didnt work either
Title: Re: Extract depth map from portrait mode image from samsung A70
Post by: Phil Harvey on February 28, 2022, 09:38:05 PM
Sorry, I thought one of the EmbeddedImages may contain what you want.  But I think it is the DepthMapTiff you are looking for.  (A TIFF-format image.):

> exiftool ~/Desktop/20220228_093025.jpg -'*depth*'
Depth Map Name                  : DualShot_DepthMap_1
Depth Map Data                  : (Binary data 518400 bytes, use -b option to extract)
Depth Map Width                 : 960
Depth Map Height                : 540
Depth Map Tiff                  : (Binary data 518604 bytes, use -b option to extract)


- Phil
Title: Re: Extract depth map from portrait mode image from samsung A70
Post by: petemc on March 01, 2022, 09:57:55 AM
Thats it! Thank you Phil!
Title: Re: Extract depth map from portrait mode image from samsung A70
Post by: blue-j on March 09, 2022, 11:19:55 PM
Is there a way to retain or copy ALL the metadata after auto-rotating the JPEG?  I've used exiftran, tried to copy the metadata from original to rotated with exiftool, and it always leaves out the maker notes, including the depth maps.  I have a sinking feeling I have hit into a real limit here.

- J
Title: Re: Extract depth map from portrait mode image from samsung A70
Post by: StarGeek on March 10, 2022, 01:10:28 AM
What is the command you're using?

This should copy all tags, including MakerNotes, to the same exact locations they are in the original.
exiftool -TagsFromFile Source.jpg -All:All -icc_profile Target.jpg

Though I'm not sure if the -unsafe shortcut should be included in that.

Or you could always copy as a block in case there are tags that exiftool doesn't have definitions for
exiftool -TagsFromFile Source.jpg -EXIF -IPTC -XMP -icc_profile Target.jpg

See also FAQ #9 (https://exiftool.org/faq.html#Q9)
Title: Re: Extract depth map from portrait mode image from samsung A70
Post by: blue-j on March 10, 2022, 01:07:32 PM
I have tried many commands, including ones you've shared, but the depth map maker notes are not copying.  Have you tried?  Do you get different results?  - J
Title: Re: Extract depth map from portrait mode image from samsung A70
Post by: StarGeek on March 10, 2022, 01:23:43 PM
It copies MakerNotes from my Nikon jpgs correctly.  I don't know about depth maps, as I don't have a camera that does that.
Title: Re: Extract depth map from portrait mode image from samsung A70
Post by: blue-j on March 10, 2022, 01:41:33 PM
https://exiftool.org/forum/index.php?action=dlattach;topic=13335.0;attach=4442

This is the image being analyzed in this thread, that's all i have to work with myself!  - J
Title: Re: Extract depth map from portrait mode image from samsung A70
Post by: StarGeek on March 10, 2022, 02:17:27 PM
Ah, that's because it's in the trailer.

C:\>exiftool -P -overwrite_original -TagsFromFile Y:\!temp\aaaa\20220228_093025.jpg -trailer y:\!temp\Test4.jpg
    1 image files updated

C:\>exiftool -G1 -a -s -e --file:all y:\!temp\Test4.jpg
[ExifTool]      ExifToolVersion                 : 12.39
[Samsung]       DepthMapName                    : DualShot_DepthMap_1
[Samsung]       DepthMapData                    : (Binary data 518400 bytes, use -b option to extract)
[Samsung]       DepthMapWidth                   : 960
[Samsung]       DepthMapHeight                  : 540
[Samsung]       EmbeddedImageName               : DualShot_1
[Samsung]       EmbeddedImage                   : (Binary data 1512973 bytes, use -b option to extract)
[Samsung]       EmbeddedImageName               : DualShot_2
[Samsung]       EmbeddedImage2                  : (Binary data 649775 bytes, use -b option to extract)
[Samsung]       TimeStamp                       : 2022:02:28 06:30:25-08:00
[Samsung]       MCCData                         : 310
Title: Re: Extract depth map from portrait mode image from samsung A70
Post by: blue-j on March 10, 2022, 08:27:53 PM
I don't know what that means, but it sure seems hopeless...?  - J
Title: Re: Extract depth map from portrait mode image from samsung A70
Post by: StarGeek on March 10, 2022, 08:34:28 PM
Look at the command.  I copied the Trailer from 20220228_093025.jpg into Test4.jpg and now Test4.jpg has the depth map data.
Title: Re: Extract depth map from portrait mode image from samsung A70
Post by: blue-j on March 10, 2022, 11:08:42 PM
Change your name from StarGeek to StarGod!

THANK YOU SO MUCH!!!  : )

J