Robotics StackExchange | Archived questions

Visualize pointcloud in ros

Hello I have now used gpu::reprojectImageTo3D on a found disparity image and received cv::Mat of the pointcloud. I would now like to display this pointcloud.

I could not find any method inside OpenCV, I therefore found RViz and/or pcl.

I see two ways:

Method 1:

Convert the found pointcloud from OpenCV to sensor_msgs/PointCloud2 and then publish this topic. Allowing me to view it through RViz.

Issues: I am running this on embedded platform Jetson TX1 and I have read that RViz is not performing that well on the board. Furhtermore I cannot find any explanation for the conversion between the two types.

Method 2:

Use pcl to display the pointcloud from inside the node just for debug purposes.

Issues: I am however unsure if this is even possible.

Question

How do I display a pointcloud found in OpenCV?

Asked by jtim on 2016-10-27 08:28:48 UTC

Comments

Answers

Hey jtim,

I have little experience with this, but from a couple of years ago I remember looking at: http://wiki.ros.org/cv_bridge/Tutorials/UsingCvBridgeToConvertBetweenROSImagesAndOpenCVImages

the cv_bridge can cast image back and forth between opencv and ROS types, visualizing then becomes as simple as creating a publisher and rviz node. Although you indicate that RViz might not work properly, in which case you might be able to try to offload visualization to a normal PC running ROS?

Good luck!

Asked by mpjansen on 2016-10-28 03:33:55 UTC

Comments

Hey you are right. I allready use the cv_bridge for converting image messages. I however have not found the usecase of converting them to pointcloud2 messages. The offloading does not seem possible since the company is normally focussed on windows pcs and the lenovo pc is locked for installing linux

Asked by jtim on 2016-10-28 05:54:14 UTC

In the source code of stereo_image_proc from ROS, you can see the part that converts from cv::Mat to pointCloud2 message. You can refer to that part and modify as you see fit.

https://github.com/ros-perception/image_pipeline/blob/indigo/stereo_image_proc/src/nodelets/point_cloud2.cpp#L159

Best!

Asked by nhanph on 2017-03-01 22:39:16 UTC

Comments