Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Converting Point Cloud to Image Fails Without RGB Channel #366

Open
RMichaelSwan opened this issue May 11, 2022 · 2 comments
Open

Converting Point Cloud to Image Fails Without RGB Channel #366

RMichaelSwan opened this issue May 11, 2022 · 2 comments

Comments

@RMichaelSwan
Copy link

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:

pcl::toPCLPointCloud2(pcl_cloud, pcl_image);

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 RMichaelSwan changed the title Converting Point cloud to image fails without RGB channel Converting Point Cloud to Image Fails Without RGB Channel May 11, 2022
@Petros626
Copy link

Petros626 commented May 13, 2022

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/

@RMichaelSwan
Copy link
Author

RMichaelSwan commented May 18, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants