perception_pcl icon indicating copy to clipboard operation
perception_pcl copied to clipboard

Converting Point Cloud to Image Fails Without RGB Channel

Open RMichaelSwan opened this issue 2 years ago • 2 comments

The convert_pointcloud_to_image.cpp tool does not work for many common point clouds. It depends on the point cloud including an RGB field, which would only make sense for RGB-D sensors.

It looks like this may be a fundamental issue with the pcl library not supporting this type of conversion. Source of the bug: https://github.com/ros-perception/perception_pcl/blob/bd7a060e98d2bb6720b3bc30794fd25c5ef43241/pcl_conversions/include/pcl_conversions/pcl_conversions.h#L521 https://github.com/PointCloudLibrary/pcl/blob/83eecf88f56b9e6812d8875bfb30e1140e01dd5a/common/include/pcl/conversions.h#L316

I have found some converters people rolled themselves, though they are a bit old, so will take some work to get working on ROS Noetic: https://github.com/v-lopez/pointcloud_to_rangeimage/tree/srcsim-fixes https://github.com/EPVelasco/pc2image

RMichaelSwan avatar May 11 '22 08:05 RMichaelSwan

Hey,

its the same problem for me. I tried exactly the same script, but the PointCloud type isn't suitable. Did you made it running with one of these nodes? I would suggest you another solution, which we maybe can figure out together? Look here: https://stackoverflow.com/questions/52481774/how-to-save-intensity-value-in-sensor-msgs-image-from-pointcloud https://answers.ros.org/question/9515/how-to-convert-between-different-point-cloud-types-using-pcl/

Petros626 avatar May 13 '22 06:05 Petros626

Hey,

its the same problem for me. I tried exactly the same script, but the PointCloud type isn't suitable. Did you made it running with one of these nodes? I would suggest you another solution, which we maybe can figure out together? Look here: https://stackoverflow.com/questions/52481774/how-to-save-intensity-value-in-sensor-msgs-image-from-pointcloud https://answers.ros.org/question/9515/how-to-convert-between-different-point-cloud-types-using-pcl/

So I'm using a Velodyne VLP-16 with ROS Noetic.

Relevant repo: https://github.com/EPVelasco/pc2image

I ended up using this repo inside of a ROS Kinetic docker container and setting up the network as host. I also had to change my cv2 image encoding from mono16 to rgb8 in the source code of the mentioned link above due to some downstream requirements on image encoding. Unfortunately the code I linked does not work with ROS Noetic as the pcl library changed some things since this code was written.

Could probably do a rewrite of this code, but I don't have a need to dig into it right now. The code seems to be pretty simple, it's just a matter of dealing with pcl function call changes if you wanted to make it compatible with newer versions of ROS.

RMichaelSwan avatar May 18 '22 16:05 RMichaelSwan