[ros-users] point cloud questions

Michael Styer michael at styer.net
Fri Jul 30 16:52:32 UTC 2010

Hi Radu,

On Thu, 2010-07-29 at 18:09 -0700, Radu Bogdan Rusu wrote:
> On 07/29/2010 05:55 PM, Michael Styer wrote:
> > It doesn't look like there's a structured accessor for organized point
> > clouds, i.e. a way to index into the points array as a 2-d matrix rather
> > than a vector -- is that right, or have I just missed it?
> You're absolutely right, there isn't any, as we thought that index = v * cloud.width + u is easy (and vice versa). 
> However, if you have any good idea on how to wrap this without causing confusion, we could do that!

I was thinking about something like this (just a sketch, no bounds
checking on the indices):

PointT PointCloud::operator()(int u, int v) {
    if (this->is_dense)
	return points[v*this->width+u];
	ROS_ERROR("Can't use 2D indexing with a sparse point cloud");

But just calculating the linear index directly is perfectly easy to do
too. Whether the above clarifies or confuses things is probably

> > In any case, thanks very much again for your help. PCL is significantly
> > clearer to me now than it was this morning.
> You're welcome! If you don't mind contributing with some of these things to the wiki (Q & A), that would be great!

No problem; I'll write something up for the wiki.

> Cheers,
> Radu.


More information about the ros-users mailing list