Answers.Body: <p>Depth maps are created using principles of photometry (method of measuring light).</p>
  <p>The depth maps (rather images) you took from the website are &quot;images&quot; not exact depth &quot;maps&quot;. So by default when you pull out a png image from a webpage, it will be saved in &quot;RGB&quot;. That is the reason you got an array with 3 layers. In practice, it will always be a single layer that simply shows relative brightness at each point.</p>
  <p>The webpage you referred to is talking about &quot;ray tracing&quot; using software called PoVRay (Persistence of Vision Ray Tracing). What it does is creates a 3D surface with a source of light at a point in the frame and simply measures the intensity of light falling on the surface. Remember this is 3D. When you capture this surface from a point using a camera you get a 2D image that represents a &quot;depth map&quot; as seen from a point of reference with respect to the source of light.</p>
  <p>A depth map has plenty of applications in computer vision, photography, and ray tracing. Illuminating a frame, measuring depth are few such applications.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-07-11T16:37:12.893Z
Answers.LastActivityDate: 2021-07-11T16:37:12.893Z
Answers.UserDisplayName: Arun Aniyan
Body: <p>I am curious about how depth maps work. While searching I came across <a href="http://paulbourke.net/reconstruction/depthmap2/" rel="nofollow noreferrer">this website</a> which contains some images and their depth maps. I took this depth map and tried to study it using a python pillow.</p>
  <p><a href="https://i.sstatic.net/uIIPd.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/uIIPd.png" alt="enter image description here" /></a></p>
  <pre><code>from PIL import Image
  import numpy as np
  
  image = Image.open('elephant_depth_s.png')
  img = np.asarray(image)
  
  print(img.shape)
  </code></pre>
  <p>The depth map shape is <code>(400, 400, 3)</code> with 3 channels. Contrary to my assumption this depth map has three channels instead of one. Even though most of the values are zeros some are not. This <code>len(np.where(img&gt;0))</code> shows that all the channels have some values greater than zero. My question is;</p>
  <ul>
  <li>In color images, RGB channel values are used for creating corresponding color pixels. Example  RGB (255,255,0) creates yellow.</li>
  </ul>
  <p>In this depth map how these three channel corresponds to the depth?</p>
  <p>Can you please give us some more information on depth maps and their real-world applications?</p>
  
Tags: <computer-vision><deep-neural-networks><image-processing><image-segmentation><semantic-segmentation>
Title: Dissection of a depth map
UserDisplayName: Eka
ThreadText: # Dissection of a depth map
  
  (Asked by: username_0 on 2021-07-11)
  
  I am curious about how depth maps work. While searching I came across this website which contains some images and their depth maps. I took this depth map and tried to study it using a python pillow.
  
  from PIL import Image
  import numpy as np
  
  image = Image.open('elephant_depth_s.png')
  img = np.asarray(image)
  
  print(img.shape)
  
  The depth map shape is (400, 400, 3) with 3 channels. Contrary to my assumption this depth map has three channels instead of one. Even though most of the values are zeros some are not. This len(np.where(img>0)) shows that all the channels have some values greater than zero. My question is;
  
  In color images, RGB channel values are used for creating corresponding color pixels. Example  RGB (255,255,0) creates yellow.
  
  In this depth map how these three channel corresponds to the depth?
  Can you please give us some more information on depth maps and their real-world applications?
  
  **Tags:** computer-vision, deep-neural-networks, image-processing, image-segmentation, semantic-segmentation
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-07-11. Score: 1
  
  Depth maps are created using principles of photometry (method of measuring light).
  
  The depth maps (rather images) you took from the website are "images" not exact depth "maps". So by default when you pull out a png image from a webpage, it will be saved in "RGB". That is the reason you got an array with 3 layers. In practice, it will always be a single layer that simply shows relative brightness at each point.
  
  The webpage you referred to is talking about "ray tracing" using software called PoVRay (Persistence of Vision Ray Tracing). What it does is creates a 3D surface with a source of light at a point in the frame and simply measures the intensity of light falling on the surface. Remember this is 3D. When you capture this surface from a point using a camera you get a 2D image that represents a "depth map" as seen from a point of reference with respect to the source of light.
  
  A depth map has plenty of applications in computer vision, photography, and ray tracing. Illuminating a frame, measuring depth are few such applications.
  
  
  ---
  
  