Robotics StackExchange | Archived questions

Most efficient way to save Images to file?

I'm trying to save both RGB and Depth images from a camera stream, however using OpenCV's cv::FileStorage adds too much overhead, and I start losing frames after the message queue is full. Since I intend to save the image data from sessions of 5 mins, at a 30fps sample rate, is there a way that stores sensor_msgs::Image data efficiently (<0.033ms) on disk, without compression. I can't save the depth frames as images as they are published in 32FC1 encoding.

Asked by joaocandre on 2020-05-26 10:40:47 UTC

Comments

You'll want to use the rosbag Python api to iterate over the topics of interest and serialise the individual messages that way.

As this is a completely synchronous operation, there is no way to "lose frames".

See #q352991 for a related question.

Asked by gvdhoorn on 2020-05-26 13:07:10 UTC

Answers