Most efficient way to save Images to file?

asked 2020-05-26 10:40:47 -0500

joaocandre gravatar image

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.

edit retag flag offensive close merge delete


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.

gvdhoorn gravatar image gvdhoorn  ( 2020-05-26 13:07:10 -0500 )edit