-2

I was working on a project and stumbled upon an issue with the indexing in three dimensions.

How do I index into the z value of a point?

  • What do you mean by *depth*? In PCL point clouds are most commonly stored in an un-ordered fashion? The Point itself holds your Cartesian information. – Fantastic Mr Fox Jul 15 '15 at 16:50
  • @Ben By depth I mean the z coordinate. I am asking whether or not one can use cloud->points[i] to get a z value. – Sebastian Varma Jul 15 '15 at 17:37
  • I have added an answer, you should format your question correctly and add some more detail about what you wanted. Then i will upvote and retract my close vote. – Fantastic Mr Fox Jul 15 '15 at 18:20

1 Answers1

1

PCL most commonly stores its point cloud information in an un-ordered form. The point itself carries the information you might need.

For example the type PointXYZ has the following structure:

pcl::PointXYZ::PointXYZ (   
    float   _x,
    float   _y,
    float   _z 
)

Find out more about the point types here.

So in order to get the z information, you would do the following:

cloud->points[i]._z; // Depth information from a point in your point cloud. 
keineahnung2345
  • 2,635
  • 4
  • 13
  • 28
Fantastic Mr Fox
  • 32,495
  • 27
  • 95
  • 175