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

calculate depth of a point using kinect..??

asked 2014-09-11 23:36:49 -0600

ASHISH CHHONKAR gravatar image

i am using kinect in ROS. i am working with indigo, ubuntu 14.04. .. my doubt is how can i calculated depth of a point in image. My task is to locate a point in image using mouse and it will tell me the depth of that point.. i already installed openni, pcl. i am also confused of taking which topic i subscribe to calculate depth? please help me step by step.. language c++

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2014-09-12 16:44:33 -0600

paulbovbel gravatar image

updated 2014-09-12 16:45:15 -0600

The topic you are looking for is the depth/image_rect topic published by the openni stack, which you start via openni_launch (if you're using the kinect). This will be a rectified 2D image, with the intensity of the pixel representing the depth at that point.

As for displaying the image, try taking a look at the image_view node.

edit flag offensive delete link more


thanks a lot.... but this time i got a new problem... on indigo, i am not sure but openni is not installable....

ASHISH CHHONKAR gravatar image ASHISH CHHONKAR  ( 2014-09-13 10:07:42 -0600 )edit

If you're having issues installing openni, I'd suggest you open a new question, with some debug output to boot.

paulbovbel gravatar image paulbovbel  ( 2014-09-13 16:04:56 -0600 )edit

answered 2014-09-12 10:49:03 -0600

l0g1x gravatar image

Here is a good place to start: You can also look at stereo_image_proc.

These packages will take in your camera (in your case kinect so refer to section 2.3 depth_image_proc/point_cloud_xyz) depth data, and produce a point cloud.

Its hard to say how you could receive that point with your mouse, because it depends on what your mouse will be hovering over, and where your reference x,y (0,0) mouse point will be. Are you creating your own UI which detects the mouse location with respect to that window? You also have to worry about scaling the image that you display in your UI, to be able to calculate where your mouse is on the UI (where it is hovering over the incoming picture) vs. where that point on the ACTUAL (i.e 680x400 pixel) image is.

But in reality, you could pretty much should (someone correct me if I'm wrong please) be able to grab that respective mouse x,y point you calculated in the point cloud array.

edit flag offensive delete link more


thanks for your reply.... my problem is little bit simple... i am going to detect a color ball from rgb image and and wanted to find out the depth of respective pixels.......... here i have to use two topics - one carrying 2d rgb image and another for depth.....

ASHISH CHHONKAR gravatar image ASHISH CHHONKAR  ( 2014-09-13 10:12:59 -0600 )edit

but my problem is identifying that topic which give me depth directly by point the (x,y) location.

ASHISH CHHONKAR gravatar image ASHISH CHHONKAR  ( 2014-09-13 10:14:19 -0600 )edit

Question Tools



Asked: 2014-09-11 23:36:49 -0600

Seen: 947 times

Last updated: Sep 12 '14