ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Publish Kinect Depth information to a Ros Topic

asked 2011-07-13 07:21:50 -0500

Poofjunior gravatar image

updated 2016-10-24 08:59:01 -0500

ngrennan gravatar image

Hello, all,

Recently, we've been attempting to access the kinect depth data from the published point cloud provided by the openni_node, but we've run into a couple stumbling points:

first, the ros tutorial for pcl_ros

references a topic published by openni called: /camera/depth/points2 but our version of openni_kinect only publishes: /camera/depth/points Are we using an outdated version?

Also, we tried working with /camera/depth/points and we believe that this information is published in binary format. When we attempted to convert the binary format of a single point to x,y,z information though, we received a list of 4 integers. Are we interpreting the information incorrectly?

We also subscribed to the /camera/depth/image, and we could access the depth information from a single point, but we're restricted to meter-by-meter resolution. Is there a better way of getting more resolution with the /camera/depth/image ?

Thanks for reading, and we appreciate any directions you can point us to accessing the depth information (of points) from the kinect.



edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2011-07-13 08:53:35 -0500

fergs gravatar image

updated 2011-07-13 08:58:03 -0500

The current driver publishes both point clouds and images:

  • /camera/depth/points -- this is the non-colored point cloud. To use this, you'd probably want to use PCL (Point Cloud Library) functions to access individual points in a meaningful manner.
  • /camera/depth/image -- this is the depth image (not a point cloud). It can easily be converted to an OpenCV image using the cv_bridge package. For using the depth image, it is important to note that is a 32-bit float for each pixel, corresponding to meters. This answer and this one contain some useful information on using the image.
edit flag offensive delete link more


Many thanks, fergs! It turns out that we weren't interpreting the image correctly. We changed cv_image = self.bridge.imgmsg_to_cv(data, "mono8") to cv_image = self.bridge.imgmsg_to_cv(data, "32FC1") and we started seeing much better results.
Poofjunior gravatar image Poofjunior  ( 2011-07-14 04:28:58 -0500 )edit
Many thanks, fergs!
Poofjunior gravatar image Poofjunior  ( 2011-07-14 04:28:58 -0500 )edit
Great! Please click the checkmark next to my answer to accept it.
fergs gravatar image fergs  ( 2011-07-14 06:45:09 -0500 )edit

Thank you for your answer. May I ask a question that if there is a way to get the value(float) of each point on the depth/image_raw before we convert it in to a cvmat?

Consider1001 gravatar image Consider1001  ( 2014-04-15 16:16:34 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2011-07-13 07:21:50 -0500

Seen: 4,174 times

Last updated: Jul 13 '11