Hello I am trying to convert laser scan data into images so that I can find "Lines". Following are the snippets from my code:
pcl::PointCloud<pcl::PointXYZRGB> cloudp;
sensor_msgs::Image image;
conversion
pcl::toROSMsg (cloudp, image); //convert the cloud
cloudxyz_.publish(cloudp);
image_pub_.publish (image); //publish our cloud image
When I run it, "Failed to find match for field 'rgb' " is the error I get. When I use rviz, all I see is an Image which is full of black color. My laser gives is 2D data (i.e, z in point cloud is 0) and I need a 2D image so that I can apply CV algorithms on the image.
Thank you.
Originally posted by San on ROS Answers with karma: 61 on 2016-02-20
Post score: 2
Original comments
Comment by srik11 on 2016-05-10:
Hello, were you able to get the image? I also am working on a similar issue. I am trying to find simple 2d shapes from laser scan data. I tried converting the point cloud to image. I also faced the same 'no rgb' issue. I converted the PointXYZ point cloud to PointXYZRGB type.
Comment by srik11 on 2016-05-10:
I found that the default rgb value was 0 which is black. I tried manually setting a rgb field.But i get an image with horizontal line with varying width. Wanted to know if you made any progress.
Comment by San on 2016-05-11:
Hi srik11, I posted the answer, have a look.