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

get the raw kinect data

asked 2012-08-28 03:08:20 -0600

ha gravatar image

updated 2012-08-29 03:31:18 -0600

In openni, I think sensor_msgs encode data.

Because, rostopic echo /camera/depth/image and /camera/depth/disparity pulish not 16bit or 11bit, just 0~255.

I think the data is not actual depth data( distance )

I want to know depth value. But I don't know how to get the depth value.

I know the relation ( Z=fT/d ).

I think the fomula substituted raw data is right.

How can I get the raw kinect sensor data?

Or How can I get the actual depth value?

edit retag flag offensive close merge delete

Comments

I think sensor_msgs/image message format is 8bit and using cv_bridge is 16bit or 32bit. Dose from 8bit to 32bit make loss accuracy?

ha gravatar image ha  ( 2012-08-29 11:56:42 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted
2

answered 2012-08-29 05:37:47 -0600

mjcarroll gravatar image

updated 2012-08-29 05:47:10 -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;
  try
  {
    cv_ptr = cv_bridge::toCvCopy(msg, enc::TYPE_32FC1);
  }
  catch (cv_bridge::Exception& e)
  {
    ROS_ERROR("cv_bridge exception: %s", e.what());
    return;
  }
  cv::imshow(WINDOW, cv_ptr->image);
  image_pub_.publish(cv_ptr->toImageMsg());
}

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

Comments

Can you tell how to access the floating point values in cv_ptr->image?

shinnqy gravatar image shinnqy  ( 2014-05-21 22:59:25 -0600 )edit
-2

answered 2012-08-28 05:09:40 -0600

hahaha gravatar image

I also read the page (http://openkinect.org/wiki/Imaging_Information#Depth_Camera)

" The raw 11-bit disparity value to a depth value in centimeters is:

100/(-0.00307 * rawDisparity + 3.33). "

  1. depth value = distance. Is it right?

  2. So, how can I get the rawDisparity?

edit flag offensive delete link more

Comments

Please do not create answers just for discussing or asking new questions. This is not a forum. Instead please either use comments or (if you are the original poster) edit the question.

Lorenz gravatar image Lorenz  ( 2012-08-29 03:48:49 -0600 )edit

I am sorry~ but I don't find "add comment" in windows. How can I find it. I use ros in ubuntu now. And can you answer my former question? please

hahaha gravatar image hahaha  ( 2012-08-29 04:52:00 -0600 )edit

Question Tools

Stats

Asked: 2012-08-28 03:08:20 -0600

Seen: 3,074 times

Last updated: Aug 29 '12