{"id":5390,"date":"2021-05-24T21:10:32","date_gmt":"2021-05-25T02:10:32","guid":{"rendered":"https:\/\/www.summet.com\/blog\/?p=5390"},"modified":"2021-05-25T19:25:39","modified_gmt":"2021-05-26T00:25:39","slug":"how-to-extract-depth-images-from-pixel-4-google-camera-android-phone-portrait-images","status":"publish","type":"post","link":"https:\/\/www.summet.com\/blog\/2021\/05\/24\/how-to-extract-depth-images-from-pixel-4-google-camera-android-phone-portrait-images\/","title":{"rendered":"How to extract depth images from Pixel 4 \/ google camera Android phone Portrait images"},"content":{"rendered":"<div class='__iawmlf-post-loop-links' style='display:none;' data-iawmlf-post-links='[{&quot;id&quot;:244,&quot;href&quot;:&quot;https:\\\/\\\/exiftool.org\\\/forum\\\/index.php?topic=11701.0&quot;,&quot;archived_href&quot;:&quot;https:\\\/\\\/web-wp.archive.org\\\/web\\\/20260415060818\\\/https:\\\/\\\/exiftool.org\\\/forum\\\/index.php?topic=11701.0&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[],&quot;broken&quot;:false,&quot;last_checked&quot;:null,&quot;process&quot;:&quot;done&quot;}]'><\/div>\n<p>I have a Pixel 4 android phone which can take &#8220;Portrait&#8221; images that use a depth map to &#8220;blur&#8221; the background, focusing on the foreground.<\/p>\n<p>I also have a Looking Glass Factory Portrait holographic display which can display holographic images.<\/p>\n<p>Currently, the HoloPlayStudio software (version 0.3.5 beta) that comes with it only natively supports iPhone portrait photos, but will import RGB+D photos, so I need to extract the depth image (and the original image without the blurred background)<\/p>\n<p>I want to extract a depth map from my android photos so that I can (manually) create RGB+D photos (which have a regular jpeg image next to the corresponding depth map).<\/p>\n<p>This website makes it easy to see\/download the different layers embedded in the Pixel 4A &#8220;Portrait&#8221; mode jpeg image: https:\/\/www.photopea.com\/<\/p>\n<p>Download the original image and the depth map, glue them together with the depth map on the right and you have an RGB-D image suitable for HoloPlayStudio.<\/p>\n<p>You can also extract the original and Depth Map images using the exiftool.<\/p>\n<p>The command that I found worked was suggested by Phil here:<br \/>\n<a href=\"https:\/\/exiftool.org\/forum\/index.php?topic=11701.0\">https:\/\/exiftool.org\/forum\/index.php?topic=11701.0<\/a><\/p>\n<p>It extracts the 2nd trailer image, which is the depth image:<\/p>\n<pre>exiftool input.jpg -trailer -b | exiftool - -trailer -b &gt; dept.jpg<\/pre>\n<p>Incidentally, the FIRST trailer image is the non-blurred original image&#8230;<\/p>\n<pre>exiftool input.jpg -trailer -b &gt; original_image.jpg<\/pre>\n<p>So if you extract the trailer from the original image, it will be the depth map, and you won&#8217;t have to chain exiftool together on the command line as above&#8230;<\/p>\n<pre>exiftool original_image.jpg -trailer -b &gt; depth.jpg<\/pre>\n<p>Completely unrelated to extracting depth images, but possibly needed to create holograms from a linear slide movie is the following ffmpeg command that will extract 3 seconds of a video starting at the 2 second mark into PNG image frames:<\/p>\n<pre><code>ffmpeg -ss 00:02 -i &lt;input&gt; -t 00:03 filename%05d.png<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I have a Pixel 4 android phone which can take &#8220;Portrait&#8221; images that use a depth map to &#8220;blur&#8221; the background, focusing on the foreground. I also have a Looking Glass Factory Portrait holographic display which can display holographic images. &hellip; <a href=\"https:\/\/www.summet.com\/blog\/2021\/05\/24\/how-to-extract-depth-images-from-pixel-4-google-camera-android-phone-portrait-images\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,1],"tags":[],"class_list":["post-5390","post","type-post","status-publish","format-standard","hentry","category-technology","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.summet.com\/blog\/wp-json\/wp\/v2\/posts\/5390","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.summet.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.summet.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.summet.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.summet.com\/blog\/wp-json\/wp\/v2\/comments?post=5390"}],"version-history":[{"count":3,"href":"https:\/\/www.summet.com\/blog\/wp-json\/wp\/v2\/posts\/5390\/revisions"}],"predecessor-version":[{"id":5396,"href":"https:\/\/www.summet.com\/blog\/wp-json\/wp\/v2\/posts\/5390\/revisions\/5396"}],"wp:attachment":[{"href":"https:\/\/www.summet.com\/blog\/wp-json\/wp\/v2\/media?parent=5390"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.summet.com\/blog\/wp-json\/wp\/v2\/categories?post=5390"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.summet.com\/blog\/wp-json\/wp\/v2\/tags?post=5390"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}