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

kinect opencv

asked 2011-05-05 06:58:54 -0600

dinect gravatar image

updated 2016-10-24 09:00:07 -0600

ngrennan gravatar image

I'm trying to use the depth data obtained by kinect with C++ program.

I've already installed openni_kinect with the guide(http://www.ros.org/wiki/openni_kinect, OpenNI itself is installed in this procedure, right?). Next, I'd like to use the depth data with C++ program, but I don't have any idea to do it. Include and use some special function? Or not supported yet?

Could you teach me how to do it? I'm using Ubuntu10.04, diamondback and I'd like to use the depth data in image processing using OpenCV2.2.

Thank you in advance.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
16

answered 2011-05-05 07:48:58 -0600

fergs gravatar image

updated 2011-05-05 07:49:52 -0600

There are at least two ways to use the depth data from the Kinect. First, you mention OpenCV. If you want to use OpenCV with the depth data you would probably want to subscribe to the /camera/depth/image topic, which provides a "depth" image. Each pixel value is the distance measurement in meters (as a 32-bit float). You would probably want to use cv_bridge to convert the ROS topic into an OpenCV cv::Mat -- there is a very good tutorial on cv_bridge. A simple piece of example code could be found in our depth_viewer package, which includes a C++ node that uses cv_bridge and converts the 32-bit float to a nicely scaled 8-bit grayscale image and displays it using OpenCV functions. You can use just about any OpenCV functions on the depth image, and of course segmentation runs fairly easy on a depth image compared to an RGB one.

The other possibility is to use the point cloud representation, on the /camera/depth/points or /camera/rgb/points topic (the latter having RGB data in addition to the standard XYZ data). Rather than using OpenCV, you would want to use the Point Cloud Library, which has many great features and accompanying tutorials.

edit flag offensive delete link more

Comments

Hello. I'm working on a project that involves analysis of depth images using OpenCV, and have some problems with conversion into the CV format. I'd like to take a look at your depth_viewer package, but I can't find your repository. Can you give me a link or something where I can download it?

kameleon gravatar image kameleon  ( 2012-10-28 00:16:40 -0600 )edit

thanks for your kind help!!!

YUBO.ZUZU gravatar image YUBO.ZUZU  ( 2013-10-07 07:36:57 -0600 )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? (Python best)

Consider1001 gravatar image Consider1001  ( 2014-04-15 16:12:16 -0600 )edit
0

answered 2011-05-05 07:25:59 -0600

It's unlikely that anyone has time to teach you, you'll have to do that yourself. I would recommend going through the ros tutorials first.

But the openni_camera package within the openni_kinnect stack has a node that publishes on the /camera/rgb/points and /camera/depth/points topics.

In the future I would recommend that you try to ask more specific questions. Most people are unlikely to have the time or patience to answer open ended questions.

edit flag offensive delete link more

Comments

1
Too harsh ?
Asomerville gravatar image Asomerville  ( 2011-05-05 08:16:41 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2011-05-05 06:58:54 -0600

Seen: 6,718 times

Last updated: May 05 '11