I'm going around in circles trying to solve what I think is a simple problem: using Python (not C++), I would like to get the depth values corresponding to the points in the RGB image returned from the Kinect at a given (x, y) coordinate. I am subscribing to /camera/rgb/image_color and using cv_bridge and OpenCV's face detector to get the bounding box around a face. I then want to get the depth values for each point (or a subsample of points) in that box. So I need to be able to pick (x, y) coordinates (which I know) from within the box and get back the depth values for those points.
I tried subscribing to /camera/depth/image which is a 32FC1 image type and I thought this was going to work but I ran into "index out of range" errors when accessing points that should have been within the proper width and height boundaries of the image.
Although I realize there are no Python bindings for PCL )-:, I found this nice utility on this forum so I'm wondering if I should be using point clouds rather than images to get the depth values?
Any ideas?
Thanks
patrick
Thanks to Felix's comment, I went back to the /camera/depth/image approach and finally realized I was swapping rows and columns in one of the statements which is why I was getting "index out of range errors". So repeat after me: an image that has m X n pixels has n X m rows and columns. :-)
--patrick
Asked: 2011-05-27 07:50:28 -0500
Seen: 618 times
Last updated: May 27 '11
Navigation planning based on kinect data in 2.5D?
How to segment/extract a sphere using pcl_ros?
Best toolchain for recording kinect data and converting to pointcloud offline?
How can I use NARF in PCL libray for Object regconition
simulating kinect sensor in Gazebo
VSLAM based navigation with Kinect, where do I begin?
Problems with python when trying to control a Nao robot with a Kinect
ROS Answers is licensed under Creative Commons Attribution 3.0 Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.