2
votes

I am trying to convert data obtained from a 2D laser scanner into an openCV image. On searching online for this, I found that first I had to convert the laserscan data to pointcloud2, then the pointcloud2 to a ROS image and then the ROS image to an opencv image. Currently, I do not have access to a lidar, so I had created a node that publishes fake pointcloud2 data. However, I did not understand what organised pointcloud means. I arbitrarily set the height and width parameters to 100 each, and also assigned arbitrary RGB values to points, and I got a 100x100 image, but I do not understand how that image is a representation of my pointcloud data. Can someone please explain it?

1
did you ever solve this? If you did there is some quick points for the conversion the other way stackoverflow.com/questions/40302248/visualize-pointcloudJTIM

1 Answers

0
votes

I guess you are using OpenCV and PCL to develop ROS under ubuntu, for pcl::PointCloud2 is ROS point cloud format.

Organised pointcloud difinition:http://pointclouds.org/documentation/tutorials/basic_structures.php#basic-structures

I did some task on point cloud and OpenCV image and always convert point cloud to OpenCV Mat. So I can give you some suggestions.

My develop environment is PCL1.7.2, OpenCV2.4.9, Kinect v2, VS2012 under win8.1. I want to convert project point cloud onto the ground plane and transfer it into an 2D image (OpenCV Mat), you can check my another solution here and here.