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

8bit kinect data

asked 2012-08-25 16:46:52 -0600

rosmaker gravatar image

I search disparity and depth data 11bit.

But kinect pulish just 8bit.

Why do they have difference?

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted

answered 2012-08-29 05:40:15 -0600

mjcarroll gravatar image

updated 2012-08-29 05:46:04 -0600

Looking at the openni_camera documentation on the ROS wiki, you can see that the openni_node broadcasts several topics.

I think for the data that you are looking for, the topics of interest will be the depth/image_raw messages, or the depth_registered/image_raw if you have the OpenNI registration turned on.

The */image_raw messages are in the sensor_msgs/Image message format, which stores the data in a byte array, that can then be reassembled in the subscriber. This is accomplished using cv_bridge.

cv_bridge allows you to write code like this for your callback:

void imageCb(const sensor_msgs::ImageConstPtr& msg)
  cv_bridge::CvImagePtr cv_ptr;
    cv_ptr = cv_bridge::toCvCopy(msg, enc::TYPE_32FC1);
  catch (cv_bridge::Exception& e)
    ROS_ERROR("cv_bridge exception: %s", e.what());
  cv::imshow(WINDOW, cv_ptr->image);

cv_ptr->image will contain an OpenCV cv::Mat, in this case containing floating point values, which represent the depth in millimeters for that pixel.

edit flag offensive delete link more


They might also be interested in the rectified images, depth_registered/image_rect_raw

phil0stine gravatar image phil0stine  ( 2012-08-29 06:35:07 -0600 )edit

answered 2012-08-27 05:10:24 -0600

phil0stine gravatar image

Do you mean 16 bit? In any case, kinect depth image is 16 bit, not 8.

edit flag offensive delete link more


How can I 16bit data? depth data is sensor_msgs/Image Message. They have uint8[] data. (

rosmaker gravatar image rosmaker  ( 2012-08-27 05:12:56 -0600 )edit

Can you help me??

rosmaker gravatar image rosmaker  ( 2012-08-27 05:35:29 -0600 )edit

The sensor_msgs/Image message just stores the data in a byte array, that is re-cast into the appropriate array based on the height, width, and encoding fields in the message.

mjcarroll gravatar image mjcarroll  ( 2012-08-27 06:42:25 -0600 )edit

Really?? I don't know that. So how to know raw data or before stored data??

rosmaker gravatar image rosmaker  ( 2012-08-27 12:21:40 -0600 )edit

Not sure exactly what you mean, but if you know what the image encoding is, you can easily convert it to an opencv Mat of the same size and type, using cv_bridge

phil0stine gravatar image phil0stine  ( 2012-08-27 18:24:50 -0600 )edit

If I use cv_bridge, can I find depth or disparity value??

rosmaker gravatar image rosmaker  ( 2012-08-27 19:12:42 -0600 )edit

answered 2012-08-28 13:27:45 -0600

ha gravatar image

If I use cv_bridge, can I get depth or disparity value?

( I don't read last question. so I ask one more. you understand it )

edit flag offensive delete link more

Question Tools


Asked: 2012-08-25 16:46:52 -0600

Seen: 659 times

Last updated: Aug 29 '12