ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
As I was just skimming through the code. This is what openni_camera does:
for (int v = 0; v < (int)cloud_msg->height; ++v, depth_idx += depthSkip)
{
for (int u = 0; u < (int)cloud_msg->width; ++u, depth_idx += depthStep, ++pt_iter)
{
pcl::PointXYZ& pt = *pt_iter;
// Check for invalid measurements
if (depth_md[depth_idx] == 0 ||
depth_md[depth_idx] == depth.getNoSampleValue () ||
depth_md[depth_idx] == depth.getShadowValue ())
{
// not valid
pt.x = pt.y = pt.z = bad_point;
continue;
}
// Fill in XYZ
pt.x = (u - centerX) * depth_md[depth_idx] * constant;
pt.y = (v - centerY) * depth_md[depth_idx] * constant;
pt.z = depth_md[depth_idx] * 0.001;
}
}