ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Turn a point cloud into an image with Python

asked 2011-07-06 12:28:01 -0600

Poofjunior gravatar image

updated 2014-01-28 17:09:59 -0600

ngrennan gravatar image

Hi, everyone,

Recently, I tried to run through the pcl_ros tutorial to convert a point cloud from a Kinect to an image. My hope is to be able to do the exact same thing in Python, not C++, and then work with the image using the OpenCV Python interface.

here's the tutorial link:

I hit a small snag, though. It seems like the tutorial is referencing a Ros Topic from openni_camera called /camera/depth/points2, but I can't seem to find this topic in list of topics published by openni_camera.

Rather, I found: /camera/depth/points, but this doesn't seem to generate an image when I make this change in the tutorial.

Will getting the image from /camera/depth/points2 be necessary to fulfill my overall goal?

Also, are there any other ways to easily convert a Point Cloud from the Kinect to an image in Python? Many Thanks in advance for everyone's words of wisdom!

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2011-07-06 17:57:25 -0600

fergs gravatar image

There are currently no PCL-python bindings, so there is no single function to convert a point cloud into an image. You can however subscribe to /camera/depth/image, which is already an image and has 32-bit float valued pixels (values are in meters). It can be converted easily into a cvMat using cv_bridge (see this post for further details).

edit flag offensive delete link more

answered 2015-12-27 21:49:08 -0600

misaugstad gravatar image

For anyone coming across this now: Python bindings for PCL were released in February of 2013 by Strawlab at

edit flag offensive delete link more

Question Tools


Asked: 2011-07-06 12:28:01 -0600

Seen: 6,845 times

Last updated: Jul 06 '11