Robotics StackExchange | Archived questions

error while accessing rgb value

My problem is when i use to run below code i used to get values of r,g,b before after subscribing to /camera/depthregistered/points or imageraw before. but when i try to access them now what i get is

rgb -0.312749   ,

rgb -0.312749   /
rgb -0.312749   ,
rgb -0.312749   ,
rgb -0.312749   '
rgb -0.312749   +
rgb -0.312749   ,
rgb -0.312749   ,
rgb -0.312749   +
rgb -0.312749   *
rgb -0.312749   -
rgb -0.311383   *
^Crgb   -0.312749   (
rgb -0.312749   )

why am i getting this. it didn't used to come before but now, this. i cant find what is the problem from 1 hour, so i put it here. what are those +,-,*. that is the problem. my code is like:

void
cloud_cb (const sensor_msgs::PointCloud2ConstPtr& input)
{

    pcl::PointCloud<pcl::PointXYZRGB> output;
        pcl::fromROSMsg(*input,output);

pcl::PointXYZRGB p[400][400];

for(int i=0;i<400;i++)
{
  for(int j=0;j<400;j++)
    {
      p[i][j] = output.at(i,j);

  }
 }
  std::cout<<"rgb"<<"\t"<<p[200][200].x<<"\t"<<p[200][200].r<<std::endl;

After this i ran: rosrun my_pcl_tutorial example input:=/camera/depth_registered/points and also rosrun my_pcl_tutorial example input:=/camera/depth_registered/image_raw, but i got similar output.

Asked by dinesh on 2016-08-19 13:34:05 UTC

Comments

Answers