Converting pointcloud2 data to ros image

asked 2015-04-20 03:58:12 -0600

ajax33 gravatar image

I have created a node that publishes fake pointcloud2 data. However, I am not getting an image unless I use an organised point cloud. I arbitrarily set the height and width parameters to 100 each, and also gave arbitrary rgb values to the points and I got a 100x100 image. However, I do not understand how the image is a representation of my pointcloud2 data. ie. what has happened to the x,y,z values I supplied.


//generating fake pointcloud data
for(i=0;i<100;i++)
  {
     for(j=0;j<100;j++)
     {
         cloud->at(i,j).x=1.0+j; 
         cloud->at(i,j).y=2.0+j;
         cloud->at(i,j).z=3.0+j;
         cloud->at(i,j).r=(40+j)%255;
     }
  }
 
edit retag flag offensive close merge delete