Generate point cloud from rbg and depth image

I found this vtkDepthImageToPointCloud() but the way I used it didn’t seem to work. Can anyone explain how to use it?

@pieper gave a nice demo of this in 3D Slicer at a recent developer tcon. If you want to acquire and display live surface scan stream from an Intel RealSense, Microsoft Kinect, etc. device using VTK then you can use this gist:

The code snippet works as is in 3D Slicer but by changing a few lines you can use it in any VTK render window.