Convert PointCloud2 without RGB into Imagen type.

asked 2020-09-30 23:24:18 -0600

ajpaezm gravatar image

I have a ToF depth image camera. The PointCloud2 topic Is named "/tof_cam635_node/points". I would like to convert this into an Image topic so I can work with it using OpenCV.

It appears this ToF cam doesn't have RGB, but I thought that wasn't important, until I ran this command:

rosrun pcl_ros convert_pointcloud_to_image input:=/tof_cam635_node/points output:=/tof_cam635_node/my_pcl_image

Note: /tof_cam635_node/my_pcl_image topic is made up by me, not sure if that can be causing the error.

The error that I get is:

Error in converting cloud to image message: No rgb field!!

Is there a way to bypass this so I can use that depth image in OpenCV?

edit retag flag offensive close merge delete



Hi, maybe this post is usefull.

Weasfas gravatar image Weasfas  ( 2020-10-01 04:37:00 -0600 )edit

@Weasfas hi, thanks for suggesting it. Yes I saw that, but since I saw no practical reference on how to implement something like that I searched for other options. Do you happen to know a piece of code that uses what the approved answer is talking about? Thanks in advance. I'm trying to find it on my own but no luck.

ajpaezm gravatar image ajpaezm  ( 2020-10-01 07:49:53 -0600 )edit

Well the only reference I found is this, but implementing the idea is very straight forward in my opinion.

Weasfas gravatar image Weasfas  ( 2020-10-01 09:42:21 -0600 )edit

Thank you @Weasfas. If I implement it successfully, I'll let you know.

ajpaezm gravatar image ajpaezm  ( 2020-10-01 22:11:32 -0600 )edit