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

How to get coordinates from depthImage

asked 2014-10-23 09:51:46 -0600

arebot gravatar image

updated 2014-10-23 09:54:59 -0600

Hi

I am working with depthImages. This is my first time with camera models, so I do not understand how to get the information I need from camera_info topic.

My inputs are a CameraInfo and a Image(depthimage) topics. I need to get the coordinates (in odom frame) of one of the pixels.

Can anyone explain me how to do it? I have tried too much things but the results are wrong. I think it may be because of the matrices that define the camera or the focal length... but I am lost in this field.

Thank you.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
2

answered 2014-10-23 10:40:15 -0600

How you would do it in python (not tested) given a CameraInfo message info, pixel coordinates (u, v), and the depth at those coordinates, d:

import image_geometry, numpy
cam_model = image_geometry.PinholeCameraModel()
cam_model.fromCameraInfo(info)
ray = numpy.array(cam_model.projectPixelTo3dRay((u,v))
point3d = ray * d
edit flag offensive delete link more
0

answered 2014-10-23 10:36:33 -0600

dornhege gravatar image

The package image_geometry provides most of the functionality that you need.

edit flag offensive delete link more

Comments

I have taken a look at image_geometry but I haven't found anything related to the question

arenillas gravatar image arenillas  ( 2014-10-23 15:21:00 -0600 )edit

The answer by @Dan Lazewatsky illustrates that.

dornhege gravatar image dornhege  ( 2014-10-24 03:37:50 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2014-10-23 09:51:46 -0600

Seen: 754 times

Last updated: Oct 23 '14