Gazebo | Ignition | Community
Ask Your Question

How to save camera image when needed?

asked 2017-06-21 09:39:59 -0500

wy3 gravatar image

I am currently following this tutorial to publish image messages using the camera plugin. I can totally subscribe the image_raw topic and save every published image message, but that's not what I need.

I am using gazebo to collect image dataset of object manipulation. So ideally I need to capture (save to file) one image after some manipulation actions, then continue with the next round of manipulation and image capturing. So it is like a service request to save the image when needed rather than save images all the time. However, the only source of image I know in gazebo is the image topic. Does anyone have a better idea on how to do that?


edit retag flag offensive close merge delete


Hello, could you provide how to subscribe to the camera topic and save every published image. I am able to the subscribe to the topic but cannot save. Thanks

abdulhafeez gravatar imageabdulhafeez ( 2019-11-03 22:58:58 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2017-07-13 08:38:32 -0500

After searching for a similar feature, this sounds like a user feature to implement, as opposed to something Gazebo would have a native implementation for.

For example, I wanted to gather images over a certain time period and make a video from them. The best solution I could come up with was to make a ROS node that subscribed to Gazebo node that constantly published the images. If a certain flag was true in my node, I'd save the image, and if it was false, I'd ignore the whole callback.

If you're not dealing with ROS, then you'll want to write a Gazebo plugin, which could do the above without the overhead of ROS. Check out the tutorials for more info.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2017-06-21 09:39:59 -0500

Seen: 2,070 times

Last updated: Jun 21 '17