zakjma
zakjma

Reputation: 2110

How to create bag file?

I use ros and sample .bag files. I try to create my own .bag file from my images or video data. How can I do it?

This guide says has a topic named "Recording and replaying bag files " But it doesn't use images.

Upvotes: 1

Views: 5297

Answers (1)

cassinaj
cassinaj

Reputation: 1043

As mikkola said in his comment you need to publish your images to a topic. Once your images are being published, the rosbag record -O mybackfile.bag image-topic-name will record the images too.

If you are not publishing the images then you need to write an image publisher. In order to do that you must load each images with OpenCV, convert it to sensor_msgs::ImagePtr and send it via image_transport::Publisher. Here is a full example of an image publisher.

Upvotes: 5

Related Questions