# Create Depth-Map for vtkDepthImageToPointCloud

**URL:** https://discourse.vtk.org/t/create-depth-map-for-vtkdepthimagetopointcloud/11380
**Category:** Development
**Created:** [May 4, 2023, 8:18pm UTC](https://discourse.vtk.org/t/create-depth-map-for-vtkdepthimagetopointcloud/11380 "2023-05-04T20:18:11Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [May 6, 2023, 12:03pm UTC](https://discourse.vtk.org/t/create-depth-map-for-vtkdepthimagetopointcloud/11380/4 "2023-05-06T12:03:28Z")

</div>

Hi,

How are you getting the depth buffer image?

Since the code posted seems to be incomplete, you can use the `vtkWindowToImageFilter` class ([https://vtk.org/doc/nightly/html/classvtkWindowToImageFilter.html](https://vtk.org/doc/nightly/html/classvtkWindowToImageFilter.html)) to save z-buffer values as an image. Specifically, you need to call its `SetInputBufferTypeToZBuffer()` to obtain an image like this:

![image](https://discourse.vtk.org/uploads/default/original/2X/e/edd52f90134b66d8954c928995296dd9950a259d.png)

In the case above, the brighter the closer a pixel is (you may use another convention).

Also, please, check whether the solution to this question: [https://discourse.vtk.org/t/z-buffer-values-problem-with-camera/2224/2](https://discourse.vtk.org/t/z-buffer-values-problem-with-camera/2224/2) works for you. Likewise, the user was getting a blank image.

regards,

PC

---

_[View the full topic](https://discourse.vtk.org/t/create-depth-map-for-vtkdepthimagetopointcloud/11380)._
