ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

I've said this many, many times on ros answers - point.z IS NOT distance from the camera. I don't know where this misconception keeps coming from, but how coordinate frames work is clearly laid out in this REP. To summarize, here's what the fields on a point mean:

  • x forward
  • y left
  • z up

To answer your question, using linear indexing there's no guarantee on the ordering of the points, so trying to access the "middle" point like that will just return some arbitrary point. If you actually just want the distance from the center of the camera, you should consider using the depth image instead. In the depth image, each pixel represents a distance in mm, and you can index into it as you would in any image.

I've said this many, many times on ros answers - point.z IS NOT distance from the camera. I don't know where this misconception keeps coming from, but how coordinate frames work is clearly laid out in this REP. To summarize, here's what the fields on a point mean:

  • x forward
  • y left
  • z up

To answer your question, using linear indexing there's no guarantee on the ordering of the points, so trying to access the "middle" point like that will could just return some arbitrary point. Additionally, since the Kinect is a noisy sensor, even if you are getting the "same" point, all the values will be slightly different each time. If you actually just want the distance from the center of the camera, you should consider using the depth image instead. In the depth image, each pixel represents a distance in mm, and you can index into it as you would in any image.

I've said this many, many times on ros answers - point.z IS NOT distance from the camera. I don't know where this misconception keeps coming from, but how coordinate frames work is clearly laid out in this REP. To summarize, here's what the fields on a point mean:

  • x forward
  • y left
  • z up

Or in an optical frame

  • z forward
  • x right
  • y down

Note that forward is not the same as depth.

To answer your question, using linear indexing there's no guarantee on the ordering of the points, so trying to access the "middle" point like that could just return some arbitrary point. Additionally, since the Kinect is a noisy sensor, even if you are getting the "same" point, all the values will be slightly different each time. If you actually just want the distance from the center of the camera, you should consider using the depth image instead. In the depth image, each pixel represents a distance in mm, and you can index into it as you would in any image.