Transform from non-depth camera image to map coordinates

160 views
Skip to first unread message

Mitch Berkson

unread,
May 15, 2016, 5:40:47 AM5/15/16
to ros-by-example
The chapters on robot vision mostly assume a depth camera.  When I find a point in my image using OpenCV, assuming that it is on the ground plane, I suspect there is a straightforward way in ROS to convert from the image coordinates to map coordinates.  Presumably by incorporating my camera calibration and some tfs.  Thanks for any pointers.

Mitch Berkson

unread,
May 15, 2016, 8:17:43 AM5/15/16
to ros-by-example
This might be even easier than I thought.  With a urdf for the camera and the robot, I think I just need to use transformPoint.

Patrick Goebel

unread,
May 15, 2016, 8:10:11 PM5/15/16
to ros-by-...@googlegroups.com
Hi Mitch,

I don't know if you found this post on answers.ros.org.  It seems that it is not theoretically possible to project a point in a 2d camera image back to a unique point in the real world.  However, with the point on the ground plane, if you point the camera directly at the point, then you can use the camera tilt angle and height off the ground (both available from tf) together with simple trigonometry to compute the distance to the point from the center of the camera frame.  This would put the target point at coordinates (d, 0, 0) in the camera frame, where d is the distance to the point.  Then you could use transformPoint to map these coordinates into any other frame.

If your ultimate goal is SLAM using a monocular camera, you might check out ORB-SLAM2 (I have not tried it myself) or PTAM (although this package apparently hasn't been updated since ROS Groovy).

--patrick

-- 
The Pi Robot Project
http://www.pirobot.org/wordpress

Mitch Berkson

unread,
May 15, 2016, 8:52:21 PM5/15/16
to ros-by-example
Thanks.  I'm pretty sure that, with the assumption that the point is on the ground plane, any point in the image can be mapped to a point on the ground plane.  Not just the center point.

Patrick Goebel

unread,
May 15, 2016, 9:47:38 PM5/15/16
to ros-by-...@googlegroups.com
Yes, I think you are correct also.  For some reason I thought you only wanted to map a single point (maybe the center of an object) on the ground plane and so was looking for a simple solution.

For the more general problem, perhaps you have already discovered the relevant OpenCV documentation.

--patrick
-- You received this message because you are subscribed to the Google Groups "ros-by-example" group. To unsubscribe from this group and stop receiving emails from it, send an email to ros-by-exampl...@googlegroups.com. Visit this group at https://groups.google.com/group/ros-by-example. For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages