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

[PARTLY UNSOLVED] Raw Kinect Depth Data

asked 2011-10-10 05:54:34 -0600

Yo gravatar image

updated 2016-10-24 09:01:14 -0600

ngrennan gravatar image

I'd like to get the raw depth data off of the Kinect on my Turtlebot, using ROS.

What I've been doing is running roslaunch openni_camera openni_node.launch, and then looking at the published /camera/depth/image_raw.

Online research has indicated that the Kinect should spit out 11-bit values. However, it seems this topic spits out something like 14-bit values...

I made a histogram of all the depth values in 183 random depth images I collected with all sorts of varying depths in them, and I found that the array of 16-bit values which come out of the /camera/depth/image_raw topic (actually 8-bit values which I have to put together into 16-bit) range over the values zero and a seemingly logarithmic distribution of exactly 799 values between 342 and 9757 -- exactly 800 values in total.

So I'm confused about whether the values I'm getting are actually the "raw" output from the Kinect (which I want), or if something between me and the Kinect is doing some processing to it that I don't want done. (I'm using it for some very specific scientific mapping applications, and I want to know exactly what is happening to my data.)

What I've found online says that the values should range from 0 to 2^11.

If the data is straight off the Kinect, then it's odd that 2^13 < 9757 < 2^14.

If the data is simply being scaled or something, then I'd think that there'd be somewhere between 2^10 and 2^11 different values, instead of exactly 800.

Can anyone explain to me how to get the real raw data off the Kinect using OpenNI through ROS, or if I'm doing it correctly, can you explain what's going on and why it's not coming out as I would expect?

Thank you so much!

Update: sebsch answered the first part -- No, the OpenNI driver doesn't publish what I want. But it seems the suggested package won't work for my needs either. Still searching for a way to do it.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
3

answered 2011-10-19 22:17:26 -0600

sebsch gravatar image

Data published on /camera/depth/image_raw is the depth in millimeters as a 16 bit unsigned integer.

The openni driver does not publish the original (disparity-like) data as provided by the kinect. You could try one of the other (libfreenect-based) drivers, e.g. this one.

edit flag offensive delete link more

Comments

1
Thank you for answering the first part of the question! However, it seems that the driver you posted doesn't do what I need either... First, what the wiki says it publishes is incorrect. I started editing the code to get it to give me what I need (since it seemed it just wasn't publishing [cont.]
Yo gravatar image Yo  ( 2011-10-31 07:00:25 -0600 )edit
[cont.] it), but it turns out that it's not exactly all that correct in its computation either -- it's not just not publishing it. This is where the computation is done: http://bazaar.launchpad.net/~cyphylab/cyphy/bonsai/view/head:/cyphy_kinect/kinect_camera/src/kinect_driver.cpp#L462
Yo gravatar image Yo  ( 2011-10-31 07:00:29 -0600 )edit
0

answered 2011-10-10 07:19:44 -0600

fergs gravatar image

You might want to take a look at this question: http://answers.ros.org/question/869/kinect-opencv#1485

The depth image should be 32-bit float, with values corresponding to distance in meters.

edit flag offensive delete link more

Comments

Thank you for the response, but this does not answer my question. See, for example: "Each pixel is 11 bits" (http://openkinect.org/wiki/Protocol_Documentation#Relevant_Bits_of_Code). What you posted appears to be taking those 11 bits and scaling them over a 32-bit float. I want the raw 11 bits.
Yo gravatar image Yo  ( 2011-10-12 05:09:45 -0600 )edit
Out of curiosity, why do you need the 11-bit values? If you need such raw data, it may make more sense to just use OpenNI directly.
Mac gravatar image Mac  ( 2011-10-19 07:01:56 -0600 )edit
Mac-- Simplified reason: The end goal is something off of which a paper or more will probably be based, and we want to know everything that's happening to the data. And we'd like to use ROS because it makes things simpler with the rest of our code and stuff. Thanks for the suggestion though! :)
Yo gravatar image Yo  ( 2011-10-31 07:17:57 -0600 )edit

Question Tools

Stats

Asked: 2011-10-10 05:54:34 -0600

Seen: 4,051 times

Last updated: Oct 31 '11