Home | Tutorials | Wiki | Issues
Ask Your Question
0

How to Save sensor_msgs/Image

asked 2014-10-02 12:00:39 -0500

K. Zeng gravatar image

I've got Gazebo 2.2.3 and ROS Indigo set up, and I have a plugin that allows a stereo camera to publish images from Gazebo to ROS. The issue now is that I need to somehow either save the images or have access to the pointers for the camera images. Is there a Gazebo plugin that does that?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2014-10-02 15:32:37 -0500

NickDP gravatar image

I recently had a similar question, the answer to which might help you as well:

By adding

<save enabled="true">
    <path>/tmp</
</save>

to your camera model you can save the images in a directory of your choosing.

edit flag offensive delete link more

Comments

Thanks, I'll give it a try. I just need a C++ source code now.

K. Zeng gravatar imageK. Zeng ( 2014-10-02 17:25:03 -0500 )edit

Code for what? The images are stored at /tmp as .jpeg files.

NickDP gravatar imageNickDP ( 2014-10-02 18:29:16 -0500 )edit

My original plan was to write a C++ program that takes the sensor_msgs/Image topics published by Gazebo and save them when the user inputs a command. If save is not enabled in the camera, are there still pointers for the camera images that would allow me to access those images?

K. Zeng gravatar imageK. Zeng ( 2014-10-02 21:42:45 -0500 )edit

Ok, I gave it a try, and the method you suggested works. Thank you. To further clarify the code issue, I would like to write a program that saves the most recent frame captured by the camera (not all the frames continuously captured) when the user enters a certain command.

K. Zeng gravatar imageK. Zeng ( 2014-10-03 09:43:32 -0500 )edit

I'm using python and have a gazebo multirobot simulation running. But I want to obtain overview pictures of the swarm system. Do y'all have any suggestions?

aj.villa gravatar imageaj.villa ( 2017-01-19 10:37:58 -0500 )edit
Login/Signup to Answer

Question Tools

Stats

Asked: 2014-10-02 12:00:39 -0500

Seen: 1,558 times

Last updated: Oct 02 '14