# Points in a pointcloud and their distance from camera

Hi.

I wrote a node that gets the pointcloud from the Kinect and converts it from PointCloud2 to the pcl PointXYZ cloud.

Now, for starts, I wanted to take some middle point in the structure ([319][239] for a 640x480 2d pointcloud, i guess) and measure it's distance from the camera, and I did it by accessing points[76241].z, and likewise for other two coordinates, but now I see that it doesn't work like that, because in each frame i get completely different value, not only on the z coordinate, but also on x and y, and they should stay fixed because it's the same point in the 2d matrix.

First of all, if I access it that way, am I really looking at the same point in each frame? Or is it just that the origin of the coordinate system is not at the position of the camera? How would I get for example, that middle point and it's distance from the camera?

Hello.. I have the same problem. I wont to know the minimum distance from the obstacle to the robot(camera). Any help on this??Thanks

Have you manage to get the solution for this problem? If yes please let me know the solution even i am facing the same problem.

Hello, Can you explain the logic of picking 76241 (I do realize that it is 319*239). But shouldn't it be (318 * 480)+238?