In general, the z component will describe the depth or distance from the
camera / scanner. But It could be all different if you have rotated
coordinate frame. So you need to know the orientation of that coordinate
You could calculate the Euclidean distance from the origin of the scanner to
each point, than you get a distance but its not really depth.
Normally, the values stored in PCD from a laser scanner are in meters. Since
your data is from a stereo-rig it may as well be mm which would make sense
looking at the 2 lines of data in the stackoverflow question.
Once you have determined your distance or have decided weather z is your
depth or not you can store the data in a cloud of type pcl::PointXYZRGBA and
misuse the alpha channel as Depth. Don't know if this makes sense for your
have a look at the visualization from CloudCompare of the pcd
File pcd0171 from your source.
The camera system or point cloud is aligned differently than you
expect from the raw png. I colored it by range from the screenshot
calculated to the camera origin in CC (2.6.1) for better
recognition of the scene. Seems it was saved in a processed manner
and not directly in Col Row Depth, but as you see you can restore
the depth or distance from the center. As PCL is able to work with
organized point clouds also height and width in the pcd cloud
could be set to 640x480 to retain the structured nature of the
cloud, but not all pixel are valid so not the 640x480 pixel are
saved, but just 253671 or 83% resulting in an unorganized cloud.
I didn't check if indexing as indicated helps to restore the
original registration of the picture, but I'd guess. Calculate all
distances using the coordinates and the indices, fill in the
blanks and view as an depthimage. Also, from the coordinate
values, everything seems to be in mm.