Gazebo | Ignition | Community
Ask Your Question

Grab Image from Gazebo with C++

asked 2014-10-05 19:44:11 -0500

K. Zeng gravatar image

updated 2014-10-07 17:49:37 -0500

nkoenig gravatar image

I'm trying to write a C++ program that will allow me to capture a single frame from a camera in Gazebo. The Gazebo camera itself is working because I can see a live feed with the Topic Visualizer. I already got the publishing part working. Is there a ROS or Gazebo equivalent for the following 2 lines that will allow my C++ node to "latch onto" Gazebo and subscribe to the image data?

playerccamerasubscribe(camera1, PLAYEROPENMODE); *realFrame = cvQueryFrame( capture );

edit retag flag offensive close merge delete


Not sure about camera subscribe function, but I use a backslash to escape underscores. Or sometimes I enclose it in back ticks `a_b`

scpeters gravatar imagescpeters ( 2014-10-07 00:20:27 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2014-10-07 17:52:41 -0500

nkoenig gravatar image

If you have a plugin, then you can do something similar to the example CameraPlugin.

If you have a stand-alone application, then you can subscribe the the camera's image topic, and receive images in the subscription callback. Here is an example stand-alone listener.

edit flag offensive delete link more

Question Tools


Asked: 2014-10-05 19:44:11 -0500

Seen: 1,405 times

Last updated: Oct 07 '14