Gazebo | Ignition | Community
Ask Your Question

How to project from world to image pixel coordinates in a CameraSensor plugin

asked 2016-04-22 16:56:32 -0500

Andrew Symington gravatar image

I have written a gazebo CameraSensor plugin to draw sparse features from a map, based on the frustrum of the camera. I can get the frustrum information (HFOV, VFOV, near and far clip) from sensors::CameraSensor::Camera(), and I can work out the camera extrinsics from the link and sensor pose. What I can't seem to work out is how is perform an inverse pinhole projection from world coordinates (X,Y,Z) to image plane coordinates (U,V). Is this possible with the Gazebo API or do I need to use the image_geometry package in ROS to achieve this?

edit retag flag offensive close merge delete


Any ideas?

asdfjkl gravatar imageasdfjkl ( 2016-05-26 19:13:36 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2016-05-27 10:35:35 -0500

nkoenig gravatar image

Gazebo currently doesn't provided a built-in function to map world-coordinate to image plane coordinate. You can use the ROS image_geometry package, opencv, write your own, or use some other software for this.

The rendering::Camera class does provide a function called CameraToViewportRay which gets a world space ray as cast from the camera through its viewport. This may be of use to you.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools



Asked: 2016-04-22 16:56:32 -0500

Seen: 1,470 times

Last updated: May 27 '16