How to fill PCL point cloud from OpenNI depth stream

Currently I am getting depth information from the OpenNI depth stream and processing only the points of interest using openni::CoordinateConverter::convertDepthToWorld() to get real world X, Y distances. I want to use Point Cloud Library and need to get X, Y and Z distance information for all points into the point cloud. Is there any way to do this?

The Z distance is the value of the pixel of the depth image.

Hello zhumxcq,
Thanks for your reply. I have the z values for all pixels. What I am looking for is a quick way to use them to get X and Y values as using openni::CoordinateConverter::convertDepthToWorld() for each pixel is an expensive operation.

Hey
https://docs.opencv.org/2.4/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html

The “world” (camera) space coordinates can be computed directly from pixel space as follows:
X = (Xpixel - Cx) / Fx * Z
Y = (Ypixel - Cy) / Fy * Z
Cx, Cy is usually around half of the image resolution, for example, if the image is 640 x 480, Cx is around 320, Cy is around 240, +/- 10 pixels
Fx and Fy is usually the same or very close for the Astra S cameras, and Fx = Fy = 575 for depth, and Fx = Fy = 520 for video.

Hello zhumxcq,
Thanks for pointing me in the right direction.