Ask Your Question

How to get coordinates from depthImage

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

arebot gravatar image

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


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

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

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()
ray = numpy.array(cam_model.projectPixelTo3dRay((u,v))
point3d = ray * d
edit flag offensive delete link more

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

dornhege gravatar image

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

edit flag offensive delete link more


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 -0500 )edit

The answer by @Dan Lazewatsky illustrates that.

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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



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

Seen: 345 times

Last updated: Oct 23 '14